Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
9aaf1bd2
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看板
提交
9aaf1bd2
编写于
6月 05, 2024
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip: uni_modules编译模式
上级
a4ab2875
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
125 addition
and
363 deletion
+125
-363
packages/uni-app-harmony/dist/uni.api.ets
packages/uni-app-harmony/dist/uni.api.ets
+62
-329
packages/uni-cli-shared/src/uni_modules.ts
packages/uni-cli-shared/src/uni_modules.ts
+8
-10
packages/uni-cli-shared/src/utils.ts
packages/uni-cli-shared/src/utils.ts
+8
-0
packages/uni-uts-v1/src/encrypt.ts
packages/uni-uts-v1/src/encrypt.ts
+18
-6
packages/uni-uts-v1/src/kotlin.ts
packages/uni-uts-v1/src/kotlin.ts
+9
-3
packages/uni-uts-v1/src/utils.ts
packages/uni-uts-v1/src/utils.ts
+8
-0
packages/uni-uts-v1/src/uvue/index.ts
packages/uni-uts-v1/src/uvue/index.ts
+10
-5
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
+2
-10
未找到文件。
packages/uni-app-harmony/dist/uni.api.ets
浏览文件 @
9aaf1bd2
此差异已折叠。
点击以展开。
packages/uni-cli-shared/src/uni_modules.ts
浏览文件 @
9aaf1bd2
...
...
@@ -3,7 +3,7 @@ import path from 'path'
import
fs
from
'
fs-extra
'
import
{
sync
}
from
'
fast-glob
'
import
type
{
UTSTargetLanguage
}
from
'
./uts
'
import
{
normalizePath
}
from
'
./utils
'
import
{
normalizePath
,
requireUniHelpers
}
from
'
./utils
'
import
{
genUTSComponentPublicInstanceIdent
}
from
'
./easycom
'
import
{
M
}
from
'
./messages
'
...
...
@@ -720,14 +720,15 @@ export async function checkEncryptUniModules(
)
if
(
zipFile
)
{
const
downloadFile
=
path
.
resolve
(
cacheDir
,
'
uni_modules.download.zip
'
)
const
{
C
,
D
,
R
,
U
}
=
require
(
path
.
join
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
uni_helpers
'
))
const
{
C
,
D
,
R
,
U
}
=
requireUniHelpers
()
try
{
const
isLogin
=
await
C
()
const
tips
=
process
.
env
.
UNI_UTS_PLATFORM
!==
'
app-android
'
?
'
(此过程耗时较长)
'
:
''
console
.
log
(
`正在云编译插件
${
isLogin
?
''
:
'
(请先登录)
'
}
:
${
modules
.
join
(
`正在云编译插件
${
isLogin
?
''
:
'
(请先登录)
'
}
${
tips
}
:
${
modules
.
join
(
'
,
'
)}
...`
)
...
...
@@ -769,10 +770,7 @@ export async function checkEncryptUniModules(
}
else
{
// android 平台需要在这里初始化
if
(
params
.
platform
===
'
app-android
'
)
{
const
{
R
}
=
require
(
path
.
join
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
uni_helpers
'
))
const
{
R
}
=
requireUniHelpers
()
R
({
dir
:
process
.
env
.
UNI_INPUT_DIR
,
cacheDir
:
process
.
env
.
UNI_MODULES_ENCRYPT_CACHE_DIR
,
...
...
packages/uni-cli-shared/src/utils.ts
浏览文件 @
9aaf1bd2
...
...
@@ -211,3 +211,11 @@ export function enableSourceMap() {
process
.
env
.
UNI_COMPILE_TARGET
!==
'
uni_modules
'
)
}
export
function
requireUniHelpers
()
{
require
(
path
.
resolve
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
uni_helpers/lib/bytenode
'
))
return
require
(
path
.
join
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
uni_helpers
'
))
}
packages/uni-uts-v1/src/encrypt.ts
浏览文件 @
9aaf1bd2
...
...
@@ -11,11 +11,12 @@ import {
resolveDexFile
,
resolveJarPath
,
}
from
'
./kotlin
'
import
{
getCompilerServer
}
from
'
./utils
'
import
{
getCompilerServer
,
requireUniHelpers
}
from
'
./utils
'
import
{
restoreDex
}
from
'
./manifest
'
import
{
sync
}
from
'
fast-glob
'
import
{
resolveDexCacheFile
}
from
'
./manifest/dex
'
import
type
{
CompileResult
}
from
'
./index
'
import
{
hbuilderFormatter
}
from
'
./stacktrace/kotlin
'
export
function
isEncrypt
(
pluginDir
:
string
)
{
return
fs
.
existsSync
(
path
.
resolve
(
pluginDir
,
'
encrypt
'
))
...
...
@@ -195,10 +196,7 @@ async function compileEncryptByUniHelpers(pluginDir: string) {
}
// development
if
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
)
{
const
{
DUM
}
=
require
(
path
.
join
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
uni_helpers
'
))
const
{
DUM
}
=
requireUniHelpers
()
const
ktFiles
:
Record
<
string
,
string
>
=
sync
(
'
**/*.kt
'
,
{
absolute
:
false
,
...
...
@@ -242,7 +240,21 @@ async function compileEncryptByUniHelpers(pluginDir: string) {
jarFile
,
''
,
depJars
,
createStderrListener
(
outputDir
,
resolveSourceMapPath
(),
waiting
)
createStderrListener
(
outputDir
,
resolveSourceMapPath
(),
waiting
,
(
m
)
=>
{
if
(
m
.
file
)
{
const
file
=
normalizePath
(
m
.
file
)
if
(
file
.
startsWith
(
outputPluginDir
))
{
// 过滤部分插件的非错误信息
if
(
m
.
type
!==
'
error
'
)
{
return
''
}
else
{
// 移除完整路径
m
.
file
=
pluginDir
}
}
}
return
hbuilderFormatter
(
m
)
})
)
// 等待 stderrListener 执行完毕
if
(
waiting
.
done
)
{
...
...
packages/uni-uts-v1/src/kotlin.ts
浏览文件 @
9aaf1bd2
...
...
@@ -363,7 +363,12 @@ export async function runKotlinDev(
jarFile
,
resolveSourceMapFile
(
outputDir
,
kotlinFile
),
extraJars
.
concat
(
depJars
),
createStderrListener
(
outputDir
,
resolveSourceMapPath
(),
waiting
)
createStderrListener
(
outputDir
,
resolveSourceMapPath
(),
waiting
,
hbuilderFormatter
)
)
// 等待 stderrListener 执行完毕
...
...
@@ -829,7 +834,8 @@ function createPluginGlob(plugins?: string[]) {
export
function
createStderrListener
(
inputDir
:
string
,
sourceMapDir
:
string
,
waiting
:
{
done
:
Promise
<
void
>
|
undefined
}
waiting
:
{
done
:
Promise
<
void
>
|
undefined
},
format
:
(
msg
:
MessageSourceLocation
)
=>
string
)
{
return
async
function
stderrListener
(
data
:
any
)
{
waiting
.
done
=
new
Promise
(
async
(
resolve
)
=>
{
...
...
@@ -855,7 +861,7 @@ export function createStderrListener(
inputDir
,
sourceMapDir
,
replaceTabsWithSpace
:
true
,
format
:
hbuilderFormatter
,
format
,
})
if
(
msg
)
{
// 异步输出,保证插件编译失败的日志在他之前输出,不能使用process.nextTick
...
...
packages/uni-uts-v1/src/utils.ts
浏览文件 @
9aaf1bd2
...
...
@@ -788,3 +788,11 @@ function formatExtApiProviderName(service: string, name: string) {
camelize
(
name
)
)}
Provider`
}
export
function
requireUniHelpers
()
{
require
(
path
.
resolve
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
uni_helpers/lib/bytenode
'
))
return
require
(
path
.
join
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
uni_helpers
'
))
}
packages/uni-uts-v1/src/uvue/index.ts
浏览文件 @
9aaf1bd2
...
...
@@ -33,7 +33,10 @@ import {
resolveUniAppXSourceMapPath
,
shouldAutoImportUniCloud
,
}
from
'
../utils
'
import
type
{
KotlinManifestCache
}
from
'
../stacktrace/kotlin
'
import
{
type
KotlinManifestCache
,
hbuilderFormatter
,
}
from
'
../stacktrace/kotlin
'
import
{
isWindows
}
from
'
../shared
'
const
DEFAULT_IMPORTS
=
[
...
...
@@ -353,7 +356,8 @@ async function runKotlinDev(
const
cacheDir
=
process
.
env
.
HX_DEPENDENCIES_DIR
||
''
const
kotlinClassOutDir
=
kotlinClassDir
(
kotlinRootOutDir
)
const
waiting
=
{
done
:
undefined
}
const
options
=
{
const
compileOptions
=
{
version
:
'
v2
'
,
pageCount
,
kotlinc
:
resolveKotlincArgs
(
...
...
@@ -377,12 +381,13 @@ async function runKotlinDev(
stderrListener
:
createStderrListener
(
kotlinSrcOutDir
,
resolveUniAppXSourceMapPath
(
kotlinRootOutDir
),
waiting
waiting
,
hbuilderFormatter
),
}
result
.
kotlinc
=
true
// console.log('DEX编译参数:',
o
ptions)
const
{
code
,
msg
,
data
}
=
await
compileDex
(
o
ptions
,
inputDir
)
// console.log('DEX编译参数:',
compileO
ptions)
const
{
code
,
msg
,
data
}
=
await
compileDex
(
compileO
ptions
,
inputDir
)
// 等待 stderrListener 执行完毕
if
(
waiting
.
done
)
{
await
waiting
.
done
...
...
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
浏览文件 @
9aaf1bd2
import
path
from
'
path
'
// import debug from 'debug'
import
{
extend
,
isString
}
from
'
@vue/shared
'
import
type
{
Plugin
,
ResolvedConfig
}
from
'
vite
'
import
type
{
FilterPattern
}
from
'
@rollup/pluginutils
'
import
{
COMMON_EXCLUDE
}
from
'
@dcloudio/uni-cli-shared
'
import
{
COMMON_EXCLUDE
,
requireUniHelpers
}
from
'
@dcloudio/uni-cli-shared
'
import
type
{
VitePluginUniResolvedOptions
}
from
'
../..
'
import
{
uniPrePlugin
}
from
'
./pre
'
...
...
@@ -71,14 +70,7 @@ export function initPlugins(
process
.
env
.
UNI_COMPILE_TARGET
!==
'
uni_modules
'
)
{
try
{
require
(
path
.
resolve
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
uni_helpers/lib/bytenode
'
))
const
{
V
}
=
require
(
path
.
join
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
'
uni_helpers
'
))
const
{
V
}
=
requireUniHelpers
()
addPlugin
(
plugins
,
V
({
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录