Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
a26d1ccd
U
uni-app
项目概览
DCloud
/
uni-app
13 天 前同步成功
通知
751
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a26d1ccd
编写于
8月 15, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(uts): compiler
上级
e7dd56ce
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
325 addition
and
381 deletion
+325
-381
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+2
-1
packages/uni-cli-shared/src/resolve.ts
packages/uni-cli-shared/src/resolve.ts
+1
-1
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+1
-1
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+1
-1
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+0
-7
packages/uni-uts-vite/package.json
packages/uni-uts-vite/package.json
+3
-0
packages/uni-uts-vite/src/utils/compiler.ts
packages/uni-uts-vite/src/utils/compiler.ts
+83
-77
pnpm-lock.yaml
pnpm-lock.yaml
+234
-293
未找到文件。
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
a26d1ccd
...
...
@@ -13438,12 +13438,13 @@ const getDeviceInfo = defineSyncApi('getDeviceInfo', () => {
});
const getAppBaseInfo = defineSyncApi('getAppBaseInfo', () => {
weexGetSystemInfoSync();
const { hostPackageName, hostName, hostVersion, hostLanguage, osLanguage, hostTheme, appId, appName, appVersion, appVersionCode, } = systemInfo;
const { hostPackageName, hostName, hostVersion, hostLanguage, osLanguage, hostTheme, appId, appName, appVersion, appVersionCode,
appWgtVersion,
} = systemInfo;
return {
appId,
appName,
appVersion,
appVersionCode,
appWgtVersion,
appLanguage: getLocale ? getLocale() : osLanguage,
enableDebug: false,
hostPackageName,
...
...
packages/uni-cli-shared/src/resolve.ts
浏览文件 @
a26d1ccd
...
...
@@ -20,7 +20,7 @@ function resolveWithSymlinks(id: string, basedir: string): string {
// necessary to work with pnpm
preserveSymlinks
:
true
,
pathFilter
(
pkg
,
filepath
,
relativePath
)
{
if
(
pkg
.
dcloudext
&&
(
pkg
.
dcloudext
as
any
).
type
===
'
native-
uts
'
)
{
if
(
pkg
.
uni_modules
&&
(
pkg
.
uni_modules
as
any
).
type
===
'
uts
'
)
{
if
(
process
.
env
.
UNI_APP_PLATFORM
===
'
app-android
'
||
process
.
env
.
UNI_APP_PLATFORM
===
'
app-ios
'
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
a26d1ccd
...
...
@@ -6918,7 +6918,7 @@ function initPublicPage(route) {
return
initPageInternalInstance
(
"
navigateTo
"
,
__uniRoutes
[
0
].
path
,
{},
meta
);
}
let
fullPath
=
route
.
fullPath
;
if
(
route
.
meta
.
isEntry
)
{
if
(
route
.
meta
.
isEntry
&&
fullPath
.
indexOf
(
route
.
meta
.
route
)
===
-
1
)
{
fullPath
=
"
/
"
+
route
.
meta
.
route
+
fullPath
.
replace
(
"
/
"
,
""
);
}
return
initPageInternalInstance
(
"
navigateTo
"
,
fullPath
,
{},
meta
);
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
a26d1ccd
...
...
@@ -14067,7 +14067,7 @@ function initPublicPage(route) {
return initPageInternalInstance("navigateTo", __uniRoutes[0].path, {}, meta);
}
let fullPath = route.fullPath;
if (route.meta.isEntry) {
if (route.meta.isEntry
&& fullPath.indexOf(route.meta.route) === -1
) {
fullPath = "/" + route.meta.route + fullPath.replace("/", "");
}
return initPageInternalInstance("navigateTo", fullPath, {}, meta);
...
...
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
a26d1ccd
...
...
@@ -1630,12 +1630,6 @@ const showShareMenu = {
const
hideHomeButton
=
{
name
:
'
hideBackHome
'
,
};
const
saveImageToPhotosAlbum
=
{
name
:
'
saveImage
'
,
args
:
{
filePath
:
'
url
'
,
},
};
const
saveVideoToPhotosAlbum
=
{
args
:
{
filePath
:
'
src
'
,
...
...
@@ -1703,7 +1697,6 @@ var protocols = /*#__PURE__*/Object.freeze({
getScreenBrightness
:
getScreenBrightness
,
showShareMenu
:
showShareMenu
,
hideHomeButton
:
hideHomeButton
,
saveImageToPhotosAlbum
:
saveImageToPhotosAlbum
,
saveVideoToPhotosAlbum
:
saveVideoToPhotosAlbum
,
chooseAddress
:
chooseAddress
,
redirectTo
:
redirectTo
,
...
...
packages/uni-uts-vite/package.json
浏览文件 @
a26d1ccd
...
...
@@ -28,10 +28,13 @@
"@dcloudio/uni-cli-shared"
:
"3.0.0-alpha-3050420220804003"
,
"@dcloudio/uni-shared"
:
"3.0.0-alpha-3050420220804003"
,
"@dcloudio/uts"
:
"3.0.0-alpha-3050420220804003"
,
"adm-zip"
:
"^0.5.9"
,
"execa"
:
"^5.1.1"
,
"fast-glob"
:
"^3.2.11"
,
"fs-extra"
:
"^10.0.0"
},
"devDependencies"
:
{
"@types/adm-zip"
:
"^0.5.0"
,
"@types/fs-extra"
:
"^9.0.13"
}
}
packages/uni-uts-vite/src/utils/compiler.ts
浏览文件 @
a26d1ccd
import
os
from
'
os
'
import
fs
from
'
fs-extra
'
import
path
from
'
path
'
import
execa
from
'
execa
'
import
AdmZip
from
'
adm-zip
'
import
{
sync
}
from
'
fast-glob
'
import
{
once
}
from
'
@dcloudio/uni-shared
'
import
type
{
parse
,
bundle
,
UtsTarget
}
from
'
@dcloudio/uts
'
import
{
normalizePath
}
from
'
@dcloudio/uni-cli-shared
'
...
...
@@ -69,13 +70,19 @@ export async function compile(filename: string) {
// 开发模式下,需要生成 dex
if
(
fs
.
existsSync
(
kotlinFile
))
{
time
=
Date
.
now
()
await
compileKotlin
(
kotlinFile
)
console
.
log
(
'
kotlin compile time:
'
+
(
Date
.
now
()
-
time
)
+
'
ms
'
)
const
{
getDefaultJar
,
compile
}
=
getCompilerServer
()
const
jarFile
=
resolveJarPath
(
kotlinFile
)
if
(
fs
.
existsSync
(
jarFile
))
{
time
=
Date
.
now
()
await
d8
(
jarFile
)
console
.
log
(
'
d8 compile time:
'
+
(
Date
.
now
()
-
time
)
+
'
ms
'
)
const
options
=
{
kotlinc
:
resolveKotlincArgs
(
kotlinFile
,
getDefaultJar
().
concat
(
resolveLibs
(
filename
))
),
d8
:
resolveD8Args
(
jarFile
),
}
const
res
=
await
compile
(
options
,
process
.
env
.
UNI_INPUT_DIR
)
console
.
log
(
'
dex compile time:
'
+
(
Date
.
now
()
-
time
)
+
'
ms
'
)
time
=
Date
.
now
()
if
(
res
)
{
try
{
fs
.
unlinkSync
(
jarFile
)
// 短期内先不删除,方便排查问题
...
...
@@ -90,6 +97,62 @@ export async function compile(filename: string) {
}
}
function
resolveKotlincArgs
(
filename
:
string
,
jars
:
string
[])
{
return
[
filename
,
'
-cp
'
,
resolveClassPath
(
jars
),
'
-d
'
,
resolveJarPath
(
filename
),
'
-kotlin-home
'
,
'
/Applications/HBuilderX-Alpha.app/Contents/HBuilderX/plugins/uniAppRun-Extension/kotlinc
'
,
]
}
function
resolveD8Args
(
filename
:
string
)
{
return
[
filename
,
'
--no-desugaring
'
,
'
--min-api
'
,
'
19
'
,
'
--output
'
,
resolveDexPath
(
filename
),
]
}
function
resolveLibs
(
filename
:
string
)
{
const
libsPath
=
path
.
resolve
(
path
.
dirname
(
filename
),
'
libs
'
)
const
libs
:
string
[]
=
[]
if
(
fs
.
existsSync
(
libsPath
))
{
libs
.
push
(...
sync
(
'
*.jar
'
,
{
cwd
:
libsPath
,
absolute
:
true
}))
const
zips
=
sync
(
'
*.aar
'
,
{
cwd
:
libsPath
})
zips
.
forEach
((
name
)
=>
{
const
outputPath
=
resolveAndroidArchiveOutputPath
(
name
)
if
(
!
fs
.
existsSync
(
outputPath
))
{
// 解压
const
zip
=
new
AdmZip
(
path
.
resolve
(
libsPath
,
name
))
zip
.
extractAllTo
(
outputPath
,
true
)
}
})
if
(
zips
.
length
)
{
libs
.
push
(
...
sync
(
'
*/*.jar
'
,
{
cwd
:
resolveAndroidArchiveOutputPath
(),
absolute
:
true
,
})
)
}
}
return
libs
}
function
resolveAndroidArchiveOutputPath
(
aar
?:
string
)
{
return
path
.
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
../.uts/aar
'
,
aar
?
aar
.
replace
(
'
.aar
'
,
''
)
:
''
)
}
function
resolveDexFile
(
jarFile
:
string
)
{
return
normalizePath
(
path
.
resolve
(
path
.
dirname
(
jarFile
),
'
classes.dex
'
))
}
...
...
@@ -104,56 +167,6 @@ function resolveKotlinFile(
.
replace
(
path
.
extname
(
filename
),
'
.kt
'
)
}
function
resolveDirs
():
{
kotlinc
:
string
;
d8
:
string
;
lib
:
string
}
{
// eslint-disable-next-line no-restricted-globals
return
require
(
path
.
resolve
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
uts-kotlin-compiler
'
))
}
const
resolveKotlinc
=
once
(()
=>
{
const
{
kotlinc
}
=
resolveDirs
()
return
path
.
resolve
(
kotlinc
,
'
bin
'
,
'
kotlinc
'
+
(
os
.
platform
()
===
'
win32
'
?
'
.bat
'
:
''
)
)
})
async
function
compileKotlin
(
filename
:
string
)
{
const
kotlinc
=
resolveKotlinc
()
await
execa
(
kotlinc
,
[
filename
,
'
-cp
'
,
resolveClassPath
(),
'
-d
'
,
resolveJarPath
(
filename
)],
{
stdio
:
'
inherit
'
,
}
)
}
async
function
d8
(
filename
:
string
)
{
const
java
=
resolveJavaPath
()
const
d8
=
resolveD8Path
()
await
execa
(
java
,
[
'
-cp
'
,
d8
,
'
com.android.tools.r8.D8
'
,
filename
,
'
--no-desugaring
'
,
'
--min-api
'
,
'
19
'
,
'
--output
'
,
resolveDexPath
(
filename
),
],
{
stdio
:
'
inherit
'
,
}
)
}
function
resolveDexPath
(
filename
:
string
)
{
return
path
.
dirname
(
filename
)
}
...
...
@@ -162,29 +175,22 @@ function resolveJarPath(filename: string) {
return
filename
.
replace
(
path
.
extname
(
filename
),
'
.jar
'
)
}
const
resolveBuiltInClassPath
=
once
(()
=>
{
const
libDir
=
resolveDirs
().
lib
return
fs
.
readdirSync
(
libDir
)
.
filter
((
file
)
=>
file
.
endsWith
(
'
.jar
'
))
.
map
((
file
)
=>
path
.
resolve
(
libDir
,
file
))
})
function
resolveClassPath
()
{
return
resolveBuiltInClassPath
().
join
(
os
.
platform
()
===
'
win32
'
?
'
;
'
:
'
:
'
)
function
resolveClassPath
(
jars
:
string
[])
{
return
jars
.
join
(
os
.
platform
()
===
'
win32
'
?
'
;
'
:
'
:
'
)
}
const
resolveJavaPath
=
once
(()
=>
{
return
path
.
resolve
(
const
getCompilerServer
=
once
(()
=>
{
// eslint-disable-next-line no-restricted-globals
return
require
(
path
.
resolve
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
amazon-corretto
'
,
'
bin/java
'
)
})
const
resolveD8Path
=
once
(()
=>
{
const
{
d8
}
=
resolveDirs
()
return
path
.
resolve
(
d8
,
'
d8.jar
'
)
'
uniAppRun-Extension/out/main.js
'
))
as
{
getDefaultJar
():
string
[]
compile
(
options
:
{
kotlinc
:
string
[];
d8
:
string
[]
},
projectPath
:
string
):
Promise
<
boolean
>
}
})
export
function
parsePackage
(
filepath
:
string
)
{
...
...
pnpm-lock.yaml
浏览文件 @
a26d1ccd
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录