Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
a13204df
U
uni-app
项目概览
DCloud
/
uni-app
4 个月 前同步成功
通知
725
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a13204df
编写于
3月 30, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore(cli): add build:plugin
上级
398690aa
变更
13
展开全部
显示空白变更内容
内联
并排
Showing
13 changed file
with
179 addition
and
61 deletion
+179
-61
.eslintignore
.eslintignore
+2
-1
build/build.plugin.js
build/build.plugin.js
+75
-0
build/webpack.config.js
build/webpack.config.js
+21
-22
lib/extends-loader/index.js
lib/extends-loader/index.js
+40
-0
lib/h5/extends-api.js
lib/h5/extends-api.js
+3
-0
package.json
package.json
+4
-1
packages/uni-app-plus/dist/view.umd.min.js
packages/uni-app-plus/dist/view.umd.min.js
+2
-2
packages/uni-h5/dist/index.umd.min.js
packages/uni-h5/dist/index.umd.min.js
+1
-1
packages/uni-h5/package.json
packages/uni-h5/package.json
+26
-26
packages/vue-cli-plugin-uni/lib/h5/qh-api.js
packages/vue-cli-plugin-uni/lib/h5/qh-api.js
+0
-1
src/core/service/platform-api.js
src/core/service/platform-api.js
+1
-1
src/platforms/h5/service/api/index.js
src/platforms/h5/service/api/index.js
+0
-0
src/platforms/h5/service/api/ui/navigation-bar.js
src/platforms/h5/service/api/ui/navigation-bar.js
+4
-6
未找到文件。
.eslintignore
浏览文件 @
a13204df
...
...
@@ -3,4 +3,5 @@ src/platforms/app-plus-nvue/runtime
build/rollup-plugin-require-context
packages/*/packages
packages/*/template/**/*
qh-api.js
packages/uni-h5/src
packages/uni-stat
build/build.plugin.js
0 → 100644
浏览文件 @
a13204df
const
path
=
require
(
'
path
'
)
const
del
=
require
(
'
del
'
)
const
{
error
}
=
require
(
'
@vue/cli-shared-utils
'
)
const
Service
=
require
(
'
@vue/cli-service
'
)
const
vueConfig
=
require
(
'
./vue.config.js
'
)
const
extendsApiPath
=
path
.
resolve
(
__dirname
,
'
../lib/h5/extends-api
'
)
vueConfig
.
configureWebpack
.
resolve
.
alias
[
'
uni-invoke-api
'
]
=
extendsApiPath
const
service
=
new
Service
(
process
.
env
.
VUE_CLI_CONTEXT
||
process
.
cwd
(),
{
inlineOptions
:
vueConfig
})
// 删除 cache 目录
del
.
sync
([
'
node_modules/.cache
'
])
let
pluginDir
=
process
.
argv
[
2
]
if
(
!
pluginDir
)
{
console
.
error
(
`缺少参数`
)
process
.
exit
(
0
)
}
if
(
pluginDir
.
indexOf
(
'
/
'
)
===
-
1
){
pluginDir
=
path
.
resolve
(
__dirname
,
'
../packages/uni-
'
+
pluginDir
)
}
const
pkg
=
require
(
path
.
join
(
pluginDir
,
'
package.json
'
))
if
(
!
pkg
[
'
uni-app
'
])
{
console
.
error
(
`缺少 uni-app 配置`
)
process
.
exit
(
0
)
}
service
.
webpackRawConfigFns
.
push
(
function
()
{
return
{
resolve
:
{
alias
:
{
'
uni-platform/service/api.js
'
:
extendsApiPath
,
'
uni-sub-platform
'
:
path
.
resolve
(
pluginDir
,
'
src
'
),
'
uni-platform-api
'
:
path
.
resolve
(
__dirname
,
'
../src/platforms/h5/service/api
'
),
'
uni-sub-platform-api
'
:
path
.
resolve
(
pluginDir
,
'
src/service/api
'
)
}
},
module
:
{
rules
:
[{
test
:
path
.
resolve
(
__dirname
,
'
../src/platforms/h5/service/api/index.js
'
),
use
:
[{
loader
:
path
.
resolve
(
__dirname
,
'
../lib/extends-loader
'
),
options
:
{
'
extends
'
:
path
.
resolve
(
pluginDir
,
'
src/service/api
'
),
'
base
'
:
path
.
resolve
(
__dirname
,
'
../src/platforms/h5/service/api
'
)
}
}]
}]
}
}
})
service
.
run
(
'
build
'
,
{
name
:
'
index
'
,
watch
:
process
.
env
.
UNI_WATCH
===
'
true
'
,
target
:
'
lib
'
,
formats
:
process
.
env
.
UNI_WATCH
===
'
true
'
?
'
umd
'
:
'
umd-min
'
,
entry
:
'
./lib/h5/main.js
'
,
dest
:
path
.
join
(
pluginDir
,
'
dist
'
),
clean
:
true
,
mode
:
process
.
env
.
NODE_ENV
}).
then
(
function
()
{}).
catch
(
err
=>
{
error
(
err
)
process
.
exit
(
1
)
})
build/webpack.config.js
浏览文件 @
a13204df
...
...
@@ -48,12 +48,12 @@ const provides = {
if
(
process
.
env
.
UNI_VIEW
)
{
// 方便调试
delete
provides
[
'
console
'
]
}
module
.
exports
=
function
configureWebpack
(
config
)
{
if
(
process
.
env
.
UNI_VIEW
===
'
true
'
)
{
if
(
process
.
env
.
UNI_VIEW
===
'
true
'
)
{
alias
[
'
vue$
'
]
=
resolve
(
'
packages/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.esm.js
'
)
}
}
return
{
module
.
exports
=
{
mode
:
'
production
'
,
devtool
:
false
,
externals
,
...
...
@@ -70,5 +70,4 @@ module.exports = function configureWebpack (config) {
}),
new
webpack
.
ProvidePlugin
(
provides
)
]
}
}
lib/extends-loader/index.js
0 → 100644
浏览文件 @
a13204df
const
fs
=
require
(
'
fs
'
)
const
path
=
require
(
'
path
'
)
const
glob
=
require
(
'
glob
'
)
const
loaderUtils
=
require
(
'
loader-utils
'
)
const
isWin
=
/^win/
.
test
(
process
.
platform
)
const
normalizePath
=
path
=>
(
isWin
?
path
.
replace
(
/
\\
/g
,
'
/
'
)
:
path
)
module
.
exports
=
function
loader
(
source
)
{
const
options
=
loaderUtils
.
getOptions
(
this
)
const
baseDir
=
options
[
'
base
'
]
const
extendsDir
=
options
[
'
extends
'
]
const
exportCode
=
[]
const
extendsFiles
=
[]
// extends目录均导出
glob
.
sync
(
'
**/*.js
'
,
{
cwd
:
extendsDir
}).
forEach
(
file
=>
{
if
(
file
===
'
index.js
'
)
{
return
}
extendsFiles
.
push
(
file
)
exportCode
.
push
(
`export * from 'uni-sub-platform-api/
${
normalizePath
(
file
)}
'`
)
})
//base目录中有,extends无的导出
glob
.
sync
(
'
**/*.js
'
,
{
cwd
:
baseDir
}).
forEach
(
file
=>
{
if
(
file
===
'
index.js
'
)
{
return
}
if
(
!
extendsFiles
.
includes
(
file
))
{
exportCode
.
push
(
`export * from 'uni-platform-api/
${
normalizePath
(
file
)}
'`
)
}
})
console
.
log
(
exportCode
.
join
(
'
\n
'
))
return
exportCode
.
join
(
'
\n
'
)
}
lib/h5/extends-api.js
0 → 100644
浏览文件 @
a13204df
import
'
uni-sub-platform/service/index
'
import
*
as
api
from
'
uni-platform/service/api/index
'
export
default
api
package.json
浏览文件 @
a13204df
...
...
@@ -8,6 +8,8 @@
"dev:h5"
:
"npm run lint && cross-env NODE_ENV=production UNI_WATCH=true UNI_PLATFORM=h5 node build/build.js"
,
"build:h5"
:
"npm run lint && cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=h5 node build/build.js"
,
"build:h5:ui"
:
"cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=h5 UNI_UI=true node build/build.js"
,
"dev:plugin"
:
"cross-env NODE_ENV=production UNI_WATCH=true UNI_PLATFORM=h5 node build/build.plugin.js"
,
"build:plugin"
:
"cross-env NODE_ENV=production UNI_WATCH=false UNI_PLATFORM=h5 node build/build.plugin.js"
,
"build:app-plus"
:
"cross-env UNI_PLATFORM=app-plus rollup -c build/rollup.config.mp.js"
,
"build:app:all"
:
"npm run lint && npm run build:app:nvue && npm run build:app:legacy && npm run build:app:service && npm run build:app:view"
,
"build:app:v3"
:
"npm run lint && npm run build:app:service && npm run dev:app:view"
,
...
...
@@ -109,6 +111,7 @@
"swan"
:
true
,
"tt"
:
true
,
"qh"
:
true
,
"HWH5"
:
true
,
"weex"
:
true
,
"__id__"
:
true
,
"__uniConfig"
:
true
,
...
...
packages/uni-app-plus/dist/view.umd.min.js
浏览文件 @
a13204df
此差异已折叠。
点击以展开。
packages/uni-h5/dist/index.umd.min.js
浏览文件 @
a13204df
此差异已折叠。
点击以展开。
packages/uni-h5/package.json
浏览文件 @
a13204df
packages/vue-cli-plugin-uni/lib/h5/qh-api.js
已删除
100644 → 0
浏览文件 @
398690aa
此差异已折叠。
点击以展开。
src/core/service/platform-api.js
浏览文件 @
a13204df
import
baseApi
from
'
uni-core/service/api
'
import
platformApi
from
'
uni-
platform/service/
api
'
import
platformApi
from
'
uni-
invoke-
api
'
export
default
Object
.
assign
(
Object
.
create
(
null
),
baseApi
,
platformApi
)
src/platforms/h5/service/api/index.js
0 → 100644
浏览文件 @
a13204df
src/platforms/h5/service/api/ui/navigation-bar.js
浏览文件 @
a13204df
...
...
@@ -18,16 +18,14 @@ function setNavigationBar (type, args) {
if
(
frontColor
)
{
page
.
navigationBar
.
textColor
=
frontColor
===
'
#000000
'
?
'
black
'
:
'
white
'
UniServiceJSBridge
.
emit
(
'
onNavigationBarChange
'
,
{
textColor
:
frontColor
===
'
#000000
'
?
'
#000
'
:
'
#fff
'
})
}
if
(
backgroundColor
)
{
page
.
navigationBar
.
backgroundColor
=
backgroundColor
}
UniServiceJSBridge
.
emit
(
'
onNavigationBarChange
'
,
{
backgroundColor
textColor
:
frontColor
===
'
#000000
'
?
'
#000
'
:
'
#fff
'
,
backgroundColor
:
page
.
navigationBar
.
backgroundColor
})
}
page
.
navigationBar
.
duration
=
duration
+
'
ms
'
page
.
navigationBar
.
timingFunc
=
timingFunc
break
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录