Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
2d3847d4
U
uni-app
项目概览
DCloud
/
uni-app
4 个月 前同步成功
通知
726
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,发现更多精彩内容 >>
提交
2d3847d4
编写于
11月 20, 2019
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'v3' of github.com:dcloudio/uni-app into v3
上级
a3243aa0
ebcfbe35
变更
33
展开全部
隐藏空白更改
内联
并排
Showing
33 changed file
with
723 addition
and
314 deletion
+723
-314
lerna.json
lerna.json
+1
-1
packages/uni-app-plus-nvue/package.json
packages/uni-app-plus-nvue/package.json
+2
-2
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+554
-133
packages/uni-app-plus/package.json
packages/uni-app-plus/package.json
+2
-2
packages/uni-cli-shared/package.json
packages/uni-cli-shared/package.json
+2
-2
packages/uni-h5-ui/package.json
packages/uni-h5-ui/package.json
+2
-2
packages/uni-h5/package.json
packages/uni-h5/package.json
+2
-2
packages/uni-migration/package.json
packages/uni-migration/package.json
+2
-2
packages/uni-mp-alipay/package.json
packages/uni-mp-alipay/package.json
+2
-2
packages/uni-mp-baidu/dcloudio-uni-mp-baidu-3.0.0-alpha-24020191018043.tgz
...aidu/dcloudio-uni-mp-baidu-3.0.0-alpha-24020191018043.tgz
+0
-0
packages/uni-mp-baidu/package.json
packages/uni-mp-baidu/package.json
+2
-2
packages/uni-mp-qq/package.json
packages/uni-mp-qq/package.json
+2
-2
packages/uni-mp-toutiao/package.json
packages/uni-mp-toutiao/package.json
+2
-2
packages/uni-mp-weixin/package.json
packages/uni-mp-weixin/package.json
+2
-2
packages/uni-stat/package.json
packages/uni-stat/package.json
+2
-2
packages/uni-template-compiler/package.json
packages/uni-template-compiler/package.json
+2
-2
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
+9
-7
packages/vue-cli-plugin-hbuilderx/module-alias.js
packages/vue-cli-plugin-hbuilderx/module-alias.js
+0
-13
packages/vue-cli-plugin-hbuilderx/package.json
packages/vue-cli-plugin-hbuilderx/package.json
+2
-2
packages/vue-cli-plugin-uni-optimize/package.json
packages/vue-cli-plugin-uni-optimize/package.json
+2
-2
packages/vue-cli-plugin-uni/index.js
packages/vue-cli-plugin-uni/index.js
+1
-1
packages/vue-cli-plugin-uni/lib/app-plus/index.js
packages/vue-cli-plugin-uni/lib/app-plus/index.js
+51
-18
packages/vue-cli-plugin-uni/lib/cache-loader.js
packages/vue-cli-plugin-uni/lib/cache-loader.js
+2
-2
packages/vue-cli-plugin-uni/lib/chain-webpack.js
packages/vue-cli-plugin-uni/lib/chain-webpack.js
+2
-2
packages/vue-cli-plugin-uni/lib/configure-webpack.js
packages/vue-cli-plugin-uni/lib/configure-webpack.js
+1
-34
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+17
-2
packages/vue-cli-plugin-uni/lib/h5/index.js
packages/vue-cli-plugin-uni/lib/h5/index.js
+26
-50
packages/vue-cli-plugin-uni/lib/mp.js
packages/vue-cli-plugin-uni/lib/mp.js
+12
-2
packages/vue-cli-plugin-uni/lib/util.js
packages/vue-cli-plugin-uni/lib/util.js
+9
-10
packages/vue-cli-plugin-uni/lib/vue-loader.js
packages/vue-cli-plugin-uni/lib/vue-loader.js
+1
-2
packages/vue-cli-plugin-uni/package.json
packages/vue-cli-plugin-uni/package.json
+2
-2
packages/webpack-uni-mp-loader/package.json
packages/webpack-uni-mp-loader/package.json
+2
-2
packages/webpack-uni-pages-loader/package.json
packages/webpack-uni-pages-loader/package.json
+3
-3
未找到文件。
lerna.json
浏览文件 @
2d3847d4
...
...
@@ -12,5 +12,5 @@
"message"
:
"chore(release): publish %s"
}
},
"version"
:
"3.0.0-alpha-240201910180
29
"
"version"
:
"3.0.0-alpha-240201910180
43
"
}
packages/uni-app-plus-nvue/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-app-plus-nvue"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app app-plus-nvue"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
2d3847d4
此差异已折叠。
点击以展开。
packages/uni-app-plus/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-app-plus"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app app-plus"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-cli-shared/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-cli-shared"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-cli-shared"
,
"main"
:
"lib/index.js"
,
"repository"
:
{
...
...
@@ -21,5 +21,5 @@
"hash-sum"
:
"^1.0.2"
,
"strip-json-comments"
:
"^2.0.1"
},
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-h5-ui/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-h5-ui"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app h5 ui"
,
"main"
:
"dist/index.umd.min.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-h5/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-h5"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app h5"
,
"main"
:
"dist/index.umd.min.js"
,
"repository"
:
{
...
...
@@ -18,5 +18,5 @@
"intersection-observer"
:
"^0.7.0"
,
"safe-area-insets"
:
"^1.4.1"
},
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-migration/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-migration"
,
"version"
:
"3.0.0-alpha-240201910180
27
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app migration"
,
"main"
:
"lib/index.js"
,
"repository"
:
{
...
...
@@ -16,7 +16,7 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
,
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
,
"dependencies"
:
{
"mustache"
:
"^3.1.0"
,
"stricter-htmlparser2"
:
"^3.9.6"
...
...
packages/uni-mp-alipay/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-mp-alipay"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app mp-alipay"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-mp-baidu/dcloudio-uni-mp-baidu-3.0.0-alpha-24020191018043.tgz
0 → 100644
浏览文件 @
2d3847d4
文件已添加
packages/uni-mp-baidu/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-mp-baidu"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app mp-baidu"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-mp-qq/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-mp-qq"
,
"version"
:
"3.0.0-alpha-240201910180
38
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app mp-qq"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-mp-toutiao/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-mp-toutiao"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app mp-toutiao"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-mp-weixin/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-mp-weixin"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app mp-weixin"
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-stat/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-stat"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
""
,
"main"
:
"dist/index.js"
,
"repository"
:
{
...
...
@@ -34,5 +34,5 @@
"rollup-plugin-replace"
:
"^2.2.0"
,
"rollup-plugin-uglify"
:
"^6.0.2"
},
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/uni-template-compiler/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/uni-template-compiler"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-template-compiler"
,
"main"
:
"lib/index.js"
,
"repository"
:
{
...
...
@@ -22,5 +22,5 @@
"@babel/types"
:
"^7.3.3"
,
"vue-template-compiler"
:
"^2.6.10"
},
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
浏览文件 @
2d3847d4
...
...
@@ -37,13 +37,15 @@ const uniPath = process.env.UNI_USING_V8
:
'
../packages/uni-app-plus-nvue/dist/index.js
'
const
provide
=
{}
if
(
!
process
.
env
.
UNI_USING_NATIVE
)
{
provide
[
'
uni
'
]
=
[
path
.
resolve
(
__dirname
,
uniPath
),
'
default
'
]
}
if
(
process
.
env
.
UNI_USING_V8
)
{
provide
[
'
plus
'
]
=
[
path
.
resolve
(
__dirname
,
uniPath
),
'
weexPlus
'
]
if
(
!
process
.
env
.
UNI_USING_V3
)
{
if
(
!
process
.
env
.
UNI_USING_NATIVE
)
{
provide
[
'
uni
'
]
=
[
path
.
resolve
(
__dirname
,
uniPath
),
'
default
'
]
}
if
(
process
.
env
.
UNI_USING_V8
)
{
provide
[
'
plus
'
]
=
[
path
.
resolve
(
__dirname
,
uniPath
),
'
weexPlus
'
]
}
}
if
(
...
...
packages/vue-cli-plugin-hbuilderx/module-alias.js
浏览文件 @
2d3847d4
...
...
@@ -19,19 +19,6 @@ moduleAlias.addAlias('./templateLoader', (fromPath, request, alias) => {
}
return
request
})
// vue cache
if
(
// 非 h5 ,非 v3,非 native
process
.
env
.
UNI_PLATFORM
!==
'
h5
'
&&
!
process
.
env
.
UNI_USING_V3
&&
!
process
.
env
.
UNI_USING_NATIVE
)
{
moduleAlias
.
addAlias
(
'
./loaders/pitcher
'
,
(
fromPath
,
request
,
alias
)
=>
{
if
(
fromPath
.
indexOf
(
'
vue-loader
'
)
!==
-
1
)
{
return
path
.
resolve
(
__dirname
,
'
packages/vue-loader/lib/loaders/pitcher
'
)
}
return
request
})
}
if
(
isInHBuilderX
)
{
moduleAlias
.
addAlias
(
'
typescript
'
,
path
.
resolve
(
process
.
env
.
UNI_HBUILDERX_PLUGINS
,
...
...
packages/vue-cli-plugin-hbuilderx/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/vue-cli-plugin-hbuilderx"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"HBuilderX plugin for vue-cli 3"
,
"main"
:
"index.js"
,
"repository"
:
{
...
...
@@ -18,5 +18,5 @@
"css"
:
"~2.2.1"
,
"escodegen"
:
"^1.8.1"
},
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/vue-cli-plugin-uni-optimize/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/vue-cli-plugin-uni-optimize"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app optimize plugin for vue-cli 3"
,
"main"
:
"index.js"
,
"repository"
:
{
...
...
@@ -13,5 +13,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/vue-cli-plugin-uni/index.js
浏览文件 @
2d3847d4
...
...
@@ -26,7 +26,7 @@ module.exports = (api, options) => {
require
(
'
./lib/options
'
)(
options
)
api
.
configureWebpack
(
require
(
'
./lib/configure-webpack
'
)(
platformOptions
,
manifestPlatformOptions
,
options
,
api
))
api
.
chainWebpack
(
require
(
'
./lib/chain-webpack
'
)(
platformOptions
,
api
))
api
.
chainWebpack
(
require
(
'
./lib/chain-webpack
'
)(
platformOptions
,
options
,
api
))
}
module
.
exports
.
defaultModes
=
{
...
...
packages/vue-cli-plugin-uni/lib/app-plus/index.js
浏览文件 @
2d3847d4
...
...
@@ -7,9 +7,14 @@ const {
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
{
isUnaryTag
isUnaryTag
,
getPartialIdentifier
}
=
require
(
'
../util
'
)
// const {
// createTemplateCacheLoader
// } = require('../cache-loader')
function
getProvides
()
{
return
{
'
__f__
'
:
[
path
.
resolve
(
__dirname
,
'
../format-log.js
'
),
'
default
'
],
...
...
@@ -22,7 +27,7 @@ const v3 = {
vueConfig
:
{
parallel
:
false
},
webpackConfig
(
webpackConfig
,
vueOptions
)
{
webpackConfig
(
webpackConfig
,
vueOptions
,
api
)
{
const
isAppService
=
!!
vueOptions
.
pluginOptions
[
'
uni-app-plus
'
][
'
service
'
]
const
isAppView
=
!!
vueOptions
.
pluginOptions
[
'
uni-app-plus
'
][
'
view
'
]
...
...
@@ -79,8 +84,8 @@ const v3 = {
externals
:
{
vue
:
'
Vue
'
},
entry
()
{
return
entry
entry
()
{
return
entry
},
output
:
{
filename
:
'
[name].js
'
,
...
...
@@ -120,6 +125,12 @@ const v3 = {
}]
},
...
rules
// v3 暂不支持 cache
// createTemplateCacheLoader(api,
// isAppService
// ? 'uni-template-compiler-service'
// : 'uni-template-compiler-view'
// )
]
},
plugins
:
[
...
...
@@ -127,12 +138,24 @@ const v3 = {
]
}
},
chainWebpack
(
webpackConfig
,
vueOptions
)
{
chainWebpack
(
webpackConfig
,
vueOptions
,
api
)
{
webpackConfig
.
entryPoints
.
delete
(
'
app
'
)
const
isAppService
=
!!
vueOptions
.
pluginOptions
[
'
uni-app-plus
'
][
'
service
'
]
const
isAppView
=
!!
vueOptions
.
pluginOptions
[
'
uni-app-plus
'
][
'
view
'
]
const
cacheConfig
=
{
cacheDirectory
:
false
,
cacheIdentifier
:
false
}
if
(
process
.
env
.
UNI_USING_CACHE
)
{
Object
.
assign
(
cacheConfig
,
api
.
genCacheConfig
(
'
vue-template-compiler/
'
+
process
.
env
.
UNI_PLATFORM
,
getPartialIdentifier
()
))
}
const
compilerOptions
=
{
isUnaryTag
,
preserveWhitespace
:
false
,
...
...
@@ -150,20 +173,30 @@ const v3 = {
isAppService
,
isAppView
,
compiler
:
getPlatformCompiler
(),
compilerOptions
,
cacheDirectory
:
false
,
cacheIdentifier
:
false
}))
.
end
()
.
use
(
'
uniapp-custom-block-loader
'
)
.
loader
(
require
.
resolve
(
'
@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader
'
))
.
options
({
compiler
:
getPlatformCompiler
()
})
.
end
()
.
uses
.
delete
(
'
cache-loader
'
)
compilerOptions
},
cacheConfig
))
.
end
()
.
use
(
'
uniapp-custom-block-loader
'
)
.
loader
(
require
.
resolve
(
'
@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader
'
))
.
options
({
compiler
:
getPlatformCompiler
()
})
// 是否启用 cache
if
(
process
.
env
.
UNI_USING_CACHE
)
{
webpackConfig
.
module
.
rule
(
'
vue
'
)
.
use
(
'
cache-loader
'
)
.
tap
(
options
=>
Object
.
assign
(
options
,
api
.
genCacheConfig
(
'
vue-loader/
'
+
process
.
env
.
UNI_PLATFORM
,
getPartialIdentifier
()
)))
}
else
{
webpackConfig
.
module
.
rule
(
'
vue
'
)
.
uses
.
delete
(
'
cache-loader
'
)
}
if
(
isAppView
)
{
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
...
...
packages/vue-cli-plugin-uni/lib/cache-loader.js
浏览文件 @
2d3847d4
...
...
@@ -62,14 +62,14 @@ function read (key, callback) {
}
module
.
exports
=
{
createTemplateCacheLoader
:
function
(
api
)
{
createTemplateCacheLoader
:
function
(
api
,
id
=
'
uni-template-compiler
'
)
{
return
{
resourceQuery
:
/type=uni-cache-loader-template/
,
use
:
[{
loader
:
'
cache-loader
'
,
ident
:
'
uni-cache-loader-template-options
'
,
options
:
Object
.
assign
(
api
.
genCacheConfig
(
'
uni-template-compiler
/
'
+
process
.
env
.
UNI_PLATFORM
,
id
+
'
/
'
+
process
.
env
.
UNI_PLATFORM
,
getPartialIdentifier
()
),
{
read
,
...
...
packages/vue-cli-plugin-uni/lib/chain-webpack.js
浏览文件 @
2d3847d4
...
...
@@ -12,7 +12,7 @@ function resolve (dir) {
return
path
.
resolve
(
__dirname
,
'
..
'
,
dir
)
}
module
.
exports
=
function
chainWebpack
(
platformOptions
,
api
)
{
module
.
exports
=
function
chainWebpack
(
platformOptions
,
vueOptions
,
api
)
{
const
{
runByHBuilderX
,
// 使用 HBuilderX 运行
cssPreprocessOptions
...
...
@@ -94,7 +94,7 @@ module.exports = function chainWebpack (platformOptions, api) {
})
}
platformOptions
.
chainWebpack
(
webpackConfig
,
api
)
platformOptions
.
chainWebpack
(
webpackConfig
,
vueOptions
,
api
)
// define
webpackConfig
.
plugin
(
'
uni-define
'
)
...
...
packages/vue-cli-plugin-uni/lib/configure-webpack.js
浏览文件 @
2d3847d4
...
...
@@ -23,7 +23,6 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
runByHBuilderX
,
// 使用 HBuilderX 运行
isInHBuilderX
,
// 在 HBuilderX 的插件中
hasModule
,
getMainEntry
,
getPlatformVue
,
jsPreprocessOptions
,
htmlPreprocessOptions
...
...
@@ -178,7 +177,7 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
let
platformWebpackConfig
=
platformOptions
.
webpackConfig
if
(
typeof
platformWebpackConfig
===
'
function
'
)
{
platformWebpackConfig
=
platformWebpackConfig
(
webpackConfig
,
api
)
platformWebpackConfig
=
platformWebpackConfig
(
webpackConfig
,
vueOptions
,
api
)
}
// 移除 node_modules 目录,避免受路径上的 node_modules 影响
webpackConfig
.
resolve
.
modules
=
webpackConfig
.
resolve
.
modules
.
filter
(
module
=>
module
!==
...
...
@@ -207,26 +206,6 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
}))
}
let
useBuiltIns
=
'
entry
'
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
)
{
// 兼容旧版本 h5
useBuiltIns
=
'
usage
'
try
{
const
babelConfig
=
require
(
path
.
resolve
(
process
.
env
.
UNI_CLI_CONTEXT
,
'
babel.config.js
'
))
useBuiltIns
=
babelConfig
.
presets
[
0
][
1
].
useBuiltIns
}
catch
(
e
)
{}
}
const
statCode
=
process
.
env
.
UNI_USING_STAT
?
`import '@dcloudio/uni-stat';`
:
''
let
beforeCode
=
''
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
)
{
beforeCode
=
(
useBuiltIns
===
'
entry
'
?
`import '@babel/polyfill';`
:
''
)
+
`import 'uni-pages';import 'uni-
${
process
.
env
.
UNI_PLATFORM
}
';`
}
else
{
beforeCode
=
`import 'uni-pages';`
}
const
rules
=
[{
test
:
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
pages.json
'
),
use
:
[{
...
...
@@ -236,18 +215,6 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
}],
type
:
'
javascript/auto
'
},
{
test
:
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
getMainEntry
()),
// resourceQuery: /type=wrapper/,
use
:
[{
loader
:
'
wrap-loader
'
,
options
:
{
before
:
[
beforeCode
+
statCode
]
}
}]
},
{
resourceQuery
:
/vue&type=template/
,
use
:
[{
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
2d3847d4
...
...
@@ -125,7 +125,8 @@ if (process.env.UNI_PLATFORM === 'app-plus') {
platformOptions
.
compilerVersion
===
'
3
'
||
platformOptions
.
compilerVersion
===
3
)
)
{
)
{
delete
process
.
env
.
UNI_USING_CACHE
process
.
env
.
UNI_USING_V3
=
true
platformOptions
.
usingComponents
=
true
process
.
env
.
UNI_OUTPUT_TMP_DIR
=
''
...
...
@@ -256,6 +257,20 @@ const moduleAlias = require('module-alias')
moduleAlias
.
addAlias
(
'
vue-template-compiler
'
,
'
@dcloudio/vue-cli-plugin-uni/packages/vue-template-compiler
'
)
moduleAlias
.
addAlias
(
'
@megalo/template-compiler
'
,
'
@dcloudio/vue-cli-plugin-uni/packages/@megalo/template-compiler
'
)
moduleAlias
.
addAlias
(
'
mpvue-template-compiler
'
,
'
@dcloudio/vue-cli-plugin-uni/packages/mpvue-template-compiler
'
)
// vue cache
if
(
// 非 h5 ,非 v3,非 native
process
.
env
.
UNI_PLATFORM
!==
'
h5
'
&&
!
process
.
env
.
UNI_USING_V3
&&
!
process
.
env
.
UNI_USING_NATIVE
)
{
moduleAlias
.
addAlias
(
'
./loaders/pitcher
'
,
(
fromPath
,
request
,
alias
)
=>
{
if
(
fromPath
.
indexOf
(
'
vue-loader
'
)
!==
-
1
)
{
return
require
.
resolve
(
'
@dcloudio/vue-cli-plugin-hbuilderx/packages/vue-loader/lib/loaders/pitcher
'
)
}
return
request
})
}
if
(
process
.
env
.
UNI_PLATFORM
===
'
mp-toutiao
'
)
{
// !important 始终带有一个空格
...
...
@@ -283,7 +298,7 @@ if (runByHBuilderX) {
if
(
process
.
env
.
UNI_USING_CACHE
&&
process
.
env
.
UNI_PLATFORM
!==
'
h5
'
&&
process
.
env
.
UNI_PLATFORM
!==
'
h5
'
&&
!
process
.
env
.
UNI_USING_V3
&&
!
process
.
env
.
UNI_USING_NATIVE
)
{
// 使用 cache, 拷贝 cache 的 json
...
...
packages/vue-cli-plugin-uni/lib/h5/index.js
浏览文件 @
2d3847d4
...
...
@@ -3,8 +3,7 @@ const path = require('path')
const
{
getMainEntry
,
getH5Options
,
getPlatformCssnano
getH5Options
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
modifyVueLoader
=
require
(
'
../vue-loader
'
)
...
...
@@ -63,6 +62,18 @@ if (devServer && Object.keys(devServer).length) {
module
.
exports
=
{
vueConfig
,
webpackConfig
(
webpackConfig
)
{
let
useBuiltIns
=
'
usage
'
const
statCode
=
process
.
env
.
UNI_USING_STAT
?
`import '@dcloudio/uni-stat';`
:
''
try
{
const
babelConfig
=
require
(
path
.
resolve
(
process
.
env
.
UNI_CLI_CONTEXT
,
'
babel.config.js
'
))
useBuiltIns
=
babelConfig
.
presets
[
0
][
1
].
useBuiltIns
}
catch
(
e
)
{}
const
beforeCode
=
(
useBuiltIns
===
'
entry
'
?
`import '@babel/polyfill';`
:
''
)
+
`import 'uni-pages';import 'uni-
${
process
.
env
.
UNI_PLATFORM
}
';`
return
{
devtool
:
process
.
env
.
NODE_ENV
===
'
production
'
?
false
:
'
source-map
'
,
resolve
:
{
...
...
@@ -74,6 +85,16 @@ module.exports = {
},
module
:
{
rules
:
[{
test
:
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
getMainEntry
()),
use
:
[{
loader
:
'
wrap-loader
'
,
options
:
{
before
:
[
beforeCode
+
statCode
]
}
}]
},
{
test
:
/App
\.
vue$/
,
use
:
{
loader
:
'
wrap-loader
'
,
...
...
@@ -84,7 +105,7 @@ module.exports = {
},
{
resourceQuery
:
/vue&type=template/
,
use
:
[{
loader
:
resolve
(
'
packages/
h5-vue-template-loader
'
)
loader
:
resolve
(
'
packages/
webpack-uni-app-loader/filter-modules-template.js
'
)
}]
},
{
resourceQuery
:
[
/lang=wxs/
,
/blockType=wxs/
],
...
...
@@ -101,7 +122,7 @@ module.exports = {
plugins
}
},
chainWebpack
(
webpackConfig
,
api
)
{
chainWebpack
(
webpackConfig
,
vueOptions
,
api
)
{
webpackConfig
.
plugins
.
delete
(
'
copy
'
)
if
(
!
process
.
env
.
UNI_OPT_PREFETCH
)
{
...
...
@@ -114,52 +135,7 @@ module.exports = {
modifyVueLoader
(
webpackConfig
,
require
(
'
./compiler-options
'
),
api
)
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
const
module
=
webpackConfig
.
module
// TODO 临时 hack calc:false 看看 vue cli 后续是否开放 cssnano 的配置
const
cssnanoOptions
=
{
sourceMap
:
false
,
plugins
:
[
require
(
'
cssnano
'
)({
preset
:
[
'
default
'
,
getPlatformCssnano
()]
})]
}
module
.
rule
(
'
css
'
).
oneOf
(
'
vue-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
css
'
).
oneOf
(
'
vue
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
css
'
).
oneOf
(
'
normal-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
css
'
).
oneOf
(
'
normal
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
postcss
'
).
oneOf
(
'
vue-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
postcss
'
).
oneOf
(
'
vue
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
postcss
'
).
oneOf
(
'
normal-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
postcss
'
).
oneOf
(
'
normal
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
scss
'
).
oneOf
(
'
vue-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
scss
'
).
oneOf
(
'
vue
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
scss
'
).
oneOf
(
'
normal-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
scss
'
).
oneOf
(
'
normal
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
sass
'
).
oneOf
(
'
vue-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
sass
'
).
oneOf
(
'
vue
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
sass
'
).
oneOf
(
'
normal-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
sass
'
).
oneOf
(
'
normal
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
less
'
).
oneOf
(
'
vue-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
less
'
).
oneOf
(
'
vue
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
less
'
).
oneOf
(
'
normal-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
less
'
).
oneOf
(
'
normal
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
stylus
'
).
oneOf
(
'
vue-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
stylus
'
).
oneOf
(
'
vue
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
stylus
'
).
oneOf
(
'
normal-modules
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
module
.
rule
(
'
stylus
'
).
oneOf
(
'
normal
'
).
use
(
'
cssnano
'
).
loader
(
'
postcss-loader
'
).
options
(
cssnanoOptions
)
require
(
'
./cssnano-options
'
)(
webpackConfig
)
}
}
}
packages/vue-cli-plugin-uni/lib/mp.js
浏览文件 @
2d3847d4
...
...
@@ -62,7 +62,7 @@ module.exports = {
vueConfig
:
{
parallel
:
false
},
webpackConfig
(
webpackConfig
,
api
)
{
webpackConfig
(
webpackConfig
,
vueOptions
,
api
)
{
if
(
!
webpackConfig
.
optimization
)
{
webpackConfig
.
optimization
=
{}
}
...
...
@@ -94,6 +94,9 @@ module.exports = {
devtool
=
'
sourcemap
'
}
}
const
statCode
=
process
.
env
.
UNI_USING_STAT
?
`import '@dcloudio/uni-stat';`
:
''
const
beforeCode
=
`import 'uni-pages';`
return
{
devtool
,
...
...
@@ -121,6 +124,13 @@ module.exports = {
rules
:
[{
test
:
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
getMainEntry
()),
use
:
[{
loader
:
'
wrap-loader
'
,
options
:
{
before
:
[
beforeCode
+
statCode
]
}
},
{
loader
:
'
@dcloudio/webpack-uni-mp-loader/lib/main
'
}]
},
{
...
...
@@ -154,7 +164,7 @@ module.exports = {
]
}
},
chainWebpack
(
webpackConfig
,
api
)
{
chainWebpack
(
webpackConfig
,
vueOptions
,
api
)
{
if
(
process
.
env
.
UNI_PLATFORM
===
'
mp-baidu
'
)
{
webpackConfig
.
module
.
rule
(
'
js
'
)
...
...
packages/vue-cli-plugin-uni/lib/util.js
浏览文件 @
2d3847d4
...
...
@@ -16,17 +16,16 @@ module.exports = {
'
link,meta,param,source,track,wbr
'
),
getPartialIdentifier
()
{
if
(
partialIdentifier
)
{
return
partialIdentifier
}
partialIdentifier
=
{
'
UNI_COMPILER_VERSION
'
:
require
(
'
../package.json
'
).
version
}
Object
.
keys
(
process
.
env
).
forEach
(
name
=>
{
if
(
name
.
indexOf
(
'
UNI_
'
)
===
0
)
{
partialIdentifier
[
name
]
=
process
.
env
[
name
]
if
(
!
partialIdentifier
)
{
partialIdentifier
=
{
'
UNI_COMPILER_VERSION
'
:
require
(
'
../package.json
'
).
version
}
})
Object
.
keys
(
process
.
env
).
forEach
(
name
=>
{
if
(
name
.
indexOf
(
'
UNI_
'
)
===
0
)
{
partialIdentifier
[
name
]
=
process
.
env
[
name
]
}
})
}
return
partialIdentifier
}
}
packages/vue-cli-plugin-uni/lib/vue-loader.js
浏览文件 @
2d3847d4
...
...
@@ -14,7 +14,6 @@ module.exports = function modifyVueLoader (webpackConfig, compilerOptions, api)
cacheDirectory
:
false
,
cacheIdentifier
:
false
}
const
partialIdentifier
=
{}
if
(
process
.
env
.
UNI_USING_CACHE
)
{
Object
.
assign
(
cacheConfig
,
api
.
genCacheConfig
(
...
...
@@ -60,7 +59,7 @@ module.exports = function modifyVueLoader (webpackConfig, compilerOptions, api)
.
use
(
'
cache-loader
'
)
.
tap
(
options
=>
Object
.
assign
(
options
,
api
.
genCacheConfig
(
'
vue-loader/
'
+
process
.
env
.
UNI_PLATFORM
,
partialIdentifier
getPartialIdentifier
()
)))
}
else
{
webpackConfig
.
module
...
...
packages/vue-cli-plugin-uni/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/vue-cli-plugin-uni"
,
"version"
:
"
2.0.0-23320190923002
"
,
"version"
:
"
3.0.0-alpha-24020191018043
"
,
"description"
:
"uni-app plugin for vue-cli 3"
,
"main"
:
"index.js"
,
"repository"
:
{
...
...
@@ -36,5 +36,5 @@
"wrap-loader"
:
"^0.2.0"
,
"xregexp"
:
"4.0.0"
},
"gitHead"
:
"1
0184426b19cb76e01c93fb25c982c72887557e8
"
"gitHead"
:
"1
10501ffb0313e417858dec92acf07522d4ded00
"
}
packages/webpack-uni-mp-loader/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/webpack-uni-mp-loader"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"webpack-uni-mp-loader"
,
"main"
:
"index.js"
,
"repository"
:
{
...
...
@@ -16,5 +16,5 @@
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
packages/webpack-uni-pages-loader/package.json
浏览文件 @
2d3847d4
{
"name"
:
"@dcloudio/webpack-uni-pages-loader"
,
"version"
:
"3.0.0-alpha-240201910180
29
"
,
"version"
:
"3.0.0-alpha-240201910180
43
"
,
"description"
:
"uni-app pages.json loader"
,
"main"
:
"lib/index.js"
,
"repository"
:
{
...
...
@@ -21,7 +21,7 @@
"strip-json-comments"
:
"^2.0.1"
},
"uni-app"
:
{
"compilerVersion"
:
"2.
3.4
"
"compilerVersion"
:
"2.
4.3
"
},
"gitHead"
:
"
6b0d55e296028761e3de4b561c1ad7c5fb7a23e2
"
"gitHead"
:
"
110501ffb0313e417858dec92acf07522d4ded00
"
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录