Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
genary
uni-app
提交
4d5f4f2e
U
uni-app
项目概览
genary
/
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,发现更多精彩内容 >>
提交
4d5f4f2e
编写于
5月 02, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(h5): system info
上级
aa71541d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
28 deletion
+13
-28
packages/uni-h5-vite/src/plugins/manifestJson.ts
packages/uni-h5-vite/src/plugins/manifestJson.ts
+5
-2
packages/uni-h5-vite/src/plugins/pagesJson.ts
packages/uni-h5-vite/src/plugins/pagesJson.ts
+6
-18
packages/uni-mp-core/src/api/protocols/enhanceSystemInfo.ts
packages/uni-mp-core/src/api/protocols/enhanceSystemInfo.ts
+2
-1
packages/vite-plugin-uni/src/index.ts
packages/vite-plugin-uni/src/index.ts
+0
-7
未找到文件。
packages/uni-h5-vite/src/plugins/manifestJson.ts
浏览文件 @
4d5f4f2e
...
...
@@ -35,7 +35,6 @@ export function uniManifestJsonPlugin(): Plugin {
}
const
manifest
=
parseJson
(
code
)
const
{
debug
,
h5
}
=
manifest
const
appid
=
(
manifest
.
appid
||
''
).
replace
(
'
__UNI__
'
,
''
)
const
router
=
{
...
defaultRouter
,
...((
h5
&&
h5
.
router
)
||
{})
}
if
(
!
router
.
base
)
{
router
.
base
=
'
/
'
...
...
@@ -72,7 +71,11 @@ export function uniManifestJsonPlugin(): Plugin {
'
column
'
return
{
code
:
`export const appid = '
${
appid
||
''
}
'
code
:
`export const appId =
${
JSON
.
stringify
(
manifest
.
appid
||
''
)}
export const appName =
${
JSON
.
stringify
(
manifest
.
name
||
''
)}
export const appVersion =
${
JSON
.
stringify
(
manifest
.
versionName
||
''
)}
export const appVersionCode =
${
JSON
.
stringify
(
manifest
.
versionCode
||
''
)}
export const debug =
${
!!
debug
}
export const nvue =
${
JSON
.
stringify
({
'
flex-direction
'
:
flexDirection
,
...
...
packages/uni-h5-vite/src/plugins/pagesJson.ts
浏览文件 @
4d5f4f2e
...
...
@@ -53,7 +53,7 @@ function generatePagesJsonCode(
return
`
import { defineAsyncComponent, resolveComponent, createVNode, withCtx, openBlock, createBlock } from 'vue'
import { PageComponent, AsyncLoadingComponent, AsyncErrorComponent, useI18n, setupWindow, setupPage } from '@dcloudio/uni-h5'
import { app
id
, debug, networkTimeout, router, async, sdkConfigs, qqMapKey, googleMapKey, nvue, locale, fallbackLocale } from './
${
MANIFEST_JSON_JS
}
'
import { app
Id, appName, appVersion, appVersionCode
, debug, networkTimeout, router, async, sdkConfigs, qqMapKey, googleMapKey, nvue, locale, fallbackLocale } from './
${
MANIFEST_JSON_JS
}
'
const locales = import.meta.globEager('./locale/*.json')
${
importLayoutComponentsCode
}
const extend = Object.assign
...
...
@@ -247,26 +247,15 @@ function generateConfig(
pagesJson
:
Record
<
string
,
any
>
,
config
:
ResolvedConfig
)
{
const
extraParameters
=
{
appId
:
process
.
env
.
UNI_APP_ID
,
appName
:
process
.
env
.
UNI_APP_NAME
,
appVersion
:
process
.
env
.
UNI_APP_VERSION
,
appVersionCode
:
process
.
env
.
UNI_APP_VERSION_CODE
,
}
delete
pagesJson
.
pages
delete
pagesJson
.
subPackages
delete
pagesJson
.
subpackages
pagesJson
.
compilerVersion
=
process
.
env
.
UNI_COMPILER_VERSION
return
(
(
config
.
command
===
'
serve
'
?
''
:
`
${
globalName
}
['____'+appid+'____']=true
delete
${
globalName
}
['____'+appid+'____']
`
)
+
`
${
globalName
}
.__uniConfig=extend(
${
JSON
.
stringify
(
extraParameters
)}
,
${
JSON
.
stringify
(
pagesJson
)}
,{
return
`
${
globalName
}
.__uniConfig=extend(
${
JSON
.
stringify
(
pagesJson
)}
,{
appId,
appName,
appVersion,
appVersionCode,
async,
debug,
networkTimeout,
...
...
@@ -280,5 +269,4 @@ delete ${globalName}['____'+appid+'____']
router,
})
`
)
}
packages/uni-mp-core/src/api/protocols/enhanceSystemInfo.ts
浏览文件 @
4d5f4f2e
import
{
extend
}
from
'
@vue/shared
'
import
{
getDeviceBrand
}
from
'
@dcloudio/uni-shared
'
const
UUID_KEY
=
'
__DC_STAT_UUID
'
...
...
@@ -125,5 +126,5 @@ export function populateParameters(
browseVersion
:
''
,
}
Object
.
assign
(
toRes
,
parameters
)
extend
(
toRes
,
parameters
)
}
packages/vite-plugin-uni/src/index.ts
浏览文件 @
4d5f4f2e
...
...
@@ -11,7 +11,6 @@ import {
CopyOptions
,
initModuleAlias
,
initPreContext
,
parseManifestJsonOnce
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
createConfig
}
from
'
./config
'
...
...
@@ -34,8 +33,6 @@ const debugUni = debug('uni:plugin')
const
pkg
=
require
(
path
.
resolve
(
__dirname
,
'
../package.json
'
))
const
manifestJson
=
parseManifestJsonOnce
(
process
.
env
.
UNI_INPUT_DIR
)
initModuleAlias
()
rewriteCompilerSfcParse
()
...
...
@@ -45,10 +42,6 @@ process.env.UNI_COMPILER_VERSION_TYPE = pkg.version.includes('alpha')
?
'
a
'
:
'
r
'
process
.
env
.
UNI_APP_ID
=
manifestJson
.
appid
||
''
process
.
env
.
UNI_APP_NAME
=
manifestJson
.
name
||
''
process
.
env
.
UNI_APP_VERSION
=
manifestJson
.
versionName
||
''
process
.
env
.
UNI_APP_VERSION_CODE
=
manifestJson
.
versionCode
||
''
export
interface
VitePluginUniOptions
{
vueOptions
?:
VueOptions
vueJsxOptions
?:
(
VueJSXPluginOptions
&
{
babelPlugins
?:
any
[]
})
|
boolean
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录