Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
42be6f8c
U
uni-app
项目概览
DCloud
/
uni-app
5 天 前同步成功
通知
815
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看板
提交
42be6f8c
编写于
11月 30, 2023
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(uvue): 优化部分语法解析报错
上级
c7287813
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
3 deletion
+36
-3
packages/uni-app-uts/src/plugins/android/utils.ts
packages/uni-app-uts/src/plugins/android/utils.ts
+33
-2
packages/uni-cli-shared/src/vite/plugins/vitejs/utils.ts
packages/uni-cli-shared/src/vite/plugins/vitejs/utils.ts
+3
-1
未找到文件。
packages/uni-app-uts/src/plugins/android/utils.ts
浏览文件 @
42be6f8c
...
@@ -3,6 +3,7 @@ import path from 'path'
...
@@ -3,6 +3,7 @@ import path from 'path'
import
{
init
,
parse
}
from
'
es-module-lexer
'
import
{
init
,
parse
}
from
'
es-module-lexer
'
import
{
import
{
AutoImportOptions
,
AutoImportOptions
,
createRollupError
,
initAutoImportOptions
,
initAutoImportOptions
,
normalizeNodeModules
,
normalizeNodeModules
,
normalizePath
,
normalizePath
,
...
@@ -20,6 +21,8 @@ import {
...
@@ -20,6 +21,8 @@ import {
import
AutoImport
from
'
unplugin-auto-import/vite
'
import
AutoImport
from
'
unplugin-auto-import/vite
'
import
{
once
}
from
'
@dcloudio/uni-shared
'
import
{
once
}
from
'
@dcloudio/uni-shared
'
import
{
SourceMapInput
}
from
'
rollup
'
import
{
SourceMapInput
}
from
'
rollup
'
import
{
createCompilerError
}
from
'
./uvue/compiler/errors
'
import
{
SourceLocation
}
from
'
@vue/compiler-core
'
export
const
UVUE_CLASS_NAME_PREFIX
=
'
Gen
'
export
const
UVUE_CLASS_NAME_PREFIX
=
'
Gen
'
...
@@ -29,8 +32,36 @@ export const ENTRY_FILENAME = 'main.uts'
...
@@ -29,8 +32,36 @@ export const ENTRY_FILENAME = 'main.uts'
export
async
function
parseImports
(
code
:
string
)
{
export
async
function
parseImports
(
code
:
string
)
{
await
init
await
init
const
[
imports
]
=
parse
(
code
)
let
res
:
ReturnType
<
typeof
parse
>
=
[[],
[],
false
]
return
imports
try
{
res
=
parse
(
code
)
}
catch
(
err
:
any
)
{
const
message
=
err
.
message
if
(
message
)
{
const
matches
=
message
.
match
(
/@:
(\d
+
)
:
(\d
+
)
/
)
if
(
matches
)
{
throw
createRollupError
(
''
,
''
,
createCompilerError
(
0
,
{
start
:
{
offset
:
0
,
line
:
parseInt
(
matches
[
1
]),
column
:
parseInt
(
matches
[
2
]),
},
}
as
SourceLocation
,
{
0
:
'
Parse error
'
},
''
),
code
)
}
}
throw
err
}
return
res
[
0
]
.
map
(({
s
,
e
})
=>
{
.
map
(({
s
,
e
})
=>
{
return
`import "
${
code
.
slice
(
s
,
e
)}
"`
return
`import "
${
code
.
slice
(
s
,
e
)}
"`
})
})
...
...
packages/uni-cli-shared/src/vite/plugins/vitejs/utils.ts
浏览文件 @
42be6f8c
...
@@ -109,7 +109,9 @@ export function locToStartAndEnd(
...
@@ -109,7 +109,9 @@ export function locToStartAndEnd(
)
{
)
{
const
lines
=
source
.
split
(
splitRE
)
const
lines
=
source
.
split
(
splitRE
)
const
start
=
posToNumberByLines
(
lines
,
loc
.
start
.
line
,
loc
.
start
.
column
)
const
start
=
posToNumberByLines
(
lines
,
loc
.
start
.
line
,
loc
.
start
.
column
)
const
end
=
posToNumberByLines
(
lines
,
loc
.
end
.
line
,
loc
.
end
.
column
)
const
end
=
loc
.
end
?
posToNumberByLines
(
lines
,
loc
.
end
.
line
,
loc
.
end
.
column
)
:
undefined
return
{
start
,
end
}
return
{
start
,
end
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录