Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-transform-vue-jsx

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-vue-jsx - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

52

lib/group-props.js
var makeMap = require('./make-map')
var isTopLevel = makeMap('class,staticClass,style,key,ref,slot')
var isNestable = makeMap('domProps,on,nativeOn,hook')

@@ -9,32 +10,33 @@ module.exports = function groupProps (props, t) {

var name = prop.key.value || prop.key.name
var prefixIndex
if (isTopLevel(name)) {
// top-level special props
newProps.push(prop)
} else if ((prefixIndex = name.indexOf('-')) > 0) {
// nested
var prefix = name.slice(0, prefixIndex)
var suffix = name.slice(prefixIndex + 1)
var nestedProp = t.objectProperty(t.identifier(suffix), prop.value)
var nestedObject = currentNestedObjects[prefix]
if (!nestedObject) {
nestedObject = currentNestedObjects[prefix] = t.objectProperty(
t.identifier(prefix),
t.objectExpression([nestedProp])
)
newProps.push(nestedObject)
} else {
nestedObject.value.properties.push(nestedProp)
}
} else {
// rest are nested under attrs
var attrs = currentNestedObjects.attrs
if (!attrs) {
attrs = currentNestedObjects.attrs = t.objectProperty(
t.identifier('attrs'),
t.objectExpression([prop])
)
newProps.push(attrs)
var prefixIndex = name.indexOf('-')
var prefix = prefixIndex > 0 && name.slice(0, prefixIndex)
if (prefix && isNestable(prefix)) {
var suffix = name.slice(prefixIndex + 1)
var nestedProp = t.objectProperty(t.identifier(suffix), prop.value)
var nestedObject = currentNestedObjects[prefix]
if (!nestedObject) {
nestedObject = currentNestedObjects[prefix] = t.objectProperty(
t.identifier(prefix),
t.objectExpression([nestedProp])
)
newProps.push(nestedObject)
} else {
nestedObject.value.properties.push(nestedProp)
}
} else {
attrs.value.properties.push(prop)
// rest are nested under attrs
var attrs = currentNestedObjects.attrs
if (!attrs) {
attrs = currentNestedObjects.attrs = t.objectProperty(
t.identifier('attrs'),
t.objectExpression([prop])
)
newProps.push(attrs)
} else {
attrs.value.properties.push(prop)
}
}

@@ -41,0 +43,0 @@ }

{
"name": "babel-plugin-transform-vue-jsx",
"version": "2.0.1",
"version": "2.0.2",
"description": "Babel plugin for Vue 2.0 JSX",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc