@emmetio/css-abbreviation
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -5,5 +5,5 @@ 'use strict'; | ||
var streamReaderUtils = require('@emmetio/stream-reader-utils'); | ||
var Node = _interopDefault(require('@emmetio/node')); | ||
var StreamReader = _interopDefault(require('@emmetio/stream-reader')); | ||
var _emmetio_streamReaderUtils = require('@emmetio/stream-reader-utils'); | ||
@@ -44,3 +44,3 @@ /** | ||
*/ | ||
var consumeColor = function(stream) { | ||
function consumeColor(stream) { | ||
// supported color variations: | ||
@@ -60,3 +60,3 @@ // #abc → #aabbccc | ||
stream.start = stream.pos; | ||
if (stream.eat(DOT) && !stream.eatWhile(_emmetio_streamReaderUtils.isNumber)) { | ||
if (stream.eat(DOT) && !stream.eatWhile(streamReaderUtils.isNumber)) { | ||
throw stream.error('Unexpected character for alpha value of color'); | ||
@@ -67,3 +67,3 @@ } | ||
} | ||
}; | ||
} | ||
@@ -152,3 +152,3 @@ class Color { | ||
function isHex(code) { | ||
return _emmetio_streamReaderUtils.isNumber(code) || _emmetio_streamReaderUtils.isAlpha(code, 65, 70); // A-F | ||
return streamReaderUtils.isNumber(code) || streamReaderUtils.isAlpha(code, 65, 70); // A-F | ||
} | ||
@@ -180,3 +180,3 @@ | ||
function isAlphaNumericWord(code) { | ||
return _emmetio_streamReaderUtils.isNumber(code) || isAlphaWord(code); | ||
return streamReaderUtils.isNumber(code) || isAlphaWord(code); | ||
} | ||
@@ -189,3 +189,3 @@ | ||
function isAlphaWord(code) { | ||
return code === 95 /* _ */ || _emmetio_streamReaderUtils.isAlpha(code); | ||
return code === 95 /* _ */ || streamReaderUtils.isAlpha(code); | ||
} | ||
@@ -195,3 +195,3 @@ | ||
const DOT$1 = 46; // . | ||
const DASH$1 = 45; // - | ||
const DASH = 45; // - | ||
@@ -204,3 +204,3 @@ /** | ||
*/ | ||
var consumeNumericValue = function(stream) { | ||
function consumeNumericValue(stream) { | ||
stream.start = stream.pos; | ||
@@ -215,3 +215,3 @@ if (eatNumber(stream)) { | ||
} | ||
}; | ||
} | ||
@@ -240,3 +240,3 @@ /** | ||
const start = stream.pos; | ||
const negative = stream.eat(DASH$1); | ||
const negative = stream.eat(DASH); | ||
let hadDot = false, consumed = false, code; | ||
@@ -248,3 +248,3 @@ | ||
// either a second dot or not a number: stop parsing | ||
if (code === DOT$1 ? hadDot : !_emmetio_streamReaderUtils.isNumber(code)) { | ||
if (code === DOT$1 ? hadDot : !streamReaderUtils.isNumber(code)) { | ||
break; | ||
@@ -270,5 +270,5 @@ } | ||
const DOLLAR$1 = 36; // $ | ||
const DASH$2 = 45; // - | ||
const AT$1 = 64; // @ | ||
const DOLLAR = 36; // $ | ||
const DASH$1 = 45; // - | ||
const AT = 64; // @ | ||
@@ -285,6 +285,6 @@ /** | ||
*/ | ||
var consumeKeyword = function(stream, short) { | ||
function consumeKeyword(stream, short) { | ||
stream.start = stream.pos; | ||
if (stream.eat(DOLLAR$1) || stream.eat(AT$1)) { | ||
if (stream.eat(DOLLAR) || stream.eat(AT)) { | ||
// SCSS or LESS variable | ||
@@ -299,3 +299,3 @@ stream.eatWhile(isVariableName); | ||
return stream.start !== stream.pos ? new Keyword(stream.current()) : null; | ||
}; | ||
} | ||
@@ -314,3 +314,3 @@ class Keyword { | ||
function isKeyword(code) { | ||
return isAlphaNumericWord(code) || code === DASH$2; | ||
return isAlphaNumericWord(code) || code === DASH$1; | ||
} | ||
@@ -329,7 +329,7 @@ | ||
*/ | ||
var consumeQuoted = function(stream) { | ||
if (_emmetio_streamReaderUtils.eatQuoted(stream, opt)) { | ||
function consumeQuoted(stream) { | ||
if (streamReaderUtils.eatQuoted(stream, opt)) { | ||
return new QuotedString(stream.current()); | ||
} | ||
}; | ||
} | ||
@@ -364,3 +364,3 @@ class QuotedString { | ||
let level = 1, code, arg; | ||
let arg; | ||
const argsList = []; | ||
@@ -373,3 +373,3 @@ | ||
// didn’t consumed argument, expect argument separator or end-of-arguments | ||
stream.eatWhile(_emmetio_streamReaderUtils.isWhiteSpace); | ||
stream.eatWhile(streamReaderUtils.isWhiteSpace); | ||
@@ -401,3 +401,3 @@ if (stream.eat(RBRACE)) { | ||
while (!stream.eof()) { | ||
stream.eatWhile(_emmetio_streamReaderUtils.isWhiteSpace); | ||
stream.eatWhile(streamReaderUtils.isWhiteSpace); | ||
value = consumeNumericValue(stream) || consumeColor(stream) | ||
@@ -446,7 +446,7 @@ || consumeQuoted(stream) || consumeKeywordOrFunction(stream); | ||
const EXCL = 33; // ! | ||
const DOLLAR = 36; // $ | ||
const DOLLAR$1 = 36; // $ | ||
const PLUS = 43; // + | ||
const DASH = 45; // - | ||
const DASH$2 = 45; // - | ||
const COLON = 58; // : | ||
const AT = 64; // @ | ||
const AT$1 = 64; // @ | ||
@@ -458,6 +458,5 @@ /** | ||
*/ | ||
var index = function(abbr) { | ||
function index(abbr) { | ||
const root = new Node(); | ||
const stream = new StreamReader(abbr); | ||
let node; | ||
@@ -496,3 +495,3 @@ while (!stream.eof()) { | ||
return root; | ||
}; | ||
} | ||
@@ -527,6 +526,6 @@ /** | ||
if (!value.unit) { | ||
stream.eat(DASH); | ||
stream.eat(DASH$2); | ||
} | ||
} else { | ||
stream.eat(DASH); | ||
stream.eat(DASH$2); | ||
value = consumeKeyword(stream, true); | ||
@@ -558,5 +557,5 @@ } | ||
function isIdentPrefix(code) { | ||
return code === AT || code === DOLLAR || code === EXCL; | ||
return code === AT$1 || code === DOLLAR$1 || code === EXCL; | ||
} | ||
module.exports = index; |
@@ -0,4 +1,4 @@ | ||
import { isNumber, isAlpha, eatQuoted, isWhiteSpace } from '@emmetio/stream-reader-utils'; | ||
import Node from '@emmetio/node'; | ||
import StreamReader from '@emmetio/stream-reader'; | ||
import { eatQuoted, isAlpha, isNumber, isWhiteSpace } from '@emmetio/stream-reader-utils'; | ||
@@ -39,3 +39,3 @@ /** | ||
*/ | ||
var consumeColor = function(stream) { | ||
function consumeColor(stream) { | ||
// supported color variations: | ||
@@ -61,3 +61,3 @@ // #abc → #aabbccc | ||
} | ||
}; | ||
} | ||
@@ -186,3 +186,3 @@ class Color { | ||
const DOT$1 = 46; // . | ||
const DASH$1 = 45; // - | ||
const DASH = 45; // - | ||
@@ -195,3 +195,3 @@ /** | ||
*/ | ||
var consumeNumericValue = function(stream) { | ||
function consumeNumericValue(stream) { | ||
stream.start = stream.pos; | ||
@@ -206,3 +206,3 @@ if (eatNumber(stream)) { | ||
} | ||
}; | ||
} | ||
@@ -231,3 +231,3 @@ /** | ||
const start = stream.pos; | ||
const negative = stream.eat(DASH$1); | ||
const negative = stream.eat(DASH); | ||
let hadDot = false, consumed = false, code; | ||
@@ -260,5 +260,5 @@ | ||
const DOLLAR$1 = 36; // $ | ||
const DASH$2 = 45; // - | ||
const AT$1 = 64; // @ | ||
const DOLLAR = 36; // $ | ||
const DASH$1 = 45; // - | ||
const AT = 64; // @ | ||
@@ -275,6 +275,6 @@ /** | ||
*/ | ||
var consumeKeyword = function(stream, short) { | ||
function consumeKeyword(stream, short) { | ||
stream.start = stream.pos; | ||
if (stream.eat(DOLLAR$1) || stream.eat(AT$1)) { | ||
if (stream.eat(DOLLAR) || stream.eat(AT)) { | ||
// SCSS or LESS variable | ||
@@ -289,3 +289,3 @@ stream.eatWhile(isVariableName); | ||
return stream.start !== stream.pos ? new Keyword(stream.current()) : null; | ||
}; | ||
} | ||
@@ -304,3 +304,3 @@ class Keyword { | ||
function isKeyword(code) { | ||
return isAlphaNumericWord(code) || code === DASH$2; | ||
return isAlphaNumericWord(code) || code === DASH$1; | ||
} | ||
@@ -319,7 +319,7 @@ | ||
*/ | ||
var consumeQuoted = function(stream) { | ||
function consumeQuoted(stream) { | ||
if (eatQuoted(stream, opt)) { | ||
return new QuotedString(stream.current()); | ||
} | ||
}; | ||
} | ||
@@ -354,3 +354,3 @@ class QuotedString { | ||
let level = 1, code, arg; | ||
let arg; | ||
const argsList = []; | ||
@@ -434,7 +434,7 @@ | ||
const EXCL = 33; // ! | ||
const DOLLAR = 36; // $ | ||
const DOLLAR$1 = 36; // $ | ||
const PLUS = 43; // + | ||
const DASH = 45; // - | ||
const DASH$2 = 45; // - | ||
const COLON = 58; // : | ||
const AT = 64; // @ | ||
const AT$1 = 64; // @ | ||
@@ -446,6 +446,5 @@ /** | ||
*/ | ||
var index = function(abbr) { | ||
function index(abbr) { | ||
const root = new Node(); | ||
const stream = new StreamReader(abbr); | ||
let node; | ||
@@ -484,3 +483,3 @@ while (!stream.eof()) { | ||
return root; | ||
}; | ||
} | ||
@@ -515,6 +514,6 @@ /** | ||
if (!value.unit) { | ||
stream.eat(DASH); | ||
stream.eat(DASH$2); | ||
} | ||
} else { | ||
stream.eat(DASH); | ||
stream.eat(DASH$2); | ||
value = consumeKeyword(stream, true); | ||
@@ -546,5 +545,5 @@ } | ||
function isIdentPrefix(code) { | ||
return code === AT || code === DOLLAR || code === EXCL; | ||
return code === AT$1 || code === DOLLAR$1 || code === EXCL; | ||
} | ||
export default index; |
{ | ||
"name": "@emmetio/css-abbreviation", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Parses Emmet CSS abbreviatoin into AST tree", | ||
@@ -24,11 +24,11 @@ "main": "dist/css-abbreviation.cjs.js", | ||
"dependencies": { | ||
"@emmetio/node": "^0.1.0", | ||
"@emmetio/stream-reader": "^2.0.0", | ||
"@emmetio/node": "^0.1.2", | ||
"@emmetio/stream-reader": "^2.2.0", | ||
"@emmetio/stream-reader-utils": "^0.1.0" | ||
}, | ||
"devDependencies": { | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.18.0", | ||
"babel-register": "^6.18.0", | ||
"mocha": "^3.2.0", | ||
"rollup": "^0.41.4" | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", | ||
"babel-register": "^6.26.0", | ||
"mocha": "^5.0.1", | ||
"rollup": "^0.56.2" | ||
}, | ||
@@ -35,0 +35,0 @@ "directories": { |
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
24958
890
Updated@emmetio/node@^0.1.2