postcss-wee-syntax
Advanced tools
Comparing version 2.0.1 to 2.0.3
@@ -10,6 +10,5 @@ 'use strict'; | ||
parser.tokenize(); | ||
parser.loop(); | ||
parser.parse(); | ||
return parser.root; | ||
}; |
@@ -29,19 +29,19 @@ const BaseParser = require('postcss/lib/parser'); | ||
class Parser extends BaseParser { | ||
other() { | ||
var token = void 0; | ||
var end = false; | ||
var type = null; | ||
var colon = false; | ||
var bracket = null; | ||
var brackets = []; | ||
var hasBracket = false; | ||
other(start) { | ||
let end = false; | ||
let type = null; | ||
let colon = false; | ||
let bracket = null; | ||
let brackets = []; | ||
let hasBracket = false; | ||
let tokens = []; | ||
let token = start; | ||
var start = this.pos; | ||
while (this.pos < this.tokens.length) { | ||
token = this.tokens[this.pos]; | ||
while (token) { | ||
type = token[0]; | ||
tokens.push(token); | ||
if (type === '(' || type === '[') { | ||
if (!bracket) bracket = token; | ||
if (! bracket) bracket = token; | ||
brackets.push(type === '(' ? ')' : ']'); | ||
@@ -52,50 +52,49 @@ hasBracket = true; | ||
} else if (brackets.length === 0) { | ||
if (type === ';') { | ||
if (colon) { | ||
this.decl(this.tokens.slice(start, this.pos + 1)); | ||
if ( type === ';' ) { | ||
if ( colon ) { | ||
this.decl(tokens); | ||
return; | ||
} else if (hasBracket) { | ||
this.mixin(tokens); // TODO: this.tokens.slice(start, this.pos + 1) | ||
return; | ||
} else if (hasBracket) { | ||
this.mixin(this.tokens.slice(start, this.pos + 1)); | ||
return; | ||
} else { | ||
break; | ||
} | ||
} else if (type === '{') { | ||
this.rule(this.tokens.slice(start, this.pos + 1)); | ||
return; | ||
} else if (type === '}') { | ||
this.pos -= 1; | ||
end = true; | ||
break; | ||
} else if (type === ':') { | ||
colon = true; | ||
} | ||
} else if (type === brackets[brackets.length - 1]) { | ||
brackets.pop(); | ||
if (brackets.length === 0) bracket = null; | ||
} | ||
} else if ( type === '{' ) { | ||
this.rule(tokens); | ||
return; | ||
this.pos += 1; | ||
} | ||
if (this.pos === this.tokens.length) { | ||
this.pos -= 1; | ||
end = true; | ||
} | ||
} else if ( type === '}' ) { | ||
this.tokenizer.back(tokens.pop()); | ||
end = true; | ||
break; | ||
if (brackets.length > 0) this.unclosedBracket(bracket); | ||
if (end && colon) { | ||
while (this.pos > start) { | ||
token = this.tokens[this.pos][0]; | ||
if (token !== 'space' && token !== 'comment') break; | ||
this.pos -= 1; | ||
} | ||
this.decl(this.tokens.slice(start, this.pos + 1)); | ||
return; | ||
} else if ( type === ':' ) { | ||
colon = true; | ||
} | ||
} else if ( type === brackets[brackets.length - 1] ) { | ||
brackets.pop(); | ||
if ( brackets.length === 0 ) bracket = null; | ||
} | ||
token = this.tokenizer.nextToken(); | ||
} | ||
this.unknownWord(start); | ||
if ( this.tokenizer.endOfFile() ) end = true; | ||
if ( brackets.length > 0 ) this.unclosedBracket(bracket); | ||
if ( end && colon ) { | ||
while ( tokens.length ) { | ||
token = tokens[tokens.length - 1][0]; | ||
if ( token !== 'space' && token !== 'comment' ) break; | ||
this.tokenizer.back(tokens.pop()); | ||
} | ||
this.decl(tokens); | ||
return; | ||
} else { | ||
this.unknownWord(tokens); | ||
} | ||
} | ||
mixin(tokens) { | ||
mixin(tokens) { | ||
let node = new Mixin(), | ||
@@ -102,0 +101,0 @@ last; |
{ | ||
"name": "postcss-wee-syntax", | ||
"version": "2.0.1", | ||
"version": "2.0.3", | ||
"description": "Custom syntax used in the minimal front-end framework", | ||
@@ -28,10 +28,10 @@ "main": "index.js", | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"chai": "^4.1.1", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^3.2.0", | ||
"postcss-parser-tests": "^5.0.10" | ||
"postcss-parser-tests": "^6.0.2" | ||
}, | ||
"dependencies": { | ||
"postcss": "^5.2.6" | ||
"postcss": "^6.0.9" | ||
} | ||
} |
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
NPM Shrinkwrap
Supply chain riskPackage contains a shrinkwrap file. This may allow the package to bypass normal install procedures.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
81141
14
1969
1
1
+ Addedansi-styles@3.2.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedpostcss@6.0.23(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsupports-color@5.5.0(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-flag@1.0.0(transitive)
- Removedjs-base64@2.6.4(transitive)
- Removedpostcss@5.2.18(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.03.2.3(transitive)
Updatedpostcss@^6.0.9