Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builder/src/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ source directories when compiling the Lamdera Live harness module
-}
lamderaIsLiveHarnessModule :: Src.Module -> Bool
lamderaIsLiveHarnessModule modul =
Src.getName modul == "LocalDev"
Src.getName modul == "Lamdera.Live"


lamderaLiveHarnessEnv :: Env -> Env
Expand Down
16 changes: 8 additions & 8 deletions extra/Lamdera/CLI/Live.hs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ directoryConfig =


-- So that Elm's Navigation routing can work on any URL, serve any unmatched
-- non-extensioned paths to the "index" (in this case the src/LocalDev.elm
-- non-extensioned paths to the "index" (in this case the Lamdera/Live.elm
-- harness as we're local in the reactor). Extensioned paths will continue to
-- the next handler, namely `error404` (see `run` fn at top of file)
serveUnmatchedUrlsToIndex :: FilePath -> (FilePath -> Snap()) -> Snap ()
serveUnmatchedUrlsToIndex root serveElm =
do file <- getSafePath
guard (takeExtension file == "")
serveElm (lamderaCache root </> "LocalDev.elm")
serveElm (lamderaCache root </> "Lamdera" </> "Live.elm")


prepareLocalDev :: FilePath -> IO FilePath
Expand All @@ -136,7 +136,7 @@ prepareLocalDev root = do

let
cache = lamderaCache root
harnessPath = "LocalDev.elm"
harnessPath = "Lamdera" </> "Live.elm"

patchedContent path content =
if path == harnessPath
Expand All @@ -154,19 +154,19 @@ prepareLocalDev root = do


replaceVersionMarker :: Text -> Text
replaceVersionMarker localdev = do
replaceVersionMarker lamderaLive = do
let (m,mi,p) = Lamdera.Version.raw
localdev & T.replace
lamderaLive & T.replace
"( 0, 0, 0 )"
(T.concat ["( ", show_ m , ", ", show_ mi , ", ", show_ p , " )"])


replaceRpcMarker :: Bool -> Text -> Text
replaceRpcMarker shouldReplace localdev =
replaceRpcMarker shouldReplace lamderaLive =
if not shouldReplace
then localdev
then lamderaLive
else
localdev
lamderaLive
& T.replace
"-- MKRRI"
"import RPC\n\
Expand Down
6 changes: 3 additions & 3 deletions extra/Lamdera/Injection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type Mains = Map.Map ModuleName.Canonical Opt.Main

graphModifications :: Mode.Mode -> Mains -> Map.Map Opt.Global Opt.Node -> Map.Map Opt.Global Opt.Node
graphModifications mode mains graph = do
if mains & mainsInclude ["LocalDev"]
if mains & mainsInclude ["Lamdera.Live"]
then graph & Map.mapWithKey (modify $ isOptimizedMode mode)
-- & inspect
else graph
Expand Down Expand Up @@ -161,7 +161,7 @@ source mode mains =
LamderaBackend
else if mains & mainsInclude ["Frontend", "LFR"] then
LamderaFrontend
else if mains & mainsInclude ["LocalDev"] then
else if mains & mainsInclude ["Lamdera.Live"] then
LamderaLive
else
NotLamdera
Expand Down Expand Up @@ -477,7 +477,7 @@ injections outputType mode =
shouldProxy =
onlyIf (outputType == LamderaLive)
[text|
shouldProxy = $$author$$project$$LocalDev$$shouldProxy(msg)
shouldProxy = $$author$$project$$Lamdera$$Live$$shouldProxy(msg)
|]
in
[text|
Expand Down
2 changes: 1 addition & 1 deletion extra/Lamdera/UiSourceMap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import StandaloneInstances
updateDecls :: Module.Canonical -> Can.Decls -> Can.Decls
updateDecls fileName decls =
case fileName of
Module.Canonical (Name "author" "project") "LocalDev" ->
Module.Canonical (Name "author" "project") "Lamdera.Live" ->
decls

Module.Canonical (Name "author" "project") _ ->
Expand Down
2 changes: 1 addition & 1 deletion extra/LocalDev/elmjutsu-config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"mainPaths":["runtime-src/LocalDev.elm"]}
{"mainPaths":["runtime-src/Lamdera/Live.elm"]}
4 changes: 2 additions & 2 deletions extra/LocalDev/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

The runtime-src/LocalDev.elm file is what gets paged in as the entry point for `lamdera live`.
The runtime-src/Lamdera/Live.elm file is what gets paged in as the entry point for `lamdera live`.
It may import other files from the runtime-src directory.

The files in tooling-src are not used in the final compiler build, they are only here
to assist editor tooling when developing runtime-src/LocalDev.elm.
to assist editor tooling when developing runtime-src/Lamdera/Live.elm.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
port module LocalDev exposing (main)
port module Lamdera.Live exposing (main)

{-

Expand Down
2 changes: 1 addition & 1 deletion extra/dist/live.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions extra/live.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,17 @@ window.setupApp = function(name, elid) {
if (app !== null) { return } // Don't init when already initialised
// console.log(`booting with`, { c: clientId, s: sessionId, nt: nodeType, b: initBackendModel })

if (name !== "LocalDev") {
const elm = name.split('.').reduce((o,i)=> o[i], Elm)
if (name !== "Lamdera.Live") {
console.warn('Not a Lamdera app, loading as normal Elm.')
app = name.split('.').reduce((o,i)=> o[i], Elm).init({ node: document.getElementById(elid) })
app = elm.init({ node: document.getElementById(elid) })
if (document.getElementById(elid)) {
document.getElementById(elid).innerText = 'This is a headless program, meaning there is nothing to show here.\n\nI started the program anyway though, and you can access it as `app` in the developer console.'
}
return;
}

app = Elm[name].init({
app = elm.init({
node: document.getElementById(elid),
flags: { c: clientId, s: sessionId, nt: nodeType, b: initBackendModel }
})
Expand Down
2 changes: 1 addition & 1 deletion terminal/src/Develop.hs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ runWithRoot root (Flags maybePort) =
<|> Live.openEditorHandler root
<|> Live.serveExperimental root
<|> serveAssets -- Compiler packaged static files
<|> Live.serveUnmatchedUrlsToIndex root (serveElm sentryCache) -- Everything else without extensions goes to Lamdera LocalDev harness
<|> Live.serveUnmatchedUrlsToIndex root (serveElm sentryCache) -- Everything else without extensions goes to Lamdera.Live harness
<|> error404 -- Will get hit for any non-matching extensioned paths i.e. /hello.blah


Expand Down