Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wulaladx
uni-app
提交
2c947ca1
U
uni-app
项目概览
wulaladx
/
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,发现更多精彩内容 >>
提交
2c947ca1
编写于
8月 30, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(uts): web and mp
上级
0eeb015f
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
49 addition
and
18 deletion
+49
-18
packages/shims-node.d.ts
packages/shims-node.d.ts
+2
-1
packages/uni-cli-shared/src/constants.ts
packages/uni-cli-shared/src/constants.ts
+1
-0
packages/uni-mp-vite/src/plugins/usingComponents.ts
packages/uni-mp-vite/src/plugins/usingComponents.ts
+24
-3
packages/uni-stacktracey/dist/uni-stacktracey.cjs.js
packages/uni-stacktracey/dist/uni-stacktracey.cjs.js
+1
-0
packages/uni-stacktracey/dist/uni-stacktracey.es.js
packages/uni-stacktracey/dist/uni-stacktracey.es.js
+1
-0
packages/uni-stacktracey/src/index.ts
packages/uni-stacktracey/src/index.ts
+1
-0
packages/uni-uts-vite/src/plugins/v1.ts
packages/uni-uts-vite/src/plugins/v1.ts
+1
-12
packages/vite-plugin-uni/src/cli/utils.ts
packages/vite-plugin-uni/src/cli/utils.ts
+6
-0
packages/vite-plugin-uni/src/config/index.ts
packages/vite-plugin-uni/src/config/index.ts
+5
-0
packages/vite-plugin-uni/src/configResolved/plugins/resolveId.ts
...s/vite-plugin-uni/src/configResolved/plugins/resolveId.ts
+7
-2
未找到文件。
packages/shims-node.d.ts
浏览文件 @
2c947ca1
...
...
@@ -2,13 +2,14 @@ declare namespace NodeJS {
interface
Process
{
UNI_NVUE_ENTRY
:
Record
<
string
,
string
>
}
interface
ProcessEnv
{
NODE_ENV
:
'
production
'
|
'
development
'
|
'
test
'
UNI_NODE_ENV
:
'
production
'
|
'
development
'
|
'
test
'
UNI_PLATFORM
:
UniApp
.
PLATFORM
UNI_SUB_PLATFORM
:
'
quickapp-webview-huawei
'
|
'
quickapp-webview-union
'
UNI_APP_PLATFORM
:
'
android
'
|
'
ios
'
UNI_UTS_PLATFORM
:
'
app-android
'
|
'
app-ios
'
UNI_UTS_PLATFORM
:
'
app-android
'
|
'
app-ios
'
|
'
web
'
|
UniApp
.
PLATFORM
UNI_INPUT_DIR
:
string
UNI_OUTPUT_DIR
:
string
...
...
packages/uni-cli-shared/src/constants.ts
浏览文件 @
2c947ca1
...
...
@@ -8,6 +8,7 @@ export const EXTNAME_JS_RE = /\.(js|jsx|ts|tsx|mjs)$/
export
const
EXTNAME_TS_RE
=
/
\.
tsx
?
$/
export
const
extensions
=
[
'
.uts
'
,
'
.mjs
'
,
'
.js
'
,
'
.ts
'
,
...
...
packages/uni-mp-vite/src/plugins/usingComponents.ts
浏览文件 @
2c947ca1
...
...
@@ -14,8 +14,10 @@ import {
updateMiniProgramComponentsByScriptFilename
,
updateMiniProgramComponentsByTemplateFilename
,
withSourcemap
,
resolveUtsModule
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
virtualComponentPath
,
virtualPagePath
}
from
'
./entry
'
import
{
CustomPluginOptions
,
ResolvedId
}
from
'
rollup
'
export
function
uniUsingComponentsPlugin
(
options
:
{
...
...
@@ -49,6 +51,25 @@ export function uniUsingComponentsPlugin(
sourceMap
,
dynamicImport
,
}
const
resolve
=
async
(
source
:
string
,
importer
?:
string
,
options
?:
{
custom
?:
CustomPluginOptions
isEntry
?:
boolean
skipSelf
?:
boolean
}
):
Promise
<
ResolvedId
|
null
>
=>
{
const
id
=
resolveUtsModule
(
source
,
importer
||
process
.
env
.
UNI_INPUT_DIR
,
process
.
env
.
UNI_UTS_PLATFORM
)
if
(
id
)
{
source
=
id
}
return
this
.
resolve
(
source
,
importer
,
options
)
}
if
(
query
.
vue
)
{
if
(
query
.
type
===
'
script
'
)
{
// 需要主动监听
...
...
@@ -57,7 +78,7 @@ export function uniUsingComponentsPlugin(
filename
,
parseAst
(
source
,
id
),
{
resolve
:
this
.
resolve
,
resolve
,
isExternal
:
true
,
}
)
...
...
@@ -78,7 +99,7 @@ export function uniUsingComponentsPlugin(
filename
,
parseAst
(
source
,
id
),
{
resolve
:
this
.
resolve
,
resolve
,
isExternal
:
true
,
}
)
...
...
@@ -101,7 +122,7 @@ export function uniUsingComponentsPlugin(
const
ast
=
parseAst
(
source
,
id
)
const
descriptor
=
await
parseMainDescriptor
(
filename
,
ast
,
this
.
resolve
)
const
descriptor
=
await
parseMainDescriptor
(
filename
,
ast
,
resolve
)
updateMiniProgramComponentsByMainFilename
(
filename
,
...
...
packages/uni-stacktracey/dist/uni-stacktracey.cjs.js
浏览文件 @
2c947ca1
...
...
@@ -3906,6 +3906,7 @@ function utsStracktraceyPreset(opts) {
return
`at
${
nixSlashes
(
path__default
[
"
default
"
].
relative
(
inputRoot
,
_stack
.
file
.
replace
(
'
\\\\
?
\\
'
,
''
)))}
:
${
_stack
.
line
}
:
${
_stack
.
column
}
${
_stack
.
errMsg
}
`
;
}
return
''
;
}
return
item
;
})
...
...
packages/uni-stacktracey/dist/uni-stacktracey.es.js
浏览文件 @
2c947ca1
...
...
@@ -3900,6 +3900,7 @@ function utsStracktraceyPreset(opts) {
return
`at
${
nixSlashes
(
path
.
relative
(
inputRoot
,
_stack
.
file
.
replace
(
'
\\\\
?
\\
'
,
''
)))}
:
${
_stack
.
line
}
:
${
_stack
.
column
}
${
_stack
.
errMsg
}
`
;
}
return
''
;
}
return
item
;
})
...
...
packages/uni-stacktracey/src/index.ts
浏览文件 @
2c947ca1
...
...
@@ -484,6 +484,7 @@ export function utsStracktraceyPreset(
)}
:
${
_stack
.
line
}
:
${
_stack
.
column
}
${
_stack
.
errMsg
}
`
}
return
''
}
return
item
})
...
...
packages/uni-uts-vite/src/plugins/v1.ts
浏览文件 @
2c947ca1
import
type
{
Plugin
}
from
'
vite
'
import
path
from
'
path
'
import
{
isInHBuilderX
,
parseVueRequest
,
resolveUtsModule
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
isInHBuilderX
,
parseVueRequest
}
from
'
@dcloudio/uni-cli-shared
'
import
{
ClassDeclaration
,
ClassExpression
,
...
...
@@ -28,13 +24,6 @@ export function uniUtsV1Plugin(): Plugin {
name
:
'
uni:uts-v1
'
,
apply
:
'
build
'
,
enforce
:
'
pre
'
,
resolveId
(
id
,
importer
)
{
return
resolveUtsModule
(
id
,
importer
?
path
.
dirname
(
importer
)
:
process
.
env
.
UNI_INPUT_DIR
,
process
.
env
.
UNI_UTS_PLATFORM
)
},
async
transform
(
code
,
id
,
opts
)
{
if
(
opts
&&
opts
.
ssr
)
{
return
...
...
packages/vite-plugin-uni/src/cli/utils.ts
浏览文件 @
2c947ca1
...
...
@@ -190,6 +190,12 @@ function initUtsPlatform(options: CliOptions) {
if
(
options
.
platform
===
'
app
'
&&
!
process
.
env
.
UNI_UTS_PLATFORM
)
{
process
.
env
.
UNI_UTS_PLATFORM
=
'
app-android
'
}
if
(
options
.
platform
===
'
h5
'
)
{
process
.
env
.
UNI_UTS_PLATFORM
=
'
web
'
}
if
(
!
process
.
env
.
UNI_UTS_PLATFORM
)
{
process
.
env
.
UNI_UTS_PLATFORM
=
options
.
platform
as
any
}
}
function
initAutomator
({
autoHost
,
autoPort
}:
CliOptions
)
{
...
...
packages/vite-plugin-uni/src/config/index.ts
浏览文件 @
2c947ca1
...
...
@@ -43,6 +43,11 @@ export function createConfig(
optimizeDeps
:
createOptimizeDeps
(
options
),
build
:
createBuild
(
options
,
config
),
css
:
createCss
(
options
,
config
),
esbuild
:
{
include
:
/
\.(
tsx
?
|jsx|uts
)
$/
,
exclude
:
/
\.
js$/
,
loader
:
'
ts
'
,
},
worker
:
{
plugins
:
initFixedEsbuildInitTSConfck
(
process
.
env
.
UNI_INPUT_DIR
),
},
...
...
packages/vite-plugin-uni/src/configResolved/plugins/resolveId.ts
浏览文件 @
2c947ca1
import
path
from
'
path
'
import
debug
from
'
debug
'
import
{
Plugin
}
from
'
vite
'
import
{
resolveBuiltIn
}
from
'
@dcloudio/uni-cli-shared
'
import
{
resolveBuiltIn
,
resolveUtsModule
}
from
'
@dcloudio/uni-cli-shared
'
import
{
VitePluginUniResolvedOptions
}
from
'
../..
'
...
...
@@ -28,7 +28,7 @@ export function uniResolveIdPlugin(
const
resolveCache
:
Record
<
string
,
string
>
=
{}
return
{
name
:
'
uni:resolve-id
'
,
resolveId
(
id
)
{
resolveId
(
id
,
importer
)
{
const
cache
=
resolveCache
[
id
]
if
(
cache
)
{
debugResolve
(
'
cache
'
,
id
,
cache
)
...
...
@@ -39,6 +39,11 @@ export function uniResolveIdPlugin(
path
.
join
(
id
,
BUILT_IN_MODULES
[
id
as
BuiltInModulesKey
])
))
}
return
resolveUtsModule
(
id
,
importer
?
path
.
dirname
(
importer
)
:
process
.
env
.
UNI_INPUT_DIR
,
process
.
env
.
UNI_UTS_PLATFORM
)
},
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录