Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
bb88d93d
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,发现更多精彩内容 >>
提交
bb88d93d
编写于
8月 30, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(uts): compiler
上级
9bd88e4b
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
127 addition
and
51 deletion
+127
-51
packages/playground/uts/uni_modules/test-uniplugin/app-android/index.uts
...ound/uts/uni_modules/test-uniplugin/app-android/index.uts
+1
-1
packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-android/index.kt
.../dist/app/uni_modules/test-uniplugin/app-android/index.kt
+1
-0
packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-android/index.kt.map
...t/app/uni_modules/test-uniplugin/app-android/index.kt.map
+1
-1
packages/uni-cli-shared/src/resolve.ts
packages/uni-cli-shared/src/resolve.ts
+48
-11
packages/uni-uts-vite/src/plugins/v1.ts
packages/uni-uts-vite/src/plugins/v1.ts
+6
-17
packages/uni-uts-vite/src/utils/compiler.ts
packages/uni-uts-vite/src/utils/compiler.ts
+58
-21
packages/uts-darwin-arm64/uts.darwin-arm64.node
packages/uts-darwin-arm64/uts.darwin-arm64.node
+0
-0
packages/uts-darwin-x64/uts.darwin-x64.node
packages/uts-darwin-x64/uts.darwin-x64.node
+0
-0
packages/vite-plugin-uni/src/cli/utils.ts
packages/vite-plugin-uni/src/cli/utils.ts
+3
-0
packages/vite-plugin-uni/src/config/resolve.ts
packages/vite-plugin-uni/src/config/resolve.ts
+9
-0
未找到文件。
packages/playground/uts/uni_modules/test-uniplugin/app-android/index.uts
浏览文件 @
bb88d93d
import FrameLayout from 'android.widget.FrameLayout'
import Log from 'android.util.Log'
import Log from 'android.util.Log'
import FrameLayout from 'android.widget.FrameLayout'
import { IUser } from './interface.uts'
import { IUser } from './interface.uts'
import { login } from './login.uts'
import { login } from './login.uts'
import logo from '../static/logo.png'
import logo from '../static/logo.png'
...
...
packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-android/index.kt
浏览文件 @
bb88d93d
...
@@ -3,6 +3,7 @@ import kotlinx.coroutines.*;
...
@@ -3,6 +3,7 @@ import kotlinx.coroutines.*;
import
io.dcloud.uts.runtime.*;
import
io.dcloud.uts.runtime.*;
import
io.dcloud.uts.android.getResourcePath;
import
io.dcloud.uts.android.getResourcePath;
import
android.util.Log;
import
android.util.Log;
import
android.widget.FrameLayout;
interface
IUser
{
interface
IUser
{
fun
register
(
name
:
String
):
Unit
;
fun
register
(
name
:
String
):
Unit
;
}
}
...
...
packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-android/index.kt.map
浏览文件 @
bb88d93d
{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/static/logo.png","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/index.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/interface.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/login.uts"],"sourcesContent":["import { getResourcePath } from 'io.dcloud.uts.android'\nexport default getResourcePath('uni_modules/test-uniplugin/static/logo.png')\n ","import FrameLayout from 'android.widget.FrameLayout'\nimport Log from 'android.util.Log'\nimport { IUser } from './interface.uts'\nimport { login } from './login.uts'\nimport logo from '../static/logo.png'\nexport class User implements IUser {\n async login(name: string, pwd: string) {\n setTimeout(() => {\n console.log('timeout')\n }, 1000)\n login(name, pwd)\n Log.info('123')\n Log.info(logo)\n }\n register(name: string, callback: () => void) {\n Log.info(logo as FrameLayout)\n }\n}\nfunction login(name: string, callback: () => void) {}\nexport function register(name: string, callback: () => void) {}\n","export interface IUser {\n register(name: string): void\n}\n","export function login(name: string, pwd: string) {\n console.log('login')\n return { name, pwd }\n}\n"],"names":[],"mappings":";;;AAAA;ACCA,OAAgB,gBAAkB,CAAA;UCDjB,KAAK;QACpB,QAAQ,CAAC,IAAY,EAAN,MAAM,GAAG,IAAI;;ACDvB,IAAS,KAAK,CAAC,IAAY,EAAN,MAAM,EAAE,GAAW,EAAN,MAAM,iBAAE;IAC/C,OAAO,CAAC,GAAG,CAAC,OAAO,0DAAC;IACpB,OAAO;QAAE,IAAA,IAAI,GAAJ,IAAI;QAAE,IAAA,GAAG,GAAH,GAAG;KAAE,CAAA;AACtB;gBHFe,eAAe,CAAC,4CAA4C,CAAC;ACIrE,WAAM,IAAI,GAAY,KAAK;qBAC1B,KAAK,CAAC,IAAY,EAAN,MAAM,EAAE,GAAW,EAAN,MAAM,8CAAE;QACrC,UAAU,CAAC,KAAM;YACf,OAAO,CAAC,GAAG,CAAC,SAAS,0DAAC;QACxB;QAAC,EAAE,IAAI,CAAC;QACR,MAAM,IAAI,EAAE,GAAG,CAAC;QAChB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;QACf,GAAG,CAAC,IAAI,WAAM;IAChB;iBACA,QAAQ,CAAC,IAAY,EAAN,MAAM,EAAE,QAAoB,aAAA,EAAE;QAC3C,GAAG,CAAC,IAAI,cAAS,WAAW,CAAC;IAC/B;CACD;AACD,UAAe,IAAY,EAAN,MAAM,EAAE,QAAoB,QAAJ,IAAI,EAAE,CAAC,CAAC;AAC9C,IAAS,QAAQ,CAAC,IAAY,EAAN,MAAM,EAAE,QAAoB,aAAA,EAAE,CAAC,CAAC"}
{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/static/logo.png","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/index.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/interface.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/login.uts"],"sourcesContent":["import { getResourcePath } from 'io.dcloud.uts.android'\nexport default getResourcePath('uni_modules/test-uniplugin/static/logo.png')\n ","import Log from 'android.util.Log'\nimport FrameLayout from 'android.widget.FrameLayout'\nimport { IUser } from './interface.uts'\nimport { login } from './login.uts'\nimport logo from '../static/logo.png'\nexport class User implements IUser {\n async login(name: string, pwd: string) {\n setTimeout(() => {\n console.log('timeout')\n }, 1000)\n login(name, pwd)\n Log.info('123')\n Log.info(logo)\n }\n register(name: string, callback: () => void) {\n Log.info(logo as FrameLayout)\n }\n}\nfunction login(name: string, callback: () => void) {}\nexport function register(name: string, callback: () => void) {}\n","export interface IUser {\n register(name: string): void\n}\n","export function login(name: string, pwd: string) {\n console.log('login')\n return { name, pwd }\n}\n"],"names":[],"mappings":";;;AAAA;ACAA,OAAgB,gBAAkB,CAAA;AAClC,OAAwB,0BAA4B,CAAA;UCDnC,KAAK;QACpB,QAAQ,CAAC,IAAY,EAAN,MAAM,GAAG,IAAI;;ACDvB,IAAS,KAAK,CAAC,IAAY,EAAN,MAAM,EAAE,GAAW,EAAN,MAAM,iBAAE;IAC/C,OAAO,CAAC,GAAG,CAAC,OAAO,0DAAC;IACpB,OAAO;QAAE,IAAA,IAAI,GAAJ,IAAI;QAAE,IAAA,GAAG,GAAH,GAAG;KAAE,CAAA;AACtB;gBHFe,eAAe,CAAC,4CAA4C,CAAC;ACIrE,WAAM,IAAI,GAAY,KAAK;qBAC1B,KAAK,CAAC,IAAY,EAAN,MAAM,EAAE,GAAW,EAAN,MAAM,8CAAE;QACrC,UAAU,CAAC,KAAM;YACf,OAAO,CAAC,GAAG,CAAC,SAAS,0DAAC;QACxB;QAAC,EAAE,IAAI,CAAC;QACR,MAAM,IAAI,EAAE,GAAG,CAAC;QAChB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;QACf,GAAG,CAAC,IAAI,WAAM;IAChB;iBACA,QAAQ,CAAC,IAAY,EAAN,MAAM,EAAE,QAAoB,aAAA,EAAE;QAC3C,GAAG,CAAC,IAAI,cAAS,WAAW,CAAC;IAC/B;CACD;AACD,UAAe,IAAY,EAAN,MAAM,EAAE,QAAoB,QAAJ,IAAI,EAAE,CAAC,CAAC;AAC9C,IAAS,QAAQ,CAAC,IAAY,EAAN,MAAM,EAAE,QAAoB,aAAA,EAAE,CAAC,CAAC"}
\ No newline at end of file
\ No newline at end of file
packages/uni-cli-shared/src/resolve.ts
浏览文件 @
bb88d93d
...
@@ -19,17 +19,6 @@ function resolveWithSymlinks(id: string, basedir: string): string {
...
@@ -19,17 +19,6 @@ function resolveWithSymlinks(id: string, basedir: string): string {
extensions
,
extensions
,
// necessary to work with pnpm
// necessary to work with pnpm
preserveSymlinks
:
true
,
preserveSymlinks
:
true
,
pathFilter
(
pkg
,
filepath
,
relativePath
)
{
if
(
pkg
.
uni_modules
&&
(
pkg
.
uni_modules
as
any
).
type
===
'
uts
'
)
{
const
file
=
process
.
env
.
UNI_UTS_PLATFORM
+
'
/index.uts
'
if
(
fs
.
existsSync
(
path
.
join
(
filepath
.
replace
(
relativePath
,
''
),
file
))
)
{
return
file
}
}
return
relativePath
},
})
})
}
}
...
@@ -130,3 +119,51 @@ export function resolveComponentsLibPath() {
...
@@ -130,3 +119,51 @@ export function resolveComponentsLibPath() {
}
}
return
componentsLibPath
return
componentsLibPath
}
}
// 仅限 root/uni_modules/test-plugin | root/utssdk/test-plugin 格式
export
function
resolveUtsModule
(
id
:
string
,
importer
:
string
,
platform
:
typeof
process
.
env
.
UNI_UTS_PLATFORM
)
{
id
=
path
.
resolve
(
importer
,
id
)
if
(
id
.
includes
(
'
utssdk
'
)
||
id
.
includes
(
'
uni_modules
'
))
{
const
parts
=
normalizePath
(
id
).
split
(
'
/
'
)
const
parentDir
=
parts
[
parts
.
length
-
2
]
if
(
parentDir
===
'
uni_modules
'
||
parentDir
===
'
utssdk
'
)
{
const
index
=
path
.
resolve
(
id
,
'
index.uts
'
)
if
(
fs
.
existsSync
(
index
))
{
return
index
}
if
(
parentDir
===
'
uni_modules
'
&&
!
fs
.
existsSync
(
path
.
join
(
id
,
'
utssdk
'
))
)
{
// uni_modules/test-plugin/utssdk不存在
return
}
const
platformDir
=
path
.
resolve
(
id
,
parentDir
===
'
uni_modules
'
?
'
utssdk
'
:
''
,
platform
)
// App平台仅支持 uts
if
(
platform
===
'
app-android
'
||
platform
===
'
app-ios
'
)
{
return
resolveUtsFile
(
platformDir
,
[
'
.uts
'
])
}
return
resolveUtsFile
(
platformDir
)
}
}
}
function
resolveUtsFile
(
dir
:
string
,
extensions
:
string
[]
=
[
'
.uts
'
,
'
.ts
'
,
'
.js
'
]
)
{
for
(
let
i
=
0
;
i
<
extensions
.
length
;
i
++
)
{
const
indexFile
=
path
.
join
(
dir
,
'
index
'
+
extensions
[
i
])
if
(
fs
.
existsSync
(
indexFile
))
{
return
indexFile
}
}
}
packages/uni-uts-vite/src/plugins/v1.ts
浏览文件 @
bb88d93d
...
@@ -2,9 +2,8 @@ import type { Plugin } from 'vite'
...
@@ -2,9 +2,8 @@ import type { Plugin } from 'vite'
import
path
from
'
path
'
import
path
from
'
path
'
import
{
import
{
isInHBuilderX
,
isInHBuilderX
,
normalizePath
,
parseVueRequest
,
parseVueRequest
,
re
quireResolv
e
,
re
solveUtsModul
e
,
}
from
'
@dcloudio/uni-cli-shared
'
}
from
'
@dcloudio/uni-cli-shared
'
import
{
import
{
ClassDeclaration
,
ClassDeclaration
,
...
@@ -30,12 +29,11 @@ export function uniUtsV1Plugin(): Plugin {
...
@@ -30,12 +29,11 @@ export function uniUtsV1Plugin(): Plugin {
apply
:
'
build
'
,
apply
:
'
build
'
,
enforce
:
'
pre
'
,
enforce
:
'
pre
'
,
resolveId
(
id
,
importer
)
{
resolveId
(
id
,
importer
)
{
if
(
isUtsModuleRoot
(
id
))
{
return
resolveUtsModule
(
return
requireResolve
(
id
,
id
,
(
importer
&&
path
.
dirname
(
importer
))
||
process
.
env
.
UNI_INPUT_DIR
importer
?
path
.
dirname
(
importer
)
:
process
.
env
.
UNI_INPUT_DIR
,
process
.
env
.
UNI_UTS_PLATFORM
)
)
}
},
},
async
transform
(
code
,
id
,
opts
)
{
async
transform
(
code
,
id
,
opts
)
{
if
(
opts
&&
opts
.
ssr
)
{
if
(
opts
&&
opts
.
ssr
)
{
...
@@ -80,15 +78,6 @@ ${genProxyCode(ast)}
...
@@ -80,15 +78,6 @@ ${genProxyCode(ast)}
}
}
}
}
// 仅限 uni_modules/test-plugin 格式
function
isUtsModuleRoot
(
id
:
string
)
{
const
parts
=
normalizePath
(
id
).
split
(
'
/
'
)
if
(
parts
[
parts
.
length
-
2
]
===
'
uni_modules
'
)
{
return
true
}
return
false
}
function
genProxyFunctionCode
(
function
genProxyFunctionCode
(
method
:
string
,
method
:
string
,
async
:
boolean
,
async
:
boolean
,
...
...
packages/uni-uts-vite/src/utils/compiler.ts
浏览文件 @
bb88d93d
...
@@ -54,36 +54,39 @@ export async function compile(filename: string) {
...
@@ -54,36 +54,39 @@ export async function compile(filename: string) {
},
},
})
})
// console.log('uts compile time: ' + (Date.now() - time) + 'ms')
// console.log('uts compile time: ' + (Date.now() - time) + 'ms')
const
kotlinFile
=
resolveKotlinFile
(
filename
,
inputDir
,
outputDir
)
const
kotlinFile
=
resolveKotlinFile
(
filename
,
inputDir
,
outputDir
)
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
const
androidInputDir
=
resolveAndroidDir
(
filename
)
const
androidOutputDir
=
resolveAndroidDir
(
kotlinFile
)
// 生产模式下,需要将 kt 文件转移到 src 下
// 生产模式下,需要将 kt 文件转移到 src 下
fs
.
copyFileSync
(
const
cfgJson
=
path
.
resolve
(
androidInputDir
,
'
config.json
'
)
path
.
resolve
(
filename
,
'
../../package.json
'
),
if
(
fs
.
existsSync
(
cfgJson
))
{
path
.
resolve
(
kotlinFile
,
'
../../package.json
'
)
fs
.
copyFileSync
(
cfgJson
,
path
.
resolve
(
androidOutputDir
,
'
config.json
'
)
)
)
}
fs
.
mkdirSync
(
path
.
resolve
(
kotlinFile
,
'
../
src
'
))
fs
.
mkdirSync
(
path
.
resolve
(
androidOutputDir
,
'
src
'
))
if
(
fs
.
existsSync
(
kotlinFile
))
{
if
(
fs
.
existsSync
(
kotlinFile
))
{
fs
.
moveSync
(
kotlinFile
,
path
.
resolve
(
kotlinFile
,
'
../
src/index.kt
'
))
fs
.
moveSync
(
kotlinFile
,
path
.
resolve
(
androidOutputDir
,
'
src/index.kt
'
))
}
}
const
kotlinMapFile
=
kotlinFile
+
'
.map
'
const
kotlinMapFile
=
kotlinFile
+
'
.map
'
if
(
fs
.
existsSync
(
kotlinMapFile
))
{
if
(
fs
.
existsSync
(
kotlinMapFile
))
{
fs
.
moveSync
(
fs
.
moveSync
(
kotlinMapFile
,
kotlinMapFile
,
path
.
resolve
(
kotlinFile
,
'
../
src/index.map.kt
'
)
path
.
resolve
(
androidOutputDir
,
'
src/index.map.kt
'
)
)
)
}
}
const
copies
=
[
'
assets
'
,
'
libs
'
,
'
res
'
]
const
copies
=
[
'
assets
'
,
'
libs
'
,
'
res
'
]
const
moduleDir
=
path
.
dirname
(
filename
)
if
(
fs
.
existsSync
(
androidInputDir
))
{
const
outputModuleDir
=
path
.
dirname
(
kotlinFile
)
fs
.
readdirSync
(
androidInputDir
).
forEach
((
file
)
=>
{
fs
.
readdirSync
(
moduleDir
).
forEach
((
file
)
=>
{
if
(
copies
.
includes
(
file
))
{
if
(
copies
.
includes
(
file
))
{
fs
.
copySync
(
fs
.
copySync
(
path
.
join
(
module
Dir
,
file
),
path
.
join
(
androidInput
Dir
,
file
),
path
.
join
(
outputModule
Dir
,
file
)
path
.
join
(
androidOutput
Dir
,
file
)
)
)
}
}
})
})
}
}
else
if
(
process
.
env
.
NODE_ENV
===
'
development
'
)
{
}
else
if
(
process
.
env
.
NODE_ENV
===
'
development
'
)
{
// 开发模式下,需要生成 dex
// 开发模式下,需要生成 dex
if
(
fs
.
existsSync
(
kotlinFile
))
{
if
(
fs
.
existsSync
(
kotlinFile
))
{
...
@@ -143,7 +146,7 @@ function resolveD8Args(filename: string) {
...
@@ -143,7 +146,7 @@ function resolveD8Args(filename: string) {
}
}
function
resolveLibs
(
filename
:
string
)
{
function
resolveLibs
(
filename
:
string
)
{
const
libsPath
=
path
.
resolve
(
path
.
dirname
(
filename
),
'
libs
'
)
const
libsPath
=
path
.
resolve
(
resolveAndroidDir
(
filename
),
'
libs
'
)
const
libs
:
string
[]
=
[]
const
libs
:
string
[]
=
[]
if
(
fs
.
existsSync
(
libsPath
))
{
if
(
fs
.
existsSync
(
libsPath
))
{
libs
.
push
(...
sync
(
'
*.jar
'
,
{
cwd
:
libsPath
,
absolute
:
true
}))
libs
.
push
(...
sync
(
'
*.jar
'
,
{
cwd
:
libsPath
,
absolute
:
true
}))
...
@@ -179,14 +182,42 @@ function resolveDexFile(jarFile: string) {
...
@@ -179,14 +182,42 @@ function resolveDexFile(jarFile: string) {
return
normalizePath
(
path
.
resolve
(
path
.
dirname
(
jarFile
),
'
classes.dex
'
))
return
normalizePath
(
path
.
resolve
(
path
.
dirname
(
jarFile
),
'
classes.dex
'
))
}
}
function
resolveAndroidDir
(
filename
:
string
)
{
const
maybeAndroidDir
=
path
.
dirname
(
filename
)
// 如果是根目录的index.uts编译出来的index.kt,则移动到app-android下
const
isRootIndex
=
path
.
basename
(
maybeAndroidDir
)
!==
'
app-android
'
if
(
isRootIndex
)
{
if
(
maybeAndroidDir
.
includes
(
'
uni_modules
'
))
{
return
path
.
join
(
maybeAndroidDir
,
'
utssdk/app-android
'
)
}
return
path
.
join
(
maybeAndroidDir
,
'
app-android
'
)
}
return
maybeAndroidDir
}
function
resolveKotlinFile
(
function
resolveKotlinFile
(
filename
:
string
,
filename
:
string
,
inputDir
:
string
,
inputDir
:
string
,
outputDir
:
string
outputDir
:
string
)
{
)
{
return
path
let
ktFile
=
path
.
resolve
(
outputDir
,
path
.
relative
(
inputDir
,
filename
))
.
resolve
(
outputDir
,
path
.
relative
(
inputDir
,
filename
))
.
replace
(
path
.
extname
(
filename
),
'
.kt
'
)
.
replace
(
path
.
extname
(
filename
),
'
.kt
'
)
const
maybeModuleDir
=
path
.
dirname
(
filename
)
// 如果是根目录的index.uts编译出来的index.kt,则移动到app-android下
const
isRootIndex
=
path
.
basename
(
maybeModuleDir
)
!==
'
app-android
'
if
(
isRootIndex
)
{
if
(
fs
.
existsSync
(
ktFile
))
{
const
newKtFile
=
path
.
resolve
(
path
.
dirname
(
ktFile
),
(
maybeModuleDir
.
includes
(
'
uni_modules
'
)
?
'
utssdk/
'
:
''
)
+
'
app-android/index.kt
'
)
fs
.
moveSync
(
ktFile
,
newKtFile
)
ktFile
=
newKtFile
}
}
return
ktFile
}
}
function
resolveDexPath
(
filename
:
string
)
{
function
resolveDexPath
(
filename
:
string
)
{
...
@@ -226,9 +257,15 @@ const getCompilerServer = ():
...
@@ -226,9 +257,15 @@ const getCompilerServer = ():
export
function
parsePackage
(
filepath
:
string
)
{
export
function
parsePackage
(
filepath
:
string
)
{
const
parts
=
normalizePath
(
filepath
).
split
(
'
/
'
)
const
parts
=
normalizePath
(
filepath
).
split
(
'
/
'
)
const
index
=
parts
.
findIndex
((
part
)
=>
part
===
'
uni_modules
'
)
const
isUniModules
=
parts
.
includes
(
'
uni_modules
'
)
const
index
=
isUniModules
?
parts
.
findIndex
((
part
)
=>
part
===
'
uni_modules
'
)
:
parts
.
findIndex
((
part
)
=>
part
===
'
utssdk
'
)
if
(
index
>
-
1
)
{
if
(
index
>
-
1
)
{
return
'
uts.modules.
'
+
camelize
(
parts
[
index
+
1
])
return
(
'
uts.sdk.
'
+
(
isUniModules
?
'
modules.
'
:
''
)
+
camelize
(
parts
[
index
+
1
])
)
}
}
return
''
return
''
}
}
packages/uts-darwin-arm64/uts.darwin-arm64.node
浏览文件 @
bb88d93d
无法预览此类型文件
packages/uts-darwin-x64/uts.darwin-x64.node
浏览文件 @
bb88d93d
无法预览此类型文件
packages/vite-plugin-uni/src/cli/utils.ts
浏览文件 @
bb88d93d
...
@@ -187,6 +187,9 @@ function initUtsPlatform(options: CliOptions) {
...
@@ -187,6 +187,9 @@ function initUtsPlatform(options: CliOptions) {
options
.
platform
=
'
app
'
options
.
platform
=
'
app
'
}
}
}
}
if
(
options
.
platform
===
'
app
'
&&
!
process
.
env
.
UNI_UTS_PLATFORM
)
{
process
.
env
.
UNI_UTS_PLATFORM
=
'
app-android
'
}
}
}
function
initAutomator
({
autoHost
,
autoPort
}:
CliOptions
)
{
function
initAutomator
({
autoHost
,
autoPort
}:
CliOptions
)
{
...
...
packages/vite-plugin-uni/src/config/resolve.ts
浏览文件 @
bb88d93d
...
@@ -5,10 +5,19 @@ import {
...
@@ -5,10 +5,19 @@ import {
extensions
,
extensions
,
normalizePath
,
normalizePath
,
requireResolve
,
requireResolve
,
resolveUtsModule
,
}
from
'
@dcloudio/uni-cli-shared
'
}
from
'
@dcloudio/uni-cli-shared
'
import
{
VitePluginUniResolvedOptions
}
from
'
..
'
import
{
VitePluginUniResolvedOptions
}
from
'
..
'
export
const
customResolver
:
ResolverFunction
=
(
updatedId
,
importer
)
=>
{
export
const
customResolver
:
ResolverFunction
=
(
updatedId
,
importer
)
=>
{
const
utsModuleFile
=
resolveUtsModule
(
updatedId
,
importer
?
path
.
dirname
(
importer
)
:
process
.
env
.
UNI_INPUT_DIR
,
process
.
env
.
UNI_UTS_PLATFORM
)
if
(
utsModuleFile
)
{
return
isWindows
?
normalizePath
(
utsModuleFile
)
:
utsModuleFile
}
if
(
isWindows
)
{
if
(
isWindows
)
{
return
normalizePath
(
return
normalizePath
(
requireResolve
(
updatedId
,
importer
||
process
.
env
.
UNI_INPUT_DIR
)
requireResolve
(
updatedId
,
importer
||
process
.
env
.
UNI_INPUT_DIR
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录