diff --git a/generator/src/cli.js b/generator/src/cli.js index 9b70f2e0..9df6965e 100755 --- a/generator/src/cli.js +++ b/generator/src/cli.js @@ -325,16 +325,11 @@ async function requireElm(compiledElmPath) { function generatorWrapperFile(moduleName) { return `port module Main exposing (main) -import BackendTask exposing (BackendTask) -import FatalError -import Cli.Program as Program -import Json.Decode as Decode -import Json.Encode as Encode import Pages.Internal.Platform.GeneratorApplication import ${moduleName} -main : Program.StatefulProgram Pages.Internal.Platform.GeneratorApplication.Model Pages.Internal.Platform.GeneratorApplication.Msg (BackendTask FatalError.FatalError ()) Pages.Internal.Platform.GeneratorApplication.Flags +main : Pages.Internal.Platform.GeneratorApplication.Program main = Pages.Internal.Platform.GeneratorApplication.app { data = ${moduleName}.run @@ -345,13 +340,13 @@ main = } -port toJsPort : Encode.Value -> Cmd msg +port toJsPort : Pages.Internal.Platform.GeneratorApplication.JsonValue -> Cmd msg -port fromJsPort : (Decode.Value -> msg) -> Sub msg +port fromJsPort : (Pages.Internal.Platform.GeneratorApplication.JsonValue -> msg) -> Sub msg -port gotBatchSub : (Decode.Value -> msg) -> Sub msg +port gotBatchSub : (Pages.Internal.Platform.GeneratorApplication.JsonValue -> msg) -> Sub msg `; } function collect(value, previous) { diff --git a/src/Pages/Internal/Platform/GeneratorApplication.elm b/src/Pages/Internal/Platform/GeneratorApplication.elm index 784e0678..d97087a8 100644 --- a/src/Pages/Internal/Platform/GeneratorApplication.elm +++ b/src/Pages/Internal/Platform/GeneratorApplication.elm @@ -1,8 +1,8 @@ -module Pages.Internal.Platform.GeneratorApplication exposing (Flags, Model, Msg(..), init, requestDecoder, update, app) +module Pages.Internal.Platform.GeneratorApplication exposing (Program, Flags, Model, Msg(..), init, requestDecoder, update, app, JsonValue) {-| Exposed for internal use only (used in generated code). -@docs Flags, Model, Msg, init, requestDecoder, update, app +@docs Program, Flags, Model, Msg, init, requestDecoder, update, app, JsonValue -} @@ -25,6 +25,14 @@ import Pages.StaticHttp.Request import TerminalText as Terminal +type alias JsonValue = + Decode.Value + + +type alias Program = + Program.StatefulProgram Model Msg (BackendTask FatalError.FatalError ()) Flags + + {-| -} type alias Flags = { compatibilityKey : Int @@ -47,7 +55,7 @@ type Msg {-| -} app : GeneratorProgramConfig - -> Program.StatefulProgram Model Msg (BackendTask FatalError ()) Flags + -> Program app config = let cliConfig : Program.Config (BackendTask FatalError ())