weex-vue-precompiler
Advanced tools
Comparing version 0.1.20 to 0.1.21
{ | ||
"name": "weex-vue-precompiler", | ||
"version": "0.1.20", | ||
"version": "0.1.21", | ||
"description": "a precompiler for weex-vue-render.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -5,3 +5,4 @@ const util = require('../util') | ||
extend, | ||
getStaticStyleObject | ||
getStaticStyleObject, | ||
fixStyleUnit | ||
} = util | ||
@@ -65,3 +66,4 @@ | ||
else if (px2remTags.indexOf(keyName) > -1) { | ||
propNode.value = transformNode(propNode.value, 'text', rootValue, true/*asPropValue*/) | ||
propNode.value = transformNode(fixStyleUnit(keyName, propNode.value), 'text', | ||
rootValue, true/*asPropValue*/) | ||
} | ||
@@ -68,0 +70,0 @@ } |
@@ -10,3 +10,3 @@ /** | ||
const { ast } = require('../util') | ||
const { ast, fixStyleUnit } = require('../util') | ||
const { getCompiler } = require('../components') | ||
@@ -55,3 +55,4 @@ const { getTransformer } = require('wxv-transformer') | ||
if (bindingStyleNamesForPx2Rem.indexOf(key) > -1) { | ||
prop.value = transformNode(prop.value, tagName, rootValue, true/*asPropValue*/) | ||
prop.value = transformNode(fixStyleUnit(key, prop.value), tagName, | ||
rootValue, true/*asPropValue*/) | ||
} | ||
@@ -58,0 +59,0 @@ } |
@@ -45,2 +45,13 @@ const ast = require('./ast') | ||
exports.fixStyleUnit = function (styleName, literal) { | ||
const unitless = ['lineHeight'] | ||
let value = literal.value | ||
if (unitless.indexOf(styleName) < 0 && typeof value === 'number') { | ||
console.warn(`[weex-vue-precompiler] style '${styleName}: ${value}' should end with 'px'.`) | ||
value += 'px' | ||
literal.value = value | ||
} | ||
return literal | ||
} | ||
exports.mergeStringArray = function () { | ||
@@ -47,0 +58,0 @@ const arrs = Array.prototype.slice.call(arguments) |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
48290
1839
0