Comparing version 0.5.0 to 0.6.0
@@ -1,3 +0,3 @@ | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0.default:_0}(); | ||
var serialize=function(){var _1=require('./serialize');return _1.hasOwnProperty("serialize")?_1.serialize:_1.hasOwnProperty("default")?_1.default:_1}(); | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var serialize=function(){var _1=require('./serialize');return _1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
@@ -13,6 +13,6 @@ var Token = homunculus.getClass('token', 'css'); | ||
Jaw.prototype.parse = function(code) { | ||
this.parser = homunculus.getParser('css'); | ||
Jaw.prototype.parse = function(code, option) { | ||
if(option===void 0)option={};this.parser = homunculus.getParser('css'); | ||
this.node = this.parser.parse(code); | ||
return serialize(this.node); | ||
return serialize(this.node, option); | ||
} | ||
@@ -28,2 +28,2 @@ | ||
exports.default=new Jaw(); | ||
exports["default"]=new Jaw(); |
@@ -1,2 +0,2 @@ | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0.default:_0}(); | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
@@ -35,3 +35,3 @@ var Token = homunculus.getClass('token', 'jsx'); | ||
exports.default=function(node, excludeLine) { | ||
exports["default"]=function(node, excludeLine) { | ||
res = ''; | ||
@@ -38,0 +38,0 @@ recursion(node, excludeLine); |
@@ -1,4 +0,4 @@ | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0.default:_0}(); | ||
var join=function(){var _1=require('./join');return _1.hasOwnProperty("join")?_1.join:_1.hasOwnProperty("default")?_1.default:_1}(); | ||
var sort=function(){var _2=require('./sort');return _2.hasOwnProperty("sort")?_2.sort:_2.hasOwnProperty("default")?_2.default:_2}(); | ||
var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var join=function(){var _1=require('./join');return _1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
var sort=function(){var _2=require('./sort');return _2.hasOwnProperty("default")?_2["default"]:_2}(); | ||
@@ -8,6 +8,6 @@ var Token = homunculus.getClass('token', 'css'); | ||
function parse(node) { | ||
function parse(node, option) { | ||
var res = {}; | ||
node.leaves().forEach(function(leaf, i) { | ||
styleset(leaf, i, res); | ||
styleset(leaf, i, res, option); | ||
}); | ||
@@ -17,7 +17,7 @@ return res; | ||
function styleset(node, i, res) { | ||
function styleset(node, i, res, option) { | ||
var sels = selectors(node.first()); | ||
var styles = block(node.last()); | ||
sels.forEach(function(sel) { | ||
record(sel, i, styles, res); | ||
record(sel, i, styles, res, option); | ||
}); | ||
@@ -54,3 +54,3 @@ } | ||
function record(sel, idx, styles, res) { | ||
function record(sel, idx, styles, res, option) { | ||
var _p = [0, 0, 0]; | ||
@@ -65,3 +65,3 @@ outer: | ||
var t = sel[i]; | ||
var s = t.content() | ||
var s = t.content(); | ||
priority(t, s, _p); | ||
@@ -152,3 +152,5 @@ switch(t.type()) { | ||
}); | ||
res._p = _p; | ||
if(!option.noPriority) { | ||
res._p = _p; | ||
} | ||
} | ||
@@ -297,2 +299,2 @@ | ||
exports.default=parse; | ||
exports["default"]=parse; |
{ | ||
"name": "jaw", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Parasitize CSS to JSX for migi", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -13,6 +13,6 @@ import homunculus from 'homunculus'; | ||
parse(code) { | ||
parse(code, option = {}) { | ||
this.parser = homunculus.getParser('css'); | ||
this.node = this.parser.parse(code); | ||
return serialize(this.node); | ||
return serialize(this.node, option); | ||
} | ||
@@ -19,0 +19,0 @@ |
@@ -8,6 +8,6 @@ import homunculus from 'homunculus'; | ||
function parse(node) { | ||
function parse(node, option) { | ||
var res = {}; | ||
node.leaves().forEach(function(leaf, i) { | ||
styleset(leaf, i, res); | ||
styleset(leaf, i, res, option); | ||
}); | ||
@@ -17,7 +17,7 @@ return res; | ||
function styleset(node, i, res) { | ||
function styleset(node, i, res, option) { | ||
var sels = selectors(node.first()); | ||
var styles = block(node.last()); | ||
sels.forEach(function(sel) { | ||
record(sel, i, styles, res); | ||
record(sel, i, styles, res, option); | ||
}); | ||
@@ -54,3 +54,3 @@ } | ||
function record(sel, idx, styles, res) { | ||
function record(sel, idx, styles, res, option) { | ||
var _p = [0, 0, 0]; | ||
@@ -65,3 +65,3 @@ outer: | ||
var t = sel[i]; | ||
var s = t.content() | ||
var s = t.content(); | ||
priority(t, s, _p); | ||
@@ -152,3 +152,5 @@ switch(t.type()) { | ||
}); | ||
res._p = _p; | ||
if(!option.noPriority) { | ||
res._p = _p; | ||
} | ||
} | ||
@@ -155,0 +157,0 @@ |
@@ -1,3 +0,3 @@ | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0.default:_0}(); | ||
var serialize=function(){var _1=require('./serialize');return _1.hasOwnProperty("serialize")?_1.serialize:_1.hasOwnProperty("default")?_1.default:_1}(); | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var serialize=function(){var _1=require('./serialize');return _1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
@@ -13,6 +13,6 @@ var Token = homunculus.getClass('token', 'css'); | ||
Jaw.prototype.parse = function(code) { | ||
this.parser = homunculus.getParser('css'); | ||
Jaw.prototype.parse = function(code, option) { | ||
if(option===void 0)option={};this.parser = homunculus.getParser('css'); | ||
this.node = this.parser.parse(code); | ||
return serialize(this.node); | ||
return serialize(this.node, option); | ||
} | ||
@@ -28,2 +28,2 @@ | ||
exports.default=new Jaw();}); | ||
exports["default"]=new Jaw();}); |
@@ -1,2 +0,2 @@ | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0.default:_0}(); | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
@@ -35,3 +35,3 @@ var Token = homunculus.getClass('token', 'jsx'); | ||
exports.default=function(node, excludeLine) { | ||
exports["default"]=function(node, excludeLine) { | ||
res = ''; | ||
@@ -38,0 +38,0 @@ recursion(node, excludeLine); |
@@ -1,4 +0,4 @@ | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("homunculus")?_0.homunculus:_0.hasOwnProperty("default")?_0.default:_0}(); | ||
var join=function(){var _1=require('./join');return _1.hasOwnProperty("join")?_1.join:_1.hasOwnProperty("default")?_1.default:_1}(); | ||
var sort=function(){var _2=require('./sort');return _2.hasOwnProperty("sort")?_2.sort:_2.hasOwnProperty("default")?_2.default:_2}(); | ||
define(function(require, exports, module){var homunculus=function(){var _0=require('homunculus');return _0.hasOwnProperty("default")?_0["default"]:_0}(); | ||
var join=function(){var _1=require('./join');return _1.hasOwnProperty("default")?_1["default"]:_1}(); | ||
var sort=function(){var _2=require('./sort');return _2.hasOwnProperty("default")?_2["default"]:_2}(); | ||
@@ -8,6 +8,6 @@ var Token = homunculus.getClass('token', 'css'); | ||
function parse(node) { | ||
function parse(node, option) { | ||
var res = {}; | ||
node.leaves().forEach(function(leaf, i) { | ||
styleset(leaf, i, res); | ||
styleset(leaf, i, res, option); | ||
}); | ||
@@ -17,7 +17,7 @@ return res; | ||
function styleset(node, i, res) { | ||
function styleset(node, i, res, option) { | ||
var sels = selectors(node.first()); | ||
var styles = block(node.last()); | ||
sels.forEach(function(sel) { | ||
record(sel, i, styles, res); | ||
record(sel, i, styles, res, option); | ||
}); | ||
@@ -54,3 +54,3 @@ } | ||
function record(sel, idx, styles, res) { | ||
function record(sel, idx, styles, res, option) { | ||
var _p = [0, 0, 0]; | ||
@@ -65,3 +65,3 @@ outer: | ||
var t = sel[i]; | ||
var s = t.content() | ||
var s = t.content(); | ||
priority(t, s, _p); | ||
@@ -152,3 +152,5 @@ switch(t.type()) { | ||
}); | ||
res._p = _p; | ||
if(!option.noPriority) { | ||
res._p = _p; | ||
} | ||
} | ||
@@ -297,2 +299,2 @@ | ||
exports.default=parse;}); | ||
exports["default"]=parse;}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
132735
30
1150