babel-plugin-transform-vue-jsx
Advanced tools
Comparing version 3.5.1 to 3.6.0
26
index.js
var esutils = require('esutils') | ||
var groupProps = require('./lib/group-props') | ||
var mustUseProp = require('./lib/must-use-prop') | ||
var addDefault = require('@babel/helper-module-imports').addDefault | ||
var isInsideJsxExpression = function (t, path) { | ||
if (!path.parentPath) { | ||
return false | ||
} | ||
if (t.isJSXExpressionContainer(path.parentPath)) { | ||
return true | ||
} | ||
return isInsideJsxExpression(t, path.parentPath) | ||
} | ||
module.exports = function (babel) { | ||
@@ -51,2 +62,6 @@ var t = babel.types | ||
} | ||
// do nothing if this method is a part of JSX expression | ||
if (isInsideJsxExpression(t, path)) { | ||
return | ||
} | ||
const isRender = path.node.key.name === 'render' | ||
@@ -117,8 +132,5 @@ // inject h otherwise | ||
if (attribs.length) { | ||
attribs = buildOpeningElementAttributes(attribs, file) | ||
} else { | ||
attribs = t.nullLiteral() | ||
attribs = buildOpeningElementAttributes(attribs, path) | ||
args.push(attribs) | ||
} | ||
args.push(attribs) | ||
return t.callExpression(t.identifier('h'), args) | ||
@@ -152,3 +164,3 @@ } | ||
function buildOpeningElementAttributes (attribs, file) { | ||
function buildOpeningElementAttributes (attribs, path) { | ||
var _props = [] | ||
@@ -185,3 +197,3 @@ var objs = [] | ||
// add prop merging helper | ||
var helper = file.addImport('babel-helper-vue-jsx-merge-props', 'default', '_mergeJSXProps') | ||
var helper = addDefault(path, 'babel-helper-vue-jsx-merge-props', { nameHint: '_mergeJSXProps' }) | ||
// spread it | ||
@@ -188,0 +200,0 @@ attribs = t.callExpression( |
var makeMap = require('./make-map') | ||
var isTopLevel = makeMap('class,staticClass,style,key,ref,refInFor,slot,scopedSlots') | ||
var isNestable = makeMap('domProps,on,nativeOn,hook') | ||
var nestableRE = /^(domProps|on|nativeOn|hook)([\-_A-Z])/ | ||
var nestableRE = /^(props|domProps|on|nativeOn|hook)([\-_A-Z])/ | ||
var dirRE = /^v-/ | ||
@@ -6,0 +5,0 @@ var xlinkRE = /^xlink([A-Z])/ |
{ | ||
"name": "babel-plugin-transform-vue-jsx", | ||
"version": "3.5.1", | ||
"version": "3.6.0", | ||
"description": "Babel plugin for Vue 2.0 JSX", | ||
@@ -14,6 +14,6 @@ "main": "index.js", | ||
"lint": "eslint index.js", | ||
"test": "npm run lint && mocha --compilers js:babel-register", | ||
"test": "npm run lint && mocha --require @babel/register", | ||
"dev": "cd example && webpack --watch", | ||
"build": "webpack -p index.js dist/babel-plugin-transform-vue-jsx.min.js --target=web --output-library=babel-plugin-transform-vue-jsx --output-library-target=umd --module-bind 'js=babel-loader'", | ||
"prepublish": "npm run build" | ||
"build": "webpack -d", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
@@ -42,9 +42,9 @@ "repository": { | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.0", | ||
"@babel/core": "^7.0.0-beta.40", | ||
"@babel/helper-module-imports": "^7.0.0-beta.40", | ||
"@babel/preset-env": "^7.0.0-beta.40", | ||
"@babel/register": "^7.0.0-beta.40", | ||
"babel-helper-vue-jsx-merge-props": "^2.0.3", | ||
"babel-loader": "^7.1.2", | ||
"babel-loader": "8.0.0-beta.0", | ||
"babel-plugin-syntax-jsx": "^6.18.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-register": "^6.26.0", | ||
"chai": "^4.1.2", | ||
@@ -55,4 +55,4 @@ "eslint": "^4.16.0", | ||
"vue": "^2.5.13", | ||
"webpack": "^3.10.0" | ||
"webpack": "^3.11.0" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
1512280
7627
1
1