提交 ab272127 编写于 作者: fxy060608's avatar fxy060608 提交者: 雪洛

wip: uni_modules编译模式

上级 9491aaac
...@@ -5,6 +5,7 @@ import { walk } from 'estree-walker' ...@@ -5,6 +5,7 @@ import { walk } from 'estree-walker'
import { parseExpression } from '@babel/parser' import { parseExpression } from '@babel/parser'
import MagicString from 'magic-string' import MagicString from 'magic-string'
import { import {
camelize,
genUTSComponentPublicInstanceIdent, genUTSComponentPublicInstanceIdent,
genUTSComponentPublicInstanceImported, genUTSComponentPublicInstanceImported,
normalizePath, normalizePath,
...@@ -72,8 +73,21 @@ export function addEasyComponentAutoImports( ...@@ -72,8 +73,21 @@ export function addEasyComponentAutoImports(
if (path.isAbsolute(fileName) && fileName.startsWith(rootDir)) { if (path.isAbsolute(fileName) && fileName.startsWith(rootDir)) {
fileName = '@/' + normalizePath(path.relative(rootDir, fileName)) fileName = '@/' + normalizePath(path.relative(rootDir, fileName))
} }
let imported = ''
// 加密插件easycom类型导入
if (fileName.includes('?uts-proxy')) {
const moduleId = path.basename(fileName.split('?uts-proxy')[0])
fileName = `uts.sdk.modules.${camelize(moduleId)}`
imported = genUTSComponentPublicInstanceImported(
rootDir,
`@/uni_modules/${moduleId}/components/${tagName}/${tagName}`
)
} else {
imported = genUTSComponentPublicInstanceImported(rootDir, fileName)
}
easyComponentAutoImports[fileName] = [ easyComponentAutoImports[fileName] = [
genUTSComponentPublicInstanceImported(rootDir, fileName), imported,
genUTSComponentPublicInstanceIdent(tagName), genUTSComponentPublicInstanceIdent(tagName),
] ]
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册