Skip to content

Commit

Permalink
feat(uni-app-x harmony): 调整自动导入
Browse files Browse the repository at this point in the history
  • Loading branch information
Wangyaqi committed Jan 14, 2025
1 parent 9cbe2bc commit 2f6377f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 39 deletions.
18 changes: 12 additions & 6 deletions packages/uni-app-harmony/build.ets.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@
[
"UTSHarmony"
],
[
"document"
],
[
"UniElement"
],
Expand All @@ -228,15 +231,15 @@
[
"UniElementImpl"
],
[
"document"
],
[
"UniCustomElement"
],
[
"UniTextElement"
],
[
"UniFormControlElement"
],
[
"UniCustomEvent"
]
Expand Down Expand Up @@ -340,6 +343,9 @@
[
"UTSHarmony"
],
[
"document"
],
[
"UniElement"
],
Expand All @@ -352,15 +358,15 @@
[
"UniElementImpl"
],
[
"document"
],
[
"UniCustomElement"
],
[
"UniTextElement"
],
[
"UniFormControlElement"
],
[
"UniCustomEvent"
]
Expand Down
74 changes: 41 additions & 33 deletions packages/uni-uts-v1/src/arkts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,41 +43,49 @@ function getRuntimePackageName(isX = false) {

export function getArkTSAutoImports(isX = false): AutoImportOptions {
const runtimePackageName = getRuntimePackageName(isX)
const runtimeExports: [string][] = [
['defineAsyncApi'],
['defineSyncApi'],
['defineTaskApi'],
['defineOnApi'],
['defineOffApi'],
['getUniProvider'],
['getUniProviders'],
['string'],
['AsyncApiSuccessResult'],
['AsyncApiResult'],
['ApiExecutor'],
['ComponentInternalInstance'],
['ComponentPublicInstance'],
['IUniError'],
['ProtocolOptions'],
['ApiOptions'],
['ApiError'],
['UniError'],
['UniProvider'],
['uni'],
['IUTSObject'],
['UTSObject'],
['UTSJSONObject'],
['SourceError'],
['UTSHarmony'],
]
if (isX) {
runtimeExports.push(
['document'],
['UniElement'],
['UniPageImpl'],
['customElements'],
['UniCustomElement'],
['UniElementImpl'],
['UniTextElement'],
['UniFormControlElement'],
['UniCustomEvent']
)
}
return mergeArkTSAutoImports(
{
[runtimePackageName]: [
['defineAsyncApi'],
['defineSyncApi'],
['defineTaskApi'],
['defineOnApi'],
['defineOffApi'],
['getUniProvider'],
['getUniProviders'],
['string'],
['AsyncApiSuccessResult'],
['AsyncApiResult'],
['ApiExecutor'],
['ComponentInternalInstance'],
['ComponentPublicInstance'],
['IUniError'],
['ProtocolOptions'],
['ApiOptions'],
['ApiError'],
['UniError'],
['UniProvider'],
['uni'],
['IUTSObject'],
['UTSObject'],
['UTSJSONObject'],
['SourceError'],
['UniElement'],
['UTSHarmony'],
['UniPageImpl'],
['customElements'],
['UniCustomElement'],
['UniElementImpl'],
['UniCustomEvent'],
],
[runtimePackageName]: runtimeExports,
},
require(isX
? '../lib/arkts/ext-api-export-x.json'
Expand Down

0 comments on commit 2f6377f

Please sign in to comment.