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

wip(uts): support imports

上级 87be611e
......@@ -6370,6 +6370,7 @@ function initHidpi() {
translate: "all",
createRadialGradient: "all",
createLinearGradient: "all",
transform: [4, 5],
setTransform: [4, 5]
};
const proto = CanvasRenderingContext2D.prototype;
......
import { resolve } from 'path'
import { UtsKotlinOptions, UtsResult, UtsSwiftOptions } from './types'
import type { UtsKotlinOptions, UtsResult, UtsSwiftOptions } from './types'
import { normalizePath } from './utils'
export * from './types'
const bindingsOverride = process.env['UTS_BINARY_PATH']
const bindings = !!bindingsOverride
? require(resolve(bindingsOverride))
......@@ -26,6 +24,10 @@ export function toKotlin(options: UtsKotlinOptions): Promise<UtsResult> {
} else if (output.sourceMap === false) {
output.sourceMap = ''
}
if (!output.imports) {
// TODO
output.imports = []
}
input.root = normalizePath(input.root)
input.filename = normalizePath(input.filename)
......
import { cac } from 'cac'
import { runBuild, runDev, ToOptions, UtsTarget } from '.'
import { runBuild, runDev, ToOptions, UtsTarget } from './index'
const cli = cac('uts')
......@@ -15,7 +15,7 @@ export interface CliOptions {
cli
.command('<input> [output]')
.option('-t, --target <target>', '[string] kotlin | swift', {
default: UtsTarget.KOTLIN,
default: 'kotlin',
})
.option('-s, --sourceMap [sourceMap]', `[boolean|string] output sourceMap`, {
default: false,
......
......@@ -4,8 +4,12 @@ import glob from 'fast-glob'
import { watch } from 'chokidar'
import { InputKotlinOptions, toKotlin } from './api'
import { OutputKotlinOptions, UtsKotlinOptions } from './types'
import { toKotlin } from './api'
import type {
InputKotlinOptions,
OutputKotlinOptions,
UtsKotlinOptions,
} from './types'
import { printStartup, printUtsResult, printUtsResults, timeEnd } from './utils'
export enum UtsTarget {
......
......@@ -26,6 +26,7 @@ export type InputKotlinOptions = UtsParseOptions & {
export type OutputKotlinOptions = {
outDir: string
imports?: string[]
sourceMap: boolean | string
inlineSourcesContent?: boolean
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册