2020-05-17 20:12:03 +03:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
|
|
exports[`generate UI file 1`] = `
|
|
|
|
"port module Pages exposing (PathKey, allPages, allImages, internals, images, isValidRoute, pages, builtAt)
|
|
|
|
|
|
|
|
import Color exposing (Color)
|
|
|
|
import Pages.Internal
|
|
|
|
import Head
|
|
|
|
import Html exposing (Html)
|
|
|
|
import Json.Decode
|
|
|
|
import Json.Encode
|
|
|
|
import Pages.Platform
|
|
|
|
import Pages.Manifest exposing (DisplayMode, Orientation)
|
|
|
|
import Pages.Manifest.Category as Category exposing (Category)
|
|
|
|
import Url.Parser as Url exposing ((</>), s)
|
|
|
|
import Pages.ImagePath as ImagePath exposing (ImagePath)
|
|
|
|
import Pages.PagePath as PagePath exposing (PagePath)
|
|
|
|
import Pages.Directory as Directory exposing (Directory)
|
|
|
|
import Time
|
|
|
|
|
|
|
|
|
|
|
|
builtAt : Time.Posix
|
|
|
|
builtAt =
|
|
|
|
Time.millisToPosix 1589734402000
|
|
|
|
|
|
|
|
|
|
|
|
type PathKey
|
|
|
|
= PathKey
|
|
|
|
|
|
|
|
|
2020-05-17 22:22:03 +03:00
|
|
|
buildImage : List String -> ImagePath.Dimensions -> ImagePath PathKey
|
|
|
|
buildImage path dimensions =
|
|
|
|
ImagePath.build PathKey (\\"images\\" :: path) dimensions
|
2020-05-17 20:12:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
buildPage : List String -> PagePath PathKey
|
|
|
|
buildPage path =
|
|
|
|
PagePath.build PathKey path
|
|
|
|
|
|
|
|
|
|
|
|
directoryWithIndex : List String -> Directory PathKey Directory.WithIndex
|
|
|
|
directoryWithIndex path =
|
|
|
|
Directory.withIndex PathKey allPages path
|
|
|
|
|
|
|
|
|
|
|
|
directoryWithoutIndex : List String -> Directory PathKey Directory.WithoutIndex
|
|
|
|
directoryWithoutIndex path =
|
|
|
|
Directory.withoutIndex PathKey allPages path
|
|
|
|
|
|
|
|
|
|
|
|
port toJsPort : Json.Encode.Value -> Cmd msg
|
|
|
|
|
|
|
|
port fromJsPort : (Json.Decode.Value -> msg) -> Sub msg
|
|
|
|
|
|
|
|
|
|
|
|
internals : Pages.Internal.Internal PathKey
|
|
|
|
internals =
|
|
|
|
{ applicationType = Pages.Internal.Browser
|
|
|
|
, toJsPort = toJsPort
|
|
|
|
, fromJsPort = fromJsPort identity
|
|
|
|
, content = content
|
|
|
|
, pathKey = PathKey
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allPages : List (PagePath PathKey)
|
|
|
|
allPages =
|
|
|
|
[
|
|
|
|
]
|
|
|
|
|
|
|
|
pages =
|
|
|
|
{ directory = directoryWithoutIndex []
|
|
|
|
}
|
|
|
|
|
|
|
|
images =
|
2020-06-17 06:51:44 +03:00
|
|
|
{ staticHttpError = (buildImage [ \\"static-http-error.png\\" ] { width = 919, height = 105 })
|
|
|
|
, directory = directoryWithoutIndex []
|
2020-05-17 20:12:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
allImages : List (ImagePath PathKey)
|
|
|
|
allImages =
|
2020-06-17 06:51:44 +03:00
|
|
|
[(buildImage [ \\"static-http-error.png\\" ] { width = 919, height = 105 })
|
2020-05-17 20:12:03 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
isValidRoute : String -> Result String ()
|
|
|
|
isValidRoute route =
|
|
|
|
let
|
|
|
|
validRoutes =
|
|
|
|
List.map PagePath.toString allPages
|
|
|
|
in
|
|
|
|
if
|
|
|
|
(route |> String.startsWith \\"http://\\")
|
|
|
|
|| (route |> String.startsWith \\"https://\\")
|
|
|
|
|| (route |> String.startsWith \\"#\\")
|
|
|
|
|| (validRoutes |> List.member route)
|
|
|
|
then
|
|
|
|
Ok ()
|
|
|
|
|
|
|
|
else
|
|
|
|
(\\"Valid routes:\\\\n\\"
|
|
|
|
++ String.join \\"\\\\n\\\\n\\" validRoutes
|
|
|
|
)
|
|
|
|
|> Err
|
|
|
|
|
|
|
|
|
|
|
|
content : List ( List String, { extension: String, frontMatter : String, body : Maybe String } )
|
|
|
|
content =
|
|
|
|
[
|
|
|
|
]
|
|
|
|
"
|
|
|
|
`;
|