@espkg/mina2vue
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "@espkg/mina2vue", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Convert native wxml, wxss eg. to .vue files", | ||
"main": "index.js", | ||
"directories": { | ||
"lib": "lib", | ||
"src": "src", | ||
"test": "test" | ||
@@ -46,3 +46,6 @@ }, | ||
"webpack-cli": "^3.3.10" | ||
} | ||
}, | ||
"files": [ | ||
"src" | ||
] | ||
} |
@@ -6,2 +6,3 @@ import parser from '@babel/parser' | ||
import minaScriptTransformer from './mina-script-transformer' | ||
import MFScriptTransformer from './mf-script-transformer' | ||
import vueGenerator from './vue-generator' | ||
@@ -32,3 +33,4 @@ import styleTransformer from './style-transformer' | ||
}) | ||
const distAST = minaScriptTransformer(scriptAST) | ||
let distAST = minaScriptTransformer(scriptAST) | ||
distAST = MFScriptTransformer(distAST) | ||
const distCode = generator.default(distAST).code | ||
@@ -35,0 +37,0 @@ |
@@ -67,4 +67,4 @@ import t from '@babel/types' | ||
t.identifier('mounted'), | ||
prop.value.params, | ||
prop.value.body | ||
prop.value ? prop.value.params : prop.params, | ||
prop.value ? prop.value.body : prop.body | ||
)) | ||
@@ -156,15 +156,9 @@ break | ||
}, | ||
MemberExpression (path) { | ||
const { node } = path | ||
ThisExpression (path) { | ||
// this.data.foo -> this.foo | ||
if (t.isMemberExpression(node.object) && | ||
t.isThisExpression(node.object.object) && | ||
node.object.property.name === 'data' | ||
const parentNode = path.parentPath.node | ||
if (t.isMemberExpression(path.parentPath.node) && | ||
parentNode.property.name === 'data' | ||
) { | ||
path.replaceWith( | ||
t.memberExpression( | ||
t.thisExpression(), | ||
t.identifier(node.property.name) | ||
) | ||
) | ||
path.parentPath.replaceWith(t.ThisExpression()) | ||
} | ||
@@ -171,0 +165,0 @@ } |
@@ -24,2 +24,6 @@ function dynamicValue (value) { | ||
case 'mf-page': | ||
node.name = 'div' | ||
break | ||
default: | ||
@@ -117,3 +121,3 @@ } | ||
node.attribs[`@${eventName}`] = value | ||
node.attribs[`@${eventName}`] = `${value}($event)` | ||
delete node.attribs[attribute] | ||
@@ -196,2 +200,4 @@ } | ||
handleWXAttribute(value, attribute, node) | ||
} else if (attribute === 'mfConfig') { | ||
delete node.attribs[attribute] | ||
} else { | ||
@@ -198,0 +204,0 @@ handleElseAttribute(value, attribute, node) |
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
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
20646
11
592