Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
0f89a16a
U
uni-app
项目概览
DCloud
/
uni-app
6 个月 前同步成功
通知
750
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看板
提交
0f89a16a
编写于
5月 16, 2024
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip: uni_modules 编译模式
上级
ad023b0b
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
92 addition
and
26 deletion
+92
-26
packages/playground/__tests__/__snapshots__/uni_modules.spec.ts.snap
...ayground/__tests__/__snapshots__/uni_modules.spec.ts.snap
+9
-9
packages/playground/uni_modules/src/uni_modules/test-com2/components/test-com2-1/test-com2-1.vue
..._modules/test-com2/components/test-com2-1/test-com2-1.vue
+1
-1
packages/uni-app-plus/dist/style.css
packages/uni-app-plus/dist/style.css
+1
-1
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+4
-3
packages/uni-app-uts/src/plugins/android/uvue/compiler/codegen.ts
.../uni-app-uts/src/plugins/android/uvue/compiler/codegen.ts
+54
-8
packages/uni-h5/dist-x/uni-h5.cjs.js
packages/uni-h5/dist-x/uni-h5.cjs.js
+7
-1
packages/uni-h5/dist-x/uni-h5.es.js
packages/uni-h5/dist-x/uni-h5.es.js
+7
-1
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+1
-0
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+1
-0
packages/uni-uts-v1/src/encrypt.ts
packages/uni-uts-v1/src/encrypt.ts
+7
-2
未找到文件。
packages/playground/__tests__/__snapshots__/uni_modules.spec.ts.snap
浏览文件 @
0f89a16a
...
...
@@ -241,7 +241,7 @@ open class GenUniModulesTestCom2ComponentsTestCom21TestCom21 : VueComponent {
createElementVNode("
image
", utsMapOf("
src
" to _ctx.api), null, 8, utsArrayOf(
"
src
"
)),
createElementVNode("
video
")
createElementVNode("
video
"
, utsMapOf("
src
" to "
https
://
qiniu
-
web
-
assets
.
dcloud
.
net
.
cn
/
video
/
sample
/
2
minute
-
demo
.
mp4
")
)
), 64);
}
open var msg: String by \`$data\`;
...
...
@@ -460,7 +460,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock(Fragment, null, [
createElementVNode("
text
", { class: "
text
" }, toDisplayString($data.msg) + toDisplayString($data.api), 1),
createElementVNode("
image
", { src: $data.api }, null, 8, ["
src
"]),
createElementVNode("
video
")
createElementVNode("
video
"
, { src: "
https
://
qiniu
-
web
-
assets
.
dcloud
.
net
.
cn
/
video
/
sample
/
2
minute
-
demo
.
mp4
" }
)
], 64);
}
const testCom21 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["
render
", _sfc_render$1], ["
styles
", [_style_0$1]]]);
...
...
@@ -617,10 +617,10 @@ exports[`uni_modules playground uni-app-x build:h5 5`] = `
.text[data-v-
d600df3c
] {
.text[data-v-
e2332c62
] {
color: red;
}
.image[data-v-
d600df3c
] {
.image[data-v-
e2332c62
] {
background: url('@/uni_modules/test-com2/components/test-com2-1/api.png');
}
"
...
...
@@ -668,10 +668,10 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
_: 1
}),
createVNode(_component_v_uni_image, { src: $data.api }, null, 8, ["
src
"]),
createVNode(_component_v_uni_video)
createVNode(_component_v_uni_video
, { src: "
https
://
qiniu
-
web
-
assets
.
dcloud
.
net
.
cn
/
video
/
sample
/
2
minute
-
demo
.
mp4
" }
)
], 64);
}
const testCom21 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["
render
", _sfc_render$1], ["
__scopeId
", "
data
-
v
-
d600df3c
"]]);
const testCom21 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["
render
", _sfc_render$1], ["
__scopeId
", "
data
-
v
-
e2332c62
"]]);
const _sfc_main = defineComponent({
data() {
return {
...
...
@@ -958,7 +958,7 @@ open class GenUniModulesTestCom2ComponentsTestCom21TestCom21 : VueComponent {
createElementVNode("
image
", utsMapOf("
src
" to _ctx.api), null, 8, utsArrayOf(
"
src
"
)),
createElementVNode("
video
")
createElementVNode("
video
"
, utsMapOf("
src
" to "
https
://
qiniu
-
web
-
assets
.
dcloud
.
net
.
cn
/
video
/
sample
/
2
minute
-
demo
.
mp4
")
)
), 64);
}
open var msg: String by \`$data\`;
...
...
@@ -1212,7 +1212,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
/* TEXT */
),
createElementVNode("
image
", { src: $data.api }, null, 8, ["
src
"]),
createElementVNode("
video
")
createElementVNode("
video
"
, { src: "
https
://
qiniu
-
web
-
assets
.
dcloud
.
net
.
cn
/
video
/
sample
/
2
minute
-
demo
.
mp4
" }
)
],
64
/* STABLE_FRAGMENT */
...
...
@@ -1465,7 +1465,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
/* STABLE */
}),
createVNode(_component_v_uni_image, { src: $data.api }, null, 8, ["
src
"]),
createVNode(_component_v_uni_video)
createVNode(_component_v_uni_video
, { src: "
https
://
qiniu
-
web
-
assets
.
dcloud
.
net
.
cn
/
video
/
sample
/
2
minute
-
demo
.
mp4
" }
)
],
64
/* STABLE_FRAGMENT */
...
...
packages/playground/uni_modules/src/uni_modules/test-com2/components/test-com2-1/test-com2-1.vue
浏览文件 @
0f89a16a
<
template
>
<text
class=
"text"
>
{{
msg
}}{{
api
}}
</text>
<image
:src=
"api"
/>
<video
/>
<video
src=
"https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4"
/>
</
template
>
<
script
>
import
Api
from
'
./api.png
'
...
...
packages/uni-app-plus/dist/style.css
浏览文件 @
0f89a16a
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
0f89a16a
...
...
@@ -13262,15 +13262,15 @@ function parseTheme(pageStyle) {
function useTabBarThemeChange(tabBar, options) {
if (__uniConfig.darkmode) {
const fn = () => {
const { list = [], color, selectedColor, backgroundColor, borderStyle, } = parseTheme(options);
tabBar &&
const { list = [], color, selectedColor, backgroundColor, borderStyle,
midButton,
} = parseTheme(options);
if (tabBar) {
tabBar.setTabBarStyle({
color,
selectedColor,
backgroundColor,
borderStyle,
midButton,
});
tabBar &&
tabBar.setTabBarItems({
list: list.map((item) => ({
iconPath: item.iconPath,
...
...
@@ -13278,6 +13278,7 @@ function useTabBarThemeChange(tabBar, options) {
visible: item.visible,
})),
});
}
};
// 由于应用首次启动获取不到手机 theme 应用首次启动设置下 tabBar
fn();
...
...
packages/uni-app-uts/src/plugins/android/uvue/compiler/codegen.ts
浏览文件 @
0f89a16a
...
...
@@ -34,7 +34,14 @@ import {
locStub
,
toValidAssetId
,
}
from
'
@vue/compiler-core
'
import
{
NOOP
,
isArray
,
isString
,
isSymbol
}
from
'
@vue/shared
'
import
{
NOOP
,
camelize
,
capitalize
,
isArray
,
isString
,
isSymbol
,
}
from
'
@vue/shared
'
import
{
type
ParserPlugin
,
parseExpression
}
from
'
@babel/parser
'
import
{
isCompoundExpressionNode
,
...
...
@@ -318,8 +325,17 @@ function genEasyComImports(
}
const
source
=
matchEasyCom
(
id
,
true
)
if
(
source
)
{
const
componentId
=
toValidAssetId
(
id
,
'
easycom
'
as
'
component
'
)
push
(
`import
${
componentId
}
from '
${
source
}
'`
)
if
(
source
.
includes
(
'
?uts-proxy
'
))
{
push
(
`import {
${
genEncryptUniModuleEasyComClass
(
id
,
parseUniModuleId
(
source
)
)}
} from '
${
source
}
';`
)
}
else
{
const
componentId
=
toValidAssetId
(
id
,
'
easycom
'
as
'
component
'
)
push
(
`import
${
componentId
}
from '
${
source
}
'`
)
}
newline
()
}
}
...
...
@@ -352,12 +368,25 @@ function genAssets(
if
(
type
===
'
component
'
)
{
const
source
=
matchEasyCom
(
id
,
false
)
if
(
source
)
{
const
easyComponentId
=
toValidAssetId
(
id
,
'
easycom
'
as
'
component
'
)
let
importCode
=
''
const
componentId
=
toValidAssetId
(
id
,
type
)
assetCode
=
`const
${
componentId
}
=
${
helper
(
RESOLVE_EASY_COMPONENT
)}
(
${
JSON
.
stringify
(
id
)}
,
${
easyComponentId
}
)`
const
importCode
=
`import
${
easyComponentId
}
from '
${
source
}
';`
// 加密 easyCom
if
(
source
.
includes
(
'
?uts-proxy
'
))
{
const
easyComponentId
=
genEncryptUniModuleEasyComClass
(
id
,
parseUniModuleId
(
source
)
)
assetCode
=
`const
${
componentId
}
=
${
helper
(
RESOLVE_EASY_COMPONENT
)}
(
${
JSON
.
stringify
(
id
)}
,
${
easyComponentId
}
)`
importCode
=
`import {
${
easyComponentId
}
} from '
${
source
}
';`
}
else
{
const
easyComponentId
=
toValidAssetId
(
id
,
'
easycom
'
as
'
component
'
)
assetCode
=
`const
${
componentId
}
=
${
helper
(
RESOLVE_EASY_COMPONENT
)}
(
${
JSON
.
stringify
(
id
)}
,
${
easyComponentId
}
)`
importCode
=
`import
${
easyComponentId
}
from '
${
source
}
';`
}
if
(
!
importEasyComponents
.
includes
(
importCode
))
{
importEasyComponents
.
push
(
importCode
)
addEasyComponentAutoImports
(
...
...
@@ -384,6 +413,23 @@ function genAssets(
}
}
function
parseUniModuleId
(
source
:
string
)
{
const
parts
=
source
.
split
(
'
/
'
)
return
parts
[
parts
.
length
-
1
].
replace
(
'
?uts-proxy
'
,
''
)
}
// GenUniModulesTestCom1ComponentsTestCom11TestCom11Class
function
genEncryptUniModuleEasyComClass
(
componentName
:
string
,
uniModuleId
:
string
)
{
return
capitalize
(
camelize
(
`gen-uni-modules-
${
uniModuleId
}
-components-
${
componentName
}
-
${
componentName
}
-class`
)
)
}
function
isText
(
n
:
string
|
CodegenNode
)
{
return
(
isString
(
n
)
||
...
...
packages/uni-h5/dist-x/uni-h5.cjs.js
浏览文件 @
0f89a16a
...
...
@@ -12940,6 +12940,7 @@ const TabBar = /* @__PURE__ */ defineSystemComponent({
tabBar2
.
color
=
tabBarStyle
.
color
;
tabBar2
.
selectedColor
=
tabBarStyle
.
selectedColor
;
tabBar2
.
blurEffect
=
tabBarStyle
.
blurEffect
;
tabBar2
.
midButton
=
tabBarStyle
.
midButton
;
if
(
tabBarStyle
.
list
&&
tabBarStyle
.
list
.
length
)
{
tabBarStyle
.
list
.
forEach
((
item
,
index2
)
=>
{
tabBar2
.
list
[
index2
].
iconPath
=
item
.
iconPath
;
...
...
@@ -13569,8 +13570,13 @@ function updateBackgroundColorContent(backgroundColorContent) {
}
function
useBackgroundColorContent
(
pageMeta
)
{
function
update
()
{
updateBackgroundColorContent
(
pageMeta
.
backgroundColorContent
||
""
);
if
(
pageMeta
.
backgroundColorContent
)
{
updateBackgroundColorContent
(
parseTheme
({
backgroundColorContent
:
pageMeta
.
backgroundColorContent
}).
backgroundColorContent
);
}
}
onThemeChange
(
update
);
vue
.
watchEffect
(
update
);
}
function
usePageHeadTransparentBackgroundColor
(
backgroundColor
)
{
...
...
packages/uni-h5/dist-x/uni-h5.es.js
浏览文件 @
0f89a16a
...
...
@@ -24200,6 +24200,7 @@ const TabBar = /* @__PURE__ */ defineSystemComponent({
tabBar2.color = tabBarStyle.color;
tabBar2.selectedColor = tabBarStyle.selectedColor;
tabBar2.blurEffect = tabBarStyle.blurEffect;
tabBar2.midButton = tabBarStyle.midButton;
if (tabBarStyle.list && tabBarStyle.list.length) {
tabBarStyle.list.forEach((item, index2) => {
tabBar2.list[index2].iconPath = item.iconPath;
...
...
@@ -26835,8 +26836,13 @@ function updateBackgroundColorContent(backgroundColorContent) {
}
function useBackgroundColorContent(pageMeta) {
function update() {
updateBackgroundColorContent(pageMeta.backgroundColorContent || "");
if (pageMeta.backgroundColorContent) {
updateBackgroundColorContent(
parseTheme({ backgroundColorContent: pageMeta.backgroundColorContent }).backgroundColorContent
);
}
}
onThemeChange$2(update);
watchEffect(update);
onActivated(update);
}
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
0f89a16a
...
...
@@ -11618,6 +11618,7 @@ const TabBar = /* @__PURE__ */ defineSystemComponent({
tabBar2
.
color
=
tabBarStyle
.
color
;
tabBar2
.
selectedColor
=
tabBarStyle
.
selectedColor
;
tabBar2
.
blurEffect
=
tabBarStyle
.
blurEffect
;
tabBar2
.
midButton
=
tabBarStyle
.
midButton
;
if
(
tabBarStyle
.
list
&&
tabBarStyle
.
list
.
length
)
{
tabBarStyle
.
list
.
forEach
((
item
,
index2
)
=>
{
tabBar2
.
list
[
index2
].
iconPath
=
item
.
iconPath
;
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
0f89a16a
...
...
@@ -22418,6 +22418,7 @@ const TabBar = /* @__PURE__ */ defineSystemComponent({
tabBar2.color = tabBarStyle.color;
tabBar2.selectedColor = tabBarStyle.selectedColor;
tabBar2.blurEffect = tabBarStyle.blurEffect;
tabBar2.midButton = tabBarStyle.midButton;
if (tabBarStyle.list && tabBarStyle.list.length) {
tabBarStyle.list.forEach((item, index2) => {
tabBar2.list[index2].iconPath = item.iconPath;
...
...
packages/uni-uts-v1/src/encrypt.ts
浏览文件 @
0f89a16a
...
...
@@ -156,7 +156,7 @@ async function compileEncryptByUniHelpers(pluginDir: string) {
addInjectComponents
(
pkg
.
uni_modules
?.
artifacts
?.
components
||
[])
return
{
dir
:
outputPluginDir
,
code
:
''
,
code
:
'
export default {}
'
,
deps
:
[]
as
string
[],
encrypt
:
true
,
inject_apis
,
...
...
@@ -230,11 +230,16 @@ async function compileEncryptByUniHelpers(pluginDir: string) {
}
else
if
(
msg
)
{
console
.
error
(
msg
)
}
const
assets
=
path
.
resolve
(
cachePluginDir
,
'
assets
'
)
if
(
fs
.
existsSync
(
assets
))
{
fs
.
copySync
(
assets
,
path
.
resolve
(
outputDir
,
pluginRelativeDir
,
'
assets
'
))
}
}
return
{
dir
:
outputPluginDir
,
code
:
''
,
code
:
'
export default {}
'
,
deps
:
[]
as
string
[],
encrypt
:
true
,
inject_apis
:
[],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录