diff --git a/deps/obelisk-oauth b/deps/obelisk-oauth index 9fc65d49a..393ff559e 160000 --- a/deps/obelisk-oauth +++ b/deps/obelisk-oauth @@ -1 +1 @@ -Subproject commit 9fc65d49a9da612c85419ed069993dcb8e25d996 +Subproject commit 393ff559e0b3192196e0692c0b655a1249072314 diff --git a/lib/jenga-backend-servant/jenga-backend-servant.cabal b/lib/jenga-backend-servant/jenga-backend-servant.cabal index 44dd16bbd..67835fa9c 100644 --- a/lib/jenga-backend-servant/jenga-backend-servant.cabal +++ b/lib/jenga-backend-servant/jenga-backend-servant.cabal @@ -14,6 +14,7 @@ library , bytestring , containers , data-default + , jenga-asset-serve-snap , jenga-route-servant , reflex-effectful , servant diff --git a/lib/jenga-backend-servant/src/Jenga/Backend/Servant.hs b/lib/jenga-backend-servant/src/Jenga/Backend/Servant.hs index 904cecf1f..28d35cdad 100644 --- a/lib/jenga-backend-servant/src/Jenga/Backend/Servant.hs +++ b/lib/jenga-backend-servant/src/Jenga/Backend/Servant.hs @@ -71,6 +71,7 @@ import GHC.Generics (Generic) import Snap.Core import Snap.Http.Server (quickHttpServe) import qualified Snap.Util.FileServe as Snap +import qualified Jenga.Asset.Serve.Snap as JengaAsset import Jenga.Route (HasRoute(..), PageName, urlToSegments) import Jenga.Frontend (Frontend(..), renderFrontendHtml) @@ -223,12 +224,20 @@ serveFrontendRoute cfg configs backend = do -- ─── Static file serving ─────────────────────────────────────── --- | Serve files from a StaticAssets directory. --- Tries processed (hashed) first, falls back to unprocessed. +-- | Serve files from a StaticAssets directory using the obelisk-style +-- hashed-asset protocol (reads type/target metadata, emits redirects to +-- the hashed asset, serves it with proper caching + encoding negotiation). +-- +-- Previously used @Snap.serveDirectory@, which does trailing-slash +-- canonicalization for the asset directories (each hashed asset is +-- structured as a dir with @type@/@target@/@encodings@ files), so every +-- request for @/ghcjs\/all.js@ got 302'd to @/ghcjs\/all.js\/@ and fell +-- through to the SPA HTML. Matches obelisk-v1's @serveStaticAssets@. serveStaticDir :: StaticAssets -> Snap () serveStaticDir assets = - Snap.serveDirectory (_staticAssets_processed assets) - <|> Snap.serveDirectory (_staticAssets_unprocessed assets) + JengaAsset.serveAssets + (_staticAssets_processed assets) + (_staticAssets_unprocessed assets) -- | Serve static assets (compatibility alias). serveStaticAssets :: StaticAssets -> [Text] -> Snap () diff --git a/skeleton/cabal.project b/skeleton/cabal.project index b32cb6de2..936c3dc90 100644 --- a/skeleton/cabal.project +++ b/skeleton/cabal.project @@ -24,8 +24,8 @@ if !(arch(javascript) || arch(wasm32)) --optional-packages: -- deps/jenga/deps/reflex-dom/* --- multi-repl: True --- Disabled: GHC 9.14 multi-unit GHCi panics with "LinkInMemory". +multi-repl: True +-- Re-enabled to investigate the LinkInMemory panic prior turns noted. diff --git a/skeleton/frontend/js/frontend-js.cabal b/skeleton/frontend/js/frontend-js.cabal index 162cdcd7d..17b96dee2 100644 --- a/skeleton/frontend/js/frontend-js.cabal +++ b/skeleton/frontend/js/frontend-js.cabal @@ -49,12 +49,18 @@ custom-setup jenga-setup library + hs-source-dirs: src build-depends: base -- , frontend reexported-modules: Frontend + -- Placeholder module: workaround for GHC #25366 / #26073. + -- cabal repl --enable-multi-repl panics ("LinkInMemory") on units + -- with no exposed-modules of their own. + exposed-modules: FrontendJs.Placeholder + default-language: Haskell2010 if (arch(javascript) || arch(wasm32)) diff --git a/skeleton/frontend/js/src/FrontendJs/Placeholder.hs b/skeleton/frontend/js/src/FrontendJs/Placeholder.hs new file mode 100644 index 000000000..84442d092 --- /dev/null +++ b/skeleton/frontend/js/src/FrontendJs/Placeholder.hs @@ -0,0 +1 @@ +module FrontendJs.Placeholder where diff --git a/skeleton/frontend/wasm/frontend-wasm.cabal b/skeleton/frontend/wasm/frontend-wasm.cabal index 46879b19c..526523e69 100644 --- a/skeleton/frontend/wasm/frontend-wasm.cabal +++ b/skeleton/frontend/wasm/frontend-wasm.cabal @@ -49,12 +49,20 @@ custom-setup jenga-setup library + hs-source-dirs: src build-depends: base -- , frontend reexported-modules: Frontend + -- Placeholder module: workaround for GHC #25366 / #26073. + -- cabal repl --enable-multi-repl panics ("LinkInMemory") on units + -- with no exposed-modules of their own. See: + -- https://gitlab.haskell.org/ghc/ghc/-/issues/25366 + -- https://gitlab.haskell.org/ghc/ghc/-/issues/26073 + exposed-modules: FrontendWasm.Placeholder + default-language: Haskell2010 if (arch(javascript) || arch(wasm32)) diff --git a/skeleton/frontend/wasm/src/FrontendWasm/Placeholder.hs b/skeleton/frontend/wasm/src/FrontendWasm/Placeholder.hs new file mode 100644 index 000000000..b3f1ed9fc --- /dev/null +++ b/skeleton/frontend/wasm/src/FrontendWasm/Placeholder.hs @@ -0,0 +1 @@ +module FrontendWasm.Placeholder where