Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
cf107fa8
U
uni-app
项目概览
MuGuiLin
/
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,发现更多精彩内容 >>
提交
cf107fa8
编写于
1月 12, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): nvue
上级
4ef3587d
变更
20
展开全部
隐藏空白更改
内联
并排
Showing
20 changed file
with
131 addition
and
112 deletion
+131
-112
packages/uni-app-plus/__tests__/service/index.spec.ts
packages/uni-app-plus/__tests__/service/index.spec.ts
+1
-1
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+1
-1
packages/uni-app-vite/src/index.ts
packages/uni-app-vite/src/index.ts
+7
-3
packages/uni-app-vite/src/nvue/index.ts
packages/uni-app-vite/src/nvue/index.ts
+14
-2
packages/uni-app-vite/src/nvue/plugin/index.ts
packages/uni-app-vite/src/nvue/plugin/index.ts
+1
-1
packages/uni-app-vite/src/plugin/build.ts
packages/uni-app-vite/src/plugin/build.ts
+5
-11
packages/uni-app-vite/src/plugin/index.ts
packages/uni-app-vite/src/plugin/index.ts
+16
-0
packages/uni-app-vite/src/plugin/uni/index.ts
packages/uni-app-vite/src/plugin/uni/index.ts
+0
-0
packages/uni-app-vite/src/plugin/uni/transforms/transformRenderjs.ts
...i-app-vite/src/plugin/uni/transforms/transformRenderjs.ts
+0
-0
packages/uni-app-vite/src/plugins/manifestJson.ts
packages/uni-app-vite/src/plugins/manifestJson.ts
+1
-1
packages/uni-app-vite/src/plugins/resolveId.ts
packages/uni-app-vite/src/plugins/resolveId.ts
+0
-29
packages/uni-app-vite/src/plugins/template.ts
packages/uni-app-vite/src/plugins/template.ts
+2
-48
packages/uni-app-vite/src/utils.ts
packages/uni-app-vite/src/utils.ts
+2
-0
packages/uni-app-vite/src/vue/index.ts
packages/uni-app-vite/src/vue/index.ts
+7
-6
packages/uni-app-vite/src/vue/plugin/index.ts
packages/uni-app-vite/src/vue/plugin/index.ts
+72
-8
packages/uni-app-vite/src/vue/plugins/confusion.ts
packages/uni-app-vite/src/vue/plugins/confusion.ts
+1
-1
packages/uni-app-vite/src/vue/plugins/mainJs.ts
packages/uni-app-vite/src/vue/plugins/mainJs.ts
+0
-0
packages/uni-app-vite/src/vue/plugins/pagesJson.ts
packages/uni-app-vite/src/vue/plugins/pagesJson.ts
+0
-0
packages/uni-app-vite/src/vue/plugins/renderjs.ts
packages/uni-app-vite/src/vue/plugins/renderjs.ts
+0
-0
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+1
-0
未找到文件。
packages/uni-app-plus/__tests__/service/index.spec.ts
浏览文件 @
cf107fa8
import
{
compileTemplate
}
from
'
@vue/compiler-sfc
'
import
{
uniAppPlugin
}
from
'
../../../uni-app-vite/src/
vue/
plugin
'
import
{
uniAppPlugin
}
from
'
../../../uni-app-vite/src/plugin
'
import
{
ref
,
nextTick
,
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
cf107fa8
此差异已折叠。
点击以展开。
packages/uni-app-vite/src/index.ts
浏览文件 @
cf107fa8
import
{
initVuePlugins
}
from
'
./vue
'
import
{
initNVuePlugins
}
from
'
./nvue
'
import
{
uniAppPlugin
}
from
'
./plugin
'
export
default
()
=>
{
return
process
.
env
.
UNI_COMPILER
===
'
nvue
'
?
initNVuePlugins
()
:
initVuePlugins
()
return
[
uniAppPlugin
(),
...(
process
.
env
.
UNI_COMPILER
===
'
nvue
'
?
initNVuePlugins
()
:
initVuePlugins
()),
]
}
packages/uni-app-vite/src/nvue/index.ts
浏览文件 @
cf107fa8
import
{
uniNVuePlugin
}
from
'
./plugin
'
import
{
initAppProvide
,
uniHBuilderXConsolePlugin
,
uniViteInjectPlugin
,
UNI_EASYCOM_EXCLUDE
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
uniAppNVuePlugin
}
from
'
./plugin
'
import
{
uniEasycomPlugin
}
from
'
../plugins/easycom
'
export
function
initNVuePlugins
()
{
return
[
uniNVuePlugin
()]
return
[
uniEasycomPlugin
({
exclude
:
UNI_EASYCOM_EXCLUDE
}),
uniHBuilderXConsolePlugin
(),
uniViteInjectPlugin
(
'
uni:app-inject
'
,
initAppProvide
()),
uniAppNVuePlugin
(),
]
}
packages/uni-app-vite/src/nvue/plugin/index.ts
浏览文件 @
cf107fa8
import
path
from
'
path
'
import
{
Plugin
}
from
'
vite
'
export
function
uniNVuePlugin
():
Plugin
{
export
function
uni
App
NVuePlugin
():
Plugin
{
return
{
name
:
'
uni:app-nvue
'
,
config
()
{
...
...
packages/uni-app-vite/src/
vue/
plugin/build.ts
→
packages/uni-app-vite/src/plugin/build.ts
浏览文件 @
cf107fa8
...
...
@@ -4,9 +4,8 @@ import { ConfigEnv, UserConfig } from 'vite'
import
{
emptyDir
,
isInHybridNVue
,
normalizePath
,
resolveMainPathOnce
,
APP_SERVICE_FILENAME
,
}
from
'
@dcloudio/uni-cli-shared
'
export
function
buildOptions
(
...
...
@@ -16,8 +15,10 @@ export function buildOptions(
const
inputDir
=
process
.
env
.
UNI_INPUT_DIR
const
outputDir
=
process
.
env
.
UNI_OUTPUT_DIR
// 开始编译时,清空输出目录
if
(
fs
.
existsSync
(
outputDir
))
{
emptyDir
(
outputDir
)
if
(
!
isInHybridNVue
(
userConfig
))
{
if
(
fs
.
existsSync
(
outputDir
))
{
emptyDir
(
outputDir
)
}
}
return
{
// App 端目前仅提供 inline
...
...
@@ -25,15 +26,8 @@ export function buildOptions(
emptyOutDir
:
false
,
// 不清空输出目录,否则会影响 webpack 的输出
assetsInlineLimit
:
0
,
rollupOptions
:
{
input
:
resolveMainPathOnce
(
inputDir
),
external
:
[
'
vue
'
],
output
:
{
name
:
'
AppService
'
,
format
:
process
.
env
.
UNI_APP_CODE_SPLITING
?
'
amd
'
:
'
iife
'
,
amd
:
{
autoId
:
true
,
},
entryFileNames
:
APP_SERVICE_FILENAME
,
sourcemapPathTransform
(
relativeSourcePath
,
sourcemapPath
)
{
const
sourcePath
=
normalizePath
(
path
.
relative
(
...
...
packages/uni-app-vite/src/plugin/index.ts
0 → 100644
浏览文件 @
cf107fa8
import
{
UniVitePlugin
}
from
'
@dcloudio/uni-cli-shared
'
import
{
uniOptions
}
from
'
./uni
'
import
{
buildOptions
}
from
'
./build
'
export
function
uniAppPlugin
():
UniVitePlugin
{
return
{
name
:
'
uni:app
'
,
uni
:
uniOptions
(),
config
(
config
,
env
)
{
return
{
build
:
buildOptions
(
config
,
env
),
}
},
}
}
packages/uni-app-vite/src/
vue/
plugin/uni/index.ts
→
packages/uni-app-vite/src/plugin/uni/index.ts
浏览文件 @
cf107fa8
文件已移动
packages/uni-app-vite/src/
vue/
plugin/uni/transforms/transformRenderjs.ts
→
packages/uni-app-vite/src/plugin/uni/transforms/transformRenderjs.ts
浏览文件 @
cf107fa8
文件已移动
packages/uni-app-vite/src/plugins/manifestJson.ts
浏览文件 @
cf107fa8
...
...
@@ -41,7 +41,7 @@ export function uniManifestJsonPlugin(): Plugin {
})
return
{
code
:
''
,
map
:
this
.
getCombinedSourcemap
()
,
map
:
null
,
}
},
}
...
...
packages/uni-app-vite/src/plugins/resolveId.ts
已删除
100644 → 0
浏览文件 @
4ef3587d
import
debug
from
'
debug
'
import
{
Plugin
}
from
'
vite
'
import
{
resolveBuiltIn
}
from
'
@dcloudio/uni-cli-shared
'
const
debugResolve
=
debug
(
'
uni:app-resolve-id
'
)
export
function
uniResolveIdPlugin
():
Plugin
{
const
resolveCache
:
Record
<
string
,
string
>
=
{}
return
{
name
:
'
uni:app-resolve-id
'
,
enforce
:
'
pre
'
,
configResolved
()
{
resolveCache
[
'
@dcloudio/uni-app-vue
'
]
=
resolveBuiltIn
(
'
@dcloudio/uni-app-vue
'
)
},
resolveId
(
id
)
{
if
(
id
===
'
vue
'
)
{
id
=
'
@dcloudio/uni-app-vue
'
}
const
cache
=
resolveCache
[
id
]
if
(
cache
)
{
debugResolve
(
'
cache
'
,
id
,
cache
)
return
cache
}
},
}
}
packages/uni-app-vite/src/plugins/template.ts
浏览文件 @
cf107fa8
import
path
from
'
path
'
import
fs
from
'
fs-extra
'
import
{
Plugin
}
from
'
vite
'
import
{
OutputBundle
}
from
'
rollup
'
import
{
parsePagesJsonOnce
}
from
'
@dcloudio/uni-cli-shared
'
import
{
APP_RENDERJS_JS
,
APP_WXS_JS
}
from
'
./renderjs
'
function
genViewHtml
(
bundle
:
OutputBundle
)
{
const
viewHtmlStr
=
fs
.
readFileSync
(
path
.
resolve
(
__dirname
,
'
../../lib/template/__uniappview.html
'
),
'
utf8
'
)
const
{
globalStyle
}
=
parsePagesJsonOnce
(
process
.
env
.
UNI_INPUT_DIR
,
process
.
env
.
UNI_PLATFORM
)
const
__uniConfig
=
{
globalStyle
:
{
rpxCalcMaxDeviceWidth
:
(
globalStyle
as
any
).
rpxCalcMaxDeviceWidth
,
rpxCalcBaseDeviceWidth
:
(
globalStyle
as
any
).
rpxCalcBaseDeviceWidth
,
},
}
const
wxsCode
=
bundle
[
APP_WXS_JS
]
?
`<script src="
${
APP_WXS_JS
}
"></script>`
:
''
const
renderjsCode
=
bundle
[
APP_RENDERJS_JS
]
?
`<script src="
${
APP_RENDERJS_JS
}
"></script>`
:
''
const
automatorCode
=
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
?
`<script src="__uniappautomator.js"></script>`
:
''
return
viewHtmlStr
.
toString
()
.
replace
(
'
<!--wxsCode-->
'
,
wxsCode
)
.
replace
(
'
<!--renderjsCode-->
'
,
renderjsCode
)
.
replace
(
'
<!--automatorCode-->
'
,
automatorCode
)
.
replace
(
'
/*__uniConfig*/
'
,
`var __uniConfig =
${
JSON
.
stringify
(
__uniConfig
)}
`
)
}
import
{
templateDir
}
from
'
../utils
'
export
function
uniTemplatePlugin
():
Plugin
{
let
outputDir
:
string
...
...
@@ -56,19 +17,12 @@ export function uniTemplatePlugin(): Plugin {
overwrite
:
true
,
}
)
fs
.
copySync
(
path
.
resolve
(
__dirname
,
'
../../lib/template/
'
)
,
outputDir
,
{
fs
.
copySync
(
templateDir
,
outputDir
,
{
overwrite
:
true
,
filter
(
src
)
{
return
!
src
.
includes
(
'
__uniappview.html
'
)
},
})
},
generateBundle
(
_
,
bundle
)
{
this
.
emitFile
({
fileName
:
'
__uniappview.html
'
,
source
:
genViewHtml
(
bundle
),
type
:
'
asset
'
,
})
},
}
}
packages/uni-app-vite/src/utils.ts
0 → 100644
浏览文件 @
cf107fa8
import
path
from
'
path
'
export
const
templateDir
=
path
.
resolve
(
__dirname
,
'
../lib/template/
'
)
packages/uni-app-vite/src/vue/index.ts
浏览文件 @
cf107fa8
...
...
@@ -9,15 +9,16 @@ import {
isVueSfcFile
,
isUniPageFile
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
uniAppPlugin
}
from
'
../vue/plugin
'
import
{
uniTemplatePlugin
}
from
'
../plugins/template
'
import
{
uniMainJsPlugin
}
from
'
../plugins/mainJs
'
import
{
uniManifestJsonPlugin
}
from
'
../plugins/manifestJson
'
import
{
uniPagesJsonPlugin
}
from
'
../plugins/pagesJson
'
import
{
uniRenderjsPlugin
}
from
'
../plugins/renderjs
'
import
{
uniStatsPlugin
}
from
'
../plugins/stats
'
import
{
uniEasycomPlugin
}
from
'
../plugins/easycom
'
import
{
uniConfusionPlugin
}
from
'
../plugins/confusion
'
import
{
uniConfusionPlugin
}
from
'
./plugins/confusion
'
import
{
uniMainJsPlugin
}
from
'
./plugins/mainJs
'
import
{
uniPagesJsonPlugin
}
from
'
./plugins/pagesJson
'
import
{
uniRenderjsPlugin
}
from
'
./plugins/renderjs
'
import
{
uniAppVuePlugin
}
from
'
./plugin
'
function
initUniCssScopedPluginFilter
(
inputDir
:
string
...
...
@@ -46,7 +47,7 @@ export function initVuePlugins() {
uniRenderjsPlugin
(),
uniTemplatePlugin
(),
uniStatsPlugin
(),
uniAppPlugin
(),
uniApp
Vue
Plugin
(),
uniConfusionPlugin
(),
]
const
filter
=
initUniCssScopedPluginFilter
(
process
.
env
.
UNI_INPUT_DIR
)
...
...
packages/uni-app-vite/src/vue/plugin/index.ts
浏览文件 @
cf107fa8
import
{
UniVitePlugin
}
from
'
@dcloudio/uni-cli-shared
'
import
path
from
'
path
'
import
fs
from
'
fs-extra
'
import
{
APP_SERVICE_FILENAME
,
resolveMainPathOnce
,
parsePagesJsonOnce
,
UniVitePlugin
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
OutputBundle
}
from
'
rollup
'
import
{
APP_RENDERJS_JS
,
APP_WXS_JS
}
from
'
../plugins/renderjs
'
import
{
uniOptions
}
from
'
./uni
'
import
{
buildOptions
}
from
'
./build
'
import
{
configResolved
}
from
'
./configResolved
'
import
{
templateDir
}
from
'
../../utils
'
export
function
uniAppPlugin
():
UniVitePlugin
{
export
function
uniAppVuePlugin
():
UniVitePlugin
{
const
inputDir
=
process
.
env
.
UNI_INPUT_DIR
return
{
name
:
'
uni:app
'
,
uni
:
uniOptions
(),
config
(
config
,
env
)
{
name
:
'
uni:app-vue
'
,
config
()
{
return
{
build
:
buildOptions
(
config
,
env
),
build
:
{
rollupOptions
:
{
input
:
resolveMainPathOnce
(
inputDir
),
output
:
{
name
:
'
AppService
'
,
format
:
process
.
env
.
UNI_APP_CODE_SPLITING
?
'
amd
'
:
'
iife
'
,
amd
:
{
autoId
:
true
,
},
entryFileNames
:
APP_SERVICE_FILENAME
,
},
},
},
}
},
configResolved
,
generateBundle
(
_
,
bundle
)
{
this
.
emitFile
({
fileName
:
'
__uniappview.html
'
,
source
:
genViewHtml
(
bundle
),
type
:
'
asset
'
,
})
},
}
}
function
genViewHtml
(
bundle
:
OutputBundle
)
{
const
viewHtmlStr
=
fs
.
readFileSync
(
path
.
join
(
templateDir
,
'
__uniappview.html
'
),
'
utf8
'
)
const
{
globalStyle
}
=
parsePagesJsonOnce
(
process
.
env
.
UNI_INPUT_DIR
,
process
.
env
.
UNI_PLATFORM
)
const
__uniConfig
=
{
globalStyle
:
{
rpxCalcMaxDeviceWidth
:
(
globalStyle
as
any
).
rpxCalcMaxDeviceWidth
,
rpxCalcBaseDeviceWidth
:
(
globalStyle
as
any
).
rpxCalcBaseDeviceWidth
,
},
}
const
wxsCode
=
bundle
[
APP_WXS_JS
]
?
`<script src="
${
APP_WXS_JS
}
"></script>`
:
''
const
renderjsCode
=
bundle
[
APP_RENDERJS_JS
]
?
`<script src="
${
APP_RENDERJS_JS
}
"></script>`
:
''
const
automatorCode
=
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
?
`<script src="__uniappautomator.js"></script>`
:
''
return
viewHtmlStr
.
toString
()
.
replace
(
'
<!--wxsCode-->
'
,
wxsCode
)
.
replace
(
'
<!--renderjsCode-->
'
,
renderjsCode
)
.
replace
(
'
<!--automatorCode-->
'
,
automatorCode
)
.
replace
(
'
/*__uniConfig*/
'
,
`var __uniConfig =
${
JSON
.
stringify
(
__uniConfig
)}
`
)
}
packages/uni-app-vite/src/plugins/confusion.ts
→
packages/uni-app-vite/src/
vue/
plugins/confusion.ts
浏览文件 @
cf107fa8
...
...
@@ -14,7 +14,7 @@ export function uniConfusionPlugin(): Plugin {
const
hasConfusion
=
process
.
env
.
NODE_ENV
===
'
production
'
&&
hasConfusionFile
(
inputDir
)
return
{
name
:
'
uni:app-confusion
'
,
name
:
'
uni:app-
vue-
confusion
'
,
enforce
:
'
post
'
,
apply
:
'
build
'
,
config
()
{
...
...
packages/uni-app-vite/src/plugins/mainJs.ts
→
packages/uni-app-vite/src/
vue/
plugins/mainJs.ts
浏览文件 @
cf107fa8
文件已移动
packages/uni-app-vite/src/plugins/pagesJson.ts
→
packages/uni-app-vite/src/
vue/
plugins/pagesJson.ts
浏览文件 @
cf107fa8
文件已移动
packages/uni-app-vite/src/plugins/renderjs.ts
→
packages/uni-app-vite/src/
vue/
plugins/renderjs.ts
浏览文件 @
cf107fa8
文件已移动
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
cf107fa8
...
...
@@ -9636,6 +9636,7 @@ function useMovableViewState(props2, trigger, rootRef) {
}
}
function __handleTouchMove(event) {
event.stopPropagation();
if (!_isScaling && !props2.disabled && _isTouching) {
let x = _translateX;
let y = _translateY;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录