elm-pages 2.1.7 → 2.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generator/review/elm.json +34 -0
- package/generator/review/src/ReviewConfig.elm +10 -0
- package/generator/src/basepath-middleware.js +15 -9
- package/generator/src/build.js +77 -4
- package/generator/src/cli.js +13 -9
- package/generator/src/compile-elm.js +43 -0
- package/generator/src/dev-server.js +63 -11
- package/generator/src/error-formatter.js +62 -9
- package/generator/src/generate-template-module-connector.js +17 -4
- package/generator/src/init.js +4 -0
- package/generator/src/pre-render-html.js +19 -12
- package/generator/src/render-worker.js +0 -1
- package/generator/src/render.js +1 -2
- package/generator/src/seo-renderer.js +21 -2
- package/generator/static-code/hmr.js +43 -6
- package/generator/template/elm.json +13 -5
- package/generator/template/package.json +3 -2
- package/package.json +14 -8
- package/src/ApiRoute.elm +178 -0
- package/src/AriaLiveAnnouncer.elm +36 -0
- package/src/BuildError.elm +60 -0
- package/src/DataSource/File.elm +288 -0
- package/src/DataSource/Glob.elm +1050 -0
- package/src/DataSource/Http.elm +467 -0
- package/src/DataSource/Internal/Glob.elm +74 -0
- package/src/DataSource/Port.elm +87 -0
- package/src/DataSource/ServerRequest.elm +60 -0
- package/src/DataSource.elm +801 -0
- package/src/Head/Seo.elm +516 -0
- package/src/Head/Twitter.elm +109 -0
- package/src/Head.elm +452 -0
- package/src/HtmlPrinter.elm +27 -0
- package/src/Internal/ApiRoute.elm +89 -0
- package/src/Internal/OptimizedDecoder.elm +18 -0
- package/src/KeepOrDiscard.elm +6 -0
- package/src/OptimizedDecoder/Pipeline.elm +335 -0
- package/src/OptimizedDecoder.elm +818 -0
- package/src/Pages/ContentCache.elm +248 -0
- package/src/Pages/Flags.elm +26 -0
- package/src/Pages/Http.elm +10 -0
- package/src/Pages/Internal/ApplicationType.elm +6 -0
- package/src/Pages/Internal/NotFoundReason.elm +256 -0
- package/src/Pages/Internal/Platform/Cli.elm +1015 -0
- package/src/Pages/Internal/Platform/Effect.elm +14 -0
- package/src/Pages/Internal/Platform/StaticResponses.elm +540 -0
- package/src/Pages/Internal/Platform/ToJsPayload.elm +138 -0
- package/src/Pages/Internal/Platform.elm +745 -0
- package/src/Pages/Internal/RoutePattern.elm +122 -0
- package/src/Pages/Internal/Router.elm +116 -0
- package/src/Pages/Internal/StaticHttpBody.elm +54 -0
- package/src/Pages/Internal/String.elm +39 -0
- package/src/Pages/Manifest/Category.elm +240 -0
- package/src/Pages/Manifest.elm +412 -0
- package/src/Pages/PageUrl.elm +38 -0
- package/src/Pages/ProgramConfig.elm +73 -0
- package/src/Pages/Review/NoContractViolations.elm +397 -0
- package/src/Pages/Secrets.elm +83 -0
- package/src/Pages/SiteConfig.elm +13 -0
- package/src/Pages/StaticHttp/Request.elm +42 -0
- package/src/Pages/StaticHttpRequest.elm +320 -0
- package/src/Pages/Url.elm +60 -0
- package/src/Path.elm +96 -0
- package/src/QueryParams.elm +216 -0
- package/src/RenderRequest.elm +163 -0
- package/src/RequestsAndPending.elm +20 -0
- package/src/Secrets.elm +111 -0
- package/src/SecretsDict.elm +45 -0
- package/src/StructuredData.elm +236 -0
- package/src/TerminalText.elm +242 -0
- package/src/Test/Html/Internal/ElmHtml/Constants.elm +53 -0
- package/src/Test/Html/Internal/ElmHtml/Helpers.elm +17 -0
- package/src/Test/Html/Internal/ElmHtml/InternalTypes.elm +529 -0
- package/src/Test/Html/Internal/ElmHtml/Markdown.elm +56 -0
- package/src/Test/Html/Internal/ElmHtml/ToString.elm +197 -0
- package/src/Test/Internal/KernelConstants.elm +34 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
module TerminalText exposing
|
|
2
|
+
( Text(..)
|
|
3
|
+
, ansi
|
|
4
|
+
, ansiPrefix
|
|
5
|
+
, blue
|
|
6
|
+
, colorToString
|
|
7
|
+
, cyan
|
|
8
|
+
, encoder
|
|
9
|
+
, fromAnsiString
|
|
10
|
+
, green
|
|
11
|
+
, red
|
|
12
|
+
, resetColors
|
|
13
|
+
, text
|
|
14
|
+
, toString
|
|
15
|
+
, toString_
|
|
16
|
+
, yellow
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
import Ansi
|
|
20
|
+
import Json.Encode as Encode
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
type Text
|
|
24
|
+
= Style AnsiStyle String
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
text : String -> Text
|
|
28
|
+
text value =
|
|
29
|
+
Style blankStyle value
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
cyan : String -> Text
|
|
33
|
+
cyan inner =
|
|
34
|
+
Style { blankStyle | color = Just Ansi.Cyan } inner
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
green : String -> Text
|
|
38
|
+
green inner =
|
|
39
|
+
Style { blankStyle | color = Just Ansi.Green } inner
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
yellow : String -> Text
|
|
43
|
+
yellow inner =
|
|
44
|
+
Style { blankStyle | color = Just Ansi.Yellow } inner
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
red : String -> Text
|
|
48
|
+
red inner =
|
|
49
|
+
Style { blankStyle | color = Just Ansi.Red } inner
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
blue : String -> Text
|
|
53
|
+
blue inner =
|
|
54
|
+
Style { blankStyle | color = Just Ansi.Blue } inner
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
resetColors : String
|
|
58
|
+
resetColors =
|
|
59
|
+
ansi "[0m"
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
ansi : String -> String
|
|
63
|
+
ansi code =
|
|
64
|
+
ansiPrefix ++ code
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
ansiPrefix : String
|
|
68
|
+
ansiPrefix =
|
|
69
|
+
"\u{001B}"
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
colorToString : Ansi.Color -> String
|
|
73
|
+
colorToString color =
|
|
74
|
+
ansi <|
|
|
75
|
+
case color of
|
|
76
|
+
Ansi.Red ->
|
|
77
|
+
"[31m"
|
|
78
|
+
|
|
79
|
+
Ansi.Blue ->
|
|
80
|
+
"[34m"
|
|
81
|
+
|
|
82
|
+
Ansi.Green ->
|
|
83
|
+
"[32m"
|
|
84
|
+
|
|
85
|
+
Ansi.Yellow ->
|
|
86
|
+
"[33m"
|
|
87
|
+
|
|
88
|
+
Ansi.Cyan ->
|
|
89
|
+
"[36m"
|
|
90
|
+
|
|
91
|
+
_ ->
|
|
92
|
+
-- TODO
|
|
93
|
+
""
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
toString : List Text -> String
|
|
97
|
+
toString list =
|
|
98
|
+
list
|
|
99
|
+
|> List.map toString_
|
|
100
|
+
|> String.join ""
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
toString_ : Text -> String
|
|
104
|
+
toString_ (Style ansiStyle innerText) =
|
|
105
|
+
String.concat
|
|
106
|
+
[ ansiStyle.color |> Maybe.withDefault Ansi.White |> colorToString
|
|
107
|
+
, innerText
|
|
108
|
+
, resetColors
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
fromAnsiString : String -> List Text
|
|
113
|
+
fromAnsiString ansiString =
|
|
114
|
+
Ansi.parseInto ( blankStyle, [] ) parseInto ansiString
|
|
115
|
+
|> Tuple.second
|
|
116
|
+
|> List.reverse
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
type alias AnsiStyle =
|
|
120
|
+
{ bold : Bool
|
|
121
|
+
, underline : Bool
|
|
122
|
+
, color : Maybe Ansi.Color
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
blankStyle : AnsiStyle
|
|
127
|
+
blankStyle =
|
|
128
|
+
{ bold = False
|
|
129
|
+
, underline = False
|
|
130
|
+
, color = Nothing
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
parseInto : Ansi.Action -> ( AnsiStyle, List Text ) -> ( AnsiStyle, List Text )
|
|
135
|
+
parseInto action ( pendingStyle, soFar ) =
|
|
136
|
+
case action of
|
|
137
|
+
Ansi.Print string ->
|
|
138
|
+
( blankStyle, Style pendingStyle string :: soFar )
|
|
139
|
+
|
|
140
|
+
Ansi.Remainder _ ->
|
|
141
|
+
( pendingStyle, soFar )
|
|
142
|
+
|
|
143
|
+
Ansi.SetForeground maybeColor ->
|
|
144
|
+
case maybeColor of
|
|
145
|
+
Just newColor ->
|
|
146
|
+
( { pendingStyle
|
|
147
|
+
| color = Just newColor
|
|
148
|
+
}
|
|
149
|
+
, soFar
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
Nothing ->
|
|
153
|
+
( blankStyle, soFar )
|
|
154
|
+
|
|
155
|
+
Ansi.SetBold bool ->
|
|
156
|
+
( { pendingStyle | bold = bool }, soFar )
|
|
157
|
+
|
|
158
|
+
Ansi.SetFaint _ ->
|
|
159
|
+
( pendingStyle, soFar )
|
|
160
|
+
|
|
161
|
+
Ansi.SetItalic _ ->
|
|
162
|
+
( pendingStyle, soFar )
|
|
163
|
+
|
|
164
|
+
Ansi.SetUnderline bool ->
|
|
165
|
+
( { pendingStyle | underline = bool }, soFar )
|
|
166
|
+
|
|
167
|
+
Ansi.SetBackground _ ->
|
|
168
|
+
( pendingStyle, soFar )
|
|
169
|
+
|
|
170
|
+
Ansi.Linebreak ->
|
|
171
|
+
case soFar of
|
|
172
|
+
next :: rest ->
|
|
173
|
+
( pendingStyle, Style blankStyle "\n" :: next :: rest )
|
|
174
|
+
|
|
175
|
+
[] ->
|
|
176
|
+
( pendingStyle, soFar )
|
|
177
|
+
|
|
178
|
+
_ ->
|
|
179
|
+
( pendingStyle, soFar )
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
encoder : Text -> Encode.Value
|
|
183
|
+
encoder (Style ansiStyle string) =
|
|
184
|
+
Encode.object
|
|
185
|
+
[ ( "bold", Encode.bool ansiStyle.bold )
|
|
186
|
+
, ( "underline", Encode.bool ansiStyle.underline )
|
|
187
|
+
, ( "color"
|
|
188
|
+
, Encode.string <|
|
|
189
|
+
case ansiStyle.color |> Maybe.withDefault Ansi.White of
|
|
190
|
+
Ansi.Red ->
|
|
191
|
+
"red"
|
|
192
|
+
|
|
193
|
+
Ansi.Blue ->
|
|
194
|
+
"blue"
|
|
195
|
+
|
|
196
|
+
Ansi.Green ->
|
|
197
|
+
"green"
|
|
198
|
+
|
|
199
|
+
Ansi.Yellow ->
|
|
200
|
+
"yellow"
|
|
201
|
+
|
|
202
|
+
Ansi.Cyan ->
|
|
203
|
+
"cyan"
|
|
204
|
+
|
|
205
|
+
Ansi.Black ->
|
|
206
|
+
"black"
|
|
207
|
+
|
|
208
|
+
Ansi.Magenta ->
|
|
209
|
+
"magenta"
|
|
210
|
+
|
|
211
|
+
Ansi.White ->
|
|
212
|
+
"white"
|
|
213
|
+
|
|
214
|
+
Ansi.BrightBlack ->
|
|
215
|
+
"BLACK"
|
|
216
|
+
|
|
217
|
+
Ansi.BrightRed ->
|
|
218
|
+
"RED"
|
|
219
|
+
|
|
220
|
+
Ansi.BrightGreen ->
|
|
221
|
+
"GREEN"
|
|
222
|
+
|
|
223
|
+
Ansi.BrightYellow ->
|
|
224
|
+
"YELLOW"
|
|
225
|
+
|
|
226
|
+
Ansi.BrightBlue ->
|
|
227
|
+
"BLUE"
|
|
228
|
+
|
|
229
|
+
Ansi.BrightMagenta ->
|
|
230
|
+
"MAGENTA"
|
|
231
|
+
|
|
232
|
+
Ansi.BrightCyan ->
|
|
233
|
+
"CYAN"
|
|
234
|
+
|
|
235
|
+
Ansi.BrightWhite ->
|
|
236
|
+
"WHITE"
|
|
237
|
+
|
|
238
|
+
Ansi.Custom _ _ _ ->
|
|
239
|
+
""
|
|
240
|
+
)
|
|
241
|
+
, ( "string", Encode.string string )
|
|
242
|
+
]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Test.Html.Internal.ElmHtml.Constants exposing
|
|
2
|
+
( propKey, styleKey, eventKey, attributeKey, attributeNamespaceKey
|
|
3
|
+
, knownKeys
|
|
4
|
+
)
|
|
5
|
+
|
|
6
|
+
{-| Constants for representing internal keys for Elm's vdom implementation
|
|
7
|
+
|
|
8
|
+
@docs propKey, styleKey, eventKey, attributeKey, attributeNamespaceKey
|
|
9
|
+
@docs knownKeys
|
|
10
|
+
|
|
11
|
+
-}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
{-| Internal key for attribute properties
|
|
15
|
+
-}
|
|
16
|
+
propKey : String
|
|
17
|
+
propKey =
|
|
18
|
+
"a2"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
{-| Internal key for style
|
|
22
|
+
-}
|
|
23
|
+
styleKey : String
|
|
24
|
+
styleKey =
|
|
25
|
+
"a1"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
{-| Internal key for style
|
|
29
|
+
-}
|
|
30
|
+
eventKey : String
|
|
31
|
+
eventKey =
|
|
32
|
+
"a0"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
{-| Internal key for style
|
|
36
|
+
-}
|
|
37
|
+
attributeKey : String
|
|
38
|
+
attributeKey =
|
|
39
|
+
"a3"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
{-| Internal key for style
|
|
43
|
+
-}
|
|
44
|
+
attributeNamespaceKey : String
|
|
45
|
+
attributeNamespaceKey =
|
|
46
|
+
"a4"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
{-| Keys that we are aware of and should pay attention to
|
|
50
|
+
-}
|
|
51
|
+
knownKeys : List String
|
|
52
|
+
knownKeys =
|
|
53
|
+
[ styleKey, eventKey, attributeKey, attributeNamespaceKey ]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Test.Html.Internal.ElmHtml.Helpers exposing (filterKnownKeys)
|
|
2
|
+
|
|
3
|
+
{-| Internal helpers for ElmHtml
|
|
4
|
+
|
|
5
|
+
@docs filterKnownKeys
|
|
6
|
+
|
|
7
|
+
-}
|
|
8
|
+
|
|
9
|
+
import Dict exposing (Dict)
|
|
10
|
+
import Test.Html.Internal.ElmHtml.Constants exposing (knownKeys)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
{-| Filter out keys that we don't know
|
|
14
|
+
-}
|
|
15
|
+
filterKnownKeys : Dict String a -> Dict String a
|
|
16
|
+
filterKnownKeys =
|
|
17
|
+
Dict.filter (\key _ -> not (List.member key knownKeys))
|