mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 14:40:17 +00:00
Remove AquaPath usage
This commit is contained in:
parent
4cecab1a26
commit
667f2585a4
@ -1,56 +1,54 @@
|
||||
package api
|
||||
|
||||
import api.types.{AquaConfig, AquaFunction, CompilationResult, GeneratedSource, Input}
|
||||
import aqua.Rendering.given
|
||||
import aqua.raw.value.ValueRaw
|
||||
import aqua.api.{APICompilation, APIResult, AquaAPIConfig}
|
||||
import aqua.api.TargetType.*
|
||||
import aqua.api.{APICompilation, APIResult, AquaAPIConfig}
|
||||
import aqua.backend.air.AirBackend
|
||||
import aqua.backend.api.APIBackend
|
||||
import aqua.backend.js.JavaScriptBackend
|
||||
import aqua.backend.ts.TypeScriptBackend
|
||||
import aqua.backend.{AirFunction, Backend, Generated}
|
||||
import aqua.compiler.*
|
||||
import aqua.files.{AquaFileSources, AquaFilesIO, FileModuleId}
|
||||
import aqua.logging.{LogFormatter, LogLevels}
|
||||
import aqua.constants.Constants
|
||||
import aqua.definitions.FunctionDef
|
||||
import aqua.files.{AquaFileSources, AquaFilesIO, FileModuleId}
|
||||
import aqua.io.*
|
||||
import aqua.raw.ops.Call
|
||||
import aqua.run.{CliFunc, FuncCompiler}
|
||||
import aqua.js.{FunctionDefJs, ServiceDefJs, VarJson}
|
||||
import aqua.logging.{LogFormatter, LogLevels}
|
||||
import aqua.model.AquaContext
|
||||
import aqua.model.transform.{Transform, TransformConfig}
|
||||
import aqua.parser.lexer.{LiteralToken, Token}
|
||||
import aqua.parser.lift.FileSpan.F
|
||||
import aqua.parser.lift.{FileSpan, Span}
|
||||
import aqua.parser.{ArrowReturnError, BlockIndentError, LexerError, ParserError}
|
||||
import aqua.{AquaIO, SpanParser}
|
||||
import aqua.model.transform.{Transform, TransformConfig}
|
||||
import aqua.backend.api.APIBackend
|
||||
import aqua.backend.js.JavaScriptBackend
|
||||
import aqua.backend.ts.TypeScriptBackend
|
||||
import aqua.definitions.FunctionDef
|
||||
import aqua.js.{FunctionDefJs, ServiceDefJs, VarJson}
|
||||
import aqua.model.AquaContext
|
||||
import aqua.raw.ops.Call
|
||||
import aqua.raw.ops.CallArrowRawTag
|
||||
import aqua.raw.value.ValueRaw
|
||||
import aqua.raw.value.{LiteralRaw, VarRaw}
|
||||
import aqua.res.AquaRes
|
||||
import aqua.{AquaIO, SpanParser}
|
||||
|
||||
import api.types.{AquaConfig, AquaFunction, CompilationResult, GeneratedSource, Input}
|
||||
import cats.Applicative
|
||||
import cats.data.Validated.{Invalid, Valid, invalidNec, validNec}
|
||||
import cats.data.{Chain, NonEmptyChain, Validated, ValidatedNec}
|
||||
import cats.data.Validated.{invalidNec, validNec, Invalid, Valid}
|
||||
import cats.syntax.applicative.*
|
||||
import cats.syntax.apply.*
|
||||
import cats.syntax.flatMap.*
|
||||
import cats.syntax.functor.*
|
||||
import cats.effect.IO
|
||||
import cats.effect.unsafe.implicits.global
|
||||
import cats.syntax.applicative.*
|
||||
import cats.syntax.apply.*
|
||||
import cats.syntax.either.*
|
||||
import cats.syntax.flatMap.*
|
||||
import cats.syntax.functor.*
|
||||
import cats.syntax.show.*
|
||||
import cats.syntax.traverse.*
|
||||
import cats.syntax.either.*
|
||||
import fs2.io.file.{Files, Path}
|
||||
import scribe.Logging
|
||||
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.concurrent.Future
|
||||
import scala.scalajs.js.{|, undefined, Promise, UndefOr}
|
||||
import scala.scalajs.js
|
||||
import scala.scalajs.js.JSConverters.*
|
||||
import scala.scalajs.js.annotation.*
|
||||
import scala.scalajs.js.{Promise, UndefOr, undefined, |}
|
||||
import scribe.Logging
|
||||
|
||||
@JSExportTopLevel("Aqua")
|
||||
object AquaAPI extends App with Logging {
|
||||
|
@ -1,50 +1,42 @@
|
||||
package aqua.api
|
||||
|
||||
import aqua.Rendering.given
|
||||
import aqua.raw.value.ValueRaw
|
||||
import aqua.raw.ConstantRaw
|
||||
import aqua.api.AquaAPIConfig
|
||||
import aqua.backend.api.APIBackend
|
||||
import aqua.backend.{AirFunction, Backend, Generated}
|
||||
import aqua.compiler.*
|
||||
import aqua.files.{AquaFileSources, AquaFilesIO, FileModuleId}
|
||||
import aqua.logging.{LogFormatter, LogLevels}
|
||||
import aqua.constants.Constants
|
||||
import aqua.definitions.FunctionDef
|
||||
import aqua.files.{AquaFileSources, AquaFilesIO, FileModuleId}
|
||||
import aqua.io.*
|
||||
import aqua.raw.ops.Call
|
||||
import aqua.run.{CliFunc, FuncCompiler, RunPreparer}
|
||||
import aqua.logging.{LogFormatter, LogLevels}
|
||||
import aqua.model.AquaContext
|
||||
import aqua.model.transform.{Transform, TransformConfig}
|
||||
import aqua.parser.lexer.{LiteralToken, Token}
|
||||
import aqua.parser.lift.FileSpan.F
|
||||
import aqua.parser.lift.{FileSpan, Span}
|
||||
import aqua.parser.{ArrowReturnError, BlockIndentError, LexerError, ParserError}
|
||||
import aqua.{AquaIO, SpanParser}
|
||||
import aqua.model.transform.{Transform, TransformConfig}
|
||||
import aqua.backend.api.APIBackend
|
||||
import aqua.definitions.FunctionDef
|
||||
import aqua.model.AquaContext
|
||||
import aqua.raw.ConstantRaw
|
||||
import aqua.raw.ops.Call
|
||||
import aqua.raw.value.ValueRaw
|
||||
import aqua.res.AquaRes
|
||||
import aqua.run.{CliFunc, FuncCompiler, RunPreparer}
|
||||
import aqua.{AquaIO, SpanParser}
|
||||
|
||||
import cats.Applicative
|
||||
import cats.~>
|
||||
import cats.data.{
|
||||
Chain,
|
||||
EitherT,
|
||||
NonEmptyChain,
|
||||
NonEmptyList,
|
||||
Validated,
|
||||
ValidatedNec,
|
||||
ValidatedNel,
|
||||
Writer
|
||||
}
|
||||
import cats.data.Validated.{invalid, invalidNec, validNec, Invalid, Valid}
|
||||
import cats.syntax.applicative.*
|
||||
import cats.syntax.apply.*
|
||||
import cats.syntax.flatMap.*
|
||||
import cats.syntax.functor.*
|
||||
import cats.data.*
|
||||
import cats.data.Validated.*
|
||||
import cats.effect.IO
|
||||
import cats.effect.unsafe.implicits.global
|
||||
import cats.syntax.applicative.*
|
||||
import cats.syntax.apply.*
|
||||
import cats.syntax.either.*
|
||||
import cats.syntax.flatMap.*
|
||||
import cats.syntax.functor.*
|
||||
import cats.syntax.option.*
|
||||
import cats.syntax.show.*
|
||||
import cats.syntax.traverse.*
|
||||
import cats.syntax.either.*
|
||||
import cats.~>
|
||||
import fs2.io.file.{Files, Path}
|
||||
import scribe.{Level, Logging}
|
||||
|
||||
@ -68,7 +60,7 @@ object APICompilation {
|
||||
LogFormatter.initLogger(Some(level))
|
||||
|
||||
new FuncCompiler[IO](
|
||||
Some(RelativePath(Path(pathStr))),
|
||||
Path(pathStr).some,
|
||||
imports.map(Path.apply),
|
||||
transformConfig
|
||||
).compile().map { contextV =>
|
||||
|
@ -3,34 +3,33 @@ package aqua.run
|
||||
import aqua.Rendering.given
|
||||
import aqua.compiler.{AquaCompiler, AquaCompilerConf, CompileResult, CompilerAPI}
|
||||
import aqua.files.{AquaFileSources, FileModuleId}
|
||||
import aqua.{AquaIO, SpanParser}
|
||||
import aqua.io.{AquaFileError, AquaPath, PackagePath, Prelude}
|
||||
import aqua.io.{AquaFileError, PackagePath, Prelude}
|
||||
import aqua.model.transform.TransformConfig
|
||||
import aqua.model.{AquaContext, FuncArrow}
|
||||
import aqua.parser.lift.FileSpan
|
||||
import aqua.run.CliFunc
|
||||
import aqua.{AquaIO, SpanParser}
|
||||
|
||||
import cats.data.Validated.{invalidNec, validNec}
|
||||
import cats.data.{Chain, NonEmptyList, Validated, ValidatedNec}
|
||||
import cats.effect.IO
|
||||
import cats.effect.kernel.{Async, Clock}
|
||||
import cats.syntax.applicative.*
|
||||
import cats.syntax.apply.*
|
||||
import cats.syntax.either.*
|
||||
import cats.syntax.flatMap.*
|
||||
import cats.syntax.functor.*
|
||||
import cats.syntax.monad.*
|
||||
import cats.syntax.option.*
|
||||
import cats.syntax.show.*
|
||||
import cats.syntax.traverse.*
|
||||
import cats.syntax.option.*
|
||||
import cats.syntax.either.*
|
||||
import cats.syntax.validated.*
|
||||
import cats.syntax.apply.*
|
||||
import fs2.io.file.{Files, Path}
|
||||
import scala.concurrent.duration.Duration
|
||||
import scribe.Logging
|
||||
|
||||
import scala.concurrent.duration.Duration
|
||||
|
||||
class FuncCompiler[F[_]: Files: AquaIO: Async](
|
||||
input: Option[AquaPath],
|
||||
input: Option[Path],
|
||||
imports: List[Path],
|
||||
transformConfig: TransformConfig
|
||||
) extends Logging {
|
||||
@ -66,10 +65,10 @@ class FuncCompiler[F[_]: Files: AquaIO: Async](
|
||||
builtinsV <-
|
||||
if (withBuiltins) compileBuiltins()
|
||||
else Chain.empty.pure[Result].pure[F]
|
||||
compileResult <- input.traverse { ap =>
|
||||
compileResult <- input.traverse { ip =>
|
||||
// compile only context to wrap and call function later
|
||||
Clock[F].timed(
|
||||
ap.getPath().flatMap(p => compileToContext(p, preludeImports ++ imports))
|
||||
compileToContext(ip, preludeImports ++ imports)
|
||||
)
|
||||
}
|
||||
(compileTime, contextV) = compileResult.orEmpty
|
||||
|
Loading…
Reference in New Issue
Block a user