提交 d4ae7bf5 编写于 作者: fxy060608's avatar fxy060608

wip(uts): compiler

上级 a51e70f5
...@@ -19,3 +19,5 @@ export default async function getBatteryInfo(options: GetBatteryInfoOptions) { ...@@ -19,3 +19,5 @@ export default async function getBatteryInfo(options: GetBatteryInfoOptions) {
options.complete!(res) options.complete!(res)
} }
} }
export class Test {}
...@@ -13,3 +13,5 @@ async func getBatteryInfo(_ options: GetBatteryInfoOptions) { ...@@ -13,3 +13,5 @@ async func getBatteryInfo(_ options: GetBatteryInfoOptions) {
if (options.success != nil) options.success!(res); if (options.success != nil) options.success!(res);
if (options.complete != nil) options.complete!(res); if (options.complete != nil) options.complete!(res);
} }
class Test : NSObject {
}
{"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"} {"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 \ No newline at end of file
...@@ -35,8 +35,7 @@ export async function compileKotlin(filename: string) { ...@@ -35,8 +35,7 @@ export async function compileKotlin(filename: string) {
const inputDir = process.env.UNI_INPUT_DIR const inputDir = process.env.UNI_INPUT_DIR
const outputDir = process.env.UNI_OUTPUT_DIR const outputDir = process.env.UNI_OUTPUT_DIR
// let time = Date.now() // let time = Date.now()
await bundle({ await bundle(UtsTarget.KOTLIN, {
target: UtsTarget.KOTLIN,
input: { input: {
root: inputDir, root: inputDir,
filename, filename,
......
...@@ -22,8 +22,7 @@ export async function compileSwift(filename: string) { ...@@ -22,8 +22,7 @@ export async function compileSwift(filename: string) {
const inputDir = process.env.UNI_INPUT_DIR const inputDir = process.env.UNI_INPUT_DIR
const outputDir = process.env.UNI_OUTPUT_DIR const outputDir = process.env.UNI_OUTPUT_DIR
// let time = Date.now() // let time = Date.now()
await bundle({ await bundle(UtsTarget.SWIFT, {
target: UtsTarget.SWIFT,
input: { input: {
root: inputDir, root: inputDir,
filename, filename,
......
...@@ -29,6 +29,7 @@ export type UtsOutputOptions = { ...@@ -29,6 +29,7 @@ export type UtsOutputOptions = {
extname: string extname: string
logFilename?: boolean logFilename?: boolean
noColor?: boolean noColor?: boolean
isPlugin?: boolean
} }
export interface UtsOptions { export interface UtsOptions {
input: UtsInputOptions input: UtsInputOptions
...@@ -41,6 +42,4 @@ export interface UtsResult { ...@@ -41,6 +42,4 @@ export interface UtsResult {
error?: Error error?: Error
} }
export interface UtsBundleOptions extends UtsOptions { export interface UtsBundleOptions extends UtsOptions {}
target: UtsTarget
}
...@@ -33,6 +33,7 @@ function testKotlin() { ...@@ -33,6 +33,7 @@ function testKotlin() {
sourceMap: true, sourceMap: true,
extname: 'kt', extname: 'kt',
logFilename: true, logFilename: true,
isPlugin: true,
}, },
}).then((res) => { }).then((res) => {
console.log('bundle: ' + (Date.now() - start) + 'ms') console.log('bundle: ' + (Date.now() - start) + 'ms')
...@@ -65,6 +66,7 @@ function testSwift() { ...@@ -65,6 +66,7 @@ function testSwift() {
sourceMap: true, sourceMap: true,
extname: 'swift', extname: 'swift',
logFilename: true, logFilename: true,
isPlugin: true,
}, },
}).then((res) => { }).then((res) => {
console.log('bundle: ' + (Date.now() - start) + 'ms') console.log('bundle: ' + (Date.now() - start) + 'ms')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册