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

babel-preset-vue

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-vue - npm Package Compare versions

Comparing version 0.2.0 to 1.0.0

dist/babel-preset-vue.es.js

74

dist/babel-preset-vue.js

@@ -500,3 +500,3 @@ (function (global, factory) {

var makeMap$1 = function makeMap (str) {
var makeMap = function makeMap (str) {
var map = Object.create(null);

@@ -510,8 +510,9 @@ var list = str.split(',');

var makeMap = makeMap$1;
var isTopLevel = makeMap('class,staticClass,style,key,ref,slot');
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 dirRE = /^v-/;
var xlinkRE = /^xlink([A-Z])/;
var groupProps$1 = function groupProps (props, t) {
var groupProps = function groupProps (props, t) {
var newProps = [];

@@ -526,6 +527,8 @@ var currentNestedObjects = Object.create(null);

// nested modules
var prefixIndex = name.indexOf('-');
var prefix = prefixIndex > 0 && name.slice(0, prefixIndex);
if (prefix && isNestable(prefix)) {
var suffix = name.slice(prefixIndex + 1);
var nestMatch = name.match(nestableRE);
if (nestMatch) {
var prefix = nestMatch[1];
var suffix = name.replace(nestableRE, function (_, $1, $2) {
return $2 === '-' ? '' : $2.toLowerCase()
});
var nestedProp = t.objectProperty(t.stringLiteral(suffix), prop.value);

@@ -542,5 +545,5 @@ var nestedObject = currentNestedObjects[prefix];

}
} else if (prefix === 'v') {
} else if (dirRE.test(name)) {
// custom directive
name = name.slice(prefixIndex + 1);
name = name.replace(dirRE, '');
var dirs = currentNestedObjects.directives;

@@ -604,5 +607,2 @@ if (!dirs) {

var esutils = utils;
var groupProps = groupProps$1;
var index$2 = function (babel) {

@@ -631,2 +631,44 @@ var t = babel.types;

}
},
'Program': function Program (path) {
path.traverse({
'ObjectMethod|ClassMethod': function ObjectMethod_ClassMethod (path) {
var params = path.get('params');
// do nothing if there is (h) param
if (params.length && params[0].node.name === 'h') {
return
}
// do nothing if there is no JSX inside
var jsxChecker = {
hasJsx: false
};
path.traverse({
JSXElement: function JSXElement () {
this.hasJsx = true;
}
}, jsxChecker);
if (!jsxChecker.hasJsx) {
return
}
var isRender = path.node.key.name === 'render';
// inject h otherwise
path.get('body').unshiftContainer('body', t.variableDeclaration('const', [
t.variableDeclarator(
t.identifier('h'),
(
isRender
? t.memberExpression(
t.identifier('arguments'),
t.numericLiteral(0),
true
)
: t.memberExpression(
t.thisExpression(),
t.identifier('$createElement')
)
)
)
]));
}
});
}

@@ -669,3 +711,3 @@ }

return t.thisExpression()
} else if (esutils.keyword.isIdentifierNameES6(node.name)) {
} else if (utils.keyword.isIdentifierNameES6(node.name)) {
node.type = 'Identifier';

@@ -723,6 +765,6 @@ } else {

// add prop merging helper
file.addImport('babel-helper-vue-jsx-merge-props', 'default', '_mergeJSXProps');
var helper = file.addImport('babel-helper-vue-jsx-merge-props', 'default', '_mergeJSXProps');
// spread it
attribs = t.callExpression(
t.identifier('_mergeJSXProps'),
helper,
[t.arrayExpression(objs)]

@@ -729,0 +771,0 @@ );

{
"name": "babel-preset-vue",
"version": "0.2.0",
"version": "1.0.0",
"description": "Babel preset for all Vue plugins.",

@@ -19,3 +19,3 @@ "license": "MIT",

"prepublish": "npm run build",
"build": "bili index.js --format umd --module-name PresetVue"
"build": "bili index.js --format umd --compress umd --module-name PresetVue"
},

@@ -35,7 +35,7 @@ "files": [

"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.1.2"
"babel-plugin-transform-vue-jsx": "^3.4.3"
},
"devDependencies": {
"bili": "^0.14.0"
"bili": "^0.17.2"
}
}

@@ -11,2 +11,4 @@ # babel-preset-vue

CDN: [UNPKG](https://unpkg.com/babel-preset-vue/)
## Usage

@@ -13,0 +15,0 @@

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