diff --git a/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts b/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts index 04c10fea601923536c29f269554b266d32df7844..fee031126d94ecc6248ded285e735b0fda6637ed 100644 --- a/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts +++ b/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts @@ -19,3 +19,5 @@ export default async function getBatteryInfo(options: GetBatteryInfoOptions) { options.complete!(res) } } + +export class Test {} diff --git a/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift b/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift index eaa4eb1438ff99f74fc5babad6d7edff77c66357..ba173344c4f76ec9db6e1b5476ae1517275e8508 100644 --- a/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift +++ b/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift @@ -13,3 +13,5 @@ async func getBatteryInfo(_ options: GetBatteryInfoOptions) { if (options.success != nil) options.success!(res); if (options.complete != nil) options.complete!(res); } +class Test : NSObject { +} diff --git a/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift.map b/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift.map index 9ce12d3d16e4f454bbe85a934e4ceab3dd80c98d..359a866690ffca41be8aa074a983b4e6ecea9fcf 100644 --- a/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift.map +++ b/packages/playground/uts/unpackage/dist/app/uni_modules/test-uniplugin/app-ios/index.swift.map @@ -1 +1 @@ -{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts"],"sourcesContent":["import { UIDevice } from 'UIKit'\n\ntype GetBatteryInfoOptions = {\n success?: (res: UTSJSONObject) => void\n fail?: (res: UTSJSONObject) => void\n complete?: (res: UTSJSONObject) => void\n}\n\nexport default async function getBatteryInfo(options: GetBatteryInfoOptions) {\n const res = {\n errMsg: 'getBatteryInfo:ok',\n level: UIDevice.current.batteryLevel * 100,\n isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,\n }\n if (options.success != null) {\n options.success!(res)\n }\n if (options.complete != null) {\n options.complete!(res)\n }\n}\n"],"names":[],"mappings":"AAAA;UAEK,qBAAqB;QACxB,OAAO,MAAI,GAAkB,EAAb,aAAa,KAAK,IAAI;QACtC,IAAI,MAAI,GAAkB,EAAb,aAAa,KAAK,IAAI;QACnC,QAAQ,MAAI,GAAkB,EAAb,aAAa,KAAK,IAAI;;AAG1B,WAAe,cAAc,CAAC,EAAA,OAA8B,EAArB,qBAAqB,EAAE;IAC3E,IAAM,GAAG,GAAG;QACV,CAAA,MAAM,GAAE,mBAAmB;QAC3B,CAAA,KAAK,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,GAAG,GAAG;QAC1C,CAAA,UAAU,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,QAAQ,CAAC,YAAY,CAAC,QAAQ;KAC5E;IACD,IAAI,OAAO,CAAC,OAAO,IAAI,GAAI,EACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;IAEvB,IAAI,OAAO,CAAC,QAAQ,IAAI,GAAI,EAC1B,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;AAE1B"} \ No newline at end of file +{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts"],"sourcesContent":["import { UIDevice } from 'UIKit'\n\ntype GetBatteryInfoOptions = {\n success?: (res: UTSJSONObject) => void\n fail?: (res: UTSJSONObject) => void\n complete?: (res: UTSJSONObject) => void\n}\n\nexport default async function getBatteryInfo(options: GetBatteryInfoOptions) {\n const res = {\n errMsg: 'getBatteryInfo:ok',\n level: UIDevice.current.batteryLevel * 100,\n isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,\n }\n if (options.success != null) {\n options.success!(res)\n }\n if (options.complete != null) {\n options.complete!(res)\n }\n}\n\nexport class Test {}\n"],"names":[],"mappings":"AAAA;UAEK,qBAAqB;QACxB,OAAO,MAAI,GAAkB,EAAb,aAAa,KAAK,IAAI;QACtC,IAAI,MAAI,GAAkB,EAAb,aAAa,KAAK,IAAI;QACnC,QAAQ,MAAI,GAAkB,EAAb,aAAa,KAAK,IAAI;;AAG1B,WAAe,cAAc,CAAC,EAAA,OAA8B,EAArB,qBAAqB,EAAE;IAC3E,IAAM,GAAG,GAAG;QACV,CAAA,MAAM,GAAE,mBAAmB;QAC3B,CAAA,KAAK,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,GAAG,GAAG;QAC1C,CAAA,UAAU,GAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,IAAI,QAAQ,CAAC,YAAY,CAAC,QAAQ;KAC5E;IACD,IAAI,OAAO,CAAC,OAAO,IAAI,GAAI,EACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;IAEvB,IAAI,OAAO,CAAC,QAAQ,IAAI,GAAI,EAC1B,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;AAE1B;AAEO,MAAM,IAAI;CAAG"} \ No newline at end of file diff --git a/packages/uni-uts-vite/src/utils/compiler/kotlin.ts b/packages/uni-uts-vite/src/utils/compiler/kotlin.ts index e1975fe128e9d06074de7d6e3427aad763f5f090..efc0fa7f5116d386a982d02c63843aa5c3f1491e 100644 --- a/packages/uni-uts-vite/src/utils/compiler/kotlin.ts +++ b/packages/uni-uts-vite/src/utils/compiler/kotlin.ts @@ -35,8 +35,7 @@ export async function compileKotlin(filename: string) { const inputDir = process.env.UNI_INPUT_DIR const outputDir = process.env.UNI_OUTPUT_DIR // let time = Date.now() - await bundle({ - target: UtsTarget.KOTLIN, + await bundle(UtsTarget.KOTLIN, { input: { root: inputDir, filename, diff --git a/packages/uni-uts-vite/src/utils/compiler/swift.ts b/packages/uni-uts-vite/src/utils/compiler/swift.ts index 18c41b78e67e20c605a2d5af3fa4d221a95612b3..921c607b083f34fa3a0996f25e52f119a8e0f38a 100644 --- a/packages/uni-uts-vite/src/utils/compiler/swift.ts +++ b/packages/uni-uts-vite/src/utils/compiler/swift.ts @@ -22,8 +22,7 @@ export async function compileSwift(filename: string) { const inputDir = process.env.UNI_INPUT_DIR const outputDir = process.env.UNI_OUTPUT_DIR // let time = Date.now() - await bundle({ - target: UtsTarget.SWIFT, + await bundle(UtsTarget.SWIFT, { input: { root: inputDir, filename, diff --git a/packages/uts-darwin-arm64/uts.darwin-arm64.node b/packages/uts-darwin-arm64/uts.darwin-arm64.node index 3f73c3ad19ec7010c5e749a1abae8a976c1aa70e..b3a3b5f0a853bfed5b768e01151d483b589ea039 100755 Binary files a/packages/uts-darwin-arm64/uts.darwin-arm64.node and b/packages/uts-darwin-arm64/uts.darwin-arm64.node differ diff --git a/packages/uts-darwin-x64/uts.darwin-x64.node b/packages/uts-darwin-x64/uts.darwin-x64.node index f0512ddffd54117aebf648506266095f37a07e38..cbfcbbb166d70f0dd150f19b9488bf3a7e0b8c23 100755 Binary files a/packages/uts-darwin-x64/uts.darwin-x64.node and b/packages/uts-darwin-x64/uts.darwin-x64.node differ diff --git a/packages/uts/src/types.ts b/packages/uts/src/types.ts index 03e4cfca7fbcbf3871f41a32a989fd4c2ad7a248..59e6189dc5ade1542c6ebeef22e197d3cfc30b90 100644 --- a/packages/uts/src/types.ts +++ b/packages/uts/src/types.ts @@ -29,6 +29,7 @@ export type UtsOutputOptions = { extname: string logFilename?: boolean noColor?: boolean + isPlugin?: boolean } export interface UtsOptions { input: UtsInputOptions @@ -41,6 +42,4 @@ export interface UtsResult { error?: Error } -export interface UtsBundleOptions extends UtsOptions { - target: UtsTarget -} +export interface UtsBundleOptions extends UtsOptions {} diff --git a/scripts/test.js b/scripts/test.js index ed5ca3a518cd0ee5cd6511231b0a625b9310c057..e70cdbca4986b9b72b81c8b2b5de0667e079fce4 100644 --- a/scripts/test.js +++ b/scripts/test.js @@ -33,6 +33,7 @@ function testKotlin() { sourceMap: true, extname: 'kt', logFilename: true, + isPlugin: true, }, }).then((res) => { console.log('bundle: ' + (Date.now() - start) + 'ms') @@ -65,6 +66,7 @@ function testSwift() { sourceMap: true, extname: 'swift', logFilename: true, + isPlugin: true, }, }).then((res) => { console.log('bundle: ' + (Date.now() - start) + 'ms')