Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
31ed94ab
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看板
提交
31ed94ab
编写于
3月 10, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(qa): nvue
上级
96419591
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
92 addition
and
26 deletion
+92
-26
packages/uni-quickapp/lib/configure-webpack.js
packages/uni-quickapp/lib/configure-webpack.js
+1
-3
packages/uni-quickapp/lib/loader/main-loader.js
packages/uni-quickapp/lib/loader/main-loader.js
+8
-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/configure-webpack.js
浏览文件 @
31ed94ab
...
...
@@ -8,9 +8,8 @@ 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
'
)
...
...
@@ -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
浏览文件 @
31ed94ab
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/entry-parser.js
浏览文件 @
31ed94ab
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
浏览文件 @
31ed94ab
...
...
@@ -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
浏览文件 @
31ed94ab
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
浏览文件 @
96419591
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
浏览文件 @
31ed94ab
div
{
flex-direction
:
column
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录