Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let importTaroComponentNode: t.ImportDeclaration
let importNervNode: t.ImportDeclaration
let importTaroNode: t.ImportDeclaration
let renderClassMethodNode: t.ClassMethod
let exportDefaultDeclarationNode: t.ExportDefaultDeclaration
let exportNamedDeclarationPath: NodePath
let componentClassName
let needSetConfigFromHooks
let configFromHooks
const renderReturnStatementPaths: NodePath[] = []
ast = babel.transformFromAst(ast, '', {
plugins: [
[require('babel-plugin-preval')],
[require('babel-plugin-danger-remove-unused-import'), { ignore: ['@tarojs/taro', 'react', 'nervjs'] }],
[require('babel-plugin-transform-taroapi').default, {
apis: require(resolve.sync('@tarojs/taro-h5/dist/taroApis', { basedir: this.appPath })),
packageName: '@tarojs/taro'
}]
]
}).ast
const ClassDeclarationOrExpression = {
enter (astPath: NodePath | NodePath) {
const node = astPath.node
if (!node.superClass) return
if (isTaroClass(astPath)) {
resetTSClassProperty(node.body.body)
if (t.isClassDeclaration(astPath)) {
if (node.id === null) {
componentClassName = '_TaroComponentClass'
astPath.replaceWith(