Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzj-java
uni-app
提交
829df827
U
uni-app
项目概览
wzj-java
/
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,发现更多精彩内容 >>
提交
829df827
编写于
11月 10, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(cli): copy assets (uni_modules)
上级
1d3a6119
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
86 addition
and
27 deletion
+86
-27
lib/h5/uni.config.js
lib/h5/uni.config.js
+7
-3
packages/uni-app-plus/lib/uni.config.js
packages/uni-app-plus/lib/uni.config.js
+3
-0
packages/uni-mp-alipay/lib/uni.config.js
packages/uni-mp-alipay/lib/uni.config.js
+7
-3
packages/uni-mp-baidu/lib/uni.config.js
packages/uni-mp-baidu/lib/uni.config.js
+7
-3
packages/uni-mp-kuaishou/lib/uni.config.js
packages/uni-mp-kuaishou/lib/uni.config.js
+8
-4
packages/uni-mp-qq/lib/uni.config.js
packages/uni-mp-qq/lib/uni.config.js
+12
-2
packages/uni-mp-toutiao/lib/uni.config.js
packages/uni-mp-toutiao/lib/uni.config.js
+7
-3
packages/uni-mp-weixin/lib/uni.config.js
packages/uni-mp-weixin/lib/uni.config.js
+13
-3
packages/vue-cli-plugin-uni/lib/copy-webpack-options.js
packages/vue-cli-plugin-uni/lib/copy-webpack-options.js
+9
-1
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+12
-0
packages/webpack-uni-pages-loader/lib/uni_modules.js
packages/webpack-uni-pages-loader/lib/uni_modules.js
+1
-5
未找到文件。
lib/h5/uni.config.js
浏览文件 @
829df827
const
fs
=
require
(
'
fs
'
)
const
path
=
require
(
'
path
'
)
function
getTemplatePath
(
template
)
{
function
getTemplatePath
(
template
)
{
if
(
template
)
{
const
userTemplate
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
template
)
if
(
fs
.
existsSync
(
userTemplate
))
...
...
@@ -40,12 +40,16 @@ module.exports = {
vue
:
'
@dcloudio/vue-cli-plugin-uni/packages/h5-vue
'
},
copyWebpackOptions
(
platformOptions
,
vueOptions
)
{
return
[{
const
copyOptions
=
[{
from
:
require
.
resolve
(
'
@dcloudio/uni-h5/dist/index.css
'
),
to
:
getIndexCssPath
(
vueOptions
.
assetsDir
,
platformOptions
.
template
),
transform
},
'
hybrid/html
'
]
global
.
uniModules
.
forEach
(
module
=>
{
copyOptions
.
push
(
'
uni_modules/
'
+
module
+
'
/hybrid/html
'
)
})
return
copyOptions
}
}
packages/uni-app-plus/lib/uni.config.js
浏览文件 @
829df827
...
...
@@ -33,6 +33,9 @@ module.exports = {
copyOptions
.
push
(
componentsCopyOption
)
}
copyOptions
.
push
(
'
hybrid/html
'
)
global
.
uniModules
.
forEach
(
module
=>
{
copyOptions
.
push
(
'
uni_modules/
'
+
module
+
'
/hybrid/html
'
)
})
if
(
process
.
env
.
UNI_USING_V3
)
{
// TODO 将仅保留v3逻辑
copyOptions
.
push
(
path
.
resolve
(
__dirname
,
'
../dist/view.css
'
))
copyOptions
.
push
(
path
.
resolve
(
__dirname
,
'
../dist/view.umd.min.js
'
))
...
...
packages/uni-mp-alipay/lib/uni.config.js
浏览文件 @
829df827
...
...
@@ -17,6 +17,10 @@ module.exports = {
subPackages
:
true
},
copyWebpackOptions
(
platformOptions
,
vueOptions
)
{
return
[
'
mycomponents
'
]
const
copyOptions
=
[
'
mycomponents
'
]
global
.
uniModules
.
forEach
(
module
=>
{
copyOptions
.
push
(
'
uni_modules/
'
+
module
+
'
/mycomponents
'
)
})
return
copyOptions
}
}
packages/uni-mp-baidu/lib/uni.config.js
浏览文件 @
829df827
...
...
@@ -17,6 +17,10 @@ module.exports = {
subPackages
:
true
},
copyWebpackOptions
(
platformOptions
,
vueOptions
)
{
return
[
'
swancomponents
'
]
const
copyOptions
=
[
'
swancomponents
'
]
global
.
uniModules
.
forEach
(
module
=>
{
copyOptions
.
push
(
'
uni_modules/
'
+
module
+
'
/swancomponents
'
)
})
return
copyOptions
}
}
packages/uni-mp-kuaishou/lib/uni.config.js
浏览文件 @
829df827
...
...
@@ -14,6 +14,10 @@ module.exports = {
project
:
'
project.ks.json
'
},
copyWebpackOptions
(
platformOptions
,
vueOptions
)
{
return
[
'
kscomponents
'
]
const
copyOptions
=
[
'
kscomponents
'
]
global
.
uniModules
.
forEach
(
module
=>
{
copyOptions
.
push
(
'
uni_modules/
'
+
module
+
'
/kscomponents
'
)
})
return
copyOptions
}
}
packages/uni-mp-qq/lib/uni.config.js
浏览文件 @
829df827
...
...
@@ -38,6 +38,16 @@ module.exports = {
ignore
:
[
'
**/*.vue
'
,
'
**/*.css
'
]
// v3 会自动转换生成vue,css文件,需要过滤
})
}
global
.
uniModules
.
forEach
(
module
=>
{
const
wxcomponentsDir
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
uni_modules
'
,
module
,
COMPONENTS_DIR_NAME
)
if
(
fs
.
existsSync
(
wxcomponentsDir
))
{
copyOptions
.
push
({
from
:
wxcomponentsDir
,
to
:
'
uni_modules/
'
+
module
+
'
/
'
+
COMPONENTS_DIR_NAME
,
ignore
:
[
'
**/*.vue
'
,
'
**/*.css
'
]
// v3 会自动转换生成vue,css文件,需要过滤
})
}
})
return
copyOptions
}
}
packages/uni-mp-toutiao/lib/uni.config.js
浏览文件 @
829df827
...
...
@@ -14,6 +14,10 @@ module.exports = {
project
:
'
project.tt.json
'
},
copyWebpackOptions
(
platformOptions
,
vueOptions
)
{
return
[
'
ttcomponents
'
]
const
copyOptions
=
[
'
ttcomponents
'
]
global
.
uniModules
.
forEach
(
module
=>
{
copyOptions
.
push
(
'
uni_modules/
'
+
module
+
'
/ttcomponents
'
)
})
return
copyOptions
}
}
packages/uni-mp-weixin/lib/uni.config.js
浏览文件 @
829df827
...
...
@@ -40,6 +40,16 @@ module.exports = {
ignore
:
[
'
**/*.vue
'
,
'
**/*.css
'
]
// v3 会自动转换生成vue,css文件,需要过滤
})
}
global
.
uniModules
.
forEach
(
module
=>
{
const
wxcomponentsDir
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
uni_modules
'
,
module
,
COMPONENTS_DIR_NAME
)
if
(
fs
.
existsSync
(
wxcomponentsDir
))
{
copyOptions
.
push
({
from
:
wxcomponentsDir
,
to
:
'
uni_modules/
'
+
module
+
'
/
'
+
COMPONENTS_DIR_NAME
,
ignore
:
[
'
**/*.vue
'
,
'
**/*.css
'
]
// v3 会自动转换生成vue,css文件,需要过滤
})
}
})
return
copyOptions
}
}
packages/vue-cli-plugin-uni/lib/copy-webpack-options.js
浏览文件 @
829df827
...
...
@@ -51,8 +51,16 @@ function getAssetsCopyOptions (assetsDir) {
return
copyOptions
}
function
getUniModulesAssetsCopyOptions
(
assetsDir
)
{
const
copyOptions
=
[]
global
.
uniModules
.
forEach
(
module
=>
{
copyOptions
.
push
(...
getAssetsCopyOptions
(
'
uni_modules/
'
+
module
+
'
/
'
+
assetsDir
))
})
return
copyOptions
}
function
getCopyWebpackPluginOptions
(
platformOptions
,
vueOptions
)
{
const
copyOptions
=
getAssetsCopyOptions
(
assetsDir
)
const
copyOptions
=
getAssetsCopyOptions
(
assetsDir
)
.
concat
(
getUniModulesAssetsCopyOptions
(
assetsDir
))
global
.
uniPlugin
.
copyWebpackOptions
.
forEach
(
copyWebpackOptions
=>
{
const
platformCopyOptions
=
copyWebpackOptions
(
platformOptions
,
vueOptions
,
copyOptions
)
||
[]
platformCopyOptions
.
forEach
(
copyOption
=>
{
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
829df827
...
...
@@ -19,6 +19,7 @@ process.env.UNI_INPUT_DIR = process.env.UNI_INPUT_DIR || path.resolve(process.cw
// 初始化全局插件对象
global
.
uniPlugin
=
require
(
'
@dcloudio/uni-cli-shared/lib/plugin
'
).
init
()
const
manifestJsonObj
=
require
(
'
@dcloudio/uni-cli-shared/lib/manifest
'
).
getManifestJson
()
const
platformOptions
=
manifestJsonObj
[
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
]
||
{}
// 插件校验环境
...
...
@@ -103,6 +104,17 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache
delete
process
.
env
.
UNI_USING_CACHE
}
global
.
uniModules
=
[]
try
{
global
.
uniModules
=
fs
.
readdirSync
(
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
uni_modules
'
))
.
filter
(
module
=>
fs
.
existsSync
(
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
uni_modules
'
,
module
,
'
package.json
'
)
)
)
}
catch
(
e
)
{}
const
{
normalizePath
,
isSupportSubPackages
,
...
...
packages/webpack-uni-pages-loader/lib/uni_modules.js
浏览文件 @
829df827
...
...
@@ -22,12 +22,8 @@ function normalizeUniModulesPagesJson (pagesJson, pluginId) {
module
.
exports
=
function
parsePages
(
content
)
{
const
uniModulesDir
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
uni_modules
'
)
let
plugins
=
[]
try
{
plugins
=
fs
.
readdirSync
(
uniModulesDir
)
}
catch
(
e
)
{}
const
pluginPagesJsons
=
[]
plugin
s
.
forEach
(
plugin
=>
{
global
.
uniModule
s
.
forEach
(
plugin
=>
{
const
pagesJsonPath
=
path
.
resolve
(
uniModulesDir
,
plugin
,
'
pages.json
'
)
if
(
fs
.
existsSync
(
pagesJsonPath
))
{
pluginPagesJsons
.
push
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录