diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/adapter.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/adapter.js new file mode 100644 index 000000000..7fa8e3697 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/adapter.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var Adapters; +(function (Adapters) { + Adapters["weapp"] = "weapp"; + Adapters["swan"] = "swan"; + Adapters["alipay"] = "alipay"; + Adapters["quickapp"] = "quickapp"; + Adapters["tt"] = "tt"; +})(Adapters = exports.Adapters || (exports.Adapters = {})); +const weixinAdapter = { + if: 'wx:if', + else: 'wx:else', + elseif: 'wx:elif', + for: 'wx:for', + forItem: 'wx:for-item', + forIndex: 'wx:for-index', + key: 'wx:key', + type: "weapp" /* weapp */ +}; +const swanAdapter = { + if: 's-if', + else: 's-else', + elseif: 's-elif', + for: 's-for', + forItem: 's-for-item', + forIndex: 's-for-index', + key: 's-key', + type: "swan" /* swan */ +}; +const alipayAdapter = { + if: 'a:if', + else: 'a:else', + elseif: 'a:elif', + for: 'a:for', + forItem: 'a:for-item', + forIndex: 'a:for-index', + key: 'a:key', + type: "alipay" /* alipay */ +}; +const ttAdapter = { + if: 'tt:if', + else: 'tt:else', + elseif: 'tt:elif', + for: 'tt:for', + forItem: 'tt:for-item', + forIndex: 'tt:for-index', + key: 'tt:key', + type: "tt" /* tt */ +}; +exports.Adapter = weixinAdapter; +function setAdapter(adapter) { + switch (adapter.toLowerCase()) { + case "swan" /* swan */: + exports.Adapter = swanAdapter; + break; + case "alipay" /* alipay */: + exports.Adapter = alipayAdapter; + break; + case "tt" /* tt */: + exports.Adapter = ttAdapter; + break; + default: + exports.Adapter = weixinAdapter; + break; + } +} +exports.setAdapter = setAdapter; +//# sourceMappingURL=adapter.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/adapter.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/adapter.js.map new file mode 100644 index 000000000..e00138eb7 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/adapter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":";;AAAA,IAAkB,QAMjB;AAND,WAAkB,QAAQ;IACxB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,qBAAS,CAAA;AACX,CAAC,EANiB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAMzB;AAaD,MAAM,aAAa,GAAY;IAC7B,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,QAAQ;IACb,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,cAAc;IACxB,GAAG,EAAE,QAAQ;IACb,IAAI,qBAAgB;CACrB,CAAA;AAED,MAAM,WAAW,GAAY;IAC3B,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,OAAO;IACZ,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,aAAa;IACvB,GAAG,EAAE,OAAO;IACZ,IAAI,mBAAe;CACpB,CAAA;AAED,MAAM,aAAa,GAAY;IAC7B,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,OAAO;IACZ,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,aAAa;IACvB,GAAG,EAAE,OAAO;IACZ,IAAI,uBAAiB;CACtB,CAAA;AAED,MAAM,SAAS,GAAY;IACzB,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,QAAQ;IACb,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,cAAc;IACxB,GAAG,EAAE,QAAQ;IACb,IAAI,eAAa;CAClB,CAAA;AAEU,QAAA,OAAO,GAAY,aAAa,CAAA;AAE3C,SAAgB,UAAU,CAAE,OAAiB;IAC3C,QAAQ,OAAO,CAAC,WAAW,EAAE,EAAE;QAC7B;YACE,eAAO,GAAG,WAAW,CAAA;YACrB,MAAK;QACP;YACE,eAAO,GAAG,aAAa,CAAA;YACvB,MAAK;QACP;YACE,eAAO,GAAG,SAAS,CAAA;YACnB,MAAK;QACP;YACE,eAAO,GAAG,aAAa,CAAA;YACvB,MAAK;KACR;AACH,CAAC;AAfD,gCAeC"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/class.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/class.js new file mode 100644 index 000000000..00b3679d5 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/class.js @@ -0,0 +1,616 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const t = require("babel-types"); +const utils_1 = require("./utils"); +const constant_1 = require("./constant"); +const lodash_1 = require("lodash"); +const render_1 = require("./render"); +const jsx_1 = require("./jsx"); +const adapter_1 = require("./adapter"); +const babel_generator_1 = require("babel-generator"); +function buildConstructor() { + const ctor = t.classMethod('constructor', t.identifier('constructor'), [t.identifier('props')], t.blockStatement([ + t.expressionStatement(t.callExpression(t.identifier('super'), [ + t.identifier('props') + ])) + ])); + return ctor; +} +function processThisPropsFnMemberProperties(member, path, args, binded) { + const propertyArray = []; + function traverseMember(member) { + const object = member.object; + const property = member.property; + if (t.isIdentifier(property)) { + propertyArray.push(property.name); + } + if (t.isMemberExpression(object)) { + if (t.isThisExpression(object.object) && + t.isIdentifier(object.property) && + object.property.name === 'props') { + if ("alipay" /* alipay */ === adapter_1.Adapter.type) { + if (binded) + args.shift(); + path.replaceWith(t.callExpression(t.memberExpression(t.thisExpression(), t.identifier('__triggerPropsFn')), [ + t.stringLiteral(propertyArray.reverse().join('.')), + t.arrayExpression(args) + ])); + } + else { + path.replaceWith(t.callExpression(t.memberExpression(t.thisExpression(), t.identifier('__triggerPropsFn')), [t.stringLiteral(propertyArray.reverse().join('.')), t.callExpression(t.memberExpression(t.arrayExpression([t.nullLiteral()]), t.identifier('concat')), [t.arrayExpression(args)])])); + } + } + traverseMember(object); + } + } + traverseMember(member); +} +class Transformer { + constructor(path, sourcePath, componentProperies) { + this.result = { + template: '', + components: [], + componentProperies: [] + }; + this.methods = new Map(); + this.initState = new Set(); + this.jsxReferencedIdentifiers = new Set(); + this.customComponents = new Map(); + this.anonymousMethod = new Map(); + this.renderMethod = null; + this.customComponentNames = new Set(); + this.usedState = new Set(); + this.loopStateName = new Map(); + this.customComponentData = []; + this.refs = []; + this.loopRefs = new Map(); + this.anonymousFuncCounter = utils_1.incrementId(); + this.buildPropsAnonymousFunc = (attr, expr, isBind = false) => { + const { code } = babel_generator_1.default(expr); + if (code.startsWith('this.props')) { + const methodName = utils_1.findMethodName(expr); + const hasMethodName = this.anonymousMethod.has(methodName) || !methodName; + const funcName = hasMethodName + ? this.anonymousMethod.get(methodName) + // 测试时使用1个稳定的 uniqueID 便于测试,实际使用5个英文字母,否则小程序不支持 + : process.env.NODE_ENV === 'test' ? lodash_1.uniqueId('funPrivate') : `funPrivate${utils_1.createRandomLetters(5)}`; + this.anonymousMethod.set(methodName, funcName); + const newVal = isBind + ? t.callExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier(funcName)), t.identifier('bind')), expr.arguments || []) + : t.memberExpression(t.thisExpression(), t.identifier(funcName)); + attr.get('value.expression').replaceWith(newVal); + this.methods.set(funcName, null); + this.componentProperies.add(methodName); + if (hasMethodName) { + return; + } + const attrName = attr.node.name; + if (t.isJSXIdentifier(attrName) && attrName.name.startsWith('on')) { + this.componentProperies.add(`__fn_${attrName.name}`); + } + if (methodName.startsWith('on')) { + this.componentProperies.add(`__fn_${methodName}`); + } + const method = t.classMethod('method', t.identifier(funcName), [], t.blockStatement([ + t.expressionStatement(t.callExpression(t.memberExpression(t.thisExpression(), t.identifier('__triggerPropsFn')), [t.stringLiteral(methodName), t.arrayExpression([t.spreadElement(t.identifier('arguments'))])])) + ])); + this.classPath.node.body.body = this.classPath.node.body.body.concat(method); + } + }; + this.classPath = path; + this.sourcePath = sourcePath; + this.moduleNames = Object.keys(path.scope.getAllBindings('module')); + this.componentProperies = new Set(componentProperies); + this.compile(); + } + setMultipleSlots() { + const body = this.classPath.node.body.body; + if (body.some(c => t.isClassProperty(c) && c.key.name === 'multipleSlots')) { + return; + } + const multipleSlots = t.classProperty(t.identifier('multipleSlots'), t.booleanLiteral(true)); + multipleSlots.static = true; + body.push(multipleSlots); + } + createStringRef(componentName, id, refName) { + this.refs.push({ + type: constant_1.DEFAULT_Component_SET.has(componentName) ? 'dom' : 'component', + id, + refName + }); + } + createFunctionRef(componentName, id, fn) { + this.refs.push({ + type: constant_1.DEFAULT_Component_SET.has(componentName) ? 'dom' : 'component', + id, + fn + }); + } + handleRefs() { + const objExpr = this.refs.map(ref => { + return t.objectExpression([ + t.objectProperty(t.identifier('type'), t.stringLiteral(ref.type)), + t.objectProperty(t.identifier('id'), t.stringLiteral(ref.id)), + t.objectProperty(t.identifier('refName'), t.stringLiteral(ref.refName || '')), + t.objectProperty(t.identifier('fn'), ref.fn ? ref.fn : t.nullLiteral()) + ]); + }); + this.classPath.node.body.body.push(t.classProperty(t.identifier('$$refs'), t.arrayExpression(objExpr))); + } + traverse() { + const self = this; + self.classPath.traverse({ + JSXOpeningElement: (path) => { + const jsx = path.node; + const attrs = jsx.attributes; + if (!t.isJSXIdentifier(jsx.name)) { + return; + } + const loopCallExpr = path.findParent(p => utils_1.isArrayMapCallExpression(p)); + const componentName = jsx.name.name; + const refAttr = jsx_1.findJSXAttrByName(attrs, 'ref'); + if (!refAttr) { + return; + } + const idAttr = jsx_1.findJSXAttrByName(attrs, 'id'); + let id = utils_1.createRandomLetters(5); + let idExpr; + if (!idAttr) { + if (loopCallExpr && loopCallExpr.isCallExpression()) { + const [func] = loopCallExpr.node.arguments; + let indexId = null; + if (t.isFunctionExpression(func) || t.isArrowFunctionExpression(func)) { + const params = func.params; + indexId = params[1]; + } + if (indexId === null || !t.isIdentifier(indexId)) { + throw utils_1.codeFrameError(path.node, '在循环中使用 ref 必须暴露循环的第二个参数 `index`'); + } + attrs.push(t.jSXAttribute(t.jSXIdentifier('id'), t.jSXExpressionContainer(t.binaryExpression('+', t.stringLiteral(id), indexId)))); + } + else { + attrs.push(t.jSXAttribute(t.jSXIdentifier('id'), t.stringLiteral(id))); + } + } + else { + const idValue = idAttr.value; + if (t.isStringLiteral(idValue)) { + id = idValue.value; + } + else if (t.isJSXExpressionContainer(idValue)) { + if (t.isStringLiteral(idValue.expression)) { + id = idValue.expression.value; + } + else { + idExpr = idValue.expression; + } + } + } + if (t.isStringLiteral(refAttr.value)) { + if (loopCallExpr) { + throw utils_1.codeFrameError(refAttr, '循环中的 ref 只能使用函数。'); + } + this.createStringRef(componentName, id, refAttr.value.value); + } + if (t.isJSXExpressionContainer(refAttr.value)) { + const expr = refAttr.value.expression; + if (t.isStringLiteral(expr)) { + if (loopCallExpr) { + throw utils_1.codeFrameError(refAttr, '循环中的 ref 只能使用函数。'); + } + this.createStringRef(componentName, id, expr.value); + } + else if (t.isArrowFunctionExpression(expr) || t.isMemberExpression(expr)) { + const type = constant_1.DEFAULT_Component_SET.has(componentName) ? 'dom' : 'component'; + if (loopCallExpr) { + this.loopRefs.set(path.parentPath.node, { + id: idExpr || id, + fn: expr, + type, + component: path.parentPath + }); + } + else { + this.refs.push({ + type, + id, + fn: expr + }); + } + } + else { + throw utils_1.codeFrameError(refAttr, 'ref 仅支持传入字符串、匿名箭头函数和 class 中已声明的函数'); + } + } + for (const [index, attr] of attrs.entries()) { + if (attr === refAttr) { + attrs.splice(index, 1); + } + } + }, + ClassMethod(path) { + const node = path.node; + if (t.isIdentifier(node.key)) { + const name = node.key.name; + self.methods.set(name, path); + if (name === 'render') { + self.renderMethod = path; + path.traverse({ + ReturnStatement(returnPath) { + const arg = returnPath.node.argument; + const ifStem = returnPath.findParent(p => p.isIfStatement()); + if (ifStem && ifStem.isIfStatement() && arg === null) { + const consequent = ifStem.get('consequent'); + if (consequent.isBlockStatement() && consequent.node.body.includes(returnPath.node)) { + returnPath.get('argument').replaceWith(t.nullLiteral()); + } + } + } + }); + } + if (name === 'constructor') { + path.traverse({ + AssignmentExpression(p) { + if (t.isMemberExpression(p.node.left) && + t.isThisExpression(p.node.left.object) && + t.isIdentifier(p.node.left.property) && + p.node.left.property.name === 'state' && + t.isObjectExpression(p.node.right)) { + const properties = p.node.right.properties; + properties.forEach(p => { + if (t.isObjectProperty(p) && t.isIdentifier(p.key)) { + self.initState.add(p.key.name); + } + }); + } + } + }); + } + } + }, + IfStatement(path) { + const test = path.get('test'); + const consequent = path.get('consequent'); + if (utils_1.isContainJSXElement(consequent) && utils_1.hasComplexExpression(test)) { + const scope = self.renderMethod && self.renderMethod.scope || path.scope; + utils_1.generateAnonymousState(scope, test, self.jsxReferencedIdentifiers, true); + } + }, + ClassProperty(path) { + const { key: { name }, value } = path.node; + if (t.isArrowFunctionExpression(value) || t.isFunctionExpression(value)) { + self.methods.set(name, path); + } + if (name === 'state' && t.isObjectExpression(value)) { + value.properties.forEach(p => { + if (t.isObjectProperty(p)) { + if (t.isIdentifier(p.key)) { + self.initState.add(p.key.name); + } + } + }); + } + }, + JSXExpressionContainer(path) { + const attr = path.findParent(p => p.isJSXAttribute()); + const isFunctionProp = attr && typeof attr.node.name.name === 'string' && attr.node.name.name.startsWith('on'); + path.traverse({ + MemberExpression(path) { + const sibling = path.getSibling('property'); + if (path.get('object').isThisExpression() && + (path.get('property').isIdentifier({ name: 'props' }) || path.get('property').isIdentifier({ name: 'state' })) && + sibling.isIdentifier()) { + if (!isFunctionProp) { + self.usedState.add(sibling.node.name); + } + } + } + }); + const expression = path.get('expression'); + const scope = self.renderMethod && self.renderMethod.scope || path.scope; + const calleeExpr = expression.get('callee'); + const parentPath = path.parentPath; + if (utils_1.hasComplexExpression(expression) && + !isFunctionProp && + !(calleeExpr && + calleeExpr.isMemberExpression() && + calleeExpr.get('object').isMemberExpression() && + calleeExpr.get('property').isIdentifier({ name: 'bind' })) // is not bind + ) { + utils_1.generateAnonymousState(scope, expression, self.jsxReferencedIdentifiers); + } + else { + if (parentPath.isJSXAttribute()) { + if (!(expression.isMemberExpression() || expression.isIdentifier()) && parentPath.node.name.name === 'key') { + utils_1.generateAnonymousState(scope, expression, self.jsxReferencedIdentifiers); + } + } + } + if (!attr) + return; + const key = attr.node.name; + const value = attr.node.value; + if (!t.isJSXIdentifier(key)) { + return; + } + if (t.isJSXIdentifier(key) && key.name.startsWith('on') && t.isJSXExpressionContainer(value)) { + const expr = value.expression; + if (t.isCallExpression(expr) && t.isMemberExpression(expr.callee) && t.isIdentifier(expr.callee.property, { name: 'bind' })) { + self.buildPropsAnonymousFunc(attr, expr, true); + } + else if (t.isMemberExpression(expr)) { + self.buildPropsAnonymousFunc(attr, expr, false); + } + else if (t.isArrowFunctionExpression(expr)) { + const exprPath = attr.get('value.expression'); + const stemParent = path.getStatementParent(); + const counter = self.anonymousFuncCounter(); + const anonymousFuncName = `anonymousFunc${counter}`; + const isCatch = utils_1.isContainStopPropagation(exprPath); + const classBody = self.classPath.node.body.body; + const loopCallExpr = path.findParent(p => utils_1.isArrayMapCallExpression(p)); + let index; + if (loopCallExpr) { + index = lodash_1.get(loopCallExpr, 'node.arguments[0].params[1]'); + if (!t.isIdentifier(index)) { + index = t.identifier('__index' + counter); + lodash_1.set(loopCallExpr, 'node.arguments[0].params[1]', index); + } + classBody.push(t.classProperty(t.identifier(anonymousFuncName + 'Array'), t.arrayExpression([]))); + const arrayFunc = t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier(anonymousFuncName + 'Array')), t.identifier(index.name), true); + classBody.push(t.classMethod('method', t.identifier(anonymousFuncName), [t.identifier(index.name), t.identifier('e')], t.blockStatement([ + isCatch ? t.expressionStatement(t.callExpression(t.memberExpression(t.identifier('e'), t.identifier('stopPropagation')), [])) : t.emptyStatement(), + t.expressionStatement(t.logicalExpression('&&', arrayFunc, t.callExpression(arrayFunc, [t.identifier('e')]))) + ]))); + exprPath.replaceWith(t.callExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier(anonymousFuncName)), t.identifier('bind')), [t.thisExpression(), t.identifier(index.name)])); + stemParent.insertBefore(t.expressionStatement(t.assignmentExpression('=', arrayFunc, expr))); + } + else { + classBody.push(t.classMethod('method', t.identifier(anonymousFuncName), [t.identifier('e')], t.blockStatement([ + isCatch ? t.expressionStatement(t.callExpression(t.memberExpression(t.identifier('e'), t.identifier('stopPropagation')), [])) : t.emptyStatement() + ]))); + exprPath.replaceWith(t.memberExpression(t.thisExpression(), t.identifier(anonymousFuncName))); + stemParent.insertBefore(t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier(anonymousFuncName)), expr))); + } + } + else { + throw utils_1.codeFrameError(path.node, '组件事件传参只能在使用匿名箭头函数,或使用类作用域下的确切引用(this.handleXX || this.props.handleXX),或使用 bind。'); + } + } + const jsx = path.findParent(p => p.isJSXOpeningElement()); + if (!jsx) + return; + const jsxName = jsx.node.name; + if (!t.isJSXIdentifier(jsxName)) + return; + if (expression.isJSXElement()) + return; + if (constant_1.DEFAULT_Component_SET.has(jsxName.name) || expression.isIdentifier() || expression.isMemberExpression() || expression.isLiteral() || expression.isLogicalExpression() || expression.isConditionalExpression() || key.name.startsWith('on') || expression.isCallExpression()) + return; + utils_1.generateAnonymousState(scope, expression, self.jsxReferencedIdentifiers); + }, + JSXElement(path) { + const id = path.node.openingElement.name; + if (t.isJSXIdentifier(id) && + !constant_1.DEFAULT_Component_SET.has(id.name) && + self.moduleNames.indexOf(id.name) !== -1) { + const name = id.name; + const binding = self.classPath.scope.getBinding(name); + if (binding && t.isImportDeclaration(binding.path.parent)) { + const sourcePath = binding.path.parent.source.value; + if (binding.path.isImportDefaultSpecifier()) { + self.customComponents.set(name, { + sourcePath, + type: 'default' + }); + } + else { + self.customComponents.set(name, { + sourcePath, + type: 'pattern' + }); + } + } + } + }, + MemberExpression: (path) => { + const object = path.get('object'); + const property = path.get('property'); + if (!(object.isThisExpression() && property.isIdentifier({ name: 'props' }))) { + return; + } + const parentPath = path.parentPath; + if (parentPath.isMemberExpression()) { + const siblingProp = parentPath.get('property'); + if (siblingProp.isIdentifier()) { + const name = siblingProp.node.name; + if (name === 'children') { + parentPath.replaceWith(t.jSXElement(t.jSXOpeningElement(t.jSXIdentifier('slot'), [], true), t.jSXClosingElement(t.jSXIdentifier('slot')), [], true)); + } + else if (/^render[A-Z]/.test(name)) { + const slotName = utils_1.getSlotName(name); + parentPath.replaceWith(t.jSXElement(t.jSXOpeningElement(t.jSXIdentifier('slot'), [ + t.jSXAttribute(t.jSXIdentifier('name'), t.stringLiteral(slotName)) + ], true), t.jSXClosingElement(t.jSXIdentifier('slot')), [])); + this.setMultipleSlots(); + } + else { + self.componentProperies.add(siblingProp.node.name); + } + } + } + else if (parentPath.isVariableDeclarator()) { + const siblingId = parentPath.get('id'); + if (siblingId.isObjectPattern()) { + const properties = siblingId.node.properties; + for (const prop of properties) { + if (t.isRestProperty(prop)) { + throw utils_1.codeFrameError(prop.loc, 'this.props 不支持使用 rest property 语法,请把每一个 prop 都单独列出来'); + } + else if (t.isIdentifier(prop.key)) { + self.componentProperies.add(prop.key.name); + } + } + } + } + }, + CallExpression(path) { + const node = path.node; + const callee = node.callee; + if (t.isMemberExpression(callee) && t.isMemberExpression(callee.object)) { + const property = callee.property; + if (t.isIdentifier(property)) { + if (property.name.startsWith('on')) { + self.componentProperies.add(`__fn_${property.name}`); + processThisPropsFnMemberProperties(callee, path, node.arguments, false); + } + else if (property.name === 'call' || property.name === 'apply') { + self.componentProperies.add(`__fn_${property.name}`); + processThisPropsFnMemberProperties(callee.object, path, node.arguments, true); + } + } + } + } + }); + } + setComponents() { + this.customComponents.forEach((component, name) => { + this.result.components.push({ + path: utils_1.pathResolver(component.sourcePath, this.sourcePath), + name: lodash_1.kebabCase(name), + type: component.type + }); + }); + } + setMethods() { + const methods = this.classPath.get('body').get('body'); + for (const method of methods) { + if (method.isClassMethod()) { + const key = method.get('key'); + if (key.isIdentifier()) { + this.methods.set(key.node.name, method); + } + } + } + } + resetConstructor() { + const body = this.classPath.node.body.body; + if (!this.methods.has('constructor')) { + const ctor = buildConstructor(); + body.unshift(ctor); + } + if (process.env.NODE_ENV === 'test') { + return; + } + for (const method of body) { + if (t.isClassMethod(method) && method.kind === 'constructor') { + method.kind = 'method'; + method.key = t.identifier('_constructor'); + if (t.isBlockStatement(method.body)) { + for (const statement of method.body.body) { + if (t.isExpressionStatement(statement)) { + const expr = statement.expression; + if (t.isCallExpression(expr) && (t.isIdentifier(expr.callee, { name: 'super' }) || t.isSuper(expr.callee))) { + expr.callee = t.memberExpression(t.identifier('super'), t.identifier('_constructor')); + } + } + } + } + } + } + } + handleLifecyclePropParam(propParam, properties) { + let propsName = null; + if (!propParam) { + return null; + } + if (t.isIdentifier(propParam)) { + propsName = propParam.name; + } + else if (t.isObjectPattern(propParam)) { + for (const prop of propParam.properties) { + if (t.isObjectProperty(prop) && t.isIdentifier(prop.key)) { + properties.add(prop.key.name); + } + else if (t.isRestProperty(prop) && t.isIdentifier(prop.argument)) { + propsName = prop.argument.name; + } + } + } + else { + throw utils_1.codeFrameError(propParam.loc, '此生命周期的第一个参数只支持写标识符或对象解构'); + } + return propsName; + } + findMoreProps() { + // 第一个参数是 props 的生命周期 + const lifeCycles = new Set([ + // 'constructor', + 'componentDidUpdate', + 'shouldComponentUpdate', + 'getDerivedStateFromProps', + 'getSnapshotBeforeUpdate', + 'componentWillReceiveProps', + 'componentWillUpdate' + ]); + const properties = new Set(); + this.methods.forEach((method, name) => { + if (!lifeCycles.has(name)) { + return; + } + const node = method.node; + let propsName = null; + if (t.isClassMethod(node)) { + propsName = this.handleLifecyclePropParam(node.params[0], properties); + } + else if (t.isArrowFunctionExpression(node.value) || t.isFunctionExpression(node.value)) { + propsName = this.handleLifecyclePropParam(node.value.params[0], properties); + } + if (propsName === null) { + return; + } + method.traverse({ + MemberExpression(path) { + if (!path.isReferencedMemberExpression()) { + return; + } + const { object, property } = path.node; + if (t.isIdentifier(object, { name: propsName }) && t.isIdentifier(property)) { + properties.add(property.name); + } + }, + VariableDeclarator(path) { + const { id, init } = path.node; + if (t.isObjectPattern(id) && t.isIdentifier(init, { name: propsName })) { + for (const prop of id.properties) { + if (t.isObjectProperty(prop) && t.isIdentifier(prop.key)) { + properties.add(prop.key.name); + } + } + } + } + }); + properties.forEach((value) => { + this.componentProperies.add(value); + }); + }); + } + parseRender() { + if (this.renderMethod) { + this.result.template = this.result.template + + new render_1.RenderParser(this.renderMethod, this.methods, this.initState, this.jsxReferencedIdentifiers, this.usedState, this.loopStateName, this.customComponentNames, this.customComponentData, this.componentProperies, this.loopRefs).outputTemplate; + } + } + compile() { + this.traverse(); + this.setMethods(); + this.setComponents(); + this.resetConstructor(); + this.findMoreProps(); + this.handleRefs(); + this.parseRender(); + this.result.componentProperies = [...this.componentProperies]; + } +} +exports.Transformer = Transformer; +//# sourceMappingURL=class.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/class.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/class.js.map new file mode 100644 index 000000000..385cf5612 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/class.js.map @@ -0,0 +1 @@ +{"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/class.ts"],"names":[],"mappings":";;AACA,iCAAgC;AAChC,mCAYgB;AAChB,yCAAkD;AAClD,mCAA4E;AAC5E,qCAAuC;AACvC,+BAAyC;AACzC,uCAA6C;AAE7C,qDAAsC;AAItC,SAAS,gBAAgB;IACvB,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,CACxB,aAAa,EACb,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,EAC3B,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EACvB,CAA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B,IAAI,CAAC,UAAU,EAAE,CAAA;QACjB,IAAI,CAAC,WAAW,EAAE,CAAA;QAClB,IAAI,CAAC,MAAM,CAAC,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAA;IAC/D,CAAC;CACF;AAEQ,kCAAW"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/constant.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/constant.js new file mode 100644 index 000000000..54c6d417c --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/constant.js @@ -0,0 +1,94 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.THIRD_PARTY_COMPONENTS = new Set(); +// tslint:disable-next-line:variable-name +exports.DEFAULT_Component_SET = new Set([ + 'view', + 'scroll-view', + 'swiper', + 'movable-view', + 'cover-view', + 'cover-image', + 'icon', + 'text', + 'rich-text', + 'progress', + 'button', + 'checkbox', + 'form', + 'input', + 'label', + 'picker', + 'picker-view', + 'picker-view-column', + 'radio', + 'radio-group', + 'checkbox-group', + 'slider', + 'switch', + 'textarea', + 'navigator', + 'audio', + 'image', + 'video', + 'camera', + 'live-player', + 'live-pusher', + 'map', + 'canvas', + 'open-data', + 'web-view', + 'swiper-item', + 'movable-area', + 'movable-view', + 'functional-page-navigator', + 'ad', + 'block', + 'import', + 'official-account' +]); +exports.INTERNAL_SAFE_GET = 'internal_safe_get'; +exports.TARO_PACKAGE_NAME = '@tarojs/taro'; +exports.COMPONENTS_PACKAGE_NAME = '@tarojs/components'; +exports.REDUX_PACKAGE_NAME = '@tarojs/redux'; +exports.MOBX_PACKAGE_NAME = '@tarojs/mobx'; +exports.MAP_CALL_ITERATOR = '__item'; +exports.INTERNAL_INLINE_STYLE = 'internal_inline_style'; +exports.INTERNAL_GET_ORIGNAL = 'internal_get_original'; +exports.GEL_ELEMENT_BY_ID = 'getElementById'; +exports.LOOP_STATE = '$loopState'; +exports.LOOP_ORIGINAL = '$original'; +exports.setLoopOriginal = (s) => exports.LOOP_ORIGINAL = s; +exports.LOOP_CALLEE = '$anonymousCallee_'; +exports.SPECIAL_COMPONENT_PROPS = new Map(); +exports.SPECIAL_COMPONENT_PROPS.set('Progress', new Set([ + 'activeColor', + 'backgroundColor' +])); +exports.IMAGE_COMPONENTS = new Set([ + 'Image', + 'CoverImage' +]); +exports.swanSpecialAttrs = { + 'ScrollView': ['scrollTop', 'scrollLeft', 'scrollIntoView'], + 'Input': ['value'], + 'Textarea': ['value'], + 'MovableView': ['x', 'y'], + 'Slider': ['value'] +}; +exports.ALIPAY_BUBBLE_EVENTS = new Set([ + 'onTouchStart', + 'onTouchMove', + 'onTouchEnd', + 'onTouchCancel', + 'onClick', + 'onLongTap' +]); +exports.TRANSFORM_COMPONENT_PROPS = new Map(); +exports.TRANSFORM_COMPONENT_PROPS.set("alipay" /* alipay */, { + 'Canvas': { + 'canvasId': 'id' + } +}); +exports.lessThanSignPlacehold = '__LESS_THAN_SIGN_PLACEHOLDER__'; +//# sourceMappingURL=constant.js.map diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/constant.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/constant.js.map new file mode 100644 index 000000000..722c501d2 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/constant.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../src/constant.ts"],"names":[],"mappings":";;AAEa,QAAA,sBAAsB,GAAG,IAAI,GAAG,EAAU,CAAA;AAEvD,yCAAyC;AAC5B,QAAA,qBAAqB,GAAG,IAAI,GAAG,CAAS;IACnD,MAAM;IACN,YAAY;IACZ,QAAQ;IACR,aAAa;IACb,WAAW;IACX,YAAY;IACZ,MAAM;IACN,MAAM;IACN,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;IACR,YAAY;IACZ,kBAAkB;IAClB,OAAO;IACP,YAA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U,EAAE,CAAC,OAAO,CAAC;IACrB,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IACzB,QAAQ,EAAE,CAAC,OAAO,CAAC;CACpB,CAAA;AAEY,QAAA,oBAAoB,GAAG,IAAI,GAAG,CAAS;IAClD,cAAc;IACd,aAAa;IACb,YAAY;IACZ,eAAe;IACf,SAAS;IACT,WAAW;CACZ,CAAC,CAAA;AAEW,QAAA,yBAAyB,GAAG,IAAI,GAAG,EAA0D,CAAA;AAE1G,iCAAyB,CAAC,GAAG,wBAAkB;IAC7C,QAAQ,EAAE;QACR,UAAU,EAAE,IAAI;KACjB;CACF,CAAC,CAAA;AAEW,QAAA,qBAAqB,GAAG,gCAAgC,CAAA"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/create-html-element.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/create-html-element.js new file mode 100644 index 000000000..98859f18b --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/create-html-element.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const voidHtmlTags = new Set([ + // 'image', + 'img', + 'input', + 'import' +]); +if (process.env.NODE_ENV === 'test') { + voidHtmlTags.add('image'); +} +function stringifyAttributes(input) { + const attributes = []; + for (const key of Object.keys(input)) { + let value = input[key]; + if (value === false) { + continue; + } + if (Array.isArray(value)) { + value = value.join(' '); + } + let attribute = key; + if (value !== true) { + attribute += `="${String(value)}"`; + } + attributes.push(attribute); + } + return attributes.length > 0 ? ' ' + attributes.join(' ') : ''; +} +exports.createHTMLElement = (options) => { + options = Object.assign({ + name: 'div', + attributes: {}, + value: '' + }, options); + const isVoidTag = voidHtmlTags.has(options.name); + let ret = `<${options.name}${stringifyAttributes(options.attributes)}${isVoidTag ? `/` : ''}>`; + if (!isVoidTag) { + ret += `${options.value}`; + } + return ret; +}; +//# sourceMappingURL=create-html-element.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/create-html-element.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/create-html-element.js.map new file mode 100644 index 000000000..5c20fb7be --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/create-html-element.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-html-element.js","sourceRoot":"","sources":["../../src/create-html-element.ts"],"names":[],"mappings":";;AAAA,MAAM,YAAY,GAAG,IAAI,GAAG,CAAS;IACnC,WAAW;IACX,KAAK;IACL,OAAO;IACP,QAAQ;CACT,CAAC,CAAA;AAEF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;IACnC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;CAC1B;AAQD,SAAS,mBAAmB,CAAE,KAAa;IACzC,MAAM,UAAU,GAAa,EAAE,CAAA;IAE/B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACpC,IAAI,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;QAEtB,IAAI,KAAK,KAAK,KAAK,EAAE;YACnB,SAAQ;SACT;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;SACxB;QAED,IAAI,SAAS,GAAG,GAAG,CAAA;QAEnB,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,SAAS,IAAI,KAAK,MAAM,CAAC,KAAK,CAAC,GAAG,CAAA;SACnC;QAED,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;KAC3B;IAED,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAEhE,CAAC;AAEY,QAAA,iBAAiB,GAAG,CAAC,OAAgB,EAAE,EAAE;IACpD,OAAO,GAAG,MAAM,CAAC,MAAM,CACrB;QACE,IAAI,EAAE,KAAK;QACX,UAAU,EAAE,EAAE;QACd,KAAK,EAAE,EAAE;KACV,EACD,OAAO,CACR,CAAA;IAED,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAEhD,IAAI,GAAG,GAAG,IAAI,OAAO,CAAC,IAAI,GAAG,mBAAmB,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAG,GAAG,CAAA;IAE/F,IAAI,CAAC,SAAS,EAAE;QACd,GAAG,IAAI,GAAG,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,IAAI,GAAG,CAAA;KAC5C;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/eslint.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/eslint.js new file mode 100644 index 000000000..a44d44bb1 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/eslint.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const eslint_1 = require("eslint"); +const utils_1 = require("./utils"); +const cli = new eslint_1.CLIEngine({ + baseConfig: { + extends: ['plugin:taro/transformer'] + }, + useEslintrc: false, + parser: 'babel-eslint', + parserOptions: { + ecmaVersion: 2018, + ecmaFeatures: { + jsx: true, + legacyDecorators: true + } + } +}); +exports.eslintValidation = () => { + return { + visitor: { + Program(_, state) { + const { file: { code } } = state; + const report = cli.executeOnText(code); + if (report.errorCount > 0) { + for (const result of report.results) { + for (const msg of result.messages) { + const err = utils_1.codeFrameError({ + start: { + line: msg.line, + column: msg.column + }, + end: { + line: msg.endLine, + column: msg.endColumn + } + }, msg.message); + // tslint:disable-next-line + console.warn('\n' + `ESLint(${msg.ruleId}) 错误:` + err.message + '\n'); + } + } + } + } + } + }; +}; +//# sourceMappingURL=eslint.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/eslint.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/eslint.js.map new file mode 100644 index 000000000..05f4f5104 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/eslint.js.map @@ -0,0 +1 @@ +{"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../src/eslint.ts"],"names":[],"mappings":";;AAAA,mCAAkC;AAElC,mCAAwC;AAExC,MAAM,GAAG,GAAG,IAAI,kBAAS,CAAC;IACxB,UAAU,EAAE;QACV,OAAO,EAAE,CAAC,yBAAyB,CAAC;KACrC;IACD,WAAW,EAAE,KAAK;IAClB,MAAM,EAAE,cAAc;IACtB,aAAa,EAAE;QACb,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE;YACZ,GAAG,EAAE,IAAI;YACT,gBAAgB,EAAE,IAAI;SACvB;KACF;CACF,CAAC,CAAA;AAEW,QAAA,gBAAgB,GAEzB,GAAG,EAAE;IACP,OAAO;QACL,OAAO,EAAE;YACP,OAAO,CAAE,CAAC,EAAE,KAAK;gBACf,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,CAAA;gBAChC,MAAM,MAAM,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;gBACtC,IAAI,MAAM,CAAC,UAAU,GAAG,CAAC,EAAE;oBACzB,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;wBACnC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE;4BACjC,MAAM,GAAG,GAAG,sBAAc,CAAC;gCACzB,KAAK,EAAE;oCACL,IAAI,EAAE,GAAG,CAAC,IAAI;oCACd,MAAM,EAAE,GAAG,CAAC,MAAM;iCACnB;gCACD,GAAG,EAAE;oCACH,IAAI,EAAE,GAAG,CAAC,OAAO;oCACjB,MAAM,EAAE,GAAG,CAAC,SAAS;iCACtB;6BACF,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;4BACf,2BAA2B;4BAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,UAAU,GAAG,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;yBACtE;qBACF;iBACF;YACH,CAAC;SACF;KACF,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/functional.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/functional.js new file mode 100644 index 000000000..05cc06191 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/functional.js @@ -0,0 +1,83 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const utils_1 = require("./utils"); +const t = require("babel-types"); +const lodash_1 = require("lodash"); +function initialIsCapital(word) { + return word[0] !== word[0].toLowerCase(); +} +exports.functionalComponent = () => { + return { + visitor: { + JSXElement(path) { + const arrowFuncExpr = path.findParent(p => p.isArrowFunctionExpression()); + if (arrowFuncExpr && arrowFuncExpr.isArrowFunctionExpression() && arrowFuncExpr.parentPath.isVariableDeclarator()) { + const valDecl = arrowFuncExpr.parentPath.parentPath; + if (!valDecl.isVariableDeclaration()) { + throw utils_1.codeFrameError(valDecl.node, '函数式组件不能同时定义多个值'); + } + const id = arrowFuncExpr.parentPath.node.id; + if (!t.isIdentifier(id)) { + throw utils_1.codeFrameError(id, '函数式组件只能使用普通标识符定义'); + } + if (!initialIsCapital(id.name)) { + throw utils_1.codeFrameError(id, '组件命名规则请遵守帕斯卡命名法(Pascal Case)'); + } + const hasClassDecl = arrowFuncExpr.findParent(p => p.isClassDeclaration()); + if (hasClassDecl) { + // @TODO: 加上链接 + throw utils_1.codeFrameError(arrowFuncExpr.node, '在类中的函数式组件请写成类函数式组件:参考:'); + } + const { body } = arrowFuncExpr.node; + if (t.isBlockStatement(body)) { + valDecl.replaceWith(t.functionDeclaration(id, arrowFuncExpr.node.params, body)); + } + else { + valDecl.replaceWith(t.functionDeclaration(id, arrowFuncExpr.node.params, t.blockStatement([ + t.returnStatement(body) + ]))); + } + return; + } + const functionDecl = path.findParent(p => p.isFunctionDeclaration()); + if (functionDecl && functionDecl.isFunctionDeclaration()) { + const hasClassDecl = functionDecl.findParent(p => p.isClassDeclaration()); + if (hasClassDecl) { + // @TODO: 加上链接 + throw utils_1.codeFrameError(functionDecl.node, '在类中的函数式组件请写成类函数式组件:参考:'); + } + const { id, body, params } = functionDecl.node; + let arg = null; + if (params.length > 1) { + throw utils_1.codeFrameError(id, '函数式组件的参数最多只能传入一个'); + } + else if (params.length === 1) { + arg = params[0]; + } + const cloneBody = lodash_1.cloneDeep(body); + if (!initialIsCapital(id.name)) { + throw utils_1.codeFrameError(id, '组件命名规则请遵守帕斯卡命名法(Pascal Case)'); + } + if (arg) { + if (t.isIdentifier(arg)) { + cloneBody.body.push(utils_1.buildConstVariableDeclaration(arg.name, t.memberExpression(t.thisExpression(), t.identifier('props')))); + } + else if (t.isObjectPattern(arg)) { + cloneBody.body.push(t.variableDeclaration('const', [ + t.variableDeclarator(arg, t.memberExpression(t.thisExpression(), t.identifier('props'))) + ])); + } + else { + throw utils_1.codeFrameError(arg, '函数式组件只支持传入一个简单标识符或使用对象结构'); + } + } + const classDecl = t.classDeclaration(id, t.memberExpression(t.identifier('Taro'), t.identifier('Component')), t.classBody([ + t.classMethod('method', t.identifier('render'), [], cloneBody) + ]), []); + functionDecl.replaceWith(classDecl); + } + } + } + }; +}; +//# sourceMappingURL=functional.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/functional.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/functional.js.map new file mode 100644 index 000000000..5ea47265a --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/functional.js.map @@ -0,0 +1 @@ +{"version":3,"file":"functional.js","sourceRoot":"","sources":["../../src/functional.ts"],"names":[],"mappings":";;AACA,mCA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AC,WAAW,CAAC,SAAS,CAAC,CAAA;iBACpC;YACH,CAAC;SACF;KACF,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/index.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/index.js new file mode 100644 index 000000000..da532d896 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/index.js @@ -0,0 +1,507 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const babel_traverse_1 = require("babel-traverse"); +const babel_generator_1 = require("babel-generator"); +const html_1 = require("html"); +const babel_core_1 = require("babel-core"); +const ts = require("typescript"); +const class_1 = require("./class"); +const utils_1 = require("./utils"); +const t = require("babel-types"); +const constant_1 = require("./constant"); +const adapter_1 = require("./adapter"); +const options_1 = require("./options"); +const lodash_1 = require("lodash"); +const template = require('babel-template'); +function getIdsFromMemberProps(member) { + let ids = []; + const { object, property } = member; + if (t.isMemberExpression(object)) { + ids = ids.concat(getIdsFromMemberProps(object)); + } + if (t.isThisExpression(object)) { + ids.push('this'); + } + if (t.isIdentifier(object)) { + ids.push(object.name); + } + if (t.isIdentifier(property)) { + ids.push(property.name); + } + return ids; +} +/** + * TS 编译器会把 class property 移到构造器, + * 而小程序要求 `config` 和所有函数在初始化(after new Class)之后就收集到所有的函数和 config 信息, + * 所以当如构造器里有 this.func = () => {...} 的形式,就给他转换成普通的 classProperty function + * 如果有 config 就给他还原 + */ +function resetTSClassProperty(body) { + for (const method of body) { + if (t.isClassMethod(method) && method.kind === 'constructor') { + if (t.isBlockStatement(method.body)) { + method.body.body = method.body.body.filter(statement => { + if (t.isExpressionStatement(statement) && t.isAssignmentExpression(statement.expression)) { + const expr = statement.expression; + const { left, right } = expr; + if (t.isMemberExpression(left) && + t.isThisExpression(left.object) && + t.isIdentifier(left.property)) { + if ((t.isArrowFunctionExpression(right) || t.isFunctionExpression(right)) + || + (left.property.name === 'config' && t.isObjectExpression(right))) { + const classProp = t.classProperty(left.property, right); + body.push(classProp); + handleThirdPartyComponent(classProp); + return false; + } + } + } + return true; + }); + } + } + } +} +function findDeclarationScope(path, id) { + const scopePath = path.findParent(p => !!p.scope.getOwnBindingIdentifier(id.name)); + if (scopePath) { + return scopePath; + } + throw utils_1.codeFrameError(path.node, '该引用从未被定义'); +} +function buildFullPathThisPropsRef(id, memberIds, path) { + const scopePath = findDeclarationScope(path, id); + const binding = scopePath.scope.getOwnBinding(id.name); + if (binding) { + const bindingPath = binding.path; + if (bindingPath.isVariableDeclarator()) { + const dclId = bindingPath.get('id'); + const dclInit = bindingPath.get('init'); + let dclInitIds = []; + if (dclInit.isMemberExpression()) { + dclInitIds = getIdsFromMemberProps(dclInit.node); + if (dclId.isIdentifier()) { + memberIds.shift(); + } + if (dclInitIds[0] === 'this' && dclInitIds[1] === 'props') { + return template(dclInitIds.concat(memberIds).join('.'))().expression; + } + } + } + } +} +function handleThirdPartyComponent(expr) { + if (t.isClassProperty(expr) && expr.key.name === 'config' && t.isObjectExpression(expr.value)) { + const properties = expr.value.properties; + for (const prop of properties) { + if (t.isObjectProperty(prop) && + (t.isIdentifier(prop.key, { name: 'usingComponents' }) || t.isStringLiteral(prop.key, { value: 'usingComponents' })) && + t.isObjectExpression(prop.value)) { + for (const value of prop.value.properties) { + if (t.isObjectProperty(value)) { + if (t.isStringLiteral(value.key)) { + constant_1.THIRD_PARTY_COMPONENTS.add(value.key.value); + } + if (t.isIdentifier(value.key)) { + constant_1.THIRD_PARTY_COMPONENTS.add(value.key.name); + } + } + } + } + } + } +} +function transform(options) { + if (options.adapter) { + adapter_1.setAdapter(options.adapter); + } + if (adapter_1.Adapter.type === "swan" /* swan */) { + constant_1.setLoopOriginal('privateOriginal'); + } + constant_1.THIRD_PARTY_COMPONENTS.clear(); + const code = options.isTyped + ? ts.transpile(options.code, { + jsx: ts.JsxEmit.Preserve, + target: ts.ScriptTarget.ESNext, + importHelpers: true, + noEmitHelpers: true + }) + : options.code; + options.env = Object.assign({ 'process.env.TARO_ENV': options.adapter || 'weapp' }, options.env || {}); + options_1.setTransformOptions(options); + utils_1.setting.sourceCode = code; + // babel-traverse 无法生成 Hub + // 导致 Path#getSource|buildCodeFrameError 都无法直接使用 + // 原因大概是 babylon.parse 没有生成 File 实例导致 scope 和 path 原型上都没有 `file` + // 将来升级到 babel@7 可以直接用 parse 而不是 transform + const ast = babel_core_1.transform(code, options_1.buildBabelTransformOptions()).ast; + if (options.isNormal) { + return { ast }; + } + // transformFromAst(ast, code) + let result; + const componentSourceMap = new Map(); + const imageSource = new Set(); + const importSources = new Set(); + let componentProperies = []; + let mainClass; + let storeName; + let renderMethod; + let isImportTaro = false; + babel_traverse_1.default(ast, { + TemplateLiteral(path) { + const nodes = []; + const { quasis, expressions } = path.node; + let index = 0; + if (path.parentPath.isTaggedTemplateExpression()) { + return; + } + for (const elem of quasis) { + if (elem.value.cooked) { + nodes.push(t.stringLiteral(elem.value.cooked)); + } + if (index < expressions.length) { + const expr = expressions[index++]; + if (!t.isStringLiteral(expr, { value: '' })) { + nodes.push(expr); + } + } + } + // + 号连接符必须保证第一和第二个 node 都是字符串 + if (!t.isStringLiteral(nodes[0]) && !t.isStringLiteral(nodes[1])) { + nodes.unshift(t.stringLiteral('')); + } + let root = nodes[0]; + for (let i = 1; i < nodes.length; i++) { + root = t.binaryExpression('+', root, nodes[i]); + } + path.replaceWith(root); + }, + ClassDeclaration(path) { + mainClass = path; + const superClass = utils_1.getSuperClassCode(path); + if (superClass) { + try { + componentProperies = transform({ + isRoot: false, + isApp: false, + code: superClass.code, + isTyped: true, + sourcePath: superClass.sourcePath, + outputPath: superClass.sourcePath + }).componentProperies; + } + catch (error) { + // + } + } + }, + ClassExpression(path) { + mainClass = path; + }, + ClassMethod(path) { + if (t.isIdentifier(path.node.key) && path.node.key.name === 'render') { + renderMethod = path; + } + }, + IfStatement(path) { + const consequent = path.get('consequent'); + if (!consequent.isBlockStatement()) { + consequent.replaceWith(t.blockStatement([ + consequent.node + ])); + } + }, + CallExpression(path) { + const callee = path.get('callee'); + if (utils_1.isContainJSXElement(path)) { + return; + } + if (callee.isReferencedMemberExpression()) { + const id = utils_1.findFirstIdentifierFromMemberExpression(callee.node); + const property = callee.node.property; + if (t.isIdentifier(property) && property.name.startsWith('on')) { + const funcExpr = path.findParent(p => p.isFunctionExpression()); + if (funcExpr && funcExpr.isFunctionExpression()) { + const taroAPI = funcExpr.findParent(p => p.isCallExpression() && t.isMemberExpression(p.node.callee) && t.isIdentifier(p.node.callee.object, { name: 'Taro' })); + if (taroAPI && taroAPI.isCallExpression()) { + throw utils_1.codeFrameError(funcExpr.node, '在回调函数使用从 props 传递的函数时,请把回调函数改造为箭头函数并一直使用 `this` 取值'); + } + } + } + const calleeIds = getIdsFromMemberProps(callee.node); + if (t.isIdentifier(id) && id.name.startsWith('on') && "alipay" /* alipay */ !== adapter_1.Adapter.type) { + const fullPath = buildFullPathThisPropsRef(id, calleeIds, path); + if (fullPath) { + path.replaceWith(t.callExpression(fullPath, path.node.arguments)); + } + } + } + if (callee.isReferencedIdentifier()) { + const id = callee.node; + const ids = [id.name]; + if (t.isIdentifier(id) && id.name.startsWith('on')) { + const funcExpr = path.findParent(p => p.isFunctionExpression()); + if (funcExpr && funcExpr.isFunctionExpression()) { + const taroAPI = funcExpr.findParent(p => p.isCallExpression() && t.isMemberExpression(p.node.callee) && t.isIdentifier(p.node.callee.object, { name: 'Taro' })); + if (taroAPI && taroAPI.isCallExpression()) { + throw utils_1.codeFrameError(funcExpr.node, '在回调函数使用从 props 传递的函数时,请把回调函数改造为箭头函数并一直使用 `this` 取值'); + } + } + const fullPath = buildFullPathThisPropsRef(id, ids, path); + if (fullPath) { + path.replaceWith(t.callExpression(fullPath, path.node.arguments)); + } + } + } + }, + // JSXIdentifier (path) { + // const parentPath = path.parentPath + // if (!parentPath.isJSXAttribute()) { + // return + // } + // const element = parentPath.parentPath + // if (!element.isJSXOpeningElement()) { + // return + // } + // const elementName = element.get('name') + // if (!elementName.isJSXIdentifier()) { + // return + // } + // if (DEFAULT_Component_SET.has(elementName.node.name)) { + // return + // } + // const expr = parentPath.get('value.expression') + // }, + JSXElement(path) { + const assignment = path.findParent(p => p.isAssignmentExpression()); + if (assignment && assignment.isAssignmentExpression() && !options.isTyped) { + const left = assignment.node.left; + if (t.isIdentifier(left)) { + const binding = assignment.scope.getBinding(left.name); + if (binding && binding.scope === assignment.scope) { + if (binding.path.isVariableDeclarator()) { + binding.path.node.init = path.node; + assignment.remove(); + } + else { + throw utils_1.codeFrameError(path.node, '同一个作用域的JSX 变量延时赋值没有意义。详见:https://github.com/NervJS/taro/issues/550'); + } + } + } + } + const switchStatement = path.findParent(p => p.isSwitchStatement()); + if (switchStatement && switchStatement.isSwitchStatement()) { + const { discriminant, cases } = switchStatement.node; + const ifStatement = cases.map((Case, index) => { + const [consequent] = Case.consequent; + if (!t.isBlockStatement(consequent)) { + throw utils_1.codeFrameError(switchStatement.node, '含有 JSX 的 switch case 语句必须每种情况都用花括号 `{}` 包裹结果'); + } + const block = t.blockStatement(consequent.body.filter(b => !t.isBreakStatement(b))); + if (index !== cases.length - 1 && t.isNullLiteral(Case.test)) { + throw utils_1.codeFrameError(Case, '含有 JSX 的 switch case 语句只有最后一个 case 才能是 default'); + } + const test = Case.test === null ? t.nullLiteral() : t.binaryExpression('===', discriminant, Case.test); + return { block, test }; + }).reduceRight((ifStatement, item) => { + if (t.isNullLiteral(item.test)) { + ifStatement.alternate = item.block; + return ifStatement; + } + const newStatement = t.ifStatement(item.test, item.block, t.isBooleanLiteral(ifStatement.test, { value: false }) + ? ifStatement.alternate + : ifStatement); + return newStatement; + }, t.ifStatement(t.booleanLiteral(false), t.blockStatement([]))); + switchStatement.insertAfter(ifStatement); + switchStatement.remove(); + } + const isForStatement = (p) => p && (p.isForStatement() || p.isForInStatement() || p.isForOfStatement()); + const forStatement = path.findParent(isForStatement); + if (isForStatement(forStatement)) { + throw utils_1.codeFrameError(forStatement.node, '不行使用 for 循环操作 JSX 元素,详情:https://github.com/NervJS/taro/blob/master/packages/eslint-plugin-taro/docs/manipulate-jsx-as-array.md'); + } + const loopCallExpr = path.findParent(p => utils_1.isArrayMapCallExpression(p)); + if (loopCallExpr && loopCallExpr.isCallExpression()) { + const [func] = loopCallExpr.node.arguments; + if (t.isArrowFunctionExpression(func) && !t.isBlockStatement(func.body)) { + func.body = t.blockStatement([ + t.returnStatement(func.body) + ]); + } + } + }, + JSXOpeningElement(path) { + const { name } = path.node.name; + const binding = path.scope.getBinding(name); + if (process.env.NODE_ENV !== 'test' && constant_1.DEFAULT_Component_SET.has(name) && binding && binding.kind === 'module') { + const bindingPath = binding.path; + if (bindingPath.parentPath.isImportDeclaration()) { + const source = bindingPath.parentPath.node.source; + if (source.value !== constant_1.COMPONENTS_PACKAGE_NAME) { + throw utils_1.codeFrameError(bindingPath.parentPath.node, `内置组件名: '${name}' 只能从 ${constant_1.COMPONENTS_PACKAGE_NAME} 引入。`); + } + } + } + if (name === 'Provider') { + const modules = path.scope.getAllBindings('module'); + const providerBinding = Object.values(modules).some((m) => m.identifier.name === 'Provider'); + if (providerBinding) { + path.node.name = t.jSXIdentifier('view'); + const store = path.node.attributes.find(attr => attr.name.name === 'store'); + if (store && t.isJSXExpressionContainer(store.value) && t.isIdentifier(store.value.expression)) { + storeName = store.value.expression.name; + } + path.node.attributes = []; + } + } + if (constant_1.IMAGE_COMPONENTS.has(name)) { + for (const attr of path.node.attributes) { + if (attr.name.name === 'src') { + if (t.isStringLiteral(attr.value)) { + imageSource.add(attr.value.value); + } + else if (t.isJSXExpressionContainer(attr.value)) { + if (t.isStringLiteral(attr.value.expression)) { + imageSource.add(attr.value.expression.value); + } + } + } + } + } + }, + JSXAttribute(path) { + const { name, value } = path.node; + if (options.jsxAttributeNameReplace) { + for (const r in options.jsxAttributeNameReplace) { + if (options.jsxAttributeNameReplace.hasOwnProperty(r)) { + const element = options.jsxAttributeNameReplace[r]; + if (t.isJSXIdentifier(name, { name: r })) { + path.node.name = t.jSXIdentifier(element); + } + } + } + } + if (!t.isJSXIdentifier(name) || value === null || t.isStringLiteral(value) || t.isJSXElement(value)) { + return; + } + const expr = value.expression; + const exprPath = path.get('value.expression'); + const classDecl = path.findParent(p => p.isClassDeclaration()); + const classDeclName = classDecl && classDecl.isClassDeclaration() && lodash_1.get(classDecl, 'node.id.name', ''); + let isConverted = false; + if (classDeclName) { + isConverted = classDeclName === '_C' || classDeclName.endsWith('Tmpl'); + } + if (!t.isBinaryExpression(expr, { operator: '+' }) && !t.isLiteral(expr) && name.name === 'style' && !isConverted) { + const jsxID = path.findParent(p => p.isJSXOpeningElement()).get('name'); + if (jsxID && jsxID.isJSXIdentifier() && constant_1.DEFAULT_Component_SET.has(jsxID.node.name)) { + exprPath.replaceWith(t.callExpression(t.identifier(constant_1.INTERNAL_INLINE_STYLE), [expr])); + } + } + if (name.name.startsWith('on')) { + if (exprPath.isReferencedIdentifier()) { + const ids = [expr.name]; + const fullPath = buildFullPathThisPropsRef(expr, ids, path); + if (fullPath) { + exprPath.replaceWith(fullPath); + } + } + if (exprPath.isReferencedMemberExpression()) { + const id = utils_1.findFirstIdentifierFromMemberExpression(expr); + const ids = getIdsFromMemberProps(expr); + if (t.isIdentifier(id)) { + const fullPath = buildFullPathThisPropsRef(id, ids, path); + if (fullPath) { + exprPath.replaceWith(fullPath); + } + } + } + // @TODO: bind 的处理待定 + } + }, + ImportDeclaration(path) { + const source = path.node.source.value; + if (importSources.has(source)) { + throw utils_1.codeFrameError(path.node, '无法在同一文件重复 import 相同的包。'); + } + else { + importSources.add(source); + } + const names = []; + if (source === constant_1.TARO_PACKAGE_NAME) { + isImportTaro = true; + path.node.specifiers.push(t.importSpecifier(t.identifier(constant_1.INTERNAL_SAFE_GET), t.identifier(constant_1.INTERNAL_SAFE_GET)), t.importSpecifier(t.identifier(constant_1.INTERNAL_GET_ORIGNAL), t.identifier(constant_1.INTERNAL_GET_ORIGNAL)), t.importSpecifier(t.identifier(constant_1.INTERNAL_INLINE_STYLE), t.identifier(constant_1.INTERNAL_INLINE_STYLE)), t.importSpecifier(t.identifier(constant_1.GEL_ELEMENT_BY_ID), t.identifier(constant_1.GEL_ELEMENT_BY_ID))); + } + if (source === constant_1.REDUX_PACKAGE_NAME || source === constant_1.MOBX_PACKAGE_NAME) { + path.node.specifiers.forEach((s, index, specs) => { + if (s.local.name === 'Provider') { + specs.splice(index, 1); + specs.push(t.importSpecifier(t.identifier('setStore'), t.identifier('setStore'))); + } + }); + } + path.traverse({ + ImportDefaultSpecifier(path) { + const name = path.node.local.name; + names.push(name); + }, + ImportSpecifier(path) { + const name = path.node.imported.name; + names.push(name); + if (source === constant_1.TARO_PACKAGE_NAME && name === 'Component') { + path.node.local = t.identifier('__BaseComponent'); + } + } + }); + componentSourceMap.set(source, names); + } + }); + if (!isImportTaro) { + ast.program.body.unshift(t.importDeclaration([ + t.importDefaultSpecifier(t.identifier('Taro')), + t.importSpecifier(t.identifier(constant_1.INTERNAL_SAFE_GET), t.identifier(constant_1.INTERNAL_SAFE_GET)), + t.importSpecifier(t.identifier(constant_1.INTERNAL_GET_ORIGNAL), t.identifier(constant_1.INTERNAL_GET_ORIGNAL)), + t.importSpecifier(t.identifier(constant_1.INTERNAL_INLINE_STYLE), t.identifier(constant_1.INTERNAL_INLINE_STYLE)) + ], t.stringLiteral('@tarojs/taro'))); + } + if (!mainClass) { + throw new Error('未找到 Taro.Component 的类定义'); + } + mainClass.node.body.body.forEach(handleThirdPartyComponent); + const storeBinding = mainClass.scope.getBinding(storeName); + mainClass.scope.rename('Component', '__BaseComponent'); + if (storeBinding) { + const statementPath = storeBinding.path.getStatementParent(); + if (statementPath) { + ast.program.body.forEach((node, index, body) => { + if (node === statementPath.node) { + body.splice(index + 1, 0, t.expressionStatement(t.callExpression(t.identifier('setStore'), [ + t.identifier(storeName) + ]))); + } + }); + } + } + resetTSClassProperty(mainClass.node.body.body); + if (options.isApp) { + renderMethod.replaceWith(t.classMethod('method', t.identifier('_createData'), [], t.blockStatement([]))); + return { ast }; + } + result = new class_1.Transformer(mainClass, options.sourcePath, componentProperies).result; + result.code = babel_generator_1.default(ast).code; + result.ast = ast; + const lessThanSignReg = new RegExp(constant_1.lessThanSignPlacehold, 'g'); + result.compressedTemplate = result.template; + result.template = html_1.prettyPrint(result.template, { + max_char: 0, + unformatted: process.env.NODE_ENV === 'test' ? [] : ['text'] + }); + result.template = result.template.replace(lessThanSignReg, '<'); + result.imageSrcs = Array.from(imageSource); + return result; +} +exports.default = transform; +//# sourceMappingURL=index.js.map diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/index.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/index.js.map new file mode 100644 index 000000000..92bc1e07b --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,mDAA4D;AAC5D,qDAAsC;AACtC,+BAAkC;AAClC,2CAA+C;AAC/C,iCAAgC;AAChC,mCAAqC;AACrC,mCAA4J;AAC5J,iCAAgC;AAChC,yCAcmB;AACnB,uCAAyD;AACzD,uCAAoF;AACpF,mCAAuC;AAEvC,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE1C,SAAS,qBAAqB,CAAE,MAA0B;IACxD,IAAI,GAAG,GAAa,EAAE,CAAA;IACtB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IACnC,IAAI,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE;QAChC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAA;KAChD;IACD,IAAI,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE;QAC9B,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;KACjB;IACD,IAAI,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;QAC1B,GA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file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/jsx.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/jsx.js new file mode 100644 index 000000000..f9a3d1bcc --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/jsx.js @@ -0,0 +1,258 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const babel_generator_1 = require("babel-generator"); +const t = require("babel-types"); +const lodash_1 = require("lodash"); +const constant_1 = require("./constant"); +const create_html_element_1 = require("./create-html-element"); +const utils_1 = require("./utils"); +const adapter_1 = require("./adapter"); +function isStartWithWX(str) { + return str[0] === 'w' && str[1] === 'x'; +} +exports.isStartWithWX = isStartWithWX; +const specialComponentName = ['block', 'Block', 'slot', 'Slot']; +function removeJSXThisProperty(path) { + if (!path.parentPath.isCallExpression()) { + const p = path.getSibling('property'); + if (p.isIdentifier({ name: 'props' }) || + p.isIdentifier({ name: 'state' })) { + path.parentPath.replaceWithSourceString('this'); + } + else { + path.parentPath.replaceWith(p); + } + } +} +exports.removeJSXThisProperty = removeJSXThisProperty; +function findJSXAttrByName(attrs, name) { + for (const attr of attrs) { + if (!t.isJSXIdentifier(attr.name)) { + break; + } + if (attr.name.name === name) { + return attr; + } + } + return null; +} +exports.findJSXAttrByName = findJSXAttrByName; +function buildRefTemplate(name, refName, loop, key) { + const attrs = [ + t.jSXAttribute(t.jSXIdentifier('is'), t.stringLiteral(name)), + t.jSXAttribute(t.jSXIdentifier('data'), t.stringLiteral(`{{...${refName ? `${loop ? '' : '$$'}${refName}` : '__data'}}}`)) + ]; + if (key) { + attrs.push(key); + } + return t.jSXElement(t.jSXOpeningElement(t.jSXIdentifier('template'), attrs), t.jSXClosingElement(t.jSXIdentifier('template')), []); +} +exports.buildRefTemplate = buildRefTemplate; +function buildJSXAttr(name, value) { + return t.jSXAttribute(t.jSXIdentifier(name), t.jSXExpressionContainer(value)); +} +exports.buildJSXAttr = buildJSXAttr; +function newJSXIfAttr(jsx, value) { + jsx.openingElement.attributes.push(buildJSXAttr(adapter_1.Adapter.if, value)); +} +exports.newJSXIfAttr = newJSXIfAttr; +function setJSXAttr(jsx, name, value, path) { + const element = jsx.openingElement; + if (!t.isJSXIdentifier(element.name)) { + return; + } + if (element.name.name === 'Block' || element.name.name === 'block' || !path) { + jsx.openingElement.attributes.push(t.jSXAttribute(t.jSXIdentifier(name), value)); + } + else { + const block = buildBlockElement(); + setJSXAttr(block, name, value); + block.children = [jsx]; + path.node = block; + } +} +exports.setJSXAttr = setJSXAttr; +function isAllLiteral(...args) { + return args.every(p => t.isLiteral(p)); +} +exports.isAllLiteral = isAllLiteral; +function buildBlockElement() { + return t.jSXElement(t.jSXOpeningElement(t.jSXIdentifier('block'), []), t.jSXClosingElement(t.jSXIdentifier('block')), []); +} +exports.buildBlockElement = buildBlockElement; +function parseJSXChildren(children) { + return children + .filter(child => { + return !(t.isJSXText(child) && child.value.trim() === ''); + }) + .reduce((str, child) => { + if (t.isJSXText(child)) { + const strings = []; + child.value.split(/(\r?\n\s*)/).forEach((val) => { + const value = val.replace(/\u00a0/g, ' ').trimLeft(); + if (!value) { + return; + } + if (value.startsWith('\n')) { + return; + } + strings.push(value); + }); + return str + strings.join(''); + } + if (t.isJSXElement(child)) { + return str + parseJSXElement(child); + } + if (t.isJSXExpressionContainer(child)) { + if (t.isJSXElement(child.expression)) { + return str + parseJSXElement(child.expression); + } + return str + `{${utils_1.decodeUnicode(babel_generator_1.default(child, { + quotes: 'single', + jsonCompatibleStrings: true + }) + .code) + .replace(/(this\.props\.)|(this\.state\.)/g, '') + .replace(/(props\.)|(state\.)/g, '') + .replace(/this\./g, '') + .replace(/ { + if (a.name.name === adapter_1.Adapter.else && !['block', 'Block'].includes(componentName) && !isDefaultComponent) { + hasElseAttr = true; + attributes.splice(index, 1); + } + }); + if (hasElseAttr) { + return create_html_element_1.createHTMLElement({ + name: 'block', + attributes: { + [adapter_1.Adapter.else]: true + }, + value: parseJSXChildren([element]) + }); + } + let attributesTrans = {}; + if (attributes.length) { + attributesTrans = attributes.reduce((obj, attr) => { + if (t.isJSXSpreadAttribute(attr)) { + throw utils_1.codeFrameError(attr.loc, 'JSX 参数暂不支持 ...spread 表达式'); + } + let name = attr.name.name; + if (constant_1.DEFAULT_Component_SET.has(componentName)) { + if (name === 'className') { + name = 'class'; + } + } + let value = true; + let attrValue = attr.value; + if (typeof name === 'string') { + const isAlipayEvent = adapter_1.Adapter.type === "alipay" /* alipay */ && /(^on[A-Z_])|(^catch[A-Z_])/.test(name); + if (t.isStringLiteral(attrValue)) { + value = attrValue.value; + } + else if (t.isJSXExpressionContainer(attrValue)) { + let isBindEvent = (name.startsWith('bind') && name !== 'bind') || (name.startsWith('catch') && name !== 'catch'); + let code = utils_1.decodeUnicode(babel_generator_1.default(attrValue.expression, { + quotes: 'single', + concise: true + }).code) + .replace(/"/g, "'") + .replace(/(this\.props\.)|(this\.state\.)/g, '') + .replace(/this\./g, ''); + if ("swan" /* swan */ === adapter_1.Adapter.type && + code !== 'true' && + code !== 'false' && + constant_1.swanSpecialAttrs[componentName] && + constant_1.swanSpecialAttrs[componentName].includes(name)) { + value = `{= ${code} =}`; + } + else { + if (adapter_1.Adapter.key === name) { + const splitCode = code.split('.'); + if (splitCode.length > 1) { + value = splitCode.slice(1).join('.'); + } + else { + value = code; + } + } + else { + value = isBindEvent || isAlipayEvent ? code : `{{${code}}}`; + } + } + if (adapter_1.Adapter.type === "swan" /* swan */ && name === adapter_1.Adapter.for) { + value = code; + } + if (t.isStringLiteral(attrValue.expression)) { + value = attrValue.expression.value; + } + } + else if (attrValue === null && name !== adapter_1.Adapter.else) { + value = `{{true}}`; + } + if (constant_1.THIRD_PARTY_COMPONENTS.has(componentName) && /^bind/.test(name) && name.includes('-')) { + name = name.replace(/^bind/, 'bind:'); + } + if (componentTransfromProps && componentTransfromProps[componentName]) { + const transfromProps = componentTransfromProps[componentName]; + Object.keys(transfromProps).forEach(oriName => { + if (transfromProps.hasOwnProperty(name)) { + name = transfromProps[oriName]; + } + }); + } + if ((componentName === 'Input' || componentName === 'input') && name === 'maxLength') { + obj['maxlength'] = value; + } + else if (componentSpecialProps && componentSpecialProps.has(name) || + name.startsWith('__fn_') || + isAlipayEvent) { + obj[name] = value; + } + else { + obj[isDefaultComponent && !name.includes('-') && !name.includes(':') ? lodash_1.kebabCase(name) : name] = value; + } + } + // if (!isDefaultComponent && !specialComponentName.includes(componentName)) { + // obj[TRIGGER_OBSERER] = '{{ _triggerObserer }}'; + // } + return obj; + }, {}); + } + // else if (!isDefaultComponent && !specialComponentName.includes(componentName)) { + // attributesTrans[TRIGGER_OBSERER] = '{{ _triggerObserer }}'; + // } + return create_html_element_1.createHTMLElement({ + name: lodash_1.kebabCase(componentName), + attributes: attributesTrans, + value: parseJSXChildren(children) + }); +} +exports.parseJSXElement = parseJSXElement; +function generateHTMLTemplate(template, name) { + return create_html_element_1.createHTMLElement({ + name: 'template', + attributes: { + name + }, + value: parseJSXElement(template) + }); +} +exports.generateHTMLTemplate = generateHTMLTemplate; +//# sourceMappingURL=jsx.js.map diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/jsx.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/jsx.js.map new file mode 100644 index 000000000..163ac6caa --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/jsx.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jsx.js","sourceRoot":"","sources":["../../src/jsx.ts"],"names":[],"mappings":";;AAAA,qDAAsC;AAEtC,iCAAgC;AAChC,mCAAkC;AAClC,yCAOmB;AACnB,+DAAyD;AACzD,mCAAuD;AACvD,uCAA6C;AAE7C,SAAgB,aAAa,CAAE,GAAW;IACxC,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAA;AACzC,CAAC;AAFD,sCAEC;AAED,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAA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,GAAG,uBAAuB,CAAA;KAC3D;IAED,OAAO,uCAAiB,CAAC;QACvB,IAAI,EAAE,kBAAS,CAAC,aAAa,CAAC;QAC9B,UAAU,EAAE,eAAe;QAC3B,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC;KAClC,CAAC,CAAA;AACJ,CAAC;AAzHD,0CAyHC;AAED,SAAgB,oBAAoB,CAAE,QAAsB,EAAE,IAAY;IACxE,OAAO,uCAAiB,CAAC;QACvB,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE;YACV,IAAI;SACL;QACD,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC;KACjC,CAAC,CAAA;AACJ,CAAC;AARD,oDAQC"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/lifecycle.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/lifecycle.js new file mode 100644 index 000000000..0dd3bd888 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/lifecycle.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var Lifecycle; +(function (Lifecycle) { + Lifecycle["constructor"] = "constructor"; + Lifecycle["componentWillMount"] = "componentWillMount"; + Lifecycle["componentDidMount"] = "componentDidMount"; + Lifecycle["componentWillUpdate"] = "componentWillUpdate"; + Lifecycle["componentDidUpdate"] = "componentDidUpdate"; + Lifecycle["componentWillUnmount"] = "componentWillUnmount"; + Lifecycle["componentDidCatch"] = "componentDidCatch"; + Lifecycle["componentDidShow"] = "componentDidShow"; + Lifecycle["componentDidHide"] = "componentDidHide"; + Lifecycle["componentDidAttached"] = "componentDidAttached"; + Lifecycle["componentDidMoved"] = "componentDidMoved"; + Lifecycle["shouldComponentUpdate"] = "shouldComponentUpdate"; + Lifecycle["componentWillReceiveProps"] = "componentWillReceiveProps"; +})(Lifecycle = exports.Lifecycle || (exports.Lifecycle = {})); +exports.PageLifecycle = { + [Lifecycle.componentDidMount]: 'onLaunch', + [Lifecycle.componentWillMount]: 'onLoad', + [Lifecycle.componentWillUnmount]: 'onUnload', + [Lifecycle.componentDidShow]: 'onShow', + [Lifecycle.componentDidHide]: 'onHide' +}; +exports.ComponentLifeCycle = { + [Lifecycle.componentWillMount]: 'created', + [Lifecycle.componentDidAttached]: 'attached', + [Lifecycle.componentDidMount]: 'ready', + [Lifecycle.componentDidMoved]: 'moved', + [Lifecycle.componentWillUnmount]: 'detached' +}; +//# sourceMappingURL=lifecycle.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/lifecycle.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/lifecycle.js.map new file mode 100644 index 000000000..f6fb74dee --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/lifecycle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/lifecycle.ts"],"names":[],"mappings":";;AAAA,IAAY,SAcX;AAdD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,sDAAyC,CAAA;IACzC,oDAAuC,CAAA;IACvC,wDAA2C,CAAA;IAC3C,sDAAyC,CAAA;IACzC,0DAA6C,CAAA;IAC7C,oDAAuC,CAAA;IACvC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,0DAA6C,CAAA;IAC7C,oDAAuC,CAAA;IACvC,4DAA+C,CAAA;IAC/C,oEAAuD,CAAA;AACzD,CAAC,EAdW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAcpB;AAEY,QAAA,aAAa,GAAG;IAC3B,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,UAAU;IACzC,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,QAAQ;IACxC,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,UAAU;IAC5C,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,QAAQ;IACtC,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,QAAQ;CACvC,CAAA;AAEY,QAAA,kBAAkB,GAAG;IAChC,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,SAAS;IACzC,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,UAAU;IAC5C,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,OAAO;IACtC,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,OAAO;IACtC,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,UAAU;CAC7C,CAAA"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/loop-component.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/loop-component.js new file mode 100644 index 000000000..00ef7f8bc --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/loop-component.js @@ -0,0 +1,227 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const t = require("babel-types"); +const utils_1 = require("./utils"); +const jsx_1 = require("./jsx"); +const constant_1 = require("./constant"); +const adapter_1 = require("./adapter"); +// @TODO +// 重构 parseRender 和 parseLoop 失败 +// 尚不清楚 babel 的 state 和 context 传参机制 +// 目前先写两份代码,有时间看看 babel 具体对 state 和 context 做了什么导致传参失败 +function parseLoopBody(body, jsxDeclarations, +// @TODO +// 把 templates 换成 Map 可以支持 shalow variables declared +// 现在先用 ESLint 的 no-shalow 顶着 +templates, loopScopes, finalReturnElement, returnedPaths) { + const bodyScope = body.scope; + body.traverse({ + JSXElement(jsxElementPath) { + const parentNode = jsxElementPath.parent; + const parentPath = jsxElementPath.parentPath; + const isFinalReturn = jsxElementPath.getFunctionParent().isClassMethod(); + const isJSXChildren = t.isJSXElement(parentNode); + if (!isJSXChildren) { + let statementParent = jsxElementPath.getStatementParent(); + if (!(statementParent.isVariableDeclaration() || + statementParent.isExpressionStatement())) { + statementParent = statementParent.findParent(s => s.isVariableDeclaration() || s.isExpressionStatement()); + } + jsxDeclarations.add(statementParent); + if (t.isVariableDeclarator(parentNode)) { + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + // setTemplate(name, path, templates) + name && templates.set(name, jsxElementPath.node); + } + } + else if (t.isLogicalExpression(parentNode)) { + const { left, operator } = parentNode; + if (operator === '&&') { + if (t.isExpression(left)) { + utils_1.newJSXIfAttr(jsxElementPath.node, left); + parentPath.replaceWith(jsxElementPath.node); + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + utils_1.setTemplate(name, jsxElementPath, templates); + // name && templates.set(name, path.node) + } + } + } + } + else if (t.isConditionalExpression(parentNode)) { + const { test, consequent, alternate } = parentNode; + const block = jsx_1.buildBlockElement(); + if (t.isJSXElement(consequent) && t.isLiteral(alternate)) { + const { value, confident } = parentPath.get('alternate').evaluate(); + if (confident && !value) { + utils_1.newJSXIfAttr(block, test); + block.children = [jsxElementPath.node]; + // newJSXIfAttr(jsxElementPath.node, test) + parentPath.replaceWith(block); + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + utils_1.setTemplate(name, jsxElementPath, templates); + // name && templates.set(name, path.node) + } + } + } + else if (t.isLiteral(consequent) && t.isJSXElement(consequent)) { + if (t.isNullLiteral(consequent)) { + utils_1.newJSXIfAttr(block, utils_1.reverseBoolean(test)); + // newJSXIfAttr(jsxElementPath.node, reverseBoolean(test)) + parentPath.replaceWith(block); + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + utils_1.setTemplate(name, jsxElementPath, templates); + // name && templates.set(name, path.node) + } + } + } + else if (t.isJSXElement(consequent) && t.isJSXElement(alternate)) { + const block2 = jsx_1.buildBlockElement(); + block.children = [consequent]; + utils_1.newJSXIfAttr(block, test); + jsx_1.setJSXAttr(block2, adapter_1.Adapter.else); + block2.children = [alternate]; + const parentBlock = jsx_1.buildBlockElement(); + parentBlock.children = [block, block2]; + parentPath.replaceWith(parentBlock); + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + utils_1.setTemplate(name, jsxElementPath, templates); + } + } + else { + // console.log('todo') + } + } + else if (t.isReturnStatement(parentNode)) { + if (!isFinalReturn) { + const caller = parentPath.findParent(p => p.isCallExpression()); + if (caller.isCallExpression()) { + const callee = caller.node.callee; + if (t.isMemberExpression(callee) && + t.isIdentifier(callee.property) && + callee.property.name === 'map') { + let ary = callee.object; + const blockStatementPath = parentPath.findParent(p => p.isBlockStatement()); + const body = blockStatementPath.node.body; + let stateToBeAssign = new Set(); + for (const statement of body) { + if (t.isVariableDeclaration(statement)) { + for (const dcl of statement.declarations) { + if (t.isIdentifier(dcl.id)) { + const scope = blockStatementPath.scope; + const stateName = scope.generateUid(constant_1.LOOP_STATE); + stateToBeAssign.add(stateName); + blockStatementPath.scope.rename(dcl.id.name, stateName); + } + } + } + } + if (t.isCallExpression(ary) || utils_1.isContainFunction(caller.get('callee').get('object'))) { + const variableName = `anonymousState_${bodyScope.generateUid()}`; + caller.getStatementParent().insertBefore(utils_1.buildConstVariableDeclaration(variableName, ary)); + ary = t.identifier(variableName); + } + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.for, t.jSXExpressionContainer(ary)); + const [func] = caller.node.arguments; + if (t.isFunctionExpression(func) || + t.isArrowFunctionExpression(func)) { + const [item, index] = func.params; + if (t.isIdentifier(item)) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.forItem, t.stringLiteral(item.name)); + loopScopes.add(item.name); + } + else { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.forItem, t.stringLiteral('__item')); + } + if (t.isIdentifier(index)) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.forIndex, t.stringLiteral(index.name)); + loopScopes.add(index.name); + } + caller.replaceWith(jsxElementPath.node); + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + // setTemplate(name, path, templates) + name && templates.set(name, jsxElementPath.node); + } + } + } + } + } + else { + const ifStatement = parentPath.findParent(p => p.isIfStatement()); + const blockStatement = parentPath.findParent(p => p.isBlockStatement()); + const block = finalReturnElement || jsx_1.buildBlockElement(); + if (utils_1.isBlockIfStatement(ifStatement, blockStatement)) { + const { test, alternate, consequent } = ifStatement.node; + if (alternate === blockStatement.node) { + throw utils_1.codeFrameError(parentNode.loc, '不必要的 else 分支,请遵从 ESLint consistent-return: https://eslint.org/docs/rules/consistent-return'); + } + else if (consequent === blockStatement.node) { + const parentIfStatement = ifStatement.findParent(p => p.isIfStatement()); + if (parentIfStatement) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.elseif, t.jSXExpressionContainer(test)); + } + else { + utils_1.newJSXIfAttr(jsxElementPath.node, test); + } + } + } + else if (block.children.length !== 0) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.else); + } + block.children.push(jsxElementPath.node); + finalReturnElement = block; + returnedPaths.push(parentPath); + } + } + else if (t.isArrowFunctionExpression(parentNode)) { + // + } + else if (t.isAssignmentExpression(parentNode)) { + if (t.isIdentifier(parentNode.left)) { + const name = parentNode.left.name; + const bindingNode = bodyScope.getOwnBinding(name).path.node; + const block = templates.get(name) || jsx_1.buildBlockElement(); + if (utils_1.isEmptyDeclarator(bindingNode)) { + const ifStatement = parentPath.findParent(p => p.isIfStatement()); + const blockStatement = parentPath.findParent(p => p.isBlockStatement()); + if (utils_1.isBlockIfStatement(ifStatement, blockStatement)) { + const { test, alternate, consequent } = ifStatement.node; + if (alternate === blockStatement.node) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.else); + } + else if (consequent === blockStatement.node) { + const parentIfStatement = ifStatement.findParent(p => p.isIfStatement()); + if (parentIfStatement && parentIfStatement.get('alternate') === ifStatement) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.elseif, t.jSXExpressionContainer(test)); + } + else { + if (parentIfStatement) { + utils_1.newJSXIfAttr(block, parentIfStatement.node.test); + } + utils_1.newJSXIfAttr(jsxElementPath.node, test); + } + } + block.children.push(jsxElementPath.node); + // setTemplate(name, path, templates) + name && templates.set(name, block); + } + } + else { + throw utils_1.codeFrameError(jsxElementPath.node.loc, '请将 JSX 赋值表达式初始化为 null,然后再进行 if 条件表达式赋值。'); + } + } + } + else if (!t.isJSXElement(parentNode)) { + // throwError(path, '考虑只对 JSX 元素赋值一次。') + } + } + } + }); +} +exports.parseLoopBody = parseLoopBody; +//# sourceMappingURL=loop-component.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/loop-component.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/loop-component.js.map new file mode 100644 index 000000000..d9f771122 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/loop-component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loop-component.js","sourceRoot":"","sources":["../../src/loop-component.ts"],"names":[],"mappings":";;AACA,iCAAgC;AAChC,mCAUgB;AAChB,+BAGc;AACd,yCAAuC;AACvC,uCAAmC;AAEnC,QAAQ;AACR,gCAAgC;AAChC,oCAAoC;AACpC,sDAAsD;AACtD,SAAgB,aAAa,CAC3B,IAAgC,EAChC,eAAsC;AACtC,QAAQ;AACR,oDAAoD;AACpD,6BAA6B;AAC7B,SAAoC,EACpC,UAAuB,EACvB,kBAAgC,EAChC,aAAiC;IAEjC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAA;IAC5B,IAAI,CAAC,QAAQ,CAAC;QACZ,UAAU,CAAE,cAAc;YACxB,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAA;YACxC,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAA;YAC5C,MAAM,aAAa,GAAG,cAAc,CAAC,iBAAiB,EAAE,CAAC,aAAa,EAAE,CAAA;YACxE,MAAM,aAAa,GAAG,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA;YAChD,IAAI,CAAC,aAAa,EAAE;gBAClB,IAAI,eAAe,GAAG,cAAc,CAAC,kBAAkB,EAAE,CAAA;gBACzD,IACE,CAAC,CACC,eAAe,CAAC,qBAAqB,EAAE;oBACvC,eAAe,CAAC,qB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C,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAC/B,CAAA;qCACF;yCAAM;wCACL,IAAI,iBAAiB,EAAE;4CACrB,oBAAY,CAAC,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;yCACjD;wCACD,oBAAY,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;qCACxC;iCACF;gCACD,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;gCACxC,qCAAqC;gCACrC,IAAI,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;6BACnC;yBACF;6BAAM;4BACL,MAAM,sBAAc,CAClB,cAAc,CAAC,IAAI,CAAC,GAAG,EACvB,yCAAyC,CAC1C,CAAA;yBACF;qBACF;iBACF;qBAAM,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE;oBACtC,uCAAuC;iBACxC;aACF;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAzPD,sCAyPC"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/options.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/options.js new file mode 100644 index 000000000..1682411d2 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/options.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const eslint_1 = require("./eslint"); +exports.transformOptions = {}; +exports.setTransformOptions = (options) => { + for (const key in options) { + if (options.hasOwnProperty(key)) { + exports.transformOptions[key] = options[key]; + } + } +}; +exports.buildBabelTransformOptions = () => { + return { + parserOpts: { + sourceType: 'module', + plugins: [ + 'classProperties', + 'jsx', + 'flow', + 'flowComment', + 'trailingFunctionCommas', + 'asyncFunctions', + 'exponentiationOperator', + 'asyncGenerators', + 'objectRestSpread', + 'decorators', + 'dynamicImport' + ] + }, + plugins: [ + require('babel-plugin-transform-flow-strip-types'), + [require('babel-plugin-transform-define').default, exports.transformOptions.env] + ].concat(process.env.ESLINT === 'false' || exports.transformOptions.isNormal || exports.transformOptions.isTyped ? [] : eslint_1.eslintValidation) + .concat((process.env.NODE_ENV === 'test') ? [] : require('babel-plugin-remove-dead-code').default) + }; +}; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/options.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/options.js.map new file mode 100644 index 000000000..f8c466232 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/options.js.map @@ -0,0 +1 @@ +{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":";;AACA,qCAA2C;AAgB9B,QAAA,gBAAgB,GAAY,EAAS,CAAA;AAErC,QAAA,mBAAmB,GAAG,CAAC,OAAgB,EAAE,EAAE;IACtD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE;QACzB,IAAI,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YAC/B,wBAAgB,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;SACrC;KACF;AACH,CAAC,CAAA;AAEY,QAAA,0BAA0B,GAA2B,GAAG,EAAE;IACrE,OAAO;QACL,UAAU,EAAE;YACV,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE;gBACP,iBAAiB;gBACjB,KAAK;gBACL,MAAM;gBACN,aAAa;gBACb,wBAAwB;gBACxB,gBAAgB;gBAChB,wBAAwB;gBACxB,iBAAiB;gBACjB,kBAAkB;gBAClB,YAAY;gBACZ,eAAe;aACP;SACX;QACD,OAAO,EAAE;YACP,OAAO,CAAC,yCAAyC,CAAC;YAClD,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC,OAAO,EAAE,wBAAgB,CAAC,GAAG,CAAC;SACzE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,OAAO,IAAI,wBAAgB,CAAC,QAAQ,IAAI,wBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,yBAAgB,CAAC;aACxH,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC,OAAO,CAAC;KACnG,CAAA;AACH,CAAC,CAAA"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins.js new file mode 100644 index 000000000..c1fa59f43 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const t = require("babel-types"); +function isString(node) { + return t.isLiteral(node) && typeof node.value === 'string'; +} +function buildBinaryExpression(left, right) { + return t.binaryExpression('+', left, right); +} +function templateLiterals(path, state) { + let nodes = []; + const expressions = path.get('expressions'); + for (const elem of (path.node.quasis)) { + nodes.push(t.stringLiteral(elem.value.cooked)); + const expr = expressions.shift(); + if (expr) { + // tslint:disable-next-line:no-multi-spaces + if (state.opts.spec && !expr.isBaseType('string') && !expr.isBaseType('number')) { + nodes.push(t.callExpression(t.identifier('String'), [expr.node])); + } + else { + nodes.push(expr.node); + } + } + } + // filter out empty string literals + nodes = nodes.filter((n) => !t.isLiteral(n, { value: '' })); + // since `+` is left-to-right associative + // ensure the first node is a string if first/second isn't + if (!isString(nodes[0]) && !isString(nodes[1])) { + nodes.unshift(t.stringLiteral('')); + } + if (nodes.length > 1) { + let root = buildBinaryExpression(nodes.shift(), nodes.shift()); + for (const node of nodes) { + root = buildBinaryExpression(root, node); + } + path.replaceWith(root); + } + else { + path.replaceWith(nodes[0]); + } +} +exports.templateLiterals = templateLiterals; +//# sourceMappingURL=plugins.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins.js.map new file mode 100644 index 000000000..898d70b7a --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/plugins.ts"],"names":[],"mappings":";;AAAA,iCAAgC;AAEhC,SAAS,QAAQ,CAAE,IAAI;IACrB,OAAO,CAAC,CAAC,SAAS,CAAC,IAAW,CAAC,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAA;AACnE,CAAC;AAED,SAAS,qBAAqB,CAAE,IAAI,EAAE,KAAK;IACzC,OAAO,CAAC,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;AAC7C,CAAC;AACD,SAAgB,gBAAgB,CAAE,IAAI,EAAE,KAAK;IAE3C,IAAI,KAAK,GAAkB,EAAE,CAAA;IAE7B,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IAE3C,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QACrC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;QAE9C,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,CAAA;QAChC,IAAI,IAAI,EAAE;YACR,2CAA2C;YAC3C,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAG;gBAChF,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;aAClE;iBAAM;gBACL,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACtB;SACF;KACF;IAED,mCAAmC;IACnC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IAE3D,yCAAyC;IACzC,0DAA0D;IAC1D,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;QAC9C,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAA;KACnC;IAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,IAAI,IAAI,GAAG,qBAAqB,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;QAE9D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,IAAI,GAAG,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SACzC;QAED,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;KACvB;SAAM;QACL,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;KAC3B;AACH,CAAC;AAxCD,4CAwCC"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins/remove-dead-code.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins/remove-dead-code.js new file mode 100644 index 000000000..d108edecf --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins/remove-dead-code.js @@ -0,0 +1,1137 @@ +/* eslint-disable */ +// 修改自: https://github.com/babel/minify/blob/master/packages/babel-plugin-minify-dead-code-elimination/src/index.js +// 主要更改了 `toStatements` 函数,remove if statement 发生在 render JSX 函数时不生成 block statement +const { some } = require("lodash"); +const { markEvalScopes, hasEval } = require("babel-helper-mark-eval-scopes"); +const evaluate = require("babel-helper-evaluate-path"); +function evaluateTruthy(path) { + const res = evaluate(path); + if (res.confident) + return !!res.value; +} +function prevSiblings(path) { + const parentPath = path.parentPath; + const siblings = []; + let key = parentPath.key; + while ((path = parentPath.getSibling(--key)).type) { + siblings.push(path); + } + return siblings; +} +function forEachAncestor(path, callback) { + while ((path = path.parentPath)) { + callback(path); + } +} +function containJSXElement(path) { + let matched = false; + path.traverse({ + JSXElement(p) { + matched = true; + p.stop(); + } + }); + return matched; +} +module.exports = ({ types: t, traverse }) => { + const removeOrVoid = require("babel-helper-remove-or-void")(t); + const shouldRevisit = Symbol("shouldRevisit"); + // this is used for tracking fn params that can be removed + // as traversal takes place from left and + // unused params can be removed only on the right + const markForRemoval = Symbol("markForRemoval"); + const main = { + // remove side effectless statement + ExpressionStatement(path) { + if (path.get("expression").isPure()) { + removeOrVoid(path); + } + }, + Function: { + // Let's take all the vars in a function that are not in the top level scope and hoist them + // with the first var declaration in the top-level scope. This transform in itself may + // not yield much returns (or even can be marginally harmful to size). However it's great + // for taking away statements from blocks that can be only expressions which the `simplify` + // plugin can turn into other things (e.g. if => conditional). + exit(path) { + // This hurts gzip size. + if (!this.optimizeRawSize) { + return; + } + const { node, scope } = path; + const seen = new Set(); + const declars = []; + const mutations = []; + for (const name in scope.bindings) { + const binding = scope.bindings[name]; + if (!binding.path.isVariableDeclarator()) { + continue; + } + const declarPath = binding.path.parentPath; + if (seen.has(declarPath)) { + continue; + } + seen.add(declarPath); + if (declarPath.parentPath.isForInStatement()) { + continue; + } + if (declarPath.parentPath.parentPath.isFunction()) { + continue; + } + if (!declarPath.node || !declarPath.node.declarations) { + continue; + } + const assignmentSequence = []; + for (const declar of declarPath.node.declarations) { + declars.push(declar); + if (declar.init) { + assignmentSequence.push(t.assignmentExpression("=", declar.id, declar.init)); + mutations.push(() => { + declar.init = null; + }); + } + } + if (assignmentSequence.length) { + mutations.push(() => declarPath.replaceWith(t.sequenceExpression(assignmentSequence))); + } + else { + mutations.push(() => removeOrVoid(declarPath)); + } + } + if (declars.length) { + mutations.forEach(f => f()); + for (const statement of node.body.body) { + if (t.isVariableDeclaration(statement)) { + statement.declarations.push(...declars); + return; + } + } + const varDecl = t.variableDeclaration("var", declars); + node.body.body.unshift(varDecl); + } + } + }, + // Remove bindings with no references. + Scope: { + exit(path) { + if (path.node[shouldRevisit]) { + delete path.node[shouldRevisit]; + path.visit(); + } + }, + enter(path) { + if (path.isProgram()) { + return; + } + if (hasEval(path.scope)) { + return; + } + const { scope } = path; + // if the scope is created by a function, we obtain its + // parameter list + const canRemoveParams = path.isFunction() && path.node.kind !== "set"; + const paramsList = canRemoveParams ? path.get("params") : []; + for (let i = paramsList.length - 1; i >= 0; i--) { + const param = paramsList[i]; + if (param.isIdentifier()) { + const binding = scope.bindings[param.node.name]; + if (!binding) + continue; + if (binding.referenced) { + // when the first binding is referenced (right to left) + // exit without marking anything after this + break; + } + binding[markForRemoval] = true; + continue; + } + else if (param.isAssignmentPattern()) { + const left = param.get("left"); + const right = param.get("right"); + if (left.isIdentifier() && right.isPure()) { + const binding = scope.bindings[left.node.name]; + if (binding.referenced) { + // when the first binding is referenced (right to left) + // exit without marking anything after this + break; + } + binding[markForRemoval] = true; + continue; + } + } + // other patterns - assignment, object have side-effects + // and cannot be safely removed + break; + } + for (const name in scope.bindings) { + const binding = scope.bindings[name]; + if (!binding.referenced && binding.kind !== "module") { + if (binding.kind === "param" && + (this.keepFnArgs || !binding[markForRemoval])) { + continue; + } + else if (binding.path.isVariableDeclarator()) { + const declaration = binding.path.parentPath; + const maybeBlockParent = declaration.parentPath; + if (maybeBlockParent && + maybeBlockParent.isForXStatement({ + left: declaration.node + })) { + // Can't remove if in a for-in/for-of/for-await statement `for (var x in wat)`. + continue; + } + } + else if (!scope.isPure(binding.path.node)) { + // TODO: AssignmentPattern are marked as impure and unused ids aren't removed yet + continue; + } + else if (binding.path.isFunctionExpression() || + binding.path.isClassExpression()) { + // `bar(function foo() {})` foo is not referenced but it's used. + continue; + } + else if ( + // ClassDeclaration has binding in two scopes + // 1. The scope in which it is declared + // 2. The class's own scope + binding.path.isClassDeclaration() && + binding.path === scope.path) { + continue; + } + const mutations = []; + let bail = false; + // Make sure none of the assignments value is used + binding.constantViolations.forEach(p => { + if (bail || p === binding.path) { + return; + } + if (!p.parentPath.isExpressionStatement()) { + bail = true; + } + if (p.isAssignmentExpression()) { + if (t.isArrayPattern(p.node.left) || + t.isObjectPattern(p.node.left)) { + bail = true; + } + else if (p.get("right").isPure()) { + mutations.push(() => removeOrVoid(p)); + } + else { + mutations.push(() => p.replaceWith(p.get("right"))); + } + } + }); + if (bail) { + continue; + } + if (binding.path.isVariableDeclarator()) { + if (!binding.path.get("id").isIdentifier()) { + // deopt for object and array pattern + continue; + } + // if declarator has some impure init expression + // var x = foo(); + // => foo(); + if (binding.path.node.init && + !scope.isPure(binding.path.node.init) && + binding.path.parentPath.node.declarations) { + // binding path has more than one declarations + if (binding.path.parentPath.node.declarations.length !== 1) { + continue; + } + binding.path.parentPath.replaceWith(binding.path.node.init); + } + else { + updateReferences(binding.path, this); + removeOrVoid(binding.path); + } + } + else { + updateReferences(binding.path, this); + removeOrVoid(binding.path); + } + mutations.forEach(f => f()); + scope.removeBinding(name); + } + else if (binding.constant) { + if (binding.path.isFunctionDeclaration() || + (binding.path.isVariableDeclarator() && + binding.path.get("init").isFunction())) { + const fun = binding.path.isFunctionDeclaration() + ? binding.path + : binding.path.get("init"); + let allInside = true; + for (const ref of binding.referencePaths) { + if (!ref.find(p => p.node === fun.node)) { + allInside = false; + break; + } + } + if (allInside) { + scope.removeBinding(name); + updateReferences(binding.path, this); + removeOrVoid(binding.path); + continue; + } + } + if (binding.references === 1 && + binding.kind !== "param" && + binding.kind !== "module" && + binding.constant) { + let replacement = binding.path.node; + let replacementPath = binding.path; + let isReferencedBefore = false; + const refPath = binding.referencePaths[0]; + if (t.isVariableDeclarator(replacement)) { + const _prevSiblings = prevSiblings(replacementPath); + // traverse ancestors of a reference checking if it's before declaration + forEachAncestor(refPath, ancestor => { + if (_prevSiblings.indexOf(ancestor) > -1) { + isReferencedBefore = true; + } + }); + // deopt if reference is in different scope than binding + // since we don't know if it's sync or async execution + // (i.e. whether value has been assigned to a reference or not) + if (isReferencedBefore && refPath.scope !== binding.scope) { + continue; + } + // simulate hoisting by replacing value + // with undefined if declaration is after reference + replacement = isReferencedBefore + ? t.unaryExpression("void", t.numericLiteral(0), true) + : replacement.init; + // Bail out for ArrayPattern and ObjectPattern + // TODO: maybe a more intelligent approach instead of simply bailing out + if (!replacementPath.get("id").isIdentifier()) { + continue; + } + replacementPath = replacementPath.get("init"); + } + if (!replacement) { + continue; + } + if (!scope.isPure(replacement, true) && !isReferencedBefore) { + continue; + } + let bail = false; + if (replacementPath.isIdentifier()) { + const binding = scope.getBinding(replacement.name); + // the reference should be in the same scope + // and the replacement should be a constant - this is to + // ensure that the duplication of replacement is not affected + // https://github.com/babel/minify/issues/685 + bail = !(binding && + refPath.scope.getBinding(replacement.name) === binding && + binding.constantViolations.length === 0); + } + else { + replacementPath.traverse({ + Function(path) { + path.skip(); + }, + ReferencedIdentifier({ node }) { + if (bail) { + return; + } + const binding = scope.getBinding(node.name); + if (binding && + refPath.scope.getBinding(node.name) === binding) { + bail = binding.constantViolations.length > 0; + } + } + }); + } + if (bail) { + continue; + } + let parent = binding.path.parent; + if (t.isVariableDeclaration(parent)) { + parent = binding.path.parentPath.parent; + } + // 1. Make sure we share the parent with the node. In other words it's lexically defined + // and not in an if statement or otherwise. + // 2. If the replacement is an object then we have to make sure we are not in a loop or a function + // because otherwise we'll be inlining and doing a lot more allocation than we have to + // which would also could affect correctness in that they are not the same reference. + let mayLoop = false; + const sharesRoot = refPath.find(({ node }) => { + if (!mayLoop) { + mayLoop = + t.isWhileStatement(node) || + t.isFor(node) || + t.isFunction(node); + } + return node === parent; + }); + // Anything that inherits from Object. + const isObj = n => t.isFunction(n) || + t.isObjectExpression(n) || + t.isArrayExpression(n); + const isReplacementObj = isObj(replacement) || some(replacement, isObj); + if (!sharesRoot || (isReplacementObj && mayLoop)) { + continue; + } + // check if it's safe to replace + // To solve https://github.com/babel/minify/issues/691 + // Here we bail for property checks using the "in" operator + // This is because - `in` is a side-effect-free operation but the property + // could be deleted between the replacementPath and referencePath + // It is expensive to compute the delete operation and we bail for + // all the binary "in" operations + let inExpression = replacementPath.isBinaryExpression({ + operator: "in" + }); + if (!inExpression) { + replacementPath.traverse({ + Function(path) { + path.skip(); + }, + BinaryExpression(path) { + if (path.node.operator === "in") { + inExpression = true; + path.stop(); + } + } + }); + } + if (inExpression) { + continue; + } + const replaced = replace(binding.referencePaths[0], { + binding, + scope, + replacement, + replacementPath + }); + if (replaced) { + scope.removeBinding(name); + if (binding.path.node) { + removeOrVoid(binding.path); + } + } + } + } + } // end-for-of + } + }, + // Remove unreachable code. + BlockStatement(path) { + const paths = path.get("body"); + let purge = false; + for (let i = 0; i < paths.length; i++) { + const p = paths[i]; + if (!purge && p.isCompletionStatement()) { + purge = true; + continue; + } + if (purge && !canExistAfterCompletion(p)) { + removeOrVoid(p); + } + } + }, + // Double check unreachable code and remove return statements that + // have no semantic meaning + ReturnStatement(path) { + const { node } = path; + if (!path.inList) { + return; + } + // Not last in its block? (See BlockStatement visitor) + if (path.container.length - 1 !== path.key && + !canExistAfterCompletion(path.getSibling(path.key + 1)) && + path.parentPath.isBlockStatement()) { + // This is probably a new oppurtinity by some other transform + // let's call the block visitor on this again before proceeding. + path.parentPath.pushContext(path.context); + path.parentPath.visit(); + path.parentPath.popContext(); + return; + } + if (node.argument) { + return; + } + let noNext = true; + let parentPath = path.parentPath; + while (parentPath && !parentPath.isFunction() && noNext) { + // https://github.com/babel/minify/issues/265 + if (hasLoopParent(parentPath)) { + noNext = false; + break; + } + const nextPath = parentPath.getSibling(parentPath.key + 1); + if (nextPath.node) { + if (nextPath.isReturnStatement()) { + nextPath.pushContext(path.context); + nextPath.visit(); + nextPath.popContext(); + if (parentPath.getSibling(parentPath.key + 1).node) { + noNext = false; + break; + } + } + else { + noNext = false; + break; + } + } + parentPath = parentPath.parentPath; + } + if (noNext) { + removeOrVoid(path); + } + }, + ConditionalExpression(path) { + const { node } = path; + const evaluateTest = evaluateTruthy(path.get("test")); + if (evaluateTest === true) { + path.replaceWith(node.consequent); + } + else if (evaluateTest === false) { + path.replaceWith(node.alternate); + } + }, + SwitchStatement: { + exit(path) { + const discriminantPath = path.get("discriminant"); + const evaluated = evaluate(discriminantPath, { tdz: this.tdz }); + if (!evaluated.confident) + return; + // the simplify transformation might have brought in the previous + // expressions into the switch's test expression and instead of + // bailing out of impure path, we collect the impurities of it's + // a sequence expression and bail out if the primary test itself + // is impure + let beforeTest = []; + if (t.isSequenceExpression(discriminantPath.node)) { + const expressions = discriminantPath.get("expressions"); + const lastExpression = expressions[expressions.length - 1]; + if (!lastExpression.isPure()) { + return; + } + beforeTest = [ + t.expressionStatement(t.sequenceExpression(expressions + .slice(0, expressions.length - 1) + .map(path => path.node))) + ]; + } + else if (!discriminantPath.isPure()) { + return; + } + const discriminant = evaluated.value; + const cases = path.get("cases"); + let matchingCaseIndex = -1; + let defaultCaseIndex = -1; + for (let i = 0; i < cases.length; i++) { + const test = cases[i].get("test"); + // handle default case + if (test.node === null) { + defaultCaseIndex = i; + continue; + } + const testResult = evaluate(test, { + tdz: this.tdz + }); + // if we are not able to deternine a test during + // compile time, we terminate immediately + if (!testResult.confident) + return; + if (testResult.value === discriminant) { + matchingCaseIndex = i; + break; + } + } + let result; + if (matchingCaseIndex === -1) { + if (defaultCaseIndex === -1) { + path.skip(); + path.replaceWithMultiple(extractVars(path)); + return; + } + else { + result = getStatementsUntilBreak(defaultCaseIndex); + } + } + else { + result = getStatementsUntilBreak(matchingCaseIndex); + } + if (result.bail) + return; + // we extract vars from the entire switch statement + // and there will be duplicates which + // will be again removed by DCE + replaceSwitch([ + ...extractVars(path), + ...beforeTest, + ...result.statements + ]); + function getStatementsUntilBreak(start) { + const result = { bail: false, statements: [] }; + for (let i = start; i < cases.length; i++) { + const consequent = cases[i].get("consequent"); + for (let j = 0; j < consequent.length; j++) { + const _isBreaking = isBreaking(consequent[j], path); + if (_isBreaking.bail) { + result.bail = true; + return result; + } + if (_isBreaking.break) { + // compute no more + // exit out of the loop + return result; + } + else { + result.statements.push(consequent[j].node); + } + } + } + return result; + } + function replaceSwitch(statements) { + let isBlockRequired = false; + for (let i = 0; i < statements.length; i++) { + if (t.isVariableDeclaration(statements[i], { kind: "let" })) { + isBlockRequired = true; + break; + } + if (t.isVariableDeclaration(statements[i], { kind: "const" })) { + isBlockRequired = true; + break; + } + } + if (isBlockRequired) { + path.replaceWith(t.BlockStatement(statements)); + } + else { + path.replaceWithMultiple(statements); + } + } + } + }, + WhileStatement(path) { + const test = path.get("test"); + const result = evaluate(test, { tdz: this.tdz }); + if (result.confident && test.isPure() && !result.value) { + path.remove(); + } + }, + ForStatement(path) { + const test = path.get("test"); + if (!test.isPure()) + return; + const result = evaluate(test, { tdz: this.tdz }); + if (result.confident) { + if (result.value) { + test.remove(); + } + else { + const init = path.get("init"); + if (init.node && !init.isPure()) { + path.replaceWith(init); + } + else { + path.remove(); + } + } + } + }, + DoWhileStatement(path) { + const test = path.get("test"); + const result = evaluate(test, { tdz: this.tdz }); + if (result.confident && test.isPure() && !result.value) { + const body = path.get("body"); + if (body.isBlockStatement()) { + const stmts = body.get("body"); + for (const stmt of stmts) { + const _isBreaking = isBreaking(stmt, path); + if (_isBreaking.bail || _isBreaking.break) + return; + const _isContinuing = isContinuing(stmt, path); + if (_isContinuing.bail || isContinuing.continue) + return; + } + path.replaceWith(body.node); + } + else if (body.isBreakStatement()) { + const _isBreaking = isBreaking(body, path); + if (_isBreaking.bail) + return; + if (_isBreaking.break) + path.remove(); + } + else if (body.isContinueStatement()) { + return; + } + else { + path.replaceWith(body.node); + } + } + }, + // Join assignment and definition when in sequence. + // var x; x = 1; -> var x = 1; + AssignmentExpression(path) { + if (!path.get("left").isIdentifier() || + !path.parentPath.isExpressionStatement()) { + return; + } + const prev = path.parentPath.getSibling(path.parentPath.key - 1); + if (!(prev && prev.isVariableDeclaration())) { + return; + } + const declars = prev.node.declarations; + if (declars.length !== 1 || + declars[0].init || + declars[0].id.name !== path.get("left").node.name) { + return; + } + declars[0].init = path.node.right; + removeOrVoid(path); + }, + // Remove named function expression name. While this is dangerous as it changes + // `function.name` all minifiers do it and hence became a standard. + FunctionExpression(path) { + if (!this.keepFnName) { + removeUnreferencedId(path); + } + }, + // remove class names + ClassExpression(path) { + if (!this.keepClassName) { + removeUnreferencedId(path); + } + }, + // Put the `var` in the left if feasible. + ForInStatement(path) { + const left = path.get("left"); + if (!left.isIdentifier()) { + return; + } + const binding = path.scope.getBinding(left.node.name); + if (!binding) { + return; + } + if (binding.scope.getFunctionParent() !== path.scope.getFunctionParent()) { + return; + } + if (!binding.path.isVariableDeclarator()) { + return; + } + if (binding.path.parentPath.parentPath.isForInStatement({ + left: binding.path.parent + })) { + return; + } + // If it has company then it's probably more efficient to keep. + if (binding.path.parent.declarations.length > 1) { + return; + } + // meh + if (binding.path.node.init) { + return; + } + removeOrVoid(binding.path); + path.node.left = t.variableDeclaration("var", [ + t.variableDeclarator(left.node) + ]); + binding.path = path.get("left").get("declarations")[0]; + } + }; + return { + name: "minify-dead-code-elimination", + visitor: { + IfStatement: { + exit(path, { opts: { tdz = false } = {} }) { + const consequent = path.get("consequent"); + const alternate = path.get("alternate"); + const test = path.get("test"); + const evalResult = evaluate(test, { tdz }); + const isPure = test.isPure(); + const replacements = []; + const isRenderFunction = !!path.findParent(p => p.isClassMethod() && t.isIdentifier(p.node.key) && p.node.key.name.startsWith('render')) && containJSXElement(path); + if (evalResult.confident && !isPure && test.isSequenceExpression()) { + replacements.push(t.expressionStatement(extractSequenceImpure(test))); + } + // we can check if a test will be truthy 100% and if so then we can inline + // the consequent and completely ignore the alternate + // + // if (true) { foo; } -> { foo; } + // if ("foo") { foo; } -> { foo; } + // + if (evalResult.confident && evalResult.value) { + path.replaceWithMultiple([ + ...replacements, + ...toStatements(consequent, isRenderFunction), + ...extractVars(alternate) + ]); + return; + } + // we can check if a test will be falsy 100% and if so we can inline the + // alternate if there is one and completely remove the consequent + // + // if ("") { bar; } else { foo; } -> { foo; } + // if ("") { bar; } -> + // + if (evalResult.confident && !evalResult.value) { + if (alternate.node) { + path.replaceWithMultiple([ + ...replacements, + ...toStatements(alternate, isRenderFunction), + ...extractVars(consequent) + ]); + return; + } + else { + path.replaceWithMultiple([ + ...replacements, + ...extractVars(consequent) + ]); + } + } + // remove alternate blocks that are empty + // + // if (foo) { foo; } else {} -> if (foo) { foo; } + // + if (alternate.isBlockStatement() && !alternate.node.body.length) { + alternate.remove(); + // For if-statements babel-traverse replaces with an empty block + path.node.alternate = null; + } + // if the consequent block is empty turn alternate blocks into a consequent + // and flip the test + // + // if (foo) {} else { bar; } -> if (!foo) { bar; } + // + if (consequent.isBlockStatement() && + !consequent.node.body.length && + alternate.isBlockStatement() && + alternate.node.body.length) { + consequent.replaceWith(alternate.node); + alternate.remove(); + // For if-statements babel-traverse replaces with an empty block + path.node.alternate = null; + test.replaceWith(t.unaryExpression("!", test.node, true)); + } + } + }, + EmptyStatement(path) { + if (path.parentPath.isBlockStatement() || path.parentPath.isProgram()) { + path.remove(); + } + }, + Program: { + exit(path, { opts: { + // set defaults + optimizeRawSize = false, keepFnName = false, keepClassName = false, keepFnArgs = false, tdz = false } = {} } = {}) { + (traverse.clearCache || traverse.cache.clear)(); + path.scope.crawl(); + markEvalScopes(path); + // We need to run this plugin in isolation. + path.traverse(main, { + functionToBindings: new Map(), + optimizeRawSize, + keepFnName, + keepClassName, + keepFnArgs, + tdz + }); + } + } + } + }; + function toStatements(path, isRenderFunction) { + const { node } = path; + if (path.isBlockStatement()) { + if (isRenderFunction) { + return node.body; + } + let hasBlockScoped = false; + for (let i = 0; i < node.body.length; i++) { + const bodyNode = node.body[i]; + if (t.isBlockScoped(bodyNode)) { + hasBlockScoped = true; + } + } + if (!hasBlockScoped) { + return node.body; + } + } + return [node]; + } + // Extracts vars from a path + // Useful for removing blocks or paths that can contain + // variable declarations inside them + // Note: + // drops are inits + // extractVars({ var x = 5, y = x }) => var x, y; + function extractVars(path) { + const declarators = []; + if (path.isVariableDeclaration({ kind: "var" })) { + for (const decl of path.node.declarations) { + const bindingIds = Object.keys(t.getBindingIdentifiers(decl.id)); + declarators.push(...bindingIds.map(name => t.variableDeclarator(t.identifier(name)))); + } + } + else { + path.traverse({ + VariableDeclaration(varPath) { + if (!varPath.isVariableDeclaration({ kind: "var" })) + return; + if (!isSameFunctionScope(varPath, path)) + return; + for (const decl of varPath.node.declarations) { + const bindingIds = Object.keys(t.getBindingIdentifiers(decl.id)); + declarators.push(...bindingIds.map(name => t.variableDeclarator(t.identifier(name)))); + } + } + }); + } + if (declarators.length <= 0) + return []; + return [t.variableDeclaration("var", declarators)]; + } + function replace(path, options) { + const { replacement, replacementPath, scope, binding } = options; + // Same name, different binding. + if (scope.getBinding(path.node.name) !== binding) { + return; + } + // We don't want to move code around to different scopes because: + // 1. Original bindings that is referenced could be shadowed + // 2. Moving defintions to potentially hot code is bad + if (scope !== path.scope) { + if (t.isClass(replacement) || t.isFunction(replacement)) { + return; + } + let bail = false; + traverse(replacement, { + Function(path) { + if (bail) { + return; + } + bail = true; + path.stop(); + } + }, scope); + if (bail) { + return; + } + } + // Avoid recursion. + if (path.find(({ node }) => node === replacement)) { + return; + } + // https://github.com/babel/minify/issues/611 + // this is valid only for FunctionDeclaration where we convert + // function declaration to expression in the next step + if (replacementPath.isFunctionDeclaration()) { + const fnName = replacementPath.get("id").node.name; + for (let name in replacementPath.scope.bindings) { + if (name === fnName) { + return; + } + } + } + // https://github.com/babel/minify/issues/130 + if (!t.isExpression(replacement)) { + t.toExpression(replacement); + } + // We don't remove fn name here, we let the FnExpr & ClassExpr visitors + // check its references and remove unreferenced ones + // if (t.isFunction(replacement)) { + // replacement.id = null; + // } + path.replaceWith(replacement); + return true; + } + function updateReferences(fnToDeletePath) { + if (!fnToDeletePath.isFunction()) { + return; + } + fnToDeletePath.traverse({ + ReferencedIdentifier(path) { + const { node, scope } = path; + const binding = scope.getBinding(node.name); + if (!binding || + !binding.path.isFunction() || + binding.scope === scope || + !binding.constant) { + return; + } + const index = binding.referencePaths.indexOf(path); + if (index === -1) { + return; + } + binding.references--; + binding.referencePaths.splice(index, 1); + if (binding.references === 0) { + binding.referenced = false; + } + if (binding.references <= 1 && binding.scope.path.node) { + binding.scope.path.node[shouldRevisit] = true; + } + } + }); + } + function removeUnreferencedId(path) { + const id = path.get("id").node; + if (!id) { + return; + } + const { node, scope } = path; + const binding = scope.getBinding(id.name); + // Check if shadowed or is not referenced. + if (binding && (binding.path.node !== node || !binding.referenced)) { + node.id = null; + } + } + // path1 -> path2 + // is path1 an ancestor of path2 + function isAncestor(path1, path2) { + return !!path2.findParent(parent => parent === path1); + } + function isSameFunctionScope(path1, path2) { + return path1.scope.getFunctionParent() === path2.scope.getFunctionParent(); + } + function isBreaking(stmt, path) { + return isControlTransfer(stmt, path, "break"); + } + function isContinuing(stmt, path) { + return isControlTransfer(stmt, path, "continue"); + } + // tells if a "stmt" is a break/continue statement + function isControlTransfer(stmt, path, control = "break") { + const { [control]: type } = { + break: "BreakStatement", + continue: "ContinueStatement" + }; + if (!type) { + throw new Error("Can only handle break and continue statements"); + } + const checker = `is${type}`; + if (stmt[checker]()) { + return _isControlTransfer(stmt, path); + } + let isTransferred = false; + let result = { + [control]: false, + bail: false + }; + stmt.traverse({ + [type](cPath) { + // if we already detected a break/continue statement, + if (isTransferred) + return; + result = _isControlTransfer(cPath, path); + if (result.bail || result[control]) { + isTransferred = true; + } + } + }); + return result; + function _isControlTransfer(cPath, path) { + const label = cPath.get("label"); + if (label.node !== null) { + // labels are fn scoped and not accessible by inner functions + // path is the switch statement + if (!isSameFunctionScope(path, cPath)) { + // we don't have to worry about this break statement + return { + break: false, + bail: false + }; + } + // here we handle the break labels + // if they are outside switch, we bail out + // if they are within the case, we keep them + let labelPath; + if (path.scope.getLabel) { + labelPath = getLabel(label.node.name, path); + } + else { + labelPath = path.scope.getBinding(label.node.name).path; + } + const _isAncestor = isAncestor(labelPath, path); + return { + bail: _isAncestor, + [control]: _isAncestor + }; + } + // set the flag that it is indeed breaking + let isCTransfer = true; + // this flag is to capture + // switch(0) { case 0: while(1) if (x) break; } + let possibleRunTimeControlTransfer = false; + // and compute if it's breaking the correct thing + let parent = cPath.parentPath; + while (parent !== stmt.parentPath) { + // loops and nested switch cases + if (parent.isLoop() || parent.isSwitchCase()) { + // invalidate all the possible runtime breaks captured + // while (1) { if (x) break; } + possibleRunTimeControlTransfer = false; + // and set that it's not breaking our switch statement + isCTransfer = false; + break; + } + // + // this is a special case and depends on + // the fact that SwitchStatement is handled in the + // exit hook of the traverse + // + // switch (0) { + // case 0: if (x) break; + // } + // + // here `x` is runtime only. + // in this case, we need to bail out. So we depend on exit hook + // of switch so that, it would have visited the IfStatement first + // before the SwitchStatement and would have removed the + // IfStatement if it was a compile time determined + // + if (parent.isIfStatement()) { + possibleRunTimeControlTransfer = true; + } + parent = parent.parentPath; + } + return { + [control]: possibleRunTimeControlTransfer || isCTransfer, + bail: possibleRunTimeControlTransfer + }; + } + } + // things that are hoisted + function canExistAfterCompletion(path) { + return (path.isFunctionDeclaration() || + path.isVariableDeclaration({ kind: "var" })); + } + function getLabel(name, _path) { + let label, path = _path; + do { + label = path.scope.getLabel(name); + if (label) { + return label; + } + } while ((path = path.parentPath)); + return null; + } + function hasLoopParent(path) { + let parent = path; + do { + if (parent.isLoop()) { + return true; + } + } while ((parent = parent.parentPath)); + return false; + } + function extractSequenceImpure(seq) { + const expressions = seq.get("expressions"); + const result = []; + for (let i = 0; i < expressions.length; i++) { + if (!expressions[i].isPure()) { + result.push(expressions[i].node); + } + } + return t.sequenceExpression(result); + } +}; +//# sourceMappingURL=remove-dead-code.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins/remove-dead-code.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins/remove-dead-code.js.map new file mode 100644 index 000000000..3d9a44730 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/plugins/remove-dead-code.js.map @@ -0,0 +1 @@ +{"version":3,"file":"remove-dead-code.js","sourceRoot":"","sources":["../../../src/plugins/remove-dead-code.js"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,mHAAmH;AACnH,oFAAoF;AACpF,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAC7E,MAAM,QAAQ,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAEvD,SAAS,cAAc,CAAC,IAAI;IAC1B,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,GAAG,CAAC,SAAS;QAAE,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;AACxC,CAAC;AAGD,SAAS,YAAY,CAAC,IAAI;IACxB,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACnC,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB,IAAI,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;IAEzB,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE;QACjD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACrB;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,IAAI,EAAE,QAAQ;IACrC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE;QAC/B,QAAQ,CAAC,IAAI,C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G,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC3C,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC5B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aAClC;SACF;QACD,OAAO,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;AACH,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/render.js b/packages/mp-jsx-ts/_scripts/jsx2wxml/render.js new file mode 100644 index 000000000..25781234d --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/render.js @@ -0,0 +1,1530 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const babel_traverse_1 = require("babel-traverse"); +const t = require("babel-types"); +const babel_core_1 = require("babel-core"); +const utils_1 = require("./utils"); +const lodash_1 = require("lodash"); +const jsx_1 = require("./jsx"); +const constant_1 = require("./constant"); +const adapter_1 = require("./adapter"); +const options_1 = require("./options"); +const babel_generator_1 = require("babel-generator"); +const template = require('babel-template'); +function findParents(path, cb) { + const parents = []; + // tslint:disable-next-line:no-conditional-assignment + while (path = path.parentPath) { + if (cb(path)) { + parents.push(path); + } + } + return parents; +} +function isClassDcl(p) { + return p.isClassExpression() || p.isClassDeclaration(); +} +function isChildrenOfJSXAttr(p) { + return !!p.findParent(p => p.isJSXAttribute()); +} +function buildAssignState(pendingState) { + return t.expressionStatement(t.callExpression(t.memberExpression(t.identifier('Object'), t.identifier('assign')), [ + t.memberExpression(t.thisExpression(), t.identifier('state')), + pendingState + ])); +} +class RenderParser { + constructor(renderPath, methods, initState, referencedIdentifiers, usedState, loopStateName, customComponentNames, customComponentData, componentProperies, loopRefs) { + this.classProperties = new Set(); + this.templates = new Map(); + this.jsxDeclarations = new Set(); + this.loopScopes = new Set(); + this.returnedPaths = []; + this.usedThisState = new Set(); + this.loopComponents = new Map(); + this.loopRefIdentifiers = new Map(); + this.reserveStateWords = new Set(['state', 'props']); + this.topLevelIfStatement = new Set(); + this.usedEvents = new Set(); + this.loopCalleeId = new Set(); + this.usedThisProperties = new Set(); + this.incrementCalleeId = utils_1.incrementId(); + this.classComputedState = new Set(); + this.loopIfStemComponentMap = new Map(); + this.hasNoReturnLoopStem = false; + this.handleJSXElement = (jsxElementPath, func) => { + const parentNode = jsxElementPath.parent; + const parentPath = jsxElementPath.parentPath; + const isJSXChildren = t.isJSXElement(parentNode); + if (!isJSXChildren) { + let statementParent = jsxElementPath.getStatementParent(); + const isReturnStatement = statementParent.isReturnStatement(); + const isIfStemInLoop = this.isIfStemInLoop(jsxElementPath); + const isFinalReturn = statementParent.getFunctionParent().isClassMethod(); + if (!(statementParent.isVariableDeclaration() || + statementParent.isExpressionStatement())) { + statementParent = statementParent.findParent(s => s.isVariableDeclaration() || s.isExpressionStatement()); + } + if (t.isVariableDeclarator(parentNode)) { + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + // setTemplate(name, path, templates) + name && this.templates.set(name, jsxElementPath.node); + } + } + func({ parentNode, parentPath, statementParent, isReturnStatement, isFinalReturn, isIfStemInLoop }); + } + }; + this.isIfStemInLoop = (p) => { + const ifStem = p.findParent(p => p.isIfStatement()); + if (ifStem && ifStem.isIfStatement()) { + const loopStem = ifStem.findParent(p => p.isCallExpression()); + if (loopStem && utils_1.isArrayMapCallExpression(loopStem)) { + return true; + } + } + return false; + }; + this.isLiteralOrUndefined = (node) => t.isLiteral(node) || t.isIdentifier(node, { name: 'undefined' }); + this.replaceIdWithTemplate = (handleRefId = false) => (path) => { + if (!t.isJSXAttribute(path.parent)) { + path.traverse({ + Identifier: (path) => { + const parentPath = path.parentPath; + if (parentPath.isConditionalExpression() || + parentPath.isLogicalExpression() || + path.isReferencedIdentifier()) { + const name = path.node.name; + if (handleRefId && Object.keys(this.renderScope.getAllBindings()).includes(name)) { + this.addRefIdentifier(path, path.node); + // referencedIdentifiers.add(path.node) + } + if (this.templates.has(name)) { + path.replaceWith(this.templates.get(name)); + } + } + } + }); + } + }; + this.hasStateOrProps = (key) => (p) => t.isObjectProperty(p) && t.isIdentifier(p.key) && p.key.name === key; + this.loopComponentVisitor = { + VariableDeclarator: (path) => { + const id = path.get('id'); + const init = path.get('init'); + const parentPath = path.parentPath; + if (id.isObjectPattern() && + init.isThisExpression() && + parentPath.isVariableDeclaration()) { + const { properties } = id.node; + this.destructStateOrProps('state', path, properties, parentPath); + this.destructStateOrProps('props', path, properties, parentPath); + } + }, + JSXElement: { + enter: (jsxElementPath) => { + this.handleJSXElement(jsxElementPath, (options) => { + this.handleConditionExpr(options, jsxElementPath); + if (this.isIfStemInLoop(jsxElementPath)) { + this.handleJSXInIfStatement(jsxElementPath, options); + this.removeJSXStatement(); + } + }); + }, + exit: (jsxElementPath) => { + this.handleJSXElement(jsxElementPath, ({ parentNode, parentPath, statementParent, isFinalReturn }) => { + if (statementParent && statementParent.findParent(p => p === this.renderPath)) { + this.jsxDeclarations.add(statementParent); + } + if (t.isReturnStatement(parentNode)) { + if (!isFinalReturn) { + const callExpr = parentPath.findParent(p => p.isCallExpression()); + if (callExpr.isCallExpression()) { + const callee = callExpr.node.callee; + if (this.loopComponents.has(callExpr)) { + return; + } + if (t.isMemberExpression(callee) && + t.isIdentifier(callee.property) && + callee.property.name === 'map') { + let ary = callee.object; + if (t.isCallExpression(ary) || utils_1.isContainFunction(callExpr.get('callee').get('object'))) { + const variableName = `${constant_1.LOOP_CALLEE}_${this.incrementCalleeId()}`; + callExpr.getStatementParent().insertBefore(utils_1.buildConstVariableDeclaration(variableName, utils_1.setParentCondition(jsxElementPath, ary, true))); + ary = t.identifier(variableName); + } + if (t.isMemberExpression(ary)) { + const id = utils_1.findFirstIdentifierFromMemberExpression(ary); + if (t.isIdentifier(id)) { + this.referencedIdentifiers.add(id); + } + } + else if (t.isIdentifier(ary)) { + const parentCallExpr = callExpr.find(p => p.isCallExpression()); + if (!utils_1.isArrayMapCallExpression(parentCallExpr) && parentCallExpr !== callExpr) { + this.referencedIdentifiers.add(ary); + } + } + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.for, t.jSXExpressionContainer(ary)); + this.loopCalleeId.add(utils_1.findFirstIdentifierFromMemberExpression(callee)); + const [func] = callExpr.node.arguments; + if (t.isFunctionExpression(func) || + t.isArrowFunctionExpression(func)) { + const [item, index] = func.params; + if (t.isIdentifier(item)) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.forItem, t.stringLiteral(item.name)); + this.loopScopes.add(item.name); + } + else if (t.isObjectPattern(item)) { + throw utils_1.codeFrameError(item.loc, 'JSX map 循环参数暂时不支持使用 Object pattern 解构。'); + } + else { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.forItem, t.stringLiteral('__item')); + } + if (t.isIdentifier(index)) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.forIndex, t.stringLiteral(index.name)); + this.loopScopes.add(index.name); + } + else if (index === undefined) { + if (process.env.NODE_ENV !== 'test') { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.forIndex, t.stringLiteral(this.renderScope.generateUid('anonIdx'))); + } + } + else { + throw utils_1.codeFrameError(index, '包含 JSX 的 map 循环第二个参数只能是一个普通标识符'); + } + this.loopComponents.set(callExpr, jsxElementPath); + // caller.replaceWith(jsxElementPath.node) + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + // setTemplate(name, path, templates) + name && this.templates.set(name, jsxElementPath.node); + } + } + } + } + } + } + else if (t.isArrowFunctionExpression(parentNode)) { + parentPath.replaceWith(t.arrowFunctionExpression(parentNode.params, t.blockStatement([ + t.returnStatement(jsxElementPath.node) + ]))); + } + }); + } + } + }; + this.renameIfScopeVaribale = (blockStatement) => { + return { + VariableDeclarator: (p) => { + const { id, init } = p.node; + const ifStem = p.parentPath.parentPath.parentPath; + if (!ifStem.isIfStatement() || utils_1.isContainJSXElement(p)) { + return; + } + if (t.isIdentifier(id)) { + if (id.name.startsWith('loopArray') || id.name.startsWith(constant_1.LOOP_CALLEE)) { + this.renderPath.node.body.body.unshift(t.variableDeclaration('let', [t.variableDeclarator(t.identifier(id.name))])); + p.parentPath.replaceWith(template('ID = INIT;')({ ID: t.identifier(id.name), INIT: init })); + } + else { + const newId = this.renderScope.generateDeclaredUidIdentifier('$' + id.name); + blockStatement.scope.rename(id.name, newId.name); + p.parentPath.replaceWith(template('ID = INIT;')({ ID: newId, INIT: init || t.identifier('undefined') })); + } + } + }, + JSXElement: (jsxElementPath) => { + this.handleJSXElement(jsxElementPath, (options) => { + this.handleConditionExpr(options, jsxElementPath); + }); + }, + JSXExpressionContainer: this.replaceIdWithTemplate(true) + }; + }; + this.findParallelIfStem = (p) => { + const exprs = new Set(); + let expr = p.parentPath; + while (expr.isIfStatement()) { + exprs.add(expr); + expr = expr.parentPath; + } + return exprs; + }; + this.handleNestedIfStatement = (block, jsx, test, hasNest) => { + if (this.isEmptyBlock(block)) { + return; + } + for (const child of block.children) { + if (!t.isJSXElement(child)) { + continue; + } + const ifAttr = child.openingElement.attributes.find(a => a.name.name === adapter_1.Adapter.if); + const ifElseAttr = child.openingElement.attributes.find(a => a.name.name === adapter_1.Adapter.elseif); + if ((ifAttr && t.isJSXExpressionContainer(ifAttr.value, { expression: test })) + || + (ifElseAttr && t.isJSXExpressionContainer(ifElseAttr.value, { expression: test }))) { + child.children.push(jsx); + hasNest = true; + break; + } + else { + this.handleNestedIfStatement(child, jsx, test, hasNest); + } + } + }; + this.isEmptyBlock = ((block) => block.children.length === 0 && block.openingElement.attributes.length === 0); + this.jsxElementVisitor = { + JSXElement: (jsxElementPath) => { + this.handleJSXElement(jsxElementPath, (options) => { + this.handleConditionExpr(options, jsxElementPath); + this.handleJSXInIfStatement(jsxElementPath, options); + }); + // handle jsx attrs + jsxElementPath.traverse(this.jsxAttrVisitor); + } + }; + this.jsxAttrVisitor = { + JSXExpressionContainer: (path) => { + if (!isChildrenOfJSXAttr(path)) { + return; + } + const expression = path.get('expression'); + if (expression.isStringLiteral()) { + path.replaceWith(expression); + } + else if (expression.isCallExpression()) { + const node = expression.node; + if (t.isMemberExpression(node.callee) && + t.isIdentifier(node.callee.property) && + node.callee.property.name === 'bind') { + const JSXElement = path.findParent(p => p.isJSXElement()) + .node; + // const JSXAttribute = path.findParent(p => p.isJSXAttribute()) + let bindCalleeName = null; + if (t.isIdentifier(node.callee.object)) { + bindCalleeName = node.callee.object.name; + } + else if (t.isMemberExpression(node.callee.object)) { + if (t.isIdentifier(node.callee.object.property)) { + bindCalleeName = node.callee.object.property.name; + } + } + if (bindCalleeName !== null) { + const attr = path.parentPath.node; + let bindEventName = attr.name.name; + bindEventName = bindEventName.replace(/^bind|^catch/, ''); + const args = expression.get('arguments'); + args.forEach((arg, index) => { + const node = arg.node; + const argName = babel_generator_1.default(node).code; + if (index === 0) { + jsx_1.setJSXAttr(JSXElement, `data-e-${bindEventName}-so`, t.stringLiteral(argName)); + } + else { + let expr = null; + if (t.isIdentifier(node) && path.scope.hasBinding(argName)) { + this.addRefIdentifier(path, node); + expr = t.jSXExpressionContainer(node); + } + else if (t.isMemberExpression(node)) { + const id = utils_1.findFirstIdentifierFromMemberExpression(node); + this.addRefIdentifier(path, id); + expr = t.jSXExpressionContainer(node); + } + else if (node.type === 'NumericLiteral' || t.isStringLiteral(node) || t.isBooleanLiteral(node) || t.isNullLiteral(node)) { + expr = t.jSXExpressionContainer(node); + } + else if (utils_1.hasComplexExpression(arg)) { + const isCookedLoop = JSXElement.openingElement.attributes.some(attr => attr.name.name === adapter_1.Adapter.for); + if (isCookedLoop) { + throw utils_1.codeFrameError(arg.node, '在循环中使用 bind 时,需要声明将此复杂表达式声明为一个变量再放入 bind 参数中。'); + } + else { + const id = utils_1.generateAnonymousState(this.renderScope, arg, this.referencedIdentifiers); + expr = t.jSXExpressionContainer(id); + } + } + else { + expr = t.jSXExpressionContainer(t.identifier(argName)); + } + jsx_1.setJSXAttr(JSXElement, `data-e-${bindEventName}-a-${utils_1.toLetters(index)}`, expr); + } + }); + expression.replaceWith(t.stringLiteral(`${bindCalleeName}`)); + } + } + } + }, + JSXAttribute: (path) => { + const { name, value } = path.node; + let eventShouldBeCatched = false; + const jsxElementPath = path.parentPath.parentPath; + if (t.isJSXIdentifier(name) && jsxElementPath.isJSXElement()) { + const componentName = jsxElementPath.node.openingElement.name.name; + const isThirdPartyKey = name.name === 'taroKey'; + if (name.name === 'key' || isThirdPartyKey) { + if (constant_1.THIRD_PARTY_COMPONENTS.has(componentName) && !isThirdPartyKey) { + return; + } + const jsx = path.findParent(p => p.isJSXElement()); + const loopBlock = jsx.findParent(p => { + if (p.isJSXElement()) { + const element = p.get('openingElement'); + if (element.get('name').isJSXIdentifier({ name: 'block' })) { + const attrs = element.node.attributes; + const hasWXForLoop = attrs.some(attr => t.isJSXIdentifier(attr.name, { name: adapter_1.Adapter.for })); + const hasWXKey = attrs.some(attr => t.isJSXIdentifier(attr.name, { name: adapter_1.Adapter.key })); + return hasWXForLoop && !hasWXKey; + } + } + return false; + }); + if (loopBlock) { + jsx_1.setJSXAttr(loopBlock.node, adapter_1.Adapter.key, value); + path.remove(); + } + else { + path.get('name').replaceWith(t.jSXIdentifier(adapter_1.Adapter.key)); + } + } + else if (name.name.startsWith('on')) { + if (t.isJSXExpressionContainer(value)) { + const methodName = utils_1.findMethodName(value.expression); + methodName && this.usedEvents.add(methodName); + const method = this.methods.get(methodName); + const classDecl = path.findParent(p => p.isClassDeclaration()); + const componentName = jsxElementPath.node.openingElement.name; + // if (method && t.isIdentifier(method.node.key)) { + // this.usedEvents.add(methodName) + // } else if (method === null) { + // this.usedEvents.add(methodName) + // } + if (!babel_generator_1.default(value.expression).code.includes('.bind')) { + path.node.value = t.stringLiteral(`${methodName}`); + } + if (this.methods.has(methodName)) { + eventShouldBeCatched = utils_1.isContainStopPropagation(method); + } + if (classDecl && classDecl.isClassDeclaration()) { + const superClass = utils_1.getSuperClassCode(classDecl); + if (superClass) { + try { + const ast = babel_core_1.transform(superClass.code, options_1.buildBabelTransformOptions()).ast; + babel_traverse_1.default(ast, { + ClassMethod(p) { + if (!p.get('key').isIdentifier({ name: methodName })) { + return; + } + eventShouldBeCatched = utils_1.isContainStopPropagation(method); + }, + ClassProperty(p) { + if (!p.get('key').isIdentifier({ name: methodName })) { + return; + } + eventShouldBeCatched = utils_1.isContainStopPropagation(method); + } + }); + } + catch (error) { + // + } + } + } + if (t.isJSXIdentifier(componentName) && !constant_1.DEFAULT_Component_SET.has(componentName.name)) { + const element = path.parent; + if (process.env.NODE_ENV !== 'test' && adapter_1.Adapter.type !== "alipay" /* alipay */) { + const fnName = `__fn_${name.name}`; + element.attributes = element.attributes.concat([t.jSXAttribute(t.jSXIdentifier(fnName))]); + } + } + } + if (t.isJSXIdentifier(jsxElementPath.node.openingElement.name)) { + const componentName = jsxElementPath.node.openingElement.name.name; + if (adapter_1.Adapter.type === "alipay" /* alipay */) { + let transformName = name.name; + if (constant_1.DEFAULT_Component_SET.has(componentName) && constant_1.ALIPAY_BUBBLE_EVENTS.has(name.name)) { + if (name.name === 'onClick') { + transformName = eventShouldBeCatched ? 'catchTap' : 'onTap'; + } + else { + transformName = `${eventShouldBeCatched ? 'catch' : 'on'}${name.name.slice(2)}`; + } + } + path.node.name = t.jSXIdentifier(transformName); + } + else if (constant_1.DEFAULT_Component_SET.has(componentName)) { + let transformName = `${eventShouldBeCatched ? 'catch' : 'bind'}` + + name.name.slice(2).toLowerCase(); + if (name.name === 'onClick') { + transformName = eventShouldBeCatched ? 'catchtap' : 'bindtap'; + } + path.node.name = t.jSXIdentifier(transformName); + } + else if (constant_1.THIRD_PARTY_COMPONENTS.has(componentName)) { + path.node.name = t.jSXIdentifier('bind' + name.name[2].toLowerCase() + name.name.slice(3)); + } + else { + path.node.name = t.jSXIdentifier('bind' + name.name.toLowerCase()); + } + } + // let transformName = `${eventShouldBeCatched ? 'catch' : 'bind'}` + name.name.slice(2, name.name.length) + // transformName = eventShouldBeCatched + // ? CATCH_EVENT_MAP.get(name.name)! + // : BIND_EVENT_MAP.get(name.name)! + } + else if (/^render[A-Z]/.test(name.name) && !constant_1.DEFAULT_Component_SET.has(componentName)) { + if (!t.isJSXExpressionContainer(value)) { + throw utils_1.codeFrameError(value, '以 render 开头的 props 只能传入包含一个 JSX 元素的 JSX 表达式。'); + } + const expression = value.expression; + if (!t.isJSXElement(expression)) { + throw utils_1.codeFrameError(value, '以 render 开头的 props 只能传入包含一个 JSX 元素的 JSX 表达式。'); + } + const slotName = utils_1.getSlotName(name.name); + const slot = lodash_1.cloneDeep(expression); + jsx_1.setJSXAttr(slot, 'slot', t.stringLiteral(slotName)); + jsxElementPath.node.children.push(slot); + path.remove(); + } + } + }, + Identifier: (path) => { + if (!isChildrenOfJSXAttr(path)) { + return; + } + if (!path.isReferencedIdentifier()) { + return; + } + const parentPath = path.parentPath; + if (parentPath.isConditionalExpression() || + parentPath.isLogicalExpression() || + parentPath.isJSXExpressionContainer() || + parentPath.isBinaryExpression() || + this.renderScope.hasOwnBinding(path.node.name)) { + this.addRefIdentifier(path, path.node); + } + }, + MemberExpression: { + exit: (path) => { + const { object, property } = path.node; + if (!path.isReferencedMemberExpression()) { + return; + } + if (!t.isThisExpression(object)) { + return; + } + const reserves = new Set([ + 'state', + 'props', + ...this.methods.keys() + ]); + if (t.isIdentifier(property) || t.isMemberExpression(property)) { + const id = t.isIdentifier(property) ? property : utils_1.findFirstIdentifierFromMemberExpression(property); + if (reserves.has(id.name)) { + return; + } + const jsxAttr = path.findParent(p => p.isJSXAttribute()); + if (jsxAttr && t.isJSXIdentifier(jsxAttr.node.name) && jsxAttr.node.name.name.startsWith('on')) { + return; + } + if (t.isIdentifier(id)) { + this.referencedIdentifiers.add(id); + this.usedThisProperties.add(id.name); + } + } + }, + enter: (path) => { + if (!isChildrenOfJSXAttr(path)) { + return; + } + if (!path.isReferencedMemberExpression() || path.parentPath.isMemberExpression()) { + return; + } + const { object, property } = path.node; + if (t.isMemberExpression(object) && + t.isThisExpression(object.object) && + t.isIdentifier(object.property, { name: 'state' })) { + if (t.isIdentifier(property)) { + this.usedThisState.add(property.name); + } + else if (t.isMemberExpression(property)) { + const id = utils_1.findFirstIdentifierFromMemberExpression(property); + if (id && this.renderScope.hasBinding(id.name)) { + this.usedThisState.add(id.name); + } + } + return; + } + const code = babel_generator_1.default(path.node).code; + if (code.includes('this.$router.params') && t.isIdentifier(property)) { + const name = this.renderScope.generateUid(property.name); + const dcl = utils_1.buildConstVariableDeclaration(name, path.node); + this.renderPath.node.body.body.unshift(dcl); + path.replaceWith(t.identifier(name)); + } + const parentPath = path.parentPath; + const id = utils_1.findFirstIdentifierFromMemberExpression(path.node); + if (t.isThisExpression(id)) { + return; + } + if (parentPath.isConditionalExpression() || + parentPath.isLogicalExpression() || + parentPath.isJSXExpressionContainer() || + parentPath.isBinaryExpression() || + (this.renderScope.hasOwnBinding(id.name))) { + this.addRefIdentifier(path, id); + } + } + }, + ArrowFunctionExpression: (path) => { + if (!isChildrenOfJSXAttr(path)) { + return; + } + const uid = path.scope.generateUid('_anonymous_function_'); + const c = t.classProperty(t.identifier(uid), path.node); + this.classProperties.add(c); + } + }; + this.visitors = Object.assign({ VariableDeclarator: (path) => { + const init = path.get('init'); + const id = path.get('id'); + const ifStem = init.findParent(p => p.isIfStatement()); + if (ifStem && init.node === null) { + init.replaceWith(t.identifier('undefined')); + } + let isDerivedFromState = false; + if (init.isMemberExpression()) { + const object = init.get('object'); + if (object.isMemberExpression() && object.get('object').isThisExpression() && object.get('property').isIdentifier({ name: 'state' })) { + isDerivedFromState = true; + } + if (object.isThisExpression() && init.get('property').isIdentifier({ name: 'state' })) { + isDerivedFromState = true; + } + } + if (!isDerivedFromState) { + const errMsg = 'Warning: render 函数定义一个不从 this.state 解构或赋值而来的变量,此变量又与 this.state 下的变量重名可能会导致无法渲染。'; + if (id.isIdentifier()) { + const name = id.node.name; + if (this.initState.has(name)) { + // tslint:disable-next-line + console.log(utils_1.codeFrameError(id.node, errMsg).message); + } + } + if (id.isObjectPattern()) { + const { properties } = id.node; + for (const p of properties) { + if (t.isIdentifier(p)) { + if (this.initState.has(p.name)) { + // tslint:disable-next-line + console.log(utils_1.codeFrameError(id.node, errMsg).message); + } + } + if (t.isSpreadProperty(p) && t.isIdentifier(p.argument)) { + if (this.initState.has(p.argument.name)) { + // tslint:disable-next-line + console.log(utils_1.codeFrameError(id.node, errMsg).message); + } + } + } + } + } + }, JSXEmptyExpression(path) { + const parent = path.parentPath; + if (path.parentPath.isJSXExpressionContainer()) { + parent.remove(); + } + }, + NullLiteral(path) { + const statementParent = path.getStatementParent(); + if (statementParent && statementParent.isReturnStatement() && !t.isBinaryExpression(path.parent) && !isChildrenOfJSXAttr(path)) { + path.replaceWith(t.jSXElement(t.jSXOpeningElement(t.jSXIdentifier('view'), []), undefined, [], true)); + } + }, ReturnStatement: (path) => { + const parentPath = path.parentPath; + if (parentPath.parentPath.isClassMethod() || + (parentPath.parentPath.isIfStatement() && parentPath.parentPath.parentPath.isClassMethod())) { + this.replaceIdWithTemplate()(path); + } + } }, this.jsxElementVisitor, { JSXExpressionContainer: this.replaceIdWithTemplate(true) }); + /** + * jsxDeclarations, + * renderScope, + * methods, + * loopScopes, + * initState, + * templates + */ + this.handleLoopComponents = () => { + const loopArrayId = utils_1.incrementId(); + const replaceQueue = []; + let hasLoopRef = false; + this.loopComponents.forEach((component, callee) => { + if (!callee.isCallExpression()) { + return; + } + if (this.loopIfStemComponentMap.has(callee)) { + const block = this.loopIfStemComponentMap.get(callee); + const attrs = component.node.openingElement.attributes; + const wxForDirectives = new Set([adapter_1.Adapter.for, adapter_1.Adapter.forIndex, adapter_1.Adapter.forItem]); + const ifAttrs = attrs.filter(a => wxForDirectives.has(a.name.name)); + if (ifAttrs.length) { + block.openingElement.attributes.push(...ifAttrs); + component.node.openingElement.attributes = attrs.filter(a => !wxForDirectives.has(a.name.name)); + } + jsx_1.setJSXAttr(component.node, adapter_1.Adapter.else); + block.children.push(component.node); + component.replaceWith(block); + } + for (const dcl of this.jsxDeclarations) { + const isChildren = dcl && dcl.findParent(d => d === callee); + if (isChildren) { + this.jsxDeclarations.delete(dcl); + dcl.remove(); + } + } + const blockStatementPath = component.findParent(p => p.isBlockStatement()); + const body = blockStatementPath.node.body; + let loopRefComponent; + this.loopRefs.forEach((ref, jsx) => { + if (ref.component.findParent(p => p === component)) { + loopRefComponent = jsx; + } + }); + if (this.loopRefs.has(component.node) || loopRefComponent) { + hasLoopRef = true; + const ref = this.loopRefs.get(component.node) || this.loopRefs.get(loopRefComponent); + const [func] = callee.node.arguments; + let indexId = null; + if (t.isFunctionExpression(func) || t.isArrowFunctionExpression(func)) { + const params = func.params; + indexId = params[1]; + } + if (indexId === null || !t.isIdentifier(indexId)) { + throw utils_1.codeFrameError(component.node, '在循环中使用 ref 必须暴露循环的第二个参数 `index`'); + } + const id = typeof ref.id === 'string' ? t.binaryExpression('+', t.stringLiteral(ref.id), indexId) : ref.id; + const refDeclName = '__ref'; + const args = [ + t.identifier('__scope'), + t.binaryExpression('+', t.stringLiteral('#'), id) + ]; + if (ref.type === 'component') { + args.push(t.stringLiteral('component')); + } + const callGetElementById = t.callExpression(t.identifier(constant_1.GEL_ELEMENT_BY_ID), args); + const refDecl = utils_1.buildConstVariableDeclaration(refDeclName, process.env.NODE_ENV === 'test' ? callGetElementById : t.logicalExpression('&&', t.identifier('__scope'), t.logicalExpression('&&', t.identifier('__runloopRef'), callGetElementById))); + const callRef = t.callExpression(ref.fn, [t.identifier(refDeclName)]); + const callRefFunc = t.expressionStatement(process.env.NODE_ENV === 'test' ? callRef : t.logicalExpression('&&', t.identifier(refDeclName), callRef)); + body.push(refDecl, callRefFunc); + } + let stateToBeAssign = new Set(lodash_1.difference(Object.keys(blockStatementPath.scope.getAllBindings()), Object.keys(this.renderScope.getAllBindings())).filter(i => { + return !this.methods.has(i); + }) + .filter(i => !this.loopScopes.has(i)) + .filter(i => !this.initState.has(i)) + .filter(i => !this.templates.has(i)) + .filter(i => !i.includes('.')) + .filter(i => i !== constant_1.MAP_CALL_ITERATOR)); + if (body.length > 1) { + const [func] = callee.node.arguments; + if (t.isFunctionExpression(func) || t.isArrowFunctionExpression(func)) { + const [item, indexParam] = func.params; + const parents = findParents(callee, (p) => utils_1.isArrayMapCallExpression(p)); + const iterators = new Set([item.name, ...parents + .map((p) => lodash_1.get(p, 'node.arguments[0].params[0].name', '')) + .filter(Boolean)]); + for (const [index, statement] of body.entries()) { + if (t.isVariableDeclaration(statement)) { + for (const dcl of statement.declarations) { + if (t.isIdentifier(dcl.id)) { + const name = dcl.id.name; + if (name.startsWith(constant_1.LOOP_STATE) || + name.startsWith(constant_1.LOOP_CALLEE)) { + stateToBeAssign.add(name); + dcl.id = t.identifier(name); + } + } + } + } + if (t.isReturnStatement(statement)) { + body.splice(index, 1); + } + } + stateToBeAssign.forEach(s => this.loopRefIdentifiers.set(s, callee)); + const properties = Array.from(stateToBeAssign).map(state => t.objectProperty(t.identifier(state), t.identifier(state))); + // tslint:disable-next-line:no-inner-declarations + function replaceOriginal(path, parent, name) { + if (path.isReferencedIdentifier() && + iterators.has(name) && + !(t.isMemberExpression(parent) && t.isIdentifier(parent.property, { name: constant_1.LOOP_ORIGINAL })) && + !(t.isMemberExpression(parent) && t.isIdentifier(parent.property) && (parent.property.name.startsWith(constant_1.LOOP_STATE) || parent.property.name.startsWith(constant_1.LOOP_CALLEE)))) { + path.replaceWith(t.memberExpression(t.identifier(name), t.identifier(constant_1.LOOP_ORIGINAL))); + } + } + const bodyPath = callee.get('arguments')[0].get('body'); + bodyPath.traverse({ + Identifier(path) { + const name = path.node.name; + const parent = path.parent; + replaceOriginal(path, parent, name); + } + }); + const replacements = new Set(); + component.traverse({ + JSXAttribute: !t.isIdentifier(indexParam) ? utils_1.noop : (path) => { + const { value } = path.node; + if (t.isJSXExpressionContainer(value) && t.isIdentifier(value.expression, { name: indexParam.name })) { + if (process.env.TERM_PROGRAM) { // 无法找到 cli 名称的工具(例如 idea/webstorm)显示这个报错可能会乱码 + // tslint:disable-next-line:no-console + console.log(utils_1.codeFrameError(value.expression, '建议修改:使用循环的 index 变量作为 key 是一种反优化。参考:https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md').message); + } + } + }, + JSXExpressionContainer: this.replaceIdWithTemplate(), + Identifier: (path) => { + const name = path.node.name; + const parent = path.parent; + const parentCallExpr = path.findParent(p => p.isCallExpression()); + if (replacements.has(parent) || (this.renderScope.hasOwnBinding(name) && + (this.loopCalleeId.has(path.node) || parentCallExpr && this.loopCalleeId.has(parentCallExpr.node)))) { + return; + } + if (stateToBeAssign.has(name) && path.isReferencedIdentifier()) { + if (t.isMemberExpression(parent) && t.isIdentifier(parent.property, { name: 'map' })) { + const grandParentPath = path.parentPath.parentPath; + if (grandParentPath.isCallExpression() && this.loopComponents.has(grandParentPath)) { + return; + } + } + const replacement = t.memberExpression(t.identifier(item.name), path.node); + path.replaceWith(replacement); + replacements.add(replacement); + } + else { + replaceOriginal(path, parent, name); + } + }, + MemberExpression(path) { + const { object, property } = path.node; + if (t.isThisExpression(object) && t.isIdentifier(property, { name: 'state' })) { + if (path.parentPath.isMemberExpression() && path.parentPath.parentPath.isMemberExpression()) { + // tslint:disable-next-line + console.warn(utils_1.codeFrameError(path.parentPath.parentPath.node, `在循环中使用 this.state.xx.xx 可能会存在问题,请给 xx 起一个别名,例如 const { xx } = this.state`)); + } + } + } + }); + const originalProp = t.objectProperty(t.identifier(constant_1.LOOP_ORIGINAL), t.memberExpression(t.identifier(item.name), t.identifier(constant_1.LOOP_ORIGINAL))); + properties.push(originalProp); + body.unshift(t.expressionStatement(t.assignmentExpression('=', t.identifier(item.name), t.objectExpression([ + t.objectProperty(t.identifier(constant_1.LOOP_ORIGINAL), t.callExpression(t.identifier(constant_1.INTERNAL_GET_ORIGNAL), [t.identifier(item.name)])) + ])))); + const returnStatement = t.returnStatement(properties.length ? t.objectExpression(properties) : item); + const parentCallee = callee.findParent(c => utils_1.isArrayMapCallExpression(c)); + if (utils_1.isArrayMapCallExpression(parentCallee)) { + const [func] = parentCallee.node.arguments; + const { object } = callee.node.callee; + if (t.isFunctionExpression(func) || t.isArrowFunctionExpression(func)) { + const funcBody = func.body; + if (t.isBlockStatement(funcBody)) { + if (t.isIdentifier(object) || t.isMemberExpression(object)) { + const variableName = `${constant_1.LOOP_CALLEE}_${this.incrementCalleeId()}`; + funcBody.body.splice(funcBody.body.length - 1, 0, utils_1.buildConstVariableDeclaration(variableName, utils_1.setParentCondition(component, callee.node, true))); + const iterator = func.params[0]; + component.node.openingElement.attributes.forEach(attr => { + if (attr.name.name === adapter_1.Adapter.for && t.isIdentifier(iterator)) { + attr.value = t.jSXExpressionContainer(t.memberExpression(iterator, t.identifier(variableName))); + } + }); + } + else { + throw utils_1.codeFrameError(object.loc, '多层循环中循环的数组只能是一个变量或成员表达式'); + } + } + } + body.push(returnStatement); + } + else { + body.push(returnStatement); + const stateName = 'loopArray' + loopArrayId(); + this.loopStateName.forEach((newName, callExpr) => { + if (callExpr === callee) { + const classBody = this.renderPath.parent; + for (const property of classBody.body) { + if (t.isClassProperty(property) && property.key.name === '$dynamicComponents') { + const objects = property.value; + for (const objProp of objects.properties) { + if (t.isObjectProperty(objProp) && t.isIdentifier(objProp.key, { name: newName })) { + const func = objProp.value; + func.body.body[0] = utils_1.buildConstVariableDeclaration('stateName', t.stringLiteral(stateName)); + } + } + } + } + } + }); + // setJSXAttr(returned, Adapter.for, t.identifier(stateName)) + this.addRefIdentifier(callee, t.identifier(stateName)); + // this.referencedIdentifiers.add(t.identifier(stateName)) + jsx_1.setJSXAttr(component.node, adapter_1.Adapter.for, t.jSXExpressionContainer(t.identifier(stateName))); + const returnBody = this.renderPath.node.body.body; + const ifStem = callee.findParent(p => p.isIfStatement()); + // @TEST + if (ifStem && ifStem.isIfStatement()) { + const consequent = ifStem.get('consequent'); + if (consequent.isBlockStatement()) { + const assignment = t.expressionStatement(t.assignmentExpression('=', t.identifier(stateName), utils_1.setParentCondition(component, callee.node, true))); + returnBody.unshift(t.variableDeclaration('let', [t.variableDeclarator(t.identifier(stateName))])); + consequent.node.body.push(assignment); + } + } + else { + const decl = utils_1.buildConstVariableDeclaration(stateName, utils_1.setParentCondition(component, callee.node, true)); + returnBody.push(decl); + } + } + } + } + replaceQueue.push(() => { + const statement = component.getStatementParent(); + callee.replaceWith(statement.isReturnStatement() + ? statement.get('argument').node + : component.node); + }); + }); + if (hasLoopRef) { + const scopeDecl = template('const __scope = this.$scope')(); + this.renderPath.node.body.body.unshift(scopeDecl); + } + replaceQueue.forEach(func => func()); + }; + this.setReserveWord = (word) => { + const binding = this.renderScope.getOwnBinding(word); + let hasStateId = false; + if (binding) { + const path = binding.path; + const id = path.get('id'); + const init = path.get('init'); + if (init.isThisExpression()) { + return hasStateId; + } + if (id.isObjectPattern()) { + hasStateId = id.node.properties.some(p => { + return (t.isObjectProperty(p) && t.isIdentifier(p.key, { name: word })) + || (t.isRestProperty(p) && t.isIdentifier(p.argument, { name: word })); + }); + } + else if (id.isIdentifier({ name: word })) { + hasStateId = true; + } + if (hasStateId) { + this.referencedIdentifiers.add(t.identifier(word)); + } + } + if (hasStateId) { + this.reserveStateWords.delete(word); + } + }; + this.renderPath = renderPath; + this.methods = methods; + this.initState = initState; + this.referencedIdentifiers = referencedIdentifiers; + this.loopStateName = loopStateName; + this.usedState = usedState; + this.customComponentNames = customComponentNames; + this.customComponentData = customComponentData; + this.componentProperies = componentProperies; + this.loopRefs = loopRefs; + const renderBody = renderPath.get('body'); + this.renderScope = renderBody.scope; + const [, error] = renderPath.node.body.body.filter(s => t.isReturnStatement(s)); + if (error) { + throw utils_1.codeFrameError(error.loc, 'render 函数顶级作用域暂时只支持一个 return'); + } + renderBody.traverse(this.loopComponentVisitor); + if (this.hasNoReturnLoopStem) { + renderBody.traverse({ + JSXElement: this.loopComponentVisitor.JSXElement.exit[0] + }); + } + this.handleLoopComponents(); + renderBody.traverse(this.visitors); + this.setOutputTemplate(); + this.checkDuplicateName(); + this.removeJSXStatement(); + this.setUsedState(); + this.setPendingState(); + this.setCustomEvent(); + this.createData(); + this.setProperies(); + this.setLoopRefFlag(); + } + handleConditionExpr({ parentNode, parentPath, statementParent }, jsxElementPath) { + if (parentPath.isObjectProperty()) { + const value = parentPath.get('value'); + if (value !== jsxElementPath) { + return; + } + if (!parentPath.parentPath.isObjectExpression()) { + return; + } + const properties = parentPath.parentPath.get('properties'); + if (!parentPath.parentPath.parentPath.isMemberExpression()) { + return; + } + const rval = parentPath.parentPath.parentPath.get('property'); + if (!rval || !rval.node || !Array.isArray(properties)) { + return; + } + const children = properties.map(p => p.node).map((p, index) => { + const block = jsx_1.buildBlockElement(); + const tester = t.binaryExpression('===', p.key, rval.node); + block.children = [t.jSXExpressionContainer(p.value)]; + if (index === 0) { + utils_1.newJSXIfAttr(block, tester); + } + else { + jsx_1.setJSXAttr(block, adapter_1.Adapter.elseif, t.jSXExpressionContainer(tester)); + } + return block; + }); + const block = jsx_1.buildBlockElement(); + block.children = children; + parentPath.parentPath.parentPath.replaceWith(block); + } + else if (t.isLogicalExpression(parentNode)) { + const { left, operator, right } = parentNode; + const leftExpression = parentPath.get('left'); + if (operator === '&&' && t.isExpression(left)) { + if (utils_1.hasComplexExpression(leftExpression)) { + utils_1.generateAnonymousState(this.renderScope, leftExpression, this.referencedIdentifiers, true); + } + const block = jsx_1.buildBlockElement(); + utils_1.newJSXIfAttr(block, leftExpression.node); + block.children = [jsxElementPath.node]; + parentPath.replaceWith(block); + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + utils_1.setTemplate(name, jsxElementPath, this.templates); + // name && templates.set(name, path.node) + } + } + if (operator === '||' && t.isExpression(left)) { + const newNode = t.conditionalExpression(left, left, right); + parentPath.replaceWith(newNode); + // this.handleConditionExpr({ parentNode: newNode, parentPath, statementParent }, jsxElementPath) + } + } + else if (t.isConditionalExpression(parentNode)) { + const { consequent, alternate } = parentNode; + const testExpression = parentPath.get('test'); + const block = jsx_1.buildBlockElement(); + if (utils_1.hasComplexExpression(testExpression)) { + utils_1.generateAnonymousState(parentPath.scope, testExpression, this.referencedIdentifiers, true); + } + const test = testExpression.node; + if (t.isJSXElement(consequent) && this.isLiteralOrUndefined(alternate)) { + const { value, confident } = parentPath.get('alternate').evaluate(); + if (confident && !value || t.isIdentifier({ name: 'undefined' })) { + utils_1.newJSXIfAttr(block, test); + block.children = [jsxElementPath.node]; + // newJSXIfAttr(jsxElementPath.node, test) + parentPath.replaceWith(block); + } + else { + const block2 = jsx_1.buildBlockElement(); + block.children = [consequent]; + utils_1.newJSXIfAttr(block, test); + jsx_1.setJSXAttr(block2, adapter_1.Adapter.else); + block2.children = [t.jSXExpressionContainer(alternate)]; + const parentBlock = jsx_1.buildBlockElement(); + parentBlock.children = [block, block2]; + parentPath.replaceWith(parentBlock); + } + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + utils_1.setTemplate(name, jsxElementPath, this.templates); + // name && templates.set(name, path.node) + } + } + else if (this.isLiteralOrUndefined(consequent) && t.isJSXElement(alternate)) { + const { value, confident } = parentPath.get('consequent').evaluate(); + if (confident && !value || t.isIdentifier({ name: 'undefined' })) { + utils_1.newJSXIfAttr(block, utils_1.reverseBoolean(test)); + block.children = [jsxElementPath.node]; + // newJSXIfAttr(jsxElementPath.node, test) + parentPath.replaceWith(block); + } + else { + const block2 = jsx_1.buildBlockElement(); + block.children = [t.jSXExpressionContainer(consequent)]; + utils_1.newJSXIfAttr(block, test); + jsx_1.setJSXAttr(block2, adapter_1.Adapter.else); + block2.children = [alternate]; + const parentBlock = jsx_1.buildBlockElement(); + parentBlock.children = [block, block2]; + parentPath.replaceWith(parentBlock); + } + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + utils_1.setTemplate(name, jsxElementPath, this.templates); + // name && templates.set(name, path.node) + } + } + else if (t.isJSXElement(consequent) && t.isJSXElement(alternate)) { + const block2 = jsx_1.buildBlockElement(); + block.children = [consequent]; + utils_1.newJSXIfAttr(block, test); + jsx_1.setJSXAttr(block2, adapter_1.Adapter.else); + block2.children = [alternate]; + const parentBlock = jsx_1.buildBlockElement(); + parentBlock.children = [block, block2]; + parentPath.replaceWith(parentBlock); + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + utils_1.setTemplate(name, jsxElementPath, this.templates); + } + } + else if (t.isJSXElement(consequent) && t.isCallExpression(alternate) && !utils_1.isArrayMapCallExpression(parentPath.get('alternate'))) { + const id = utils_1.generateAnonymousState(this.renderScope, parentPath.get('alternate'), this.referencedIdentifiers, true); + parentPath.get('alternate').replaceWith(id); + // + } + else if (t.isJSXElement(alternate) && t.isCallExpression(consequent) && !utils_1.isArrayMapCallExpression(parentPath.get('consequent'))) { + const id = utils_1.generateAnonymousState(this.renderScope, parentPath.get('consequent'), this.referencedIdentifiers, true); + parentPath.get('consequent').replaceWith(id); + } + else { + block.children = [t.jSXExpressionContainer(consequent)]; + utils_1.newJSXIfAttr(block, test); + const block2 = jsx_1.buildBlockElement(); + jsx_1.setJSXAttr(block2, adapter_1.Adapter.else); + block2.children = [t.jSXExpressionContainer(alternate)]; + const parentBlock = jsx_1.buildBlockElement(); + parentBlock.children = [block, block2]; + parentPath.replaceWith(parentBlock); + if (statementParent) { + const name = utils_1.findIdentifierFromStatement(statementParent.node); + utils_1.setTemplate(name, jsxElementPath, this.templates); + } + } + } + } + setProperies() { + const properties = []; + this.componentProperies.forEach((propName) => { + properties.push(t.objectProperty(t.stringLiteral(propName), t.objectExpression([ + t.objectProperty(t.stringLiteral('type'), t.nullLiteral()), + t.objectProperty(t.stringLiteral('value'), t.nullLiteral()) + ]))); + }); + let classProp = t.classProperty(t.identifier('properties'), t.objectExpression(properties)); + classProp.static = true; + const classPath = this.renderPath.findParent(isClassDcl); + adapter_1.Adapter.type !== "alipay" /* alipay */ && classPath.node.body.body.unshift(classProp); + } + setLoopRefFlag() { + if (this.loopRefs.size) { + const classPath = this.renderPath.findParent(isClassDcl); + classPath.node.body.body.unshift(t.classProperty(t.identifier('$$hasLoopRef'), t.booleanLiteral(true))); + } + } + destructStateOrProps(key, path, properties, parentPath) { + const hasStateOrProps = properties.filter(p => t.isObjectProperty(p) && t.isIdentifier(p.key) && key === p.key.name); + if (hasStateOrProps.length === 0) { + return; + } + if (hasStateOrProps.length !== properties.length) { + throw utils_1.codeFrameError(path.node, 'state 或 props 只能单独从 this 中解构'); + } + const declareState = template(`const ${key} = this.${key};`)(); + if (properties.length > 1) { + const index = properties.findIndex(p => t.isObjectProperty(p) && t.isIdentifier(p.key, { name: key })); + properties.splice(index, 1); + parentPath.insertAfter(declareState); + } + else { + parentPath.insertAfter(declareState); + parentPath.remove(); + } + } + handleJSXInIfStatement(jsxElementPath, { parentNode, parentPath, isFinalReturn, isIfStemInLoop }) { + if (t.isReturnStatement(parentNode)) { + if (!isFinalReturn && !isIfStemInLoop) { + return; + } + else { + const ifStatement = parentPath.findParent(p => p.isIfStatement()); + const blockStatement = parentPath.findParent(p => p.isBlockStatement() && (p.parentPath === ifStatement)); + const loopCallExpr = jsxElementPath.findParent(p => utils_1.isArrayMapCallExpression(p)); + if (blockStatement && blockStatement.isBlockStatement()) { + blockStatement.traverse(this.renameIfScopeVaribale(blockStatement)); + } + const block = this.finalReturnElement || jsx_1.buildBlockElement(); + if (utils_1.isBlockIfStatement(ifStatement, blockStatement)) { + const { test, alternate, consequent } = ifStatement.node; + // blockStatement.node.body.push(t.returnStatement( + // t.memberExpression(t.thisExpression(), t.identifier('state')) + // )) + if (alternate === blockStatement.node) { + throw utils_1.codeFrameError(parentNode.loc, '不必要的 else 分支,请遵从 ESLint consistent-return: https://eslint.org/docs/rules/consistent-return'); + } + else if (consequent === blockStatement.node) { + const parentIfStatement = ifStatement.findParent(p => p.isIfStatement()); + if (parentIfStatement) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.elseif, t.jSXExpressionContainer(test), jsxElementPath); + if (loopCallExpr && this.loopIfStemComponentMap.has(loopCallExpr)) { + const block = this.loopIfStemComponentMap.get(loopCallExpr); + block.children.push(jsxElementPath.node); + } + } + else { + if (isIfStemInLoop && loopCallExpr && loopCallExpr.isCallExpression()) { + if (this.loopIfStemComponentMap.has(loopCallExpr)) { + const component = this.loopIfStemComponentMap.get(loopCallExpr); + utils_1.newJSXIfAttr(jsxElementPath.node, test, jsxElementPath); + component.children.push(jsxElementPath.node); + } + else { + utils_1.newJSXIfAttr(jsxElementPath.node, test, jsxElementPath); + this.loopIfStemComponentMap.set(loopCallExpr, block); + const arrowFunc = loopCallExpr.node.arguments[0]; + if (t.isArrowFunctionExpression(arrowFunc) && t.isBlockStatement(arrowFunc.body) && !arrowFunc.body.body.some(s => t.isReturnStatement(s))) { + arrowFunc.body.body.push(t.returnStatement(jsx_1.buildBlockElement())); + this.hasNoReturnLoopStem = true; + } + } + } + else { + if (this.topLevelIfStatement.size > 0) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.elseif, t.jSXExpressionContainer(test), jsxElementPath); + } + else { + utils_1.newJSXIfAttr(jsxElementPath.node, test, jsxElementPath); + this.topLevelIfStatement.add(ifStatement); + } + } + } + } + } + else if (block.children.length !== 0) { + if (this.topLevelIfStatement.size > 0) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.else); + } + } + block.children.push(jsxElementPath.node); + if (!this.loopIfStemComponentMap.has(loopCallExpr)) { + this.finalReturnElement = block; + } + this.returnedPaths.push(parentPath); + } + } + else if (t.isArrowFunctionExpression(parentNode)) { + // console.log('arrow') + } + else if (t.isAssignmentExpression(parentNode)) { + const ifStatement = parentPath.findParent(p => p.isIfStatement()); + const blockStatement = parentPath.findParent(p => p.isBlockStatement() && (p.parentPath === ifStatement)); + if (blockStatement && blockStatement.isBlockStatement()) { + blockStatement.traverse(this.renameIfScopeVaribale(blockStatement)); + } + if (t.isIdentifier(parentNode.left)) { + const assignmentName = parentNode.left.name; + const renderScope = isIfStemInLoop ? jsxElementPath.findParent(p => utils_1.isArrayMapCallExpression(p)).get('arguments')[0].get('body').scope : this.renderScope; + const bindingNode = renderScope.getOwnBinding(assignmentName).path.node; + // tslint:disable-next-line + const parallelIfStems = this.findParallelIfStem(ifStatement); + const parentIfStatement = ifStatement.findParent(p => p.isIfStatement() && !parallelIfStems.has(p)); + // @TODO: 重构 this.templates 为基于作用域的 HashMap,现在仍然可能会存在重复的情况 + let block = this.templates.get(assignmentName) || jsx_1.buildBlockElement(); + if (utils_1.isEmptyDeclarator(bindingNode)) { + const blockStatement = parentPath.findParent(p => p.isBlockStatement()); + if (utils_1.isBlockIfStatement(ifStatement, blockStatement)) { + const { test, alternate, consequent } = ifStatement.node; + if (alternate === blockStatement.node) { + const newBlock = jsx_1.buildBlockElement(); + jsx_1.setJSXAttr(newBlock, adapter_1.Adapter.else); + newBlock.children = [jsxElementPath.node]; + jsxElementPath.node = newBlock; + } + else if (consequent === blockStatement.node) { + const parentIfStatement = ifStatement.findParent(p => p.isIfStatement()); + const assignments = []; + let isAssignedBefore = false; + // @TODO: 重构这两种循环为通用模块 + // 如果这个 JSX assigmnent 的作用域中有其他的 if block 曾经赋值过,它应该是 else-if + if (blockStatement && blockStatement.isBlockStatement()) { + for (const parentStatement of blockStatement.node.body) { + if (t.isIfStatement(parentStatement) && t.isBlockStatement(parentStatement.consequent)) { + const statements = parentStatement.consequent.body; + for (const statement of statements) { + if (t.isExpressionStatement(statement) && t.isAssignmentExpression(statement.expression) && t.isIdentifier(statement.expression.left, { name: assignmentName })) { + isAssignedBefore = true; + } + } + } + } + } + // 如果这个 JSX assigmnent 的的父级作用域中的 prev sibling 有相同的赋值,它应该是 else-if + if (parentIfStatement) { + const { consequent } = parentIfStatement.node; + if (t.isBlockStatement(consequent)) { + const body = consequent.body; + for (const parentStatement of body) { + if (t.isIfStatement(parentStatement) && t.isBlockStatement(parentStatement.consequent)) { + const statements = parentStatement.consequent.body; + for (const statement of statements) { + if (t.isExpressionStatement(statement) && t.isAssignmentExpression(statement.expression) && t.isIdentifier(statement.expression.left, { name: assignmentName })) { + assignments.push(statement.expression); + } + } + } + } + } + } + if ((parentIfStatement && + (parentIfStatement.get('alternate') === ifStatement || + assignments.findIndex(a => a === parentNode) > 0)) + || + isAssignedBefore) { + jsx_1.setJSXAttr(jsxElementPath.node, adapter_1.Adapter.elseif, t.jSXExpressionContainer(test), jsxElementPath); + } + else { + if (parentIfStatement) { + if (this.isEmptyBlock(block)) { + utils_1.newJSXIfAttr(block, parentIfStatement.node.test, jsxElementPath); + } + else { + const newBlock = jsx_1.buildBlockElement(); + jsx_1.setJSXAttr(newBlock, adapter_1.Adapter.elseif, t.jSXExpressionContainer(parentIfStatement.node.test), jsxElementPath); + block.children.push(newBlock); + } + } + utils_1.newJSXIfAttr(jsxElementPath.node, test, jsxElementPath); + } + } + const ifAttr = block.openingElement.attributes.find(a => a.name.name === adapter_1.Adapter.if); + if (ifAttr && t.isJSXExpressionContainer(ifAttr.value, { expression: test })) { + const newBlock = jsx_1.buildBlockElement(); + newBlock.children = [block, jsxElementPath.node]; + block = newBlock; + } + else if (parentIfStatement && ifStatement.parentPath !== parentIfStatement) { + let hasNest = false; + this.handleNestedIfStatement(block, jsxElementPath.node, parentIfStatement.node.test, hasNest); + if (!hasNest && parentIfStatement.get('alternate') !== ifStatement) { + const ifAttr = block.openingElement.attributes.find(a => a.name.name === adapter_1.Adapter.if); + if (ifAttr && t.isJSXExpressionContainer(ifAttr.value, { expression: parentIfStatement.node.test })) { + const newBlock = jsx_1.buildBlockElement(); + block.children.push(jsxElementPath.node); + newBlock.children = [block]; + block = newBlock; + } + } + } + else { + block.children.push(jsxElementPath.node); + } + // setTemplate(name, path, templates) + assignmentName && this.templates.set(assignmentName, block); + if (isIfStemInLoop) { + this.returnedPaths.push(parentPath); + } + } + } + else { + throw utils_1.codeFrameError(jsxElementPath.node.loc, '请将 JSX 赋值表达式初始化为 null,然后再进行 if 条件表达式赋值。'); + } + } + } + else if (!t.isJSXElement(parentNode)) { + // throwError(path, '考虑只对 JSX 元素赋值一次。') + } + } + checkDuplicateData() { + this.initState.forEach((stateName) => { + if (this.templates.has(stateName)) { + throw utils_1.codeFrameError(this.templates.get(stateName), `自定义变量组件名: \`${stateName}\` 和已有 this.state.${stateName} 重复。请使用另一个变量名。`); + } + }); + this.componentProperies.forEach((componentName) => { + if (this.componentProperies.has(componentName)) { + throw utils_1.codeFrameError(this.renderPath.node, `state: \`${componentName}\` 和已有 this.props.${componentName} 重复。请使用另一个变量名。`); + } + if (this.templates.has(componentName)) { + throw utils_1.codeFrameError(this.templates.get(componentName), `自定义变量组件名: \`${componentName}\` 和已有 this.props.${componentName} 重复。请使用另一个变量名。`); + } + }); + } + addRefIdentifier(path, id) { + const arrayMap = path.findParent(p => utils_1.isArrayMapCallExpression(p)); + if (arrayMap && arrayMap.isCallExpression()) { + this.loopRefIdentifiers.set(id.name, arrayMap); + } + else { + id && this.referencedIdentifiers.add(id); + } + } + setOutputTemplate() { + this.outputTemplate = jsx_1.parseJSXElement(this.finalReturnElement); + } + removeJSXStatement() { + this.jsxDeclarations.forEach(d => d && d.remove()); + this.returnedPaths.forEach((p) => { + if (p.removed) { + return; + } + const ifStem = p.findParent(_ => _.isIfStatement()); + if (ifStem) { + const node = p.node; + if (!node) { + return; + } + if (t.isJSXElement(node.argument)) { + const jsx = node.argument; + if (jsx.children.length === 0 && jsx.openingElement.attributes.length === 0 && !this.isIfStemInLoop(p.get('argument'))) { + node.argument = t.nullLiteral(); + } + else { + p.remove(); + } + } + else { + const isValid = p.get('argument').evaluateTruthy(); + if (isValid === false) { + node.argument = t.nullLiteral(); + } + else { + p.remove(); + } + } + } + else { + p.remove(); + } + }); + } + setCustomEvent() { + const classPath = this.renderPath.findParent(isClassDcl); + let classProp = t.classProperty(t.identifier('$$events'), t.arrayExpression(Array.from(this.usedEvents).map(s => t.stringLiteral(s)))); // babel 6 typing 没有 static + classProp.static = true; + classPath.node.body.body.unshift(classProp); + } + setUsedState() { + for (const [key, method] of this.methods) { + if (method) { + if (method.isClassMethod()) { + const kind = method.node.kind; + if (kind === 'get') { + this.classComputedState.add(key); + } + } + } + } + const componentProperies = lodash_1.cloneDeep(this.componentProperies); + componentProperies.forEach(s => { + if (s.startsWith('__fn_')) { + const eventName = s.slice(5); + if (componentProperies.has(eventName)) { + componentProperies.delete(s); + componentProperies.delete(eventName); + } + } + }); + Array.from(this.reserveStateWords).forEach(this.setReserveWord); + const usedState = Array.from(new Set(Array.from(this.referencedIdentifiers) + .map(i => i.name) + .concat([...this.initState, ...this.usedThisState, ...componentProperies, ...this.classComputedState]))) + .concat(...this.usedState) + // .filter(i => { + // return !methods.has(i) + // }) + .filter(i => !this.loopScopes.has(i)) + .filter(i => !this.templates.has(i)) + .filter(Boolean); + const classPath = this.renderPath.findParent(isClassDcl); + classPath.node.body.body.unshift(t.classProperty(t.identifier('$usedState'), t.arrayExpression([...new Set(usedState + .filter(s => !this.loopScopes.has(s.split('.')[0])) + .filter(i => i !== constant_1.MAP_CALL_ITERATOR && !this.reserveStateWords.has(i)) + .filter(i => utils_1.isVarName(i)) + .filter(i => !this.loopRefIdentifiers.has(i)) + .concat(Array.from(this.customComponentNames)))] + .map(s => t.stringLiteral(s))))); + } + checkDuplicateName() { + this.loopScopes.forEach(s => { + if (this.renderPath.scope.hasBinding(s)) { + const err = utils_1.codeFrameError(this.renderPath.scope.getBinding(s).path.node, '此变量声明与循环变量冲突,可能会造成问题。'); + // tslint:disable-next-line + console.warn('Warning: ', err.message); + this.loopScopes.delete(s); + } + }); + } + setPendingState() { + const propertyKeys = Array.from(new Set(Array.from(this.referencedIdentifiers) + .map(i => i.name))) + .filter(i => { + const method = this.methods.get(i); + let isGet = false; + if (method) { + if (method.isClassMethod()) { + const kind = method.node.kind; + if (kind === 'get') { + isGet = true; + } + } + } + return !this.methods.has(i) || isGet; + }) + .filter(i => !this.loopScopes.has(i)) + .filter(i => !this.initState.has(i)) + .filter(i => !this.templates.has(i)) + .filter(i => utils_1.isVarName(i)) + .filter(i => i !== constant_1.MAP_CALL_ITERATOR && !this.reserveStateWords.has(i)) + .filter(i => !i.startsWith('$$')) + .filter(i => !this.loopRefIdentifiers.has(i)); + let properties = propertyKeys.map(i => t.objectProperty(t.identifier(i), t.identifier(i))); + if (this.customComponentData.length > 0) { + properties = properties.concat(this.customComponentData); + } + const pendingState = t.objectExpression(properties.concat(adapter_1.Adapter.type === "swan" /* swan */ && options_1.transformOptions.isRoot ? t.objectProperty(t.identifier('_triggerObserer'), t.booleanLiteral(false)) : []).concat(Array.from(this.classComputedState).filter(i => { + return !propertyKeys.includes(i); + }).map(i => { + return t.objectProperty(t.identifier(i), t.memberExpression(t.thisExpression(), t.identifier(i))); + }))); + this.renderPath.node.body.body = this.renderPath.node.body.body.concat(buildAssignState(pendingState), t.returnStatement(t.memberExpression(t.thisExpression(), t.identifier('state')))); + } + createData() { + const renderBody = this.renderPath.get('body'); + renderBody.traverse({ + ThisExpression(path) { + const property = path.getSibling('property'); + if (property.isIdentifier({ name: 'state' })) { + property.replaceWith(t.identifier('__state')); + } + if (property.isIdentifier({ name: 'props' })) { + property.replaceWith(t.identifier('__props')); + } + } + }); + this.usedThisProperties.forEach(prop => { + if (this.renderScope.hasBinding(prop)) { + const binding = this.renderScope.getBinding(prop); + throw utils_1.codeFrameError(binding.path.node, `此变量声明与 this.${prop} 的声明冲突,请更改其中一个变量名。详情见:https://github.com/NervJS/taro/issues/822`); + } + }); + this.renderPath.node.body.body.unshift(template(`this.__state = arguments[0] || this.state || {};`)(), template(`this.__props = arguments[1] || this.props || {};`)(), template(`const __runloopRef = arguments[2];`)(), this.usedThisProperties.size + ? t.variableDeclaration('const', [ + t.variableDeclarator(t.objectPattern(Array.from(this.usedThisProperties).map(p => t.objectProperty(t.identifier(p), t.identifier(p)))), t.thisExpression()) + ]) + : t.emptyStatement()); + if (t.isIdentifier(this.renderPath.node.key)) { + this.renderPath.node.key.name = '_createData'; + } + } +} +exports.RenderParser = RenderParser; +//# sourceMappingURL=render.js.map diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/render.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/render.js.map new file mode 100644 index 000000000..37fdaba6b --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/render.js.map @@ -0,0 +1 @@ +{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/render.ts"],"names":[],"mappings":";;AAAA,mDAAmE;AACnE,iCAAgC;AAChC,2CAA+C;AAC/C,mCAwBgB;AAChB,mCAA8D;AAC9D,+BAIc;AACd,yCAUmB;AACnB,uCAA6C;AAC7C,uCAAwE;AACxE,qDAAsC;AAEtC,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAI1C,SAAS,WAAW,CAAE,IAAsB,EAAE,EAAoC;IAChF,MAAM,OAAO,GAAuB,EAAE,CAAA;IACtC,qDAAqD;IACrD,OAAO,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE;QAC7B,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE;YACZ,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SACnB;KACF;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,UAAU,CAAE,CAAmB;IACtC,OAAO,CAAC,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAA;AACxD,CAAC;AAWD,SAAS,mBAAmB,CAAE,CAAmB;IAC/C,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAA;AAChD,CAAC;AAED,SAAS,gBAAgB,CACvB,YAAgC;IAEhC,OAAO,CAAC,CAAC,mBAAmB,CAC1B,CAAC,CAAC,cAAc,CACd,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAA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644 index 000000000..3ff8dac7a --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/jsx2wxml/utils.js @@ -0,0 +1,512 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const t = require("babel-types"); +const babel_generator_1 = require("babel-generator"); +const code_frame_1 = require("@babel/code-frame"); +const constant_1 = require("./constant"); +const lodash_1 = require("lodash"); +const fs = require("fs"); +const path = require("path"); +const jsx_1 = require("./jsx"); +const adapter_1 = require("./adapter"); +const options_1 = require("./options"); +const template = require('babel-template'); +exports.incrementId = () => { + let id = 0; + return () => id++; +}; +// tslint:disable-next-line:no-empty +exports.noop = function () { }; +function getSuperClassCode(path) { + const superClass = path.node.superClass; + if (t.isIdentifier(superClass)) { + const binding = path.scope.getBinding(superClass.name); + if (binding && binding.kind === 'module') { + const bindingPath = binding.path.parentPath; + if (bindingPath.isImportDeclaration()) { + const source = bindingPath.node.source; + if (source.value === constant_1.TARO_PACKAGE_NAME) { + return; + } + try { + const p = pathResolver(source.value, options_1.transformOptions.sourcePath) + (options_1.transformOptions.isTyped ? '.tsx' : '.js'); + const code = fs.readFileSync(p, 'utf8'); + return { + code, + sourcePath: source.value + }; + } + catch (error) { + return; + } + } + } + } +} +exports.getSuperClassCode = getSuperClassCode; +function isContainStopPropagation(path) { + let matched = false; + if (path) { + path.traverse({ + Identifier(p) { + if (p.node.name === 'stopPropagation' && + p.parentPath.parentPath.isCallExpression()) { + matched = true; + } + } + }); + } + return matched; +} +exports.isContainStopPropagation = isContainStopPropagation; +function decodeUnicode(s) { + return unescape(s.replace(/\\(u[0-9a-fA-F]{4})/gm, '%$1')); +} +exports.decodeUnicode = decodeUnicode; +function isVarName(str) { + if (typeof str !== 'string') { + return false; + } + if (str.trim() !== str) { + return false; + } + try { + // tslint:disable-next-line:no-unused-expression + new Function(str, 'var ' + str); + } + catch (e) { + return false; + } + return true; +} +exports.isVarName = isVarName; +function findMethodName(expression) { + let methodName; + if (t.isIdentifier(expression) || + t.isJSXIdentifier(expression)) { + methodName = expression.name; + } + else if (t.isStringLiteral(expression)) { + methodName = expression.value; + } + else if (t.isMemberExpression(expression) && + t.isIdentifier(expression.property)) { + const { code } = babel_generator_1.default(expression); + const ids = code.split('.'); + if (ids[0] === 'this' && ids[1] === 'props' && ids[2]) { + methodName = code.replace('this.props.', ''); + } + else { + methodName = expression.property.name; + } + } + else if (t.isCallExpression(expression) && + t.isMemberExpression(expression.callee) && + t.isIdentifier(expression.callee.object)) { + methodName = expression.callee.object.name; + } + else if (t.isCallExpression(expression) && + t.isMemberExpression(expression.callee) && + t.isMemberExpression(expression.callee.object) && + t.isIdentifier(expression.callee.property) && + expression.callee.property.name === 'bind' && + t.isIdentifier(expression.callee.object.property)) { + methodName = expression.callee.object.property.name; + } + else { + throw codeFrameError(expression.loc, '当 props 为事件时(props name 以 `on` 开头),只能传入一个 this 作用域下的函数。'); + } + return methodName; +} +exports.findMethodName = findMethodName; +function setParentCondition(jsx, expr, array = false) { + const conditionExpr = jsx.findParent(p => p.isConditionalExpression()); + const logicExpr = jsx.findParent(p => p.isLogicalExpression({ operator: '&&' })); + if (array) { + const ifAttrSet = new Set([ + adapter_1.Adapter.if, + adapter_1.Adapter.else + ]); + const logicalJSX = jsx.findParent(p => p.isJSXElement() && p.node.openingElement.attributes.some(a => ifAttrSet.has(a.name.name))); + if (logicalJSX) { + const attr = logicalJSX.node.openingElement.attributes.find(a => ifAttrSet.has(a.name.name)); + if (attr) { + if (attr.name.name === adapter_1.Adapter.else) { + const prevElement = logicalJSX.getPrevSibling(); + if (prevElement && prevElement.isJSXElement()) { + const attr = prevElement.node.openingElement.attributes.find(a => a.name.name === adapter_1.Adapter.if); + if (attr && t.isJSXExpressionContainer(attr.value)) { + expr = t.conditionalExpression(reverseBoolean(lodash_1.cloneDeep(attr.value.expression)), expr, t.arrayExpression()); + return expr; + } + } + } + else if (t.isJSXExpressionContainer(attr.value)) { + expr = t.conditionalExpression(lodash_1.cloneDeep(attr.value.expression), expr, t.arrayExpression()); + return expr; + } + } + } + } + if (conditionExpr && conditionExpr.isConditionalExpression()) { + const consequent = conditionExpr.get('consequent'); + if (consequent === jsx || jsx.findParent(p => p === consequent)) { + expr = t.conditionalExpression(lodash_1.cloneDeep(conditionExpr.get('test').node), expr, array ? t.arrayExpression([]) : t.nullLiteral()); + } + } + if (logicExpr && logicExpr.isLogicalExpression({ operator: '&&' })) { + const consequent = logicExpr.get('right'); + if (consequent === jsx || jsx.findParent(p => p === consequent)) { + expr = t.conditionalExpression(lodash_1.cloneDeep(logicExpr.get('left').node), expr, array ? t.arrayExpression([]) : t.nullLiteral()); + } + } + return expr; +} +exports.setParentCondition = setParentCondition; +function generateAnonymousState(scope, expression, refIds, isLogical) { + let variableName = `anonymousState_${scope.generateUid()}`; + let statementParent = expression.getStatementParent(); + if (!statementParent) { + throw codeFrameError(expression.node.loc, '无法生成匿名 State,尝试先把值赋到一个变量上再把变量调换。'); + } + const jsx = isLogical ? expression : expression.findParent(p => p.isJSXElement()); + const callExpr = jsx.findParent(p => p.isCallExpression() && isArrayMapCallExpression(p)); + const ifExpr = jsx.findParent(p => p.isIfStatement()); + const blockStatement = jsx.findParent(p => p.isBlockStatement() && p.parentPath === ifExpr); + const expr = setParentCondition(jsx, lodash_1.cloneDeep(expression.node)); + if (!callExpr) { + refIds.add(t.identifier(variableName)); + statementParent.insertBefore(buildConstVariableDeclaration(variableName, expr)); + if (blockStatement && blockStatement.isBlockStatement()) { + blockStatement.traverse({ + VariableDeclarator: (p) => { + const { id, init } = p.node; + if (t.isIdentifier(id) && !id.name.startsWith(constant_1.LOOP_STATE)) { + const newId = scope.generateDeclaredUidIdentifier('$' + id.name); + refIds.forEach((refId) => { + if (refId.name === variableName && !variableName.startsWith('_$')) { + refIds.delete(refId); + } + }); + variableName = newId.name; + refIds.add(t.identifier(variableName)); + blockStatement.scope.rename(id.name, newId.name); + p.parentPath.replaceWith(template('ID = INIT;')({ ID: newId, INIT: init })); + } + } + }); + } + } + else { + variableName = `${constant_1.LOOP_STATE}_${callExpr.scope.generateUid()}`; + const func = callExpr.node.arguments[0]; + if (t.isArrowFunctionExpression(func)) { + if (!t.isBlockStatement(func.body)) { + func.body = t.blockStatement([ + buildConstVariableDeclaration(variableName, expr), + t.returnStatement(func.body) + ]); + } + else { + if (ifExpr && ifExpr.isIfStatement() && ifExpr.findParent(p => p === callExpr)) { + const consequent = ifExpr.get('consequent'); + const test = ifExpr.get('test'); + if (consequent.isBlockStatement()) { + if (jsx === test || jsx.findParent(p => p === test)) { + func.body.body.unshift(buildConstVariableDeclaration(variableName, expr)); + } + else { + func.body.body.unshift(t.variableDeclaration('let', [t.variableDeclarator(t.identifier(variableName), t.nullLiteral())])); + consequent.node.body.push(t.expressionStatement(t.assignmentExpression('=', t.identifier(variableName), expr))); + } + } + else { + throw codeFrameError(consequent.node, 'if 表达式的结果必须由一个花括号包裹'); + } + } + else { + func.body.body.splice(func.body.body.length - 1, 0, buildConstVariableDeclaration(variableName, expr)); + } + } + } + } + const id = t.identifier(variableName); + expression.replaceWith(id); + return id; +} +exports.generateAnonymousState = generateAnonymousState; +function isArrayMapCallExpression(callExpression) { + return callExpression && + t.isCallExpression(callExpression.node) && + t.isMemberExpression(callExpression.node.callee) && + t.isIdentifier(callExpression.node.callee.property, { name: 'map' }); +} +exports.isArrayMapCallExpression = isArrayMapCallExpression; +function buildConstVariableDeclaration(variableName, expresion) { + return t.variableDeclaration('const', [ + t.variableDeclarator(t.identifier(variableName), expresion) + ]); +} +exports.buildConstVariableDeclaration = buildConstVariableDeclaration; +function setTemplate(name, path, templates) { + const parentPath = path.parentPath; + const jsxChildren = parentPath.findParent(p => p.isJSXElement()); + if (name && !jsxChildren) { + templates.set(name, path.node); + } +} +exports.setTemplate = setTemplate; +function isContainFunction(p) { + let bool = false; + p.traverse({ + CallExpression() { + bool = true; + } + }); + return bool; +} +exports.isContainFunction = isContainFunction; +function slash(input) { + const isExtendedLengthPath = /^\\\\\?\\/.test(input); + const hasNonAscii = /[^\u0000-\u0080]+/.test(input); + const hasChinese = /[^\u4e00-\u9fa5]+/.test(input); // has Chinese characters + if (isExtendedLengthPath || (hasNonAscii && !hasChinese)) { + return input; + } + return input.replace(/\\/g, '/'); +} +function pathResolver(source, location) { + const extName = path.extname(source); + const promotedPath = source; + if (!['js', 'tsx'].includes(extName)) { + try { + const pathExist = fs.existsSync(path.resolve(path.dirname(location), source, 'index.js')); + const tsxPathExist = fs.existsSync(path.resolve(path.dirname(location), source, 'index.tsx')); + if (pathExist || tsxPathExist) { + let p = path.join(promotedPath, 'index'); + if (!p.startsWith('.')) { + p = './' + p; + } + return slash(p); + } + return slash(promotedPath); + } + catch (error) { + return slash(promotedPath); + } + } + return slash(promotedPath.split('.').slice(0, -1).join('.')); +} +exports.pathResolver = pathResolver; +function codeFrameError(node, msg) { + let errMsg = ''; + try { + errMsg = code_frame_1.codeFrameColumns(exports.setting.sourceCode, node && node.type && node.loc ? node.loc : node, { + highlightCode: true + }); + } + catch (error) { + errMsg = 'failed to locate source'; + } + return new Error(`${msg} +----- +${errMsg}`); +} +exports.codeFrameError = codeFrameError; +exports.setting = { + sourceCode: '' +}; +function createUUID() { + return '$' + 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + let r = Math.random() * 16 | 0; + let v = c === 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + }).replace(/-/g, '').slice(0, 8); +} +exports.createUUID = createUUID; +function createRandomLetters(n) { + const str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; + return Array(n).join().split(',').map(function () { return str.charAt(Math.floor(Math.random() * str.length)); }).join(''); +} +exports.createRandomLetters = createRandomLetters; +function isBlockIfStatement(ifStatement, blockStatement) { + return ifStatement && blockStatement && + ifStatement.isIfStatement() && + blockStatement.isBlockStatement(); +} +exports.isBlockIfStatement = isBlockIfStatement; +function buildCodeFrame(code) { + return (loc) => code_frame_1.codeFrameColumns(code, loc); +} +exports.buildCodeFrame = buildCodeFrame; +function isNumeric(n) { + return !isNaN(parseFloat(n)) && isFinite(n); +} +exports.isNumeric = isNumeric; +function buildJSXAttr(name, value) { + return t.jSXAttribute(t.jSXIdentifier(name), t.jSXExpressionContainer(value)); +} +exports.buildJSXAttr = buildJSXAttr; +function newJSXIfAttr(jsx, value, path) { + const element = jsx.openingElement; + if (!t.isJSXIdentifier(element.name)) { + return; + } + if (element.name.name === 'Block' || element.name.name === 'block' || !path) { + element.attributes.push(buildJSXAttr(adapter_1.Adapter.if, value)); + } + else { + const block = jsx_1.buildBlockElement(); + newJSXIfAttr(block, value); + block.children.push(jsx); + path.node = block; + } +} +exports.newJSXIfAttr = newJSXIfAttr; +function getSlotName(name) { + return name.slice(6).toLowerCase(); +} +exports.getSlotName = getSlotName; +function isContainJSXElement(path) { + let matched = false; + path.traverse({ + JSXElement(p) { + matched = true; + p.stop(); + } + }); + return matched; +} +exports.isContainJSXElement = isContainJSXElement; +function hasComplexExpression(path) { + let matched = false; + if (isContainJSXElement(path)) { + return false; + } + if (path.isObjectExpression()) { + return true; + } + if (path.isTemplateLiteral() || path.isCallExpression()) { + return true; + } + if (path.isArrayExpression()) { + const { elements } = path.node; + if (elements.some(el => t.isObjectExpression(el) || t.isArrayExpression(el))) { + return true; + } + } + path.traverse({ + CallExpression: (p) => { + matched = true; + p.stop(); + }, + TemplateLiteral(p) { + matched = true; + p.stop(); + }, + ObjectExpression(p) { + matched = true; + p.stop(); + }, + ArrayExpression(p) { + const { elements } = p.node; + if (elements.some(el => t.isObjectExpression(el))) { + return true; + } + }, + TaggedTemplateExpression(p) { + matched = true; + p.stop(); + }, + MemberExpression(path) { + const jsxElement = path.findParent(p => p.isJSXExpressionContainer()); + const object = path.get('object'); + const property = path.get('property'); + const parentPath = path.parentPath; + if (jsxElement && + object.isThisExpression() && + property.isIdentifier({ name: 'state' }) && + parentPath.isMemberExpression() && + parentPath.parentPath.isMemberExpression()) { + const sourceCode = parentPath.parentPath.getSource(); + if (sourceCode.includes('[') && sourceCode.includes(']')) { + matched = true; + path.stop(); + } + } + } + }); + return matched; +} +exports.hasComplexExpression = hasComplexExpression; +function findFirstIdentifierFromMemberExpression(node, member) { + let id; + let object = node.object; + while (true) { + if (t.identifier(object) && !t.isMemberExpression(object)) { + id = object; + if (member) { + object = member; + } + break; + } + object = object.object; + } + return id; +} +exports.findFirstIdentifierFromMemberExpression = findFirstIdentifierFromMemberExpression; +function getArgumentName(arg) { + if (t.isThisExpression(arg)) { + return 'this'; + } + else if (t.isNullLiteral(arg)) { + return 'null'; + } + else if (t.isStringLiteral(arg) || t.isNumericLiteral(arg)) { + return arg.value; + } + else if (t.isIdentifier(arg)) { + return arg.name; + } + else { + return babel_generator_1.default(arg).code; + } + throw new Error(`bind 不支持传入该参数: ${arg}`); +} +exports.getArgumentName = getArgumentName; +function isAllLiteral(...args) { + return args.every(p => t.isLiteral(p)); +} +exports.isAllLiteral = isAllLiteral; +function reverseBoolean(expression) { + return t.unaryExpression('!', expression); +} +exports.reverseBoolean = reverseBoolean; +function isEmptyDeclarator(node) { + if (t.isVariableDeclarator(node) && + (node.init === null || + t.isNullLiteral(node.init))) { + return true; + } + return false; +} +exports.isEmptyDeclarator = isEmptyDeclarator; +function toLetters(num) { + let mod = num % 26; + let pow = num / 26 | 0; + let out = mod ? String.fromCharCode(64 + mod) : (--pow, 'Z'); + const letter = pow ? toLetters(pow) + out : out; + return letter.toLowerCase(); +} +exports.toLetters = toLetters; +function findIdentifierFromStatement(statement) { + if (t.isVariableDeclaration(statement)) { + const declarator = statement.declarations.find(s => t.isIdentifier(s.id)); + if (declarator && t.isIdentifier(declarator.id)) { + return declarator.id.name; + } + } + return '__return'; +} +exports.findIdentifierFromStatement = findIdentifierFromStatement; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/jsx2wxml/utils.js.map b/packages/mp-jsx-ts/_scripts/jsx2wxml/utils.js.map new file mode 100644 index 000000000..a3aebb6c9 --- /dev/null +++ b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,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;IAC/C,OAAO,MAAM,CAAC,WAAW,EAAE,CAAA;AAC7B,CAAC;AAND,8BAMC;AAED,SAAgB,2BAA2B,CAAE,SAAiB;IAC5D,IAAI,CAAC,CAAC,qBAAqB,CAAC,SAAS,CAAC,EAAE;QACtC,MAAM,UAAU,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACzE,IAAI,UAAU,IAAI,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE;YAC/C,OAAO,UAAU,CAAC,EAAE,CAAC,IAAI,CAAA;SAC1B;KACF;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AARD,kEAQC"} \ No newline at end of file diff --git a/packages/mp-jsx-ts/_scripts/test/index.js b/packages/mp-jsx-ts/_scripts/test/index.js new file mode 100644 index 000000000..f4b100116 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/test/index.js @@ -0,0 +1,74 @@ +/* mp-jsx v0.1.0 + base on taro-transformer-wx v1.2.22 + https://github.com/NervJS/taro/tree/master/packages/taro-transformer-wx +*/ +const jsx2wxml = require('../jsx2wxml') +const fs = require('fs') +const path = require('path') + + +function buildComponent(code) { + return ` +class WeElement { + render () { + return ${code} + } +} +` +} + + +const baseOptions = { + isRoot: false, + isApp: false, + sourcePath: __dirname, + outputPath: __dirname, + code: '', + isTyped: false +} + +let { template } = jsx2wxml.default({ + ...baseOptions, + code: buildComponent(fs.readFileSync(path.join(__dirname, "./test.jsx"), 'utf8')) +}) + + +console.log(template === +` + show +`) + +template = jsx2wxml.default({ + ...baseOptions, + code: buildComponent(fs.readFileSync(path.join(__dirname, "./test.1.jsx"), 'utf8')) +}).template + + +console.log(template === +` + + + show + + + hide + + +`) + + + +template = jsx2wxml.default({ + ...baseOptions, + code: buildComponent(fs.readFileSync(path.join(__dirname, "./test.2.jsx"), 'utf8')) +}).template + + +console.log(template === +` + + {{item.name}} + + +`) + diff --git a/packages/mp-jsx-ts/_scripts/test/test.1.jsx b/packages/mp-jsx-ts/_scripts/test/test.1.jsx new file mode 100644 index 000000000..ff2937f53 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/test/test.1.jsx @@ -0,0 +1 @@ +bb?show:hide diff --git a/packages/mp-jsx-ts/_scripts/test/test.2.jsx b/packages/mp-jsx-ts/_scripts/test/test.2.jsx new file mode 100644 index 000000000..792aef4f6 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/test/test.2.jsx @@ -0,0 +1,7 @@ + +{array.map(item => ( + + {item.name} + +))} + diff --git a/packages/mp-jsx-ts/_scripts/test/test.jsx b/packages/mp-jsx-ts/_scripts/test/test.jsx new file mode 100644 index 000000000..d0de88354 --- /dev/null +++ b/packages/mp-jsx-ts/_scripts/test/test.jsx @@ -0,0 +1 @@ +show diff --git a/packages/mp-jsx-ts/package.json b/packages/mp-jsx-ts/package.json index d67e0e45a..97fdb6f8a 100644 --- a/packages/mp-jsx-ts/package.json +++ b/packages/mp-jsx-ts/package.json @@ -3,9 +3,24 @@ "version": "1.0.0", "scripts": { "tsc": "./node_modules/typescript/bin/tsc", - "compile": "tsc" + "compile": "tsc", + "start": "gulp", + "_test": "node _scripts/test/index.js" }, "devDependencies": { "typescript": "^3.1.6" + }, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "@tarojs/transformer-wx": "^1.2.22", + "babel-core": "^6.26.3", + "babel-generator": "^6.26.1", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "gulp": "^3.9.1", + "gulp-tap": "^1.0.1", + "gulp-watch": "^5.0.1", + "lodash": "^4.17.11" } }