Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
71a37d75
U
uni-app
项目概览
DCloud
/
uni-app
7 天 前同步成功
通知
816
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
71a37d75
编写于
11月 29, 2023
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(uvue): web端增加pages.json校验
上级
b6fe6550
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
74 addition
and
74 deletion
+74
-74
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-uts/src/plugins/android/pagesJson.ts
packages/uni-app-uts/src/plugins/android/pagesJson.ts
+1
-1
packages/uni-app-uts/src/plugins/android/uvue/error.ts
packages/uni-app-uts/src/plugins/android/uvue/error.ts
+0
-44
packages/uni-app-uts/src/plugins/android/uvue/index.ts
packages/uni-app-uts/src/plugins/android/uvue/index.ts
+1
-1
packages/uni-app-vite/src/nvue/plugins/appCss.ts
packages/uni-app-vite/src/nvue/plugins/appCss.ts
+6
-27
packages/uni-cli-shared/src/json/index.ts
packages/uni-cli-shared/src/json/index.ts
+1
-0
packages/uni-cli-shared/src/vite/utils/utils.ts
packages/uni-cli-shared/src/vite/utils/utils.ts
+43
-0
packages/uni-h5-vite/src/plugins/pagesJson.ts
packages/uni-h5-vite/src/plugins/pagesJson.ts
+21
-0
未找到文件。
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
71a37d75
此差异已折叠。
点击以展开。
packages/uni-app-uts/src/plugins/android/pagesJson.ts
浏览文件 @
71a37d75
...
...
@@ -2,6 +2,7 @@ import path from 'path'
import
fs
from
'
fs-extra
'
import
{
PAGES_JSON_UTS
,
createRollupError
,
normalizeUniAppXAppPagesJson
,
parseArguments
,
}
from
'
@dcloudio/uni-cli-shared
'
...
...
@@ -10,7 +11,6 @@ import type { Plugin } from 'vite'
import
{
ENTRY_FILENAME
,
genClassName
,
stringifyMap
}
from
'
./utils
'
import
{
isPages
}
from
'
../utils
'
import
{
createRollupError
}
from
'
./uvue/error
'
export
function
uniAppPagesPlugin
():
Plugin
{
const
pagesJsonPath
=
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
pages.json
'
)
...
...
packages/uni-app-uts/src/plugins/android/uvue/error.ts
已删除
100644 → 0
浏览文件 @
b6fe6550
import
type
{
RollupError
}
from
'
rollup
'
import
type
{
CompilerError
}
from
'
./compiler/errors
'
import
{
generateCodeFrame
,
locToStartAndEnd
}
from
'
@dcloudio/uni-cli-shared
'
export
function
createRollupError
(
plugin
:
string
,
id
:
string
,
error
:
CompilerError
|
SyntaxError
,
source
?:
string
):
RollupError
{
const
{
message
,
name
,
stack
}
=
error
const
rollupError
:
RollupError
=
{
id
,
plugin
,
message
,
name
,
stack
,
}
if
(
'
code
'
in
error
&&
error
.
loc
)
{
rollupError
.
loc
=
{
file
:
id
,
line
:
error
.
loc
.
start
.
line
,
column
:
error
.
loc
.
start
.
column
,
}
if
(
source
&&
source
.
length
>
0
)
{
if
(
'
offsetStart
'
in
error
&&
'
offsetEnd
'
in
error
)
{
rollupError
.
frame
=
generateCodeFrame
(
source
,
error
.
offsetStart
as
number
,
error
.
offsetEnd
as
number
).
replace
(
/
\t
/g
,
'
'
)
}
else
{
const
{
start
,
end
}
=
locToStartAndEnd
(
source
,
error
.
loc
)
rollupError
.
frame
=
generateCodeFrame
(
source
,
start
,
end
).
replace
(
/
\t
/g
,
'
'
)
}
}
}
return
rollupError
}
packages/uni-app-uts/src/plugins/android/uvue/index.ts
浏览文件 @
71a37d75
...
...
@@ -13,6 +13,7 @@ import type { SourceMapInput, TransformPluginContext } from 'rollup'
import
{
isString
}
from
'
@vue/shared
'
import
{
AutoImportOptions
,
createRollupError
,
matchEasycom
,
normalizePath
,
parseUTSComponent
,
...
...
@@ -36,7 +37,6 @@ import {
getDescriptor
,
getSrcDescriptor
,
}
from
'
./descriptorCache
'
import
{
createRollupError
}
from
'
./error
'
import
{
addAutoImports
,
addExtApiComponents
,
...
...
packages/uni-app-vite/src/nvue/plugins/appCss.ts
浏览文件 @
71a37d75
import
type
{
Plugin
}
from
'
vite
'
import
type
{
PluginContext
,
RollupError
}
from
'
rollup
'
import
type
{
PluginContext
}
from
'
rollup
'
import
fs
from
'
fs-extra
'
import
{
CompilerError
,
SFCBlock
,
SFCDescriptor
}
from
'
@vue/compiler-sfc
'
import
{
SFCBlock
,
SFCDescriptor
}
from
'
@vue/compiler-sfc
'
import
{
createRollupError
,
hash
,
parseVueRequest
,
preNVueHtml
,
...
...
@@ -104,7 +105,9 @@ function createAppDescriptor(
descriptor
.
id
=
id
if
(
errors
.
length
)
{
errors
.
forEach
((
error
:
any
)
=>
pluginContext
.
error
(
createRollupError
(
filename
,
error
))
pluginContext
.
error
(
createRollupError
(
'
uni:app-nvue-app-style
'
,
filename
,
error
)
)
)
}
appDescriptor
=
descriptor
...
...
@@ -112,30 +115,6 @@ function createAppDescriptor(
return
appDescriptor
}
export
function
createRollupError
(
id
:
string
,
error
:
CompilerError
|
SyntaxError
):
RollupError
{
const
{
message
,
name
,
stack
}
=
error
const
rollupError
:
RollupError
=
{
id
,
plugin
:
'
vue
'
,
message
,
name
,
stack
,
}
if
(
'
code
'
in
error
&&
error
.
loc
)
{
rollupError
.
loc
=
{
file
:
id
,
line
:
error
.
loc
.
start
.
line
,
column
:
error
.
loc
.
start
.
column
,
}
}
return
rollupError
}
// these are built-in query parameters so should be ignored
// if the user happen to add them as attrs
const
ignoreList
=
[
'
id
'
,
'
index
'
,
'
src
'
,
'
type
'
,
'
lang
'
,
'
module
'
]
...
...
packages/uni-cli-shared/src/json/index.ts
浏览文件 @
71a37d75
...
...
@@ -7,4 +7,5 @@ export * from './theme'
export
{
normalizeUniAppXAppPagesJson
,
normalizeUniAppXAppConfig
,
checkPagesJson
,
}
from
'
./uni-x
'
packages/uni-cli-shared/src/vite/utils/utils.ts
浏览文件 @
71a37d75
import
type
{
ConfigEnv
,
ResolvedConfig
,
UserConfig
}
from
'
vite
'
import
{
generateCodeFrame
,
locToStartAndEnd
}
from
'
../plugins/vitejs/utils
'
import
{
RollupError
}
from
'
rollup
'
import
{
CompilerError
}
from
'
@vue/compiler-sfc
'
export
function
withSourcemap
(
config
:
ResolvedConfig
)
{
if
(
config
.
command
===
'
serve
'
)
{
...
...
@@ -23,3 +26,43 @@ export function isSsr(
}
return
false
}
export
function
createRollupError
(
plugin
:
string
,
id
:
string
,
error
:
CompilerError
|
SyntaxError
,
source
?:
string
):
RollupError
{
const
{
message
,
name
,
stack
}
=
error
const
rollupError
:
RollupError
=
{
id
,
plugin
,
message
,
name
,
stack
,
}
if
(
'
code
'
in
error
&&
error
.
loc
)
{
rollupError
.
loc
=
{
file
:
id
,
line
:
error
.
loc
.
start
.
line
,
column
:
error
.
loc
.
start
.
column
,
}
if
(
source
&&
source
.
length
>
0
)
{
if
(
'
offsetStart
'
in
error
&&
'
offsetEnd
'
in
error
)
{
rollupError
.
frame
=
generateCodeFrame
(
source
,
error
.
offsetStart
as
number
,
error
.
offsetEnd
as
number
).
replace
(
/
\t
/g
,
'
'
)
}
else
{
const
{
start
,
end
}
=
locToStartAndEnd
(
source
,
error
.
loc
)
rollupError
.
frame
=
generateCodeFrame
(
source
,
start
,
end
).
replace
(
/
\t
/g
,
'
'
)
}
}
}
return
rollupError
}
packages/uni-h5-vite/src/plugins/pagesJson.ts
浏览文件 @
71a37d75
...
...
@@ -12,6 +12,8 @@ import {
isEnableTreeShaking
,
parseManifestJsonOnce
,
MANIFEST_JSON_JS
,
checkPagesJson
,
createRollupError
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
isSSR
}
from
'
../utils
'
...
...
@@ -24,6 +26,25 @@ export function uniPagesJsonPlugin(): Plugin {
if
(
opts
.
filter
(
id
))
{
const
{
resolvedConfig
}
=
opts
const
ssr
=
isSSR
(
opt
)
if
(
process
.
env
.
UNI_APP_X
===
'
true
'
)
{
// 调整换行符,确保 parseTree 的loc正确
code
=
code
.
replace
(
/
\r\n
/g
,
'
\n
'
)
try
{
checkPagesJson
(
code
,
process
.
env
.
UNI_INPUT_DIR
)
}
catch
(
err
:
any
)
{
if
(
err
.
loc
)
{
const
error
=
createRollupError
(
'
uni:app-pages
'
,
'
pages.json
'
,
err
,
code
)
this
.
error
(
error
)
}
else
{
throw
err
}
}
}
return
{
code
:
registerGlobalCode
(
resolvedConfig
,
ssr
)
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录