const addExportCall = t.callExpression(t.identifier('addExport'), [t.objectExpression(declarations)]); if (path.get('declaration')) { path.replaceWithMultiple([ path.get('declaration').node, t.callExpression(t.identifier('addExport'), [ t.objectExpression( path.get('declaration').get('declarations').map(d => t.objectProperty( d.get('id').node,
const fileMetaGenerator = (meta) => { const { path, mocks, } = meta; return t.objectExpression([ t.objectProperty(t.identifier('path'), t.stringLiteral(path)), t.objectProperty(t.identifier('mocks'), t.arrayExpression(mocks.map(mock => t.stringLiteral(mock)))), ]); }
generateEl(isChildren = true, isFirst = false) { const propertyArray = [t.objectProperty(t.identifier('path'), t.stringLiteral(`${isChildren ? (isFirst ? '' : this.toLowerLine(this.argv.componentName)) : (isFirst ? '/' : '/' + this.toLowerLine(this.argv.componentName))}`)), t.objectProperty(t.identifier('component'), t.identifier(this.argv.ComponentName))]; if (this.argv.metaParam) { propertyArray.push(t.objectProperty(t.identifier('meta'), t.stringLiteral(this.argv.metaParam)), t.objectProperty(t.identifier('name'), t.stringLiteral(this.argv.componentName))); } return t.objectExpression(propertyArray); }
const metaGenerator = (path, funObj) => { const { name, isAsync, paramIds, isDefault, isEcmaDefault, injectionWhitelist, isObject, } = funObj; return t.objectExpression([ t.objectProperty(t.identifier('path'), t.stringLiteral(path)), t.objectProperty(t.identifier('name'), t.stringLiteral(name)), // t.objectProperty(t.identifier('localName'), t.stringLiteral(localName)), t.objectProperty(t.identifier('paramIds'), t.arrayExpression(paramIds.map(pid => t.stringLiteral(pid)))), t.objectProperty(t.identifier('injectionWhitelist'), t.arrayExpression(injectionWhitelist.map(wl => t.stringLiteral(wl)))), t.objectProperty(t.identifier('isDefault'), t.booleanLiteral(isDefault)), t.objectProperty(t.identifier('isEcmaDefault'), t.booleanLiteral(isEcmaDefault)), t.objectProperty(t.identifier('isAsync'), t.booleanLiteral(isAsync)), t.objectProperty(t.identifier('isObject'), t.booleanLiteral(isObject)), ]); }