diff --git a/.gitmodules b/.gitmodules index 2833d4664..7aae23468 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,19 @@ [submodule "vendor/elm-format"] path = vendor/elm-format url = git@github.com:lamdera/elm-format.git +[submodule "extra/package-replacements/elm/virtual-dom"] + path = extra/package-replacements/elm/virtual-dom + url = git@github.com:lamdera/elm-virtual-dom.git + branch = lamdera +[submodule "extra/package-replacements/elm/browser"] + path = extra/package-replacements/elm/browser + url = git@github.com:lamdera/elm-browser.git + branch = lamdera +[submodule "extra/package-replacements/elm/html"] + path = extra/package-replacements/elm/html + url = git@github.com:lamdera/elm-html.git + branch = lamdera +[submodule "extra/package-replacements/elm/core"] + path = extra/package-replacements/elm/core + url = git@github.com:lamdera/elm-core.git + branch = lamdera diff --git a/builder/src/Elm/Details.hs b/builder/src/Elm/Details.hs index 536666e1a..ba8a9a100 100644 --- a/builder/src/Elm/Details.hs +++ b/builder/src/Elm/Details.hs @@ -63,6 +63,8 @@ import qualified Stuff import qualified Lamdera import Lamdera ((&)) import qualified Lamdera.Extensions +import qualified Lamdera.PackageReplacements +import qualified Lamdera.Version -- DETAILS @@ -405,7 +407,7 @@ verifyDep (Env key _ _ cache manager _ _) depsMVar solution pkg details@(Solver. then do Reporting.report key Reporting.DCached maybeCache <- File.readBinary (Stuff.package cache pkg vsn > "artifacts.dat") - & Lamdera.alternativeImplementation (File.readBinary (Stuff.package cache pkg vsn > "artifacts.x.dat")) + & Lamdera.alternativeImplementation (File.readBinary (Stuff.package cache pkg vsn > Lamdera.Version.artifacts)) case maybeCache of Nothing -> build key cache depsMVar pkg details fingerprint Set.empty @@ -500,7 +502,7 @@ build key cache depsMVar pkg (Solver.Details vsn _) f fs = Just results -> let path = Stuff.package cache pkg vsn > "artifacts.dat" - & Lamdera.alternativeImplementation (Stuff.package cache pkg vsn > "artifacts.x.dat") + & Lamdera.alternativeImplementation (Stuff.package cache pkg vsn > Lamdera.Version.artifacts) ifaces = gatherInterfaces exposedDict results objects = gatherObjects results artifacts = Artifacts ifaces objects @@ -622,6 +624,7 @@ crawlModule foreignDeps mvar pkg src docsStatus name = crawlFile :: Map.Map ModuleName.Raw ForeignInterface -> MVar StatusDict -> Pkg.Name -> FilePath -> DocsStatus -> ModuleName.Raw -> FilePath -> IO (Maybe Status) crawlFile foreignDeps mvar pkg src docsStatus expectedName path = do bytes <- File.readUtf8 path + & Lamdera.alternativeImplementationPassthrough (Lamdera.PackageReplacements.getReplacement pkg expectedName) case Parse.fromByteString (Parse.Package pkg) bytes of Right modul@(Src.Module (Just (A.At _ actualName)) _ _ imports _ _ _ _ _) | expectedName == actualName -> do deps <- crawlImports foreignDeps mvar pkg src imports @@ -649,6 +652,7 @@ crawlKernel foreignDeps mvar pkg src name = if exists then do bytes <- File.readUtf8 path + & Lamdera.alternativeImplementationPassthrough (Lamdera.PackageReplacements.getReplacement pkg name) case Kernel.fromByteString pkg (Map.mapMaybe getDepHome foreignDeps) bytes of Nothing -> return Nothing diff --git a/builder/src/Elm/Outline.hs b/builder/src/Elm/Outline.hs index 9ec4ea50f..18329213e 100644 --- a/builder/src/Elm/Outline.hs +++ b/builder/src/Elm/Outline.hs @@ -219,7 +219,7 @@ read root shouldCheckLamdera = do maybeDups <- detectDuplicates root (NE.toList srcDirs) case maybeDups of Nothing -> - Lamdera.alternativeImplementationPassthrough (Lamdera.Checks.runChecks root shouldCheckLamdera direct) $ + Lamdera.alternativeImplementationPassthrough (Lamdera.Checks.runChecks root shouldCheckLamdera direct indirect) $ return $ Right outline Just (canonicalDir, (dir1,dir2)) -> diff --git a/builder/src/Reporting/Exit.hs b/builder/src/Reporting/Exit.hs index eb9271f50..ebcafcb01 100644 --- a/builder/src/Reporting/Exit.hs +++ b/builder/src/Reporting/Exit.hs @@ -68,6 +68,7 @@ import qualified Reporting.Render.Code as Code import Lamdera import qualified Lamdera.Error import qualified Elm.Constraint as Con +import qualified Lamdera.Version -- RENDERERS @@ -961,6 +962,8 @@ data Outline | OutlineNoAppCore | OutlineNoAppJson | OutlineLamderaMissingDeps + | OutlineLamderaReplacementPackageVersionTooLow Pkg.Name V.Version V.Version + | OutlineLamderaReplacementPackageVersionTooHigh Pkg.Name V.Version V.Version data OutlineProblem @@ -1061,6 +1064,25 @@ toOutlineReport problem = , D.reflow "Note: if you're trying to run a normal Elm app, use the elm binary instead." ] + OutlineLamderaReplacementPackageVersionTooLow name replacedVersion elmJsonVersion -> + Help.report "UNSUPPORTED VERSION" (Just "elm.json") + ("This version of the Lamdera compiler supports the following range for \"" <> Pkg.toChars name <> "\":") + [ D.indent 4 $ D.green $ "\"" <> D.fromVersion (Lamdera.Version.resetPatch replacedVersion) <> " <= v <= " <> D.fromVersion replacedVersion <> "\"" + , D.reflow "But your elm.json contains:" + , D.indent 4 $ D.red $ "\"" <> D.fromPackage name <> "\": \"" <> D.fromVersion elmJsonVersion <> "\"" + , D.reflow "You need to update that package!" + ] + + OutlineLamderaReplacementPackageVersionTooHigh name replacedVersion elmJsonVersion -> + Help.report "UNSUPPORTED VERSION" (Just "elm.json") + ("This version of the Lamdera compiler supports the following range for \"" <> Pkg.toChars name <> "\":") + [ D.indent 4 $ D.green $ "\"" <> D.fromVersion (Lamdera.Version.resetPatch replacedVersion) <> " <= v <= " <> D.fromVersion replacedVersion <> "\"" + , D.reflow "But your elm.json contains:" + , D.indent 4 $ D.red $ "\"" <> D.fromPackage name <> "\": \"" <> D.fromVersion elmJsonVersion <> "\"" + , D.reflow "You need to update the Lamdera compiler. And if there is no later version, ask the Lamdera community to release a new version!" + , D.reflow "You can also downgrade that package for now." + ] + toOutlineProblemReport :: FilePath -> Code.Source -> Json.Context -> A.Region -> OutlineProblem -> Help.Report toOutlineProblemReport path source _ region problem = diff --git a/builder/src/Stuff.hs b/builder/src/Stuff.hs index 6d3f56568..62a05bbd9 100644 --- a/builder/src/Stuff.hs +++ b/builder/src/Stuff.hs @@ -36,6 +36,7 @@ import qualified Elm.Version as V import Lamdera ((&)) import qualified Lamdera +import qualified Lamdera.Version -- PATHS @@ -43,6 +44,7 @@ import qualified Lamdera stuff :: FilePath -> FilePath stuff root = root > "elm-stuff" > compilerVersion + & Lamdera.alternativeImplementation (root > "elm-stuff" > Lamdera.Version.medium) details :: FilePath -> FilePath diff --git a/compiler/src/Elm/Package.hs b/compiler/src/Elm/Package.hs index e94f7fa27..f228a88d3 100644 --- a/compiler/src/Elm/Package.hs +++ b/compiler/src/Elm/Package.hs @@ -31,6 +31,7 @@ module Elm.Package , lamderaContainers , time , bytes + , toName ) where diff --git a/compiler/src/Generate/Html.hs b/compiler/src/Generate/Html.hs index b572d0509..e6470068d 100644 --- a/compiler/src/Generate/Html.hs +++ b/compiler/src/Generate/Html.hs @@ -32,7 +32,7 @@ sandwich root moduleName javascript =
- +