Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小浣熊撸代码
uni-app
提交
bd5e90b4
U
uni-app
项目概览
小浣熊撸代码
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bd5e90b4
编写于
5月 13, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add component css dependency configuration
上级
2680cafb
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
29 addition
and
23 deletion
+29
-23
packages/playground/ssr/src/components/ssr-image/ssr-image.vue
...ges/playground/ssr/src/components/ssr-image/ssr-image.vue
+3
-0
packages/playground/ssr/src/pages/index/index.vue
packages/playground/ssr/src/pages/index/index.vue
+1
-0
packages/uni-cli-shared/src/deps.ts
packages/uni-cli-shared/src/deps.ts
+14
-1
packages/uni-cli-shared/src/index.ts
packages/uni-cli-shared/src/index.ts
+1
-1
packages/vite-plugin-uni/src/configResolved/plugins/easycom.ts
...ges/vite-plugin-uni/src/configResolved/plugins/easycom.ts
+5
-16
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
+2
-2
packages/vite-plugin-uni/src/configResolved/plugins/pagesJson.ts
...s/vite-plugin-uni/src/configResolved/plugins/pagesJson.ts
+3
-3
未找到文件。
packages/playground/ssr/src/components/ssr-image/ssr-image.vue
0 → 100644
浏览文件 @
bd5e90b4
<
template
>
<image
src=
"/static/logo.png"
/>
</
template
>
\ No newline at end of file
packages/playground/ssr/src/pages/index/index.vue
浏览文件 @
bd5e90b4
...
...
@@ -2,6 +2,7 @@
<ssr-cover-image
/>
<ssr-cover-view
/>
<ssr-icon
/>
<ssr-image
/>
<!--
<ssr-match-media
/>
-->
<!--
<ssr-movable-area
/>
-->
<ssr-progress
/>
...
...
packages/uni-cli-shared/src/
api
.ts
→
packages/uni-cli-shared/src/
deps
.ts
浏览文件 @
bd5e90b4
import
{
BASE_COMPONENTS_STYLE_PATH
,
H5_API_STYLE_PATH
}
from
'
./constants
'
export
const
API_
STYLE
S
=
{
export
const
API_
DEPS_CS
S
=
{
showModal
:
[
`
${
H5_API_STYLE_PATH
}
/modal.css`
],
showToast
:
[
`
${
H5_API_STYLE_PATH
}
/toast.css`
],
showActionSheet
:
[
`
${
H5_API_STYLE_PATH
}
/action-sheet.css`
],
...
...
@@ -12,3 +12,16 @@ export const API_STYLES = {
],
openLocation
:
[
`
${
H5_API_STYLE_PATH
}
/location-view.css`
],
}
const
RESIZE_SENSOR_CSS
=
BASE_COMPONENTS_STYLE_PATH
+
'
resize-sensor.css
'
export
const
COMPONENT_DEPS_CSS
=
{
canvas
:
[
RESIZE_SENSOR_CSS
],
image
:
[
RESIZE_SENSOR_CSS
],
'
movable-area
'
:
[
RESIZE_SENSOR_CSS
],
'
picker-view
'
:
[
RESIZE_SENSOR_CSS
],
'
picker-view-column
'
:
[
RESIZE_SENSOR_CSS
],
'
rich-text
'
:
[
RESIZE_SENSOR_CSS
],
textarea
:
[
RESIZE_SENSOR_CSS
],
'
web-view
'
:
[
RESIZE_SENSOR_CSS
],
}
packages/uni-cli-shared/src/index.ts
浏览文件 @
bd5e90b4
export
*
from
'
./api
'
export
*
from
'
./ssr
'
export
*
from
'
./uni
'
export
*
from
'
./url
'
export
*
from
'
./deps
'
export
*
from
'
./json
'
export
*
from
'
./utils
'
export
*
from
'
./constants
'
...
...
packages/vite-plugin-uni/src/configResolved/plugins/easycom.ts
浏览文件 @
bd5e90b4
...
...
@@ -8,6 +8,7 @@ import {
EXTNAME_VUE
,
H5_COMPONENTS_STYLE_PATH
,
BASE_COMPONENTS_STYLE_PATH
,
COMPONENT_DEPS_CSS
,
parseVueRequest
,
}
from
'
@dcloudio/uni-cli-shared
'
...
...
@@ -48,17 +49,6 @@ const baseComponents = [
'
view
'
,
]
const
resizeComponents
=
[
'
canvas
'
,
'
image
'
,
'
movable-area
'
,
'
picker-view
'
,
'
picker-view-column
'
,
'
rich-text
'
,
'
textarea
'
,
'
web-view
'
,
]
export
function
uniEasycomPlugin
(
options
:
UniPluginFilterOptions
):
Plugin
{
const
filter
=
createFilter
(
options
.
include
,
options
.
exclude
)
return
{
...
...
@@ -110,11 +100,6 @@ function addBuiltInImportDeclaration(
local
:
string
,
name
:
string
)
{
if
(
resizeComponents
.
includes
(
name
))
{
importDeclarations
.
push
(
`import '
${
BASE_COMPONENTS_STYLE_PATH
+
'
resize-sensor.css
'
}
';`
)
}
if
(
baseComponents
.
includes
(
name
))
{
importDeclarations
.
push
(
`import '
${
BASE_COMPONENTS_STYLE_PATH
+
name
+
'
.css
'
}
';`
...
...
@@ -124,6 +109,10 @@ function addBuiltInImportDeclaration(
`import '
${
H5_COMPONENTS_STYLE_PATH
+
name
+
'
.css
'
}
';`
)
}
const
deps
=
COMPONENT_DEPS_CSS
[
name
as
keyof
typeof
COMPONENT_DEPS_CSS
]
if
(
deps
)
{
deps
.
forEach
((
dep
)
=>
importDeclarations
.
push
(
`import '
${
dep
}
';`
))
}
return
addImportDeclaration
(
importDeclarations
,
local
,
...
...
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
浏览文件 @
bd5e90b4
...
...
@@ -4,7 +4,7 @@ import { Plugin, ResolvedConfig } from 'vite'
import
{
FilterPattern
}
from
'
@rollup/pluginutils
'
import
vue
from
'
@vitejs/plugin-vue
'
import
{
API_
STYLE
S
}
from
'
@dcloudio/uni-cli-shared
'
import
{
API_
DEPS_CS
S
}
from
'
@dcloudio/uni-cli-shared
'
import
{
VitePluginUniResolvedOptions
}
from
'
../..
'
import
{
uniPrePlugin
}
from
'
./pre
'
...
...
@@ -72,7 +72,7 @@ const uniInjectPluginOptions: Partial<InjectOptions> = {
callback
(
imports
,
mod
)
{
const
styles
=
mod
[
0
]
===
'
@dcloudio/uni-h5
'
&&
API_
STYLES
[
mod
[
1
]
as
keyof
typeof
API_STYLE
S
]
API_
DEPS_CSS
[
mod
[
1
]
as
keyof
typeof
API_DEPS_CS
S
]
if
(
!
styles
)
{
return
}
...
...
packages/vite-plugin-uni/src/configResolved/plugins/pagesJson.ts
浏览文件 @
bd5e90b4
...
...
@@ -8,7 +8,7 @@ import {
H5_FRAMEWORK_STYLE_PATH
,
BASE_COMPONENTS_STYLE_PATH
,
normalizePagesJson
,
API_
STYLE
S
,
API_
DEPS_CS
S
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
VitePluginUniResolvedOptions
}
from
'
../..
'
import
{
FEATURE_DEFINES
}
from
'
../../utils
'
...
...
@@ -147,8 +147,8 @@ function generateCssCode(
}
if
(
options
.
command
===
'
serve
'
)
{
// 开发模式,自动添加所有API相关css
Object
.
keys
(
API_
STYLE
S
).
forEach
((
name
)
=>
{
const
styles
=
API_
STYLES
[
name
as
keyof
typeof
API_STYLE
S
]
Object
.
keys
(
API_
DEPS_CS
S
).
forEach
((
name
)
=>
{
const
styles
=
API_
DEPS_CSS
[
name
as
keyof
typeof
API_DEPS_CS
S
]
styles
.
forEach
((
style
)
=>
{
if
(
!
cssFiles
.
includes
(
style
))
{
cssFiles
.
push
(
style
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录