Skip to content

Commit c6a748f

Browse files
authored
Merge branch 'main' into feat/ssr-component
2 parents 930c7b8 + c2833f6 commit c6a748f

File tree

3 files changed

+60
-60
lines changed

3 files changed

+60
-60
lines changed

packages/taro-cli-convertor/src/index.ts

+42-42
Original file line numberDiff line numberDiff line change
@@ -459,36 +459,36 @@ export default class Convertor {
459459
}
460460
},
461461

462-
ClassExpression (astPath) {
463-
updateLogFileContent(
464-
`INFO [taro-cli-convertor] parseAst - 解析ClassExpression ${getLineBreak()}${astPath} ${getLineBreak()}`
465-
)
466-
const node = astPath.node
467-
if (node.superClass) {
468-
let isTaroComponent = false
469-
astPath.traverse({
470-
ClassMethod (astPath) {
471-
if (astPath.get('key').isIdentifier({ name: 'render' })) {
472-
astPath.traverse({
473-
JSXElement () {
474-
isTaroComponent = true
475-
},
476-
})
477-
}
478-
},
479-
})
480-
if (isTaroComponent) {
481-
if (node.id === null) {
482-
const parentNode = astPath.parentPath.node as t.VariableDeclarator
483-
if (t.isVariableDeclarator(astPath.parentPath)) {
484-
componentClassName = (parentNode.id as t.Identifier).name
485-
}
486-
} else {
487-
componentClassName = node.id!.name
488-
}
489-
}
490-
}
491-
},
462+
// ClassExpression (astPath) {
463+
// updateLogFileContent(
464+
// `INFO [taro-cli-convertor] parseAst - 解析ClassExpression ${getLineBreak()}${astPath} ${getLineBreak()}`
465+
// )
466+
// const node = astPath.node
467+
// if (node.superClass) {
468+
// let isTaroComponent = false
469+
// astPath.traverse({
470+
// ClassMethod (astPath) {
471+
// if (astPath.get('key').isIdentifier({ name: 'render' })) {
472+
// astPath.traverse({
473+
// JSXElement () {
474+
// isTaroComponent = true
475+
// },
476+
// })
477+
// }
478+
// },
479+
// })
480+
// if (isTaroComponent) {
481+
// if (node.id === null) {
482+
// const parentNode = astPath.parentPath.node as t.VariableDeclarator
483+
// if (t.isVariableDeclarator(astPath.parentPath)) {
484+
// componentClassName = (parentNode.id as t.Identifier).name
485+
// }
486+
// } else {
487+
// componentClassName = node.id!.name
488+
// }
489+
// }
490+
// }
491+
// },
492492
ExportDefaultDeclaration (astPath) {
493493
updateLogFileContent(
494494
`INFO [taro-cli-convertor] parseAst - 解析ExportDefaultDeclaration ${getLineBreak()}${astPath} ${getLineBreak()}`
@@ -1628,18 +1628,18 @@ ${code}
16281628
}
16291629

16301630
// 判断三方库是否安装
1631-
isInNodeModule (modulePath: string) {
1632-
const nodeModules = path.resolve(this.root, 'node_modules')
1633-
if (!fs.existsSync(nodeModules)) {
1634-
return false
1635-
}
1636-
const modules = fs.readdirSync(nodeModules)
1637-
const parts = modulePath.split('/')
1638-
if (modules.indexOf(parts[0]) === -1) {
1639-
return false
1640-
}
1641-
return true
1642-
}
1631+
// isInNodeModule (modulePath: string) {
1632+
// const nodeModules = path.resolve(this.root, 'node_modules')
1633+
// if (!fs.existsSync(nodeModules)) {
1634+
// return false
1635+
// }
1636+
// const modules = fs.readdirSync(nodeModules)
1637+
// const parts = modulePath.split('/')
1638+
// if (modules.indexOf(parts[0]) === -1) {
1639+
// return false
1640+
// }
1641+
// return true
1642+
// }
16431643

16441644
traversePages (root: string, pages: Set<string>) {
16451645
pages.forEach((page) => {

packages/taro-cli-convertor/src/util/index.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -399,16 +399,16 @@ export function handleUnconvertDir (matchUnconvertDir: string, rootPath: string,
399399
}
400400
}
401401

402-
export function getMatchDirPath (filePath: string, matchStr: string) {
403-
const reg = new RegExp(matchStr)
404-
const match = reg.exec(filePath)
405-
if (match) {
406-
if (matchStr.length >= 2 && matchStr.endsWith('*')) {
407-
return matchStr.slice(0, matchStr.length - 2)
408-
}
409-
return match[0]
410-
}
411-
}
402+
// export function getMatchDirPath (filePath: string, matchStr: string) {
403+
// const reg = new RegExp(matchStr)
404+
// const match = reg.exec(filePath)
405+
// if (match) {
406+
// if (matchStr.length >= 2 && matchStr.endsWith('*')) {
407+
// return matchStr.slice(0, matchStr.length - 2)
408+
// }
409+
// return match[0]
410+
// }
411+
// }
412412

413413
// 路径标准化
414414
function normalizePath (path) {

packages/taroize/src/utils.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { codeFrameColumns } from '@babel/code-frame'
22
import generate from '@babel/generator'
33
import { parse } from '@babel/parser'
44
import { default as template } from '@babel/template'
5-
import traverse, { NodePath } from '@babel/traverse'
5+
import traverse from '@babel/traverse'
66
import * as t from '@babel/types'
77
import { fs } from '@tarojs/helper'
88
import { camelCase, capitalize } from 'lodash'
@@ -16,13 +16,13 @@ const prettierJSConfig: prettier.Options = {
1616
parser: 'babel',
1717
}
1818

19-
export function isAliasThis (p: NodePath<t.Node>, name: string) {
20-
const binding = p.scope.getBinding(name)
21-
if (binding) {
22-
return binding.path.isVariableDeclarator() && t.isThisExpression(binding.path.get('init'))
23-
}
24-
return false
25-
}
19+
// export function isAliasThis (p: NodePath<t.Node>, name: string) {
20+
// const binding = p.scope.getBinding(name)
21+
// if (binding) {
22+
// return binding.path.isVariableDeclarator() && t.isThisExpression(binding.path.get('init'))
23+
// }
24+
// return false
25+
// }
2626

2727
/**
2828
* 标准化传入路径

0 commit comments

Comments
 (0)