babel-plugin-transform-vue-jsx
Advanced tools
Comparing version 1.1.1 to 2.0.0
@@ -112,5 +112,5 @@ var esutils = require('esutils') | ||
if (!objs[0]._isSpread) { | ||
objs[0] = groupProps(objs[0].properties, t) | ||
} | ||
objs = objs.map(function (o) { | ||
return o._isSpread ? o : groupProps(o.properties, t) | ||
}) | ||
@@ -117,0 +117,0 @@ if (objs.length === 1) { |
var makeMap = require('./make-map') | ||
var isTopLevel = makeMap( | ||
'class,style,staticClass,staticAttrs,' + | ||
'key,ref,slot,transition' | ||
) | ||
var isTopLevel = makeMap('class,staticClass,style,key,ref,slot') | ||
function normalizePrefix (prefix) { | ||
if (prefix === 'prop' || prefix === 'directive') { | ||
return prefix + 's' | ||
} else { | ||
return prefix | ||
} | ||
} | ||
module.exports = function groupProps (props, t) { | ||
@@ -20,10 +9,10 @@ var newProps = [] | ||
var name = prop.key.value || prop.key.name | ||
var prefixIndex | ||
if (isTopLevel(name)) { | ||
// top-level special props | ||
newProps.push(prop) | ||
} else if (name.indexOf('-') > 0) { | ||
} else if ((prefixIndex = name.indexOf('-')) > 0) { | ||
// nested | ||
var split = name.split('-') | ||
var prefix = normalizePrefix(split[0]) | ||
var suffix = split[1] | ||
var prefix = name.slice(0, prefixIndex) | ||
var suffix = name.slice(prefixIndex + 1) | ||
var nestedProp = t.objectProperty(t.identifier(suffix), prop.value) | ||
@@ -30,0 +19,0 @@ var nestedObject = currentNestedObjects[prefix] |
{ | ||
"name": "babel-plugin-transform-vue-jsx", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "Babel plugin for Vue 2.0 JSX", | ||
@@ -39,3 +39,3 @@ "main": "index.js", | ||
"babel-cli": "^6.10.1", | ||
"babel-helper-vue-jsx-merge-props": "^1.0.0", | ||
"babel-helper-vue-jsx-merge-props": "^2.0.0", | ||
"babel-loader": "^6.2.4", | ||
@@ -42,0 +42,0 @@ "babel-plugin-syntax-jsx": "^6.8.0", |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
11302
6
0
144
198