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

wip(uts): bundle

上级 a40c941c
export function login(name: string, pwd: string) {
return { name, pwd }
}
import { login } from './login.uts'
export class User {
async login(name: string, pwd: string) {
return { name, pwd }
login(name, pwd)
}
}
export function login(name: string, pwd: string) {
return { name, pwd }
}
package index;
fun login(name: String, pwd: String): UtsJSONObject {
return object : () {
return object : UtsJSONObject() {
var name = name
var pwd = pwd
};
}
open class User {
open fun async login(name: String, pwd: String) {
return object : () {
var name = name
var pwd = pwd
};
login(name, pwd);
}
}
{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/login.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/index.uts"],"sourcesContent":["export function login(name: string, pwd: string) {\n return { name, pwd }\n}\n","import { login } from './login.uts'\nexport class User {\n async login(name: string, pwd: string) {\n login(name, pwd)\n }\n}\n"],"names":[],"mappings":"AAAO,IAAS,KAAK,CAAC,IAAY,EAAN,MAAM,EAAE,GAAW,EAAN,MAAM,iBAAE;IAC/C,OAAO;QAAE,IAAA,IAAI,GAAJ,IAAI;QAAE,IAAA,GAAG,GAAH,GAAG;KAAE,CAAA;;ACAf,WAAM,IAAI;IACf,eAAM,KAAK,CAAC,IAAY,EAAN,MAAM,EAAE,GAAW,EAAN,MAAM,EAAE;QACrC,MAAM,IAAI,EAAE,GAAG,CAAC;;CAEnB"}
\ No newline at end of file
......@@ -71,7 +71,11 @@ export function toSwift(options: UtsOptions): Promise<UtsResult> {
}
export function bundle(options: UtsBundleOptions): Promise<UtsResult> {
return bindings.bundle(toBuffer(options)).then((res: string) => res)
const bundleOptions = resolveOptions(options)
if (!bundleOptions) {
return Promise.resolve({})
}
return bindings.bundle(toBuffer(bundleOptions)).then((res: string) => res)
}
function toBuffer(t: any): Buffer {
......
......@@ -38,10 +38,6 @@ export interface UtsResult {
error?: Error
}
export interface UtsBundleOptions {
export interface UtsBundleOptions extends UtsOptions {
target: UtsTarget
entry: Record<string, string>
output: {
path: string
}
}
......@@ -3,7 +3,7 @@ const path = require('path')
const { parse, runBuild, bundle, UtsTarget } = require('../packages/uts/dist')
const projectDir = path.resolve(__dirname, '../packages/playground/uts')
const start = Date.now()
let start = Date.now()
parse(
fs.readFileSync(
path.resolve(
......@@ -16,52 +16,24 @@ parse(
console.log('parse: ' + (Date.now() - start) + 'ms')
console.log(JSON.stringify(res))
})
// bundle({
// entry: {
// 'test-uniplugin': path.resolve(
// projectDir,
// 'uni_modules/test-uniplugin/app-android/index.uts'
// ),
// },
// output: {
// path: path.resolve(
// projectDir,
// 'unpackage/dist/app-plus/uni_modules/test-uniplugin/bundle'
// ),
// },
// }).then((res) => {
// console.log(res)
// })
// uts
// runBuild(UtsTarget.KOTLIN, {
// silent: false,
// input: {
// dir: path.resolve(projectDir, 'uni_modules/test-uniplugin'),
// extname: '.uts',
// },
// output: {
// dir: path.resolve(
// projectDir,
// 'unpackage/dist/app-plus/uni_modules/test-uniplugin/android'
// ),
// sourceMap: false,
// inlineSourcesContent: false,
// },
// })
// runBuild(UtsTarget.SWIFT, {
// silent: false,
// input: {
// dir: path.resolve(projectDir, 'uni_modules/test-uniplugin'),
// extname: '.uts',
// },
// output: {
// dir: path.resolve(
// projectDir,
// 'unpackage/dist/app-plus/uni_modules/test-uniplugin/ios'
// ),
// sourceMap: false,
// inlineSourcesContent: false,
// },
// })
start = Date.now()
bundle({
input: {
root: path.resolve(projectDir, 'uni_modules/test-uniplugin'),
filename: path.resolve(
projectDir,
'uni_modules/test-uniplugin/app-android/index.uts'
),
},
output: {
outDir: path.resolve(
projectDir,
'unpackage/dist/app-plus/uni_modules/test-uniplugin/'
),
sourceMap: true,
extname: 'kt',
},
}).then((res) => {
console.log('bundle: ' + (Date.now() - start) + 'ms')
console.log(JSON.stringify(res))
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册