Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
1b6dd81f
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
720
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1b6dd81f
编写于
2月 01, 2023
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(uts): compiler
上级
710eec64
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
5 deletion
+27
-5
packages/uni-uts-v1/__tests__/__snapshots__/code.spec.ts.snap
...ages/uni-uts-v1/__tests__/__snapshots__/code.spec.ts.snap
+5
-0
packages/uni-uts-v1/__tests__/code.spec.ts
packages/uni-uts-v1/__tests__/code.spec.ts
+2
-0
packages/uni-uts-v1/__tests__/examples/uts/uni_modules/test-uts/utssdk/app-android/index.vue
...les/uts/uni_modules/test-uts/utssdk/app-android/index.vue
+0
-0
packages/uni-uts-v1/__tests__/examples/uts/unpackage/cache/app-android/uts/uni_modules/test-uts/manifest.json
.../cache/app-android/uts/uni_modules/test-uts/manifest.json
+3
-0
packages/uni-uts-v1/__tests__/manifest.spec.ts
packages/uni-uts-v1/__tests__/manifest.spec.ts
+2
-1
packages/uni-uts-v1/src/code.ts
packages/uni-uts-v1/src/code.ts
+15
-4
未找到文件。
packages/uni-uts-v1/__tests__/__snapshots__/code.spec.ts.snap
浏览文件 @
1b6dd81f
...
...
@@ -11,6 +11,8 @@ const is_uni_modules = false
const pkg = initUTSPackageName(name, is_uni_modules)
const cls = initUTSIndexClassName(name, is_uni_modules)
export const TestUtsComponent = {}
export const onMemoryWarning = initUTSProxyFunction(false, { moduleName, moduleType, errMsg, main: true, package: pkg, class: cls, name: 'onMemoryWarning', params: [{"name":"callback","type":"UTSCallback"}]})
export const offMemoryWarning = initUTSProxyFunction(false, { moduleName, moduleType, errMsg, main: true, package: pkg, class: cls, name: 'offMemoryWarning', params: [{"name":"callback","type":"UTSCallback","default":"UTSNull"}]})
export default initUTSProxyClass(Object.assign({ moduleName, moduleType, errMsg, package: pkg, class: initUTSClassName(name, 'User', is_uni_modules) }, {"constructor":{"params":[]},"methods":{},"staticMethods":{},"props":[],"staticProps":[]} ))
...
...
@@ -30,6 +32,9 @@ const pkg = initUTSPackageName(name, is_uni_modules)
const cls = initUTSIndexClassName(name, is_uni_modules)
const exports = { __esModule: true }
exports.TestUtsComponent = {}
exports.onMemoryWarning = initUTSProxyFunction(false, { moduleName, moduleType, errMsg, main: true, package: pkg, class: cls, name: 'onMemoryWarning', params: [{"name":"callback","type":"UTSCallback"}]})
exports.offMemoryWarning = initUTSProxyFunction(false, { moduleName, moduleType, errMsg, main: true, package: pkg, class: cls, name: 'offMemoryWarning', params: [{"name":"callback","type":"UTSCallback","default":"UTSNull"}]})
exports.default = initUTSProxyClass(Object.assign({ moduleName, moduleType, errMsg, package: pkg, class: initUTSClassName(name, 'User', is_uni_modules) }, {"constructor":{"params":[]},"methods":{},"staticMethods":{},"props":[],"staticProps":[]} ))
...
...
packages/uni-uts-v1/__tests__/code.spec.ts
浏览文件 @
1b6dd81f
...
...
@@ -16,6 +16,7 @@ describe('code', () => {
name
:
'
test-uts
'
,
namespace
:
'
uts.sdk.testUts
'
,
extname
:
'
.uts
'
,
androidComponents
:
{
TestUts
:
''
},
})
).
replace
(
ERR_MSG_PLACEHOLDER
,
''
)
).
toMatchSnapshot
()
...
...
@@ -31,6 +32,7 @@ describe('code', () => {
extname
:
'
.uts
'
,
format
:
FORMATS
.
CJS
,
pluginRelativeDir
:
'
utssdk/test-uts
'
,
androidComponents
:
{
TestUts
:
''
},
})
).
replace
(
ERR_MSG_PLACEHOLDER
,
''
)
).
toMatchSnapshot
()
...
...
packages/uni-uts-v1/__tests__/examples/uts/uni_modules/test-uts/utssdk/app-android/index.vue
0 → 100644
浏览文件 @
1b6dd81f
packages/uni-uts-v1/__tests__/examples/uts/unpackage/cache/app-android/uts/uni_modules/test-uts/manifest.json
浏览文件 @
1b6dd81f
...
...
@@ -16,6 +16,9 @@
"package.json"
:
{
"md5"
:
"2a19a08ee8a5d77c1e2dfcef55a8f1c1"
},
"utssdk/app-android/index.vue"
:
{
"md5"
:
"d41d8cd98f00b204e9800998ecf8427e"
},
"utssdk/app-android/assets/test.json"
:
{
"md5"
:
"d41d8cd98f00b204e9800998ecf8427e"
}
...
...
packages/uni-uts-v1/__tests__/manifest.spec.ts
浏览文件 @
1b6dd81f
...
...
@@ -53,6 +53,7 @@ describe('manifest', () => {
'
utssdk/index.uts
'
,
'
utssdk/common/utils.uts
'
,
'
utssdk/app-android/index.uts
'
,
'
utssdk/app-android/index.vue
'
,
'
utssdk/app-android/assets/test.json
'
,
])
})
...
...
@@ -109,7 +110,7 @@ describe('manifest', () => {
test
(
'
gen android manifest
'
,
async
()
=>
{
const
res
=
await
checkKotlinCompile
(
'
standard
'
,
pluginModuleOptions
)
expect
(
res
.
expired
).
toBe
(
false
)
expect
(
res
.
files
.
length
).
toBe
(
5
)
expect
(
res
.
files
.
length
).
toBe
(
6
)
expect
(
res
.
tips
).
toBeTruthy
()
const
res1
=
await
checkKotlinCompile
(
'
standard
'
,
pluginOptions
)
...
...
packages/uni-uts-v1/src/code.ts
浏览文件 @
1b6dd81f
...
...
@@ -51,10 +51,19 @@ const errMsg = \`${ERR_MSG_PLACEHOLDER}\`
const is_uni_modules =
${
is_uni_modules
}
const pkg = initUTSPackageName(name, is_uni_modules)
const cls = initUTSIndexClassName(name, is_uni_modules)
${
format
===
FORMATS
.
CJS
?
`
const exports = { __esModule: true }
`
:
''
}
${
genComponentsCode
(
format
,
options
.
androidComponents
||
{},
options
.
iosComponents
||
{}
)}
${
genModuleCode
(
await
parseModuleDecls
(
module
,
options
),
format
,
...
...
@@ -64,13 +73,18 @@ ${genModuleCode(
}
export
function
genComponentsCode
(
format
:
FORMATS
=
FORMATS
.
ES
,
androidComponents
:
Record
<
string
,
string
>
,
iosComponents
:
Record
<
string
,
string
>
)
{
const
codes
:
string
[]
=
[]
Object
.
keys
(
Object
.
assign
({},
androidComponents
,
iosComponents
)).
forEach
(
(
name
)
=>
{
codes
.
push
(
`export const
${
capitalize
(
camelize
(
name
))}
Component = {}`
)
if
(
format
===
FORMATS
.
CJS
)
{
codes
.
push
(
`exports.
${
capitalize
(
camelize
(
name
))}
Component = {}`
)
}
else
{
codes
.
push
(
`export const
${
capitalize
(
camelize
(
name
))}
Component = {}`
)
}
}
)
return
codes
.
join
(
'
\n
'
)
...
...
@@ -124,9 +138,6 @@ function genModuleCode(
pluginRelativeDir
:
string
)
{
const
codes
:
string
[]
=
[]
if
(
format
===
FORMATS
.
CJS
)
{
codes
.
push
(
`const exports = { __esModule: true }`
)
}
const
exportDefault
=
exportDefaultCode
(
format
)
const
exportConst
=
exportVarCode
(
format
,
'
const
'
)
decls
.
forEach
((
decl
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录