Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
606e0ffe
U
uni-app
项目概览
DCloud
/
uni-app
4 个月 前同步成功
通知
730
Star
38707
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看板
提交
606e0ffe
编写于
3月 10, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of github.com:dcloudio/uni-app into dev
上级
dae724b1
f197ad89
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
156 addition
and
45 deletion
+156
-45
packages/uni-quickapp/assets/vue.dev.js
packages/uni-quickapp/assets/vue.dev.js
+1
-1
packages/uni-quickapp/assets/vue.prod.js
packages/uni-quickapp/assets/vue.prod.js
+1
-1
packages/uni-quickapp/bin/service.js
packages/uni-quickapp/bin/service.js
+1
-1
packages/uni-quickapp/dist/vue.dev.js
packages/uni-quickapp/dist/vue.dev.js
+2
-2
packages/uni-quickapp/dist/vue.prod.js
packages/uni-quickapp/dist/vue.prod.js
+2
-2
packages/uni-quickapp/lib/configure-webpack.js
packages/uni-quickapp/lib/configure-webpack.js
+6
-8
packages/uni-quickapp/lib/loader/main-loader.js
packages/uni-quickapp/lib/loader/main-loader.js
+8
-0
packages/uni-quickapp/lib/manifest/base-parser.js
packages/uni-quickapp/lib/manifest/base-parser.js
+4
-0
packages/uni-quickapp/lib/manifest/entry-parser.js
packages/uni-quickapp/lib/manifest/entry-parser.js
+7
-1
packages/uni-quickapp/lib/manifest/index.js
packages/uni-quickapp/lib/manifest/index.js
+28
-3
packages/uni-quickapp/lib/plugin/instvue-plugin.js
packages/uni-quickapp/lib/plugin/instvue-plugin.js
+45
-0
packages/uni-quickapp/lib/plugin/main-plugin.js
packages/uni-quickapp/lib/plugin/main-plugin.js
+0
-19
packages/uni-quickapp/lib/polyfill.css
packages/uni-quickapp/lib/polyfill.css
+3
-0
packages/uni-quickapp/lib/validate.js
packages/uni-quickapp/lib/validate.js
+24
-0
packages/uni-quickapp/package.json
packages/uni-quickapp/package.json
+8
-2
packages/vue-cli-plugin-uni/generator.js
packages/vue-cli-plugin-uni/generator.js
+6
-3
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+1
-1
src/platforms/quickapp/service/framework/vue.js
src/platforms/quickapp/service/framework/vue.js
+9
-1
未找到文件。
packages/uni-quickapp/assets/vue.dev.js
浏览文件 @
606e0ffe
此差异已折叠。
点击以展开。
packages/uni-quickapp/assets/vue.prod.js
浏览文件 @
606e0ffe
此差异已折叠。
点击以展开。
packages/uni-quickapp/bin/service.js
浏览文件 @
606e0ffe
...
...
@@ -24,7 +24,7 @@ function getProjectName(e, t) {
const
stripJsonComments
=
require
(
'
strip-json-comments
'
);
const
r
=
_path
.
default
.
join
(
e
,
t
,
"
manifest.json
"
);
const
s
=
JSON
.
parse
(
stripJsonComments
(
_fs
.
default
.
readFileSync
(
r
).
toString
()))
return
s
&&
s
.
quickapp
&&
s
.
quickapp
.
package
||
"
Bundle
"
return
s
&&
s
.
quickapp
&&
s
.
quickapp
.
package
||
s
.
name
||
"
Bundle
"
}
catch
(
e
)
{
_sharedUtils
.
colorconsole
.
error
(
`### App Server ### 获取项目名称出错:
${
e
.
message
}
`
)
}
...
...
packages/uni-quickapp/dist/vue.dev.js
浏览文件 @
606e0ffe
此差异已折叠。
点击以展开。
packages/uni-quickapp/dist/vue.prod.js
浏览文件 @
606e0ffe
此差异已折叠。
点击以展开。
packages/uni-quickapp/lib/configure-webpack.js
浏览文件 @
606e0ffe
...
...
@@ -8,11 +8,15 @@ const ZipPlugin = require('@hap-toolkit/packager/lib/plugin/zip-plugin')
const
NotifyPlugin
=
require
(
'
@hap-toolkit/packager/lib/plugin/notify-plugin
'
)
const
Css2jsonPlugin
=
require
(
'
@hap-toolkit/dsl-vue/lib/plugin/css2json-plugin
'
)
const
InstVuePlugin
=
require
(
'
@hap-toolkit/dsl-vue/lib/plugin/instvue-plugin
'
)
const
Inst
MainPlugin
=
require
(
'
./plugin/main
-plugin
'
)
const
Inst
VuePlugin
=
require
(
'
./plugin/instvue
-plugin
'
)
const
parseManifest
=
require
(
'
./manifest/index
'
)
const
validate
=
require
(
'
./validate
'
)
parseManifest
(
process
.
UNI_PAGES
,
process
.
UNI_MANIFEST
)
validate
()
const
env
=
{
// 平台:native
...
...
@@ -23,14 +27,9 @@ const env = {
const
dslFilename
=
(
'
vue.
'
+
(
process
.
env
.
NODE_ENV
===
'
production
'
?
'
prod
'
:
'
dev
'
)
+
'
.js
'
)
parseManifest
(
process
.
UNI_PAGES
,
process
.
UNI_MANIFEST
)
const
manifest
=
global
.
framework
.
manifest
if
(
!
manifest
.
package
)
{
console
.
error
(
`maniest.json quickapp 节点缺少 package 配置`
)
process
.
exit
(
0
)
}
function
genPriorities
(
entryPagePath
)
{
const
o
=
[
/^i18n
\/
.+
\.
json$/i
,
'
manifest.json
'
,
'
app.js
'
,
/^common
\/
/i
];
...
...
@@ -74,7 +73,6 @@ module.exports = {
new
HandlerPlugin
({}),
new
Css2jsonPlugin
(),
new
InstVuePlugin
(),
new
InstMainPlugin
(),
new
ZipPlugin
({
name
:
manifest
.
package
,
icon
:
manifest
.
icon
,
...
...
packages/uni-quickapp/lib/loader/main-loader.js
浏览文件 @
606e0ffe
const
path
=
require
(
'
path
'
)
const
isWin
=
/^win/
.
test
(
process
.
platform
)
const
normalizePath
=
path
=>
(
isWin
?
path
.
replace
(
/
\\
/g
,
'
/
'
)
:
path
)
const
polyfill
=
normalizePath
(
path
.
resolve
(
__dirname
,
'
../polyfill.css
'
))
module
.
exports
=
function
(
source
,
map
)
{
return
`
import 'uni-pages';
import '
${
polyfill
}
';
${
source
}
export default App;
`
...
...
packages/uni-quickapp/lib/manifest/base-parser.js
浏览文件 @
606e0ffe
...
...
@@ -16,6 +16,10 @@ module.exports = function parseBase(manifest, manifestJson) {
merge
(
manifest
,
manifestJson
)
manifest
.
versionCode
=
parseInt
(
manifest
.
versionCode
)
||
1
if
(
!
manifest
.
package
)
{
manifest
.
package
=
manifest
.
name
||
'
Bundle
'
}
if
(
!
manifest
.
config
)
{
manifest
.
config
=
{}
}
...
...
packages/uni-quickapp/lib/manifest/entry-parser.js
浏览文件 @
606e0ffe
const
fs
=
require
(
'
fs
'
)
const
path
=
require
(
'
path
'
)
module
.
exports
=
function
parseEntry
(
pages
)
{
const
entry
=
{
'
app
'
:
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
main.js
'
)
}
pages
.
forEach
(
page
=>
{
entry
[
page
.
path
]
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
page
.
path
+
'
.vue?uxType=page
'
)
const
filepath
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
page
.
path
)
if
(
fs
.
existsSync
(
filepath
+
'
.nvue
'
))
{
entry
[
page
.
path
]
=
filepath
+
'
.nvue?uxType=page
'
}
else
{
entry
[
page
.
path
]
=
filepath
+
'
.vue?uxType=page
'
}
})
return
entry
}
packages/uni-quickapp/lib/manifest/index.js
浏览文件 @
606e0ffe
...
...
@@ -4,14 +4,39 @@ const parseDisplay = require('./display-parser')
const
parseEntry
=
require
(
'
./entry-parser
'
)
function
getPages
(
pagesJson
)
{
const
ret
=
pagesJson
.
pages
const
subPackages
=
pagesJson
.
subPackages
if
(
!
subPackages
.
length
)
{
return
ret
}
subPackages
.
forEach
(({
root
,
pages
})
=>
{
if
(
!
Array
.
isArray
(
pages
))
{
return
}
pages
.
forEach
(
page
=>
{
page
.
path
=
root
+
'
/
'
+
page
.
path
ret
.
push
(
page
)
})
})
return
ret
}
module
.
exports
=
function
(
pagesJson
,
manifestJson
,
loader
)
{
const
manifest
=
manifestJson
.
quickapp
||
{}
parseBase
(
manifest
,
manifestJson
)
parsePages
(
manifest
,
pagesJson
.
pages
)
parseDisplay
(
manifest
,
pagesJson
.
pages
,
pagesJson
.
globalStyle
)
process
.
UNI_ENTRY
=
parseEntry
(
pagesJson
.
pages
)
const
pages
=
getPages
(
pagesJson
)
parsePages
(
manifest
,
pages
)
parseDisplay
(
manifest
,
pages
,
pagesJson
.
globalStyle
)
process
.
UNI_ENTRY
=
parseEntry
(
pages
)
global
.
framework
.
manifest
=
manifest
...
...
packages/uni-quickapp/lib/plugin/instvue-plugin.js
0 → 100644
浏览文件 @
606e0ffe
const
path
=
require
(
'
path
'
)
const
WebpackSources
=
require
(
'
webpack-sources
'
)
const
extList
=
[
'
.vue
'
,
'
.nvue
'
]
class
InstVuePlugin
{
apply
(
compiler
)
{
compiler
.
hooks
.
compilation
.
tap
(
'
InstVuePlugin
'
,
(
compilation
)
=>
{
compilation
.
hooks
.
optimizeChunkAssets
.
tapAsync
(
'
InstVuePlugin
'
,
(
chunks
,
callback
)
=>
{
this
.
instMain
(
compilation
,
chunks
)
this
.
instVue
(
compilation
,
chunks
)
callback
()
})
})
}
instMain
(
compilation
,
chunks
)
{
if
(
chunks
.
find
(
chunk
=>
chunk
.
files
.
includes
(
'
app.js
'
)))
{
const
appAsset
=
compilation
.
assets
[
'
app.js
'
]
compilation
.
assets
[
'
app.js
'
]
=
new
WebpackSources
.
ConcatSource
(
`(function(){\n var handler = function() {\n return `
,
appAsset
,
`\n };\n if (typeof window === "undefined") {\n let options = handler();\n options.default['manifest'] =
${
JSON
.
stringify
(
global
.
framework
.
manifest
)}
\n $app_define$(options.default)\n $app_bootstrap$()\n }\n })();`
)
}
}
instVue
(
compilation
,
chunks
)
{
chunks
.
forEach
(
chunk
=>
{
const
extname
=
path
.
extname
(
Array
.
from
(
chunk
.
entryModule
.
buildInfo
.
fileDependencies
)[
0
])
if
(
!
extList
.
includes
(
extname
))
{
return
}
chunk
.
files
.
forEach
(
file
=>
{
if
(
!
/
\.
js$/
.
test
(
file
))
{
return
}
compilation
.
assets
[
file
]
=
new
WebpackSources
.
ConcatSource
(
`(function(){\n var handler = function() {\n return `
,
compilation
.
assets
[
file
],
`\n };\n if (typeof window === \"undefined\") {\n let options = handler();\n options = options.default ? options.default: options\n options['type'] = 'page'\n new Vue({render: function(h) {return h(options)}}).$mount('#app')\n }\n })();`
)
})
})
}
}
module
.
exports
=
InstVuePlugin
packages/uni-quickapp/lib/plugin/main-plugin.js
已删除
100644 → 0
浏览文件 @
dae724b1
const
WebpackSources
=
require
(
'
webpack-sources
'
)
class
InstMainPlugin
{
apply
(
compiler
)
{
compiler
.
hooks
.
compilation
.
tap
(
'
InstMainPlugin
'
,
(
compilation
)
=>
{
compilation
.
hooks
.
optimizeChunkAssets
.
tapAsync
(
'
InstMainPlugin
'
,
(
chunks
,
callback
)
=>
{
if
(
chunks
.
find
(
chunk
=>
chunk
.
files
.
includes
(
'
app.js
'
)))
{
const
appAsset
=
compilation
.
assets
[
'
app.js
'
]
compilation
.
assets
[
'
app.js
'
]
=
new
WebpackSources
.
ConcatSource
(
`(function(){\n var handler = function() {\n return `
,
appAsset
,
`\n };\n if (typeof window === "undefined") {\n let options = handler();\n options.default['manifest'] =
${
JSON
.
stringify
(
global
.
framework
.
manifest
)}
\n $app_define$(options.default)\n $app_bootstrap$()\n }\n })();`
)
}
callback
()
})
})
}
}
module
.
exports
=
InstMainPlugin
packages/uni-quickapp/lib/polyfill.css
0 → 100644
浏览文件 @
606e0ffe
div
{
flex-direction
:
column
;
}
packages/uni-quickapp/lib/validate.js
0 → 100644
浏览文件 @
606e0ffe
const
fs
=
require
(
'
fs
'
)
const
path
=
require
(
'
path
'
)
module
.
exports
=
function
()
{
const
manifest
=
global
.
framework
.
manifest
if
(
manifest
.
package
===
'
Bundle
'
)
{
console
.
error
(
`> 建议配置 manifest.json->quickapp->package 应用包名`
)
}
const
signPath
=
'
./sign/
'
+
(
process
.
env
.
NODE_ENV
===
'
production
'
?
'
release
'
:
'
debug
'
)
const
privatePemPath
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
signPath
+
'
/private.pem
'
)
const
certificatePemPath
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
signPath
+
'
/certificate.pem
'
)
if
(
!
fs
.
existsSync
(
privatePemPath
))
{
console
.
error
(
`> 缺少私钥文件, 打包失败:
${
privatePemPath
}
`
)
process
.
exit
(
0
)
}
if
(
!
fs
.
existsSync
(
certificatePemPath
))
{
console
.
error
(
`> 缺少证书文件, 打包失败:
${
certificatePemPath
}
`
)
process
.
exit
(
0
)
}
}
packages/uni-quickapp/package.json
浏览文件 @
606e0ffe
{
"name"
:
"@dcloudio/uni-quickapp"
,
"version"
:
"2.0.0-alpha-24720191216006"
,
"description"
:
"uni-app quickapp"
,
"description"
:
"uni-app quickapp"
,
"main"
:
"dist/vue.prod.js"
,
"repository"
:
{
"type"
:
"git"
,
"url"
:
"git+https://github.com/dcloudio/uni-app.git"
,
"directory"
:
"packages/uni-quickapp"
},
"files"
:
[
"bin"
,
"components"
,
"dist"
,
"lib"
],
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
...
...
@@ -17,7 +23,7 @@
"dependencies"
:
{
"@hap-toolkit/dsl-vue"
:
"0.6.13"
,
"@hap-toolkit/packager"
:
"0.6.13"
,
"@hap-toolkit/server"
:
"0.6.13"
,
"@hap-toolkit/server"
:
"0.6.13"
,
"module-alias"
:
"^2.1.0"
}
}
packages/vue-cli-plugin-uni/generator.js
浏览文件 @
606e0ffe
...
...
@@ -8,21 +8,24 @@ module.exports = (api, options, rootOptions) => {
scripts
:
{
'
info
'
:
'
node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js
'
,
'
serve
'
:
'
npm run dev:h5
'
,
'
build
'
:
'
npm run build:h5
'
,
'
build
'
:
'
npm run build:h5
'
,
'
serve:quickapp
'
:
'
node node_modules/@dcloudio/uni-quickapp/bin/serve.js
'
,
'
dev:h5
'
:
'
cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve
'
,
'
dev:mp-qq
'
:
'
cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch
'
,
'
dev:mp-weixin
'
:
'
cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch
'
,
'
dev:mp-baidu
'
:
'
cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch
'
,
'
dev:mp-alipay
'
:
'
cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch
'
,
'
dev:mp-toutiao
'
:
'
cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch
'
,
'
dev:mp-360
'
:
'
cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch
'
,
'
dev:quickapp
'
:
'
cross-env NODE_ENV=development UNI_PLATFORM=quickapp vue-cli-service uni-build --watch
'
,
'
dev:mp-360
'
:
'
cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch
'
,
'
build:h5
'
:
'
cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build
'
,
'
build:mp-qq
'
:
'
cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build
'
,
'
build:mp-weixin
'
:
'
cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build
'
,
'
build:mp-baidu
'
:
'
cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build
'
,
'
build:mp-alipay
'
:
'
cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build
'
,
'
build:mp-toutiao
'
:
'
cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build
'
,
'
build:mp-360
'
:
'
cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build
'
,
'
build:quickapp
'
:
'
cross-env NODE_ENV=production UNI_PLATFORM=quickapp vue-cli-service uni-build
'
,
'
build:mp-360
'
:
'
cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build
'
,
'
dev:custom
'
:
'
cross-env NODE_ENV=development uniapp-cli custom
'
,
'
build:custom
'
:
'
cross-env NODE_ENV=production uniapp-cli custom
'
},
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
606e0ffe
...
...
@@ -280,7 +280,7 @@ let hasNVue = false
if
(
process
.
env
.
UNI_USING_NATIVE
)
{
console
.
log
(
'
当前nvue编译模式:
'
+
(
isNVueCompiler
?
'
uni-app
'
:
'
weex
'
)
+
'
。编译模式差异见:https://ask.dcloud.net.cn/article/36074
'
)
}
else
if
(
process
.
env
.
UNI_PLATFORM
!==
'
h5
'
)
{
}
else
if
(
process
.
env
.
UNI_PLATFORM
!==
'
h5
'
&&
process
.
env
.
UNI_PLATFORM
!==
'
quickapp
'
)
{
try
{
let
info
=
''
if
(
process
.
env
.
UNI_PLATFORM
===
'
app-plus
'
)
{
...
...
src/platforms/quickapp/service/framework/vue.js
浏览文件 @
606e0ffe
...
...
@@ -17,7 +17,15 @@ Vue.prototype.$mount = function () {}
Vue
.
config
=
{}
Vue
.
use
=
function
(
plugin
)
{
plugins
.
push
(
plugin
)
const
isVuex
=
plugin
.
Store
&&
plugin
.
mapState
if
(
isVuex
)
{
const
exports
=
{}
/* eslint-disable no-undef */
context
.
VueFactory
(
exports
,
{}
/* document */
,
{}
/* quickappHelper */
)
plugin
.
install
(
exports
.
Vue
)
}
else
{
plugins
.
push
(
plugin
)
}
}
Vue
.
mixin
=
function
(
mixin
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录