mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 22:50:18 +00:00
Switch to compiler support v4 in FluenceJS (#566)
This commit is contained in:
parent
befa534c57
commit
5b2e08920c
@ -3,21 +3,23 @@ package aqua.backend
|
||||
object Header {
|
||||
|
||||
def header(isJs: Boolean, isCommonJS: Boolean): String = {
|
||||
val callParams = if (isJs) "" else "CallParams,"
|
||||
val callParams =
|
||||
if (isJs) ""
|
||||
else
|
||||
"import type { CallParams$$ } from '@fluencelabs/fluence/dist/internal/compilerSupport/v4'"
|
||||
val imports = if (isCommonJS) {
|
||||
"""const { Fluence, FluencePeer } = require('@fluencelabs/fluence');
|
||||
"""const { FluencePeer } = require('@fluencelabs/fluence');
|
||||
|const {
|
||||
| callFunction,
|
||||
| registerService,
|
||||
| CallParams
|
||||
|} = require('@fluencelabs/fluence/dist/internal/compilerSupport/v3${if (isJs) ".js" else ""}');""".stripMargin
|
||||
| callFunction$$,
|
||||
| registerService$$,
|
||||
|} = require('@fluencelabs/fluence/dist/internal/compilerSupport/v4${if (isJs) ".js" else ""}');""".stripMargin
|
||||
} else {
|
||||
s"""import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
s"""import { FluencePeer } from '@fluencelabs/fluence';
|
||||
|$callParams
|
||||
|import {
|
||||
| $callParams
|
||||
| callFunction,
|
||||
| registerService,
|
||||
|} from '@fluencelabs/fluence/dist/internal/compilerSupport/v3${if (isJs) ".js"
|
||||
| callFunction$$$$,
|
||||
| registerService$$$$,
|
||||
|} from '@fluencelabs/fluence/dist/internal/compilerSupport/v4${if (isJs) ".js"
|
||||
else ""}';""".stripMargin
|
||||
}
|
||||
s"""/**
|
||||
|
@ -37,7 +37,7 @@ case class OutputFunc(func: FuncRes, types: Types) {
|
||||
| let script = `
|
||||
|$script
|
||||
| `
|
||||
| return callFunction(
|
||||
| return callFunction$$$$(
|
||||
| args,
|
||||
| ${funcDef.asJson.deepDropNullValues.spaces4},
|
||||
| script
|
||||
|
@ -27,7 +27,7 @@ case class OutputService(srv: ServiceRes, types: Types) {
|
||||
|${serviceTypes.generate}
|
||||
|
|
||||
|export function register${srv.name}(${typed("...args", "any")}) {
|
||||
| registerService(
|
||||
| registerService$$$$(
|
||||
| args,
|
||||
| ${serviceDef.asJson.deepDropNullValues.spaces4}
|
||||
| );
|
||||
|
@ -81,5 +81,5 @@ object TypeScriptCommon {
|
||||
} else {
|
||||
"null"
|
||||
}
|
||||
s"callParams: CallParams<${generic}>"
|
||||
s"callParams: CallParams$$$$<${generic}>"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user