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

wip(uts): compiler

上级 fd39be63
......@@ -88,17 +88,15 @@ interface InvokeCallbackParamsRes {
params: unknown[]
keepAlive?: boolean
}
type InvokeSyncCallback = (res: InvokeCallbackParamsRes) => void
type InvokeAsyncCallback = (
res: InvokeCallbackReturnRes | InvokeCallbackParamsRes
) => void
interface InvokeSyncRes {
type: 'return'
errMsg?: string
params: unknown
}
type InvokeSyncCallback = (res: InvokeCallbackParamsRes) => void
type InvokeAsyncCallback = (
res: InvokeCallbackReturnRes | InvokeCallbackParamsRes
) => void
function getProxy(): {
invokeSync: (args: InvokeArgs, callback: InvokeSyncCallback) => InvokeSyncRes
invokeAsync: (args: InvokeArgs, callback: InvokeAsyncCallback) => void
......
......@@ -32,7 +32,7 @@ export async function compile(filename: string) {
output: {
outDir: outputDir,
package: parsePackage(filename),
sourceMap: true,
sourceMap: process.env.NODE_ENV === 'development',
extname: 'kt',
imports: [
'kotlinx.coroutines.async',
......@@ -48,6 +48,10 @@ export async function compile(filename: string) {
const kotlinFile = resolveKotlinFile(filename, inputDir, outputDir)
if (process.env.NODE_ENV === 'production') {
// 生产模式下,需要将 kt 文件转移到 src 下
fs.copyFileSync(
path.resolve(filename, '../../package.json'),
path.resolve(kotlinFile, '../../package.json')
)
fs.mkdirSync(path.resolve(kotlinFile, '../src'))
if (fs.existsSync(kotlinFile)) {
fs.moveSync(kotlinFile, path.resolve(kotlinFile, '../src/index.kt'))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册