elm-pages 3.0.0-beta.3 → 3.0.0-beta.31
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/README.md +10 -1
- package/codegen/{elm-pages-codegen.js → elm-pages-codegen.cjs} +2864 -2589
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-DeadCodeEliminateData.elmi +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-DeadCodeEliminateData.elmo +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-DeadCodeEliminateDataTest.elmo +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/d.dat +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/i.dat +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/o.dat +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm.json +1 -1
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/Reporter.elm.js +1447 -342
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/Runner.elm.js +16458 -13724
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_runner.js +1 -1
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_supervisor.js +4 -4
- package/generator/dead-code-review/elm.json +9 -7
- package/generator/dead-code-review/src/Pages/Review/DeadCodeEliminateData.elm +59 -10
- package/generator/dead-code-review/tests/Pages/Review/DeadCodeEliminateDataTest.elm +52 -36
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Internal-RoutePattern.elmi +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Internal-RoutePattern.elmo +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-NoContractViolations.elmi +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-NoContractViolations.elmo +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/d.dat +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/i.dat +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/o.dat +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm.json +1 -1
- package/generator/review/elm-stuff/tests-0.19.1/js/Reporter.elm.js +1447 -342
- package/generator/review/elm-stuff/tests-0.19.1/js/Runner.elm.js +24542 -21748
- package/generator/review/elm-stuff/tests-0.19.1/js/node_runner.js +1 -1
- package/generator/review/elm-stuff/tests-0.19.1/js/node_supervisor.js +4 -4
- package/generator/review/elm.json +10 -10
- package/generator/src/RouteBuilder.elm +113 -107
- package/generator/src/SharedTemplate.elm +3 -2
- package/generator/src/SiteConfig.elm +3 -2
- package/generator/src/basepath-middleware.js +3 -3
- package/generator/src/build.js +125 -88
- package/generator/src/cli.js +273 -88
- package/generator/src/codegen.js +29 -27
- package/generator/src/compatibility-key.js +3 -0
- package/generator/src/compile-elm.js +43 -26
- package/generator/src/config.js +39 -0
- package/generator/src/copy-dir.js +2 -2
- package/generator/src/dev-server.js +150 -133
- package/generator/src/dir-helpers.js +9 -26
- package/generator/src/elm-codegen.js +5 -4
- package/generator/src/elm-file-constants.js +2 -3
- package/generator/src/error-formatter.js +12 -11
- package/generator/src/file-helpers.js +3 -4
- package/generator/src/generate-template-module-connector.js +23 -22
- package/generator/src/init.js +9 -8
- package/generator/src/pre-render-html.js +39 -28
- package/generator/src/render-test.js +109 -0
- package/generator/src/render-worker.js +25 -28
- package/generator/src/render.js +320 -142
- package/generator/src/request-cache.js +252 -163
- package/generator/src/resolve-elm-module.js +63 -0
- package/generator/src/rewrite-client-elm-json.js +6 -5
- package/generator/src/rewrite-elm-json-help.js +56 -0
- package/generator/src/rewrite-elm-json.js +17 -7
- package/generator/src/route-codegen-helpers.js +16 -31
- package/generator/src/seo-renderer.js +12 -7
- package/generator/src/vite-utils.js +77 -0
- package/generator/static-code/hmr.js +79 -13
- package/generator/template/app/Api.elm +6 -5
- package/generator/template/app/Effect.elm +123 -0
- package/generator/template/app/ErrorPage.elm +37 -6
- package/generator/template/app/Route/Index.elm +17 -10
- package/generator/template/app/Shared.elm +24 -47
- package/generator/template/app/Site.elm +19 -6
- package/generator/template/app/View.elm +1 -8
- package/generator/template/elm-tooling.json +0 -3
- package/generator/template/elm.json +32 -24
- package/generator/template/package.json +10 -4
- package/package.json +29 -27
- package/src/ApiRoute.elm +199 -61
- package/src/BackendTask/Custom.elm +325 -0
- package/src/BackendTask/Env.elm +90 -0
- package/src/{DataSource → BackendTask}/File.elm +128 -43
- package/src/{DataSource → BackendTask}/Glob.elm +136 -125
- package/src/BackendTask/Http.elm +673 -0
- package/src/{DataSource → BackendTask}/Internal/Glob.elm +1 -1
- package/src/BackendTask/Internal/Request.elm +28 -0
- package/src/BackendTask/Random.elm +79 -0
- package/src/BackendTask/Time.elm +47 -0
- package/src/BackendTask.elm +537 -0
- package/src/FatalError.elm +89 -0
- package/src/Form/Field.elm +21 -9
- package/src/Form/FieldView.elm +94 -14
- package/src/Form.elm +275 -400
- package/src/Head.elm +237 -7
- package/src/HtmlPrinter.elm +7 -3
- package/src/Internal/ApiRoute.elm +7 -5
- package/src/PageServerResponse.elm +6 -1
- package/src/Pages/FormState.elm +6 -5
- package/src/Pages/GeneratorProgramConfig.elm +15 -0
- package/src/Pages/Internal/FatalError.elm +5 -0
- package/src/Pages/Internal/Form.elm +21 -1
- package/src/Pages/{Msg.elm → Internal/Msg.elm} +26 -16
- package/src/Pages/Internal/Platform/Cli.elm +598 -763
- package/src/Pages/Internal/Platform/CompatibilityKey.elm +6 -0
- package/src/Pages/Internal/Platform/Effect.elm +1 -2
- package/src/Pages/Internal/Platform/GeneratorApplication.elm +373 -0
- package/src/Pages/Internal/Platform/StaticResponses.elm +73 -270
- package/src/Pages/Internal/Platform/ToJsPayload.elm +4 -7
- package/src/Pages/Internal/Platform.elm +216 -102
- package/src/Pages/Internal/Script.elm +17 -0
- package/src/Pages/Internal/StaticHttpBody.elm +35 -1
- package/src/Pages/Manifest.elm +29 -4
- package/src/Pages/PageUrl.elm +23 -9
- package/src/Pages/ProgramConfig.elm +14 -10
- package/src/Pages/Script.elm +109 -0
- package/src/Pages/SiteConfig.elm +3 -2
- package/src/Pages/StaticHttp/Request.elm +2 -2
- package/src/Pages/StaticHttpRequest.elm +23 -98
- package/src/PagesMsg.elm +92 -0
- package/src/Path.elm +16 -19
- package/src/QueryParams.elm +21 -172
- package/src/RequestsAndPending.elm +8 -19
- package/src/Result/Extra.elm +26 -0
- package/src/Scaffold/Form.elm +560 -0
- package/src/Scaffold/Route.elm +1388 -0
- package/src/Server/Request.elm +43 -37
- package/src/Server/Session.elm +62 -42
- package/src/Server/SetCookie.elm +12 -4
- package/src/Test/Html/Internal/ElmHtml/ToString.elm +8 -9
- package/src/DataSource/Env.elm +0 -38
- package/src/DataSource/Http.elm +0 -446
- package/src/DataSource/Internal/Request.elm +0 -20
- package/src/DataSource/Port.elm +0 -90
- package/src/DataSource.elm +0 -538
- package/src/Pages/Generate.elm +0 -800
|
@@ -1,221 +1,80 @@
|
|
|
1
|
-
module Pages.Internal.Platform.StaticResponses exposing (
|
|
1
|
+
module Pages.Internal.Platform.StaticResponses exposing (NextStep(..), empty, nextStep, renderApiRequest)
|
|
2
2
|
|
|
3
|
+
import BackendTask exposing (BackendTask)
|
|
3
4
|
import BuildError exposing (BuildError)
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import Pages.Internal.NotFoundReason exposing (NotFoundReason)
|
|
5
|
+
import FatalError exposing (FatalError)
|
|
6
|
+
import List.Extra
|
|
7
|
+
import Pages.Internal.FatalError
|
|
8
8
|
import Pages.StaticHttp.Request as HashRequest
|
|
9
9
|
import Pages.StaticHttpRequest as StaticHttpRequest
|
|
10
10
|
import RequestsAndPending exposing (RequestsAndPending)
|
|
11
|
-
import
|
|
11
|
+
import TerminalText
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| CheckIfHandled (DataSource (Maybe NotFoundReason)) StaticHttpResult StaticHttpResult
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type StaticHttpResult
|
|
21
|
-
= NotFetched (DataSource ()) (Dict String (Result () String))
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
empty : StaticResponses
|
|
25
|
-
empty =
|
|
26
|
-
StaticResponses
|
|
27
|
-
(NotFetched (DataSource.succeed ()) Dict.empty)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
renderSingleRoute :
|
|
31
|
-
DataSource a
|
|
32
|
-
-> DataSource (Maybe NotFoundReason)
|
|
33
|
-
-> StaticResponses
|
|
34
|
-
renderSingleRoute request cliData =
|
|
35
|
-
CheckIfHandled cliData
|
|
36
|
-
(NotFetched
|
|
37
|
-
(cliData
|
|
38
|
-
|> DataSource.map (\_ -> ())
|
|
39
|
-
)
|
|
40
|
-
Dict.empty
|
|
41
|
-
)
|
|
42
|
-
(NotFetched (DataSource.map (\_ -> ()) request) Dict.empty)
|
|
14
|
+
empty : a -> BackendTask FatalError a
|
|
15
|
+
empty a =
|
|
16
|
+
BackendTask.succeed a
|
|
43
17
|
|
|
44
18
|
|
|
45
19
|
renderApiRequest :
|
|
46
|
-
|
|
47
|
-
->
|
|
20
|
+
BackendTask FatalError response
|
|
21
|
+
-> BackendTask FatalError response
|
|
48
22
|
renderApiRequest request =
|
|
49
|
-
|
|
50
|
-
(NotFetched
|
|
51
|
-
(request |> DataSource.map (\_ -> ()))
|
|
52
|
-
Dict.empty
|
|
53
|
-
)
|
|
23
|
+
request
|
|
54
24
|
|
|
55
25
|
|
|
56
|
-
|
|
57
|
-
List
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
->
|
|
62
|
-
{ model
|
|
63
|
-
| staticResponses : StaticResponses
|
|
64
|
-
, allRawResponses : RequestsAndPending
|
|
65
|
-
}
|
|
66
|
-
->
|
|
67
|
-
{ model
|
|
68
|
-
| staticResponses : StaticResponses
|
|
69
|
-
, allRawResponses : RequestsAndPending
|
|
70
|
-
}
|
|
71
|
-
batchUpdate newEntries model =
|
|
72
|
-
{ model
|
|
73
|
-
| allRawResponses = insertAll newEntries model.allRawResponses
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
insertAll :
|
|
78
|
-
List
|
|
79
|
-
{ request : HashRequest.Request
|
|
80
|
-
, response : RequestsAndPending.Response
|
|
81
|
-
}
|
|
82
|
-
-> RequestsAndPending
|
|
83
|
-
-> RequestsAndPending
|
|
84
|
-
insertAll newEntries dict =
|
|
85
|
-
case newEntries of
|
|
86
|
-
[] ->
|
|
87
|
-
dict
|
|
88
|
-
|
|
89
|
-
info :: rest ->
|
|
90
|
-
insertAll
|
|
91
|
-
rest
|
|
92
|
-
(Dict.update (HashRequest.hash info.request) (\_ -> Just (Just info.response)) dict)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
type NextStep route
|
|
96
|
-
= Continue RequestsAndPending (List HashRequest.Request) (Maybe (List route))
|
|
97
|
-
| Finish (FinishKind route)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
type FinishKind route
|
|
101
|
-
= ApiResponse
|
|
102
|
-
| Errors (List BuildError)
|
|
26
|
+
type NextStep route value
|
|
27
|
+
= Continue (List HashRequest.Request) (StaticHttpRequest.RawRequest FatalError value)
|
|
28
|
+
| Finish value
|
|
29
|
+
| FinishedWithErrors (List BuildError)
|
|
103
30
|
|
|
104
31
|
|
|
105
32
|
nextStep :
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
->
|
|
113
|
-
nextStep
|
|
33
|
+
RequestsAndPending
|
|
34
|
+
-> BackendTask FatalError a
|
|
35
|
+
->
|
|
36
|
+
{ model
|
|
37
|
+
| errors : List BuildError
|
|
38
|
+
}
|
|
39
|
+
-> NextStep route a
|
|
40
|
+
nextStep allRawResponses staticResponses { errors } =
|
|
114
41
|
let
|
|
115
|
-
staticRequestsStatus : StaticHttpRequest.Status
|
|
42
|
+
staticRequestsStatus : StaticHttpRequest.Status FatalError a
|
|
116
43
|
staticRequestsStatus =
|
|
117
44
|
allRawResponses
|
|
118
|
-
|> StaticHttpRequest.cacheRequestResolution
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
let
|
|
143
|
-
hasPermanentError : Bool
|
|
144
|
-
hasPermanentError =
|
|
145
|
-
case staticRequestsStatus of
|
|
146
|
-
StaticHttpRequest.HasPermanentError _ ->
|
|
147
|
-
True
|
|
148
|
-
|
|
149
|
-
_ ->
|
|
150
|
-
False
|
|
151
|
-
|
|
152
|
-
hasPermanentHttpError : Bool
|
|
153
|
-
hasPermanentHttpError =
|
|
154
|
-
not (List.isEmpty errors)
|
|
155
|
-
|
|
156
|
-
( allUrlsKnown, knownUrlsToFetch ) =
|
|
157
|
-
case staticRequestsStatus of
|
|
158
|
-
StaticHttpRequest.Incomplete newUrlsToFetch ->
|
|
159
|
-
( False, newUrlsToFetch )
|
|
160
|
-
|
|
161
|
-
_ ->
|
|
162
|
-
( True, [] )
|
|
163
|
-
|
|
164
|
-
fetchedAllKnownUrls : Bool
|
|
165
|
-
fetchedAllKnownUrls =
|
|
166
|
-
(rawResponses
|
|
167
|
-
|> Dict.keys
|
|
168
|
-
|> Set.fromList
|
|
169
|
-
|> Set.union (allRawResponses |> Dict.keys |> Set.fromList)
|
|
170
|
-
)
|
|
171
|
-
|> Set.diff
|
|
172
|
-
(knownUrlsToFetch
|
|
173
|
-
|> List.map HashRequest.hash
|
|
174
|
-
|> Set.fromList
|
|
175
|
-
)
|
|
176
|
-
|> Set.isEmpty
|
|
177
|
-
in
|
|
178
|
-
not (hasPermanentHttpError || hasPermanentError || (allUrlsKnown && fetchedAllKnownUrls))
|
|
45
|
+
|> StaticHttpRequest.cacheRequestResolution staticResponses
|
|
46
|
+
|
|
47
|
+
( ( pendingRequests, completedValue ), urlsToPerform, progressedBackendTask ) =
|
|
48
|
+
case staticRequestsStatus of
|
|
49
|
+
StaticHttpRequest.Incomplete newUrlsToFetch nextReq ->
|
|
50
|
+
( ( True, Nothing ), newUrlsToFetch, nextReq )
|
|
51
|
+
|
|
52
|
+
StaticHttpRequest.Complete (Err error) ->
|
|
53
|
+
( ( False, Just (Err error) )
|
|
54
|
+
, []
|
|
55
|
+
, BackendTask.fail error
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
StaticHttpRequest.Complete (Ok value) ->
|
|
59
|
+
( ( False, Just (Ok value) )
|
|
60
|
+
, []
|
|
61
|
+
, BackendTask.succeed value
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
StaticHttpRequest.HasPermanentError _ ->
|
|
65
|
+
( ( False, Nothing )
|
|
66
|
+
, []
|
|
67
|
+
, BackendTask.fail (FatalError.fromString "TODO this shouldn't happen")
|
|
68
|
+
)
|
|
179
69
|
in
|
|
180
70
|
if pendingRequests then
|
|
181
71
|
let
|
|
182
|
-
urlsToPerform : List HashRequest.Request
|
|
183
|
-
urlsToPerform =
|
|
184
|
-
-- TODO is this redundant with cacheRequestResolution?
|
|
185
|
-
StaticHttpRequest.resolveUrls request allRawResponses
|
|
186
|
-
|
|
187
|
-
newAllRawResponses : RequestsAndPending
|
|
188
|
-
newAllRawResponses =
|
|
189
|
-
Dict.union allRawResponses dictOfNewUrlsToPerform
|
|
190
|
-
|
|
191
|
-
dictOfNewUrlsToPerform : RequestsAndPending
|
|
192
|
-
dictOfNewUrlsToPerform =
|
|
193
|
-
urlsToPerform
|
|
194
|
-
|> List.map (\url -> ( HashRequest.hash url, Nothing ))
|
|
195
|
-
|> Dict.fromList
|
|
196
|
-
|
|
197
|
-
maskedToUnmasked : Dict String HashRequest.Request
|
|
198
|
-
maskedToUnmasked =
|
|
199
|
-
urlsToPerform
|
|
200
|
-
|> List.map
|
|
201
|
-
(\secureUrl ->
|
|
202
|
-
( HashRequest.hash secureUrl, secureUrl )
|
|
203
|
-
)
|
|
204
|
-
|> Dict.fromList
|
|
205
|
-
|
|
206
|
-
alreadyPerformed : Set String
|
|
207
|
-
alreadyPerformed =
|
|
208
|
-
allRawResponses
|
|
209
|
-
|> Dict.keys
|
|
210
|
-
|> Set.fromList
|
|
211
|
-
|
|
212
72
|
newThing : List HashRequest.Request
|
|
213
73
|
newThing =
|
|
214
|
-
|
|
215
|
-
|>
|
|
216
|
-
|> Dict.values
|
|
74
|
+
urlsToPerform
|
|
75
|
+
|> List.Extra.uniqueBy HashRequest.hash
|
|
217
76
|
in
|
|
218
|
-
|
|
77
|
+
Continue newThing progressedBackendTask
|
|
219
78
|
|
|
220
79
|
else
|
|
221
80
|
let
|
|
@@ -245,80 +104,24 @@ nextStep ({ allRawResponses, errors } as model) maybeRoutes =
|
|
|
245
104
|
in
|
|
246
105
|
errors ++ failedRequests
|
|
247
106
|
in
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|> Finish
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
CheckIfHandled pageFoundDataSource (NotFetched _ _) andThenRequest ->
|
|
273
|
-
let
|
|
274
|
-
pageFoundResult : Result StaticHttpRequest.Error (Maybe NotFoundReason)
|
|
275
|
-
pageFoundResult =
|
|
276
|
-
StaticHttpRequest.resolve
|
|
277
|
-
pageFoundDataSource
|
|
278
|
-
allRawResponses
|
|
279
|
-
in
|
|
280
|
-
case pageFoundResult of
|
|
281
|
-
Ok Nothing ->
|
|
282
|
-
nextStep { model | staticResponses = StaticResponses andThenRequest } maybeRoutes
|
|
283
|
-
|
|
284
|
-
Ok (Just _) ->
|
|
285
|
-
( empty
|
|
286
|
-
, Finish ApiResponse
|
|
287
|
-
-- TODO change data type here so you can avoid running `resolve` again from `Cli.elm` since it can be expensive
|
|
288
|
-
)
|
|
289
|
-
|
|
290
|
-
Err error_ ->
|
|
291
|
-
let
|
|
292
|
-
failedRequests : List BuildError
|
|
293
|
-
failedRequests =
|
|
294
|
-
let
|
|
295
|
-
maybePermanentError : Maybe StaticHttpRequest.Error
|
|
296
|
-
maybePermanentError =
|
|
297
|
-
case staticRequestsStatus of
|
|
298
|
-
StaticHttpRequest.HasPermanentError theError ->
|
|
299
|
-
Just theError
|
|
300
|
-
|
|
301
|
-
_ ->
|
|
302
|
-
Nothing
|
|
303
|
-
|
|
304
|
-
decoderErrors : List BuildError
|
|
305
|
-
decoderErrors =
|
|
306
|
-
maybePermanentError
|
|
307
|
-
|> Maybe.map (StaticHttpRequest.toBuildError "TODO PATH")
|
|
308
|
-
|> Maybe.map List.singleton
|
|
309
|
-
|> Maybe.withDefault []
|
|
310
|
-
in
|
|
311
|
-
decoderErrors
|
|
312
|
-
in
|
|
313
|
-
( model.staticResponses
|
|
314
|
-
, Finish
|
|
315
|
-
(Errors <|
|
|
316
|
-
(StaticHttpRequest.toBuildError
|
|
317
|
-
-- TODO give more fine-grained error reference
|
|
318
|
-
"get static routes"
|
|
319
|
-
error_
|
|
320
|
-
:: failedRequests
|
|
321
|
-
++ errors
|
|
322
|
-
)
|
|
323
|
-
)
|
|
324
|
-
)
|
|
107
|
+
if List.length allErrors > 0 then
|
|
108
|
+
FinishedWithErrors allErrors
|
|
109
|
+
|
|
110
|
+
else
|
|
111
|
+
case completedValue of
|
|
112
|
+
Just (Ok completed) ->
|
|
113
|
+
Finish completed
|
|
114
|
+
|
|
115
|
+
Just (Err (Pages.Internal.FatalError.FatalError buildError)) ->
|
|
116
|
+
FinishedWithErrors
|
|
117
|
+
[ { title = buildError.title |> String.toUpper
|
|
118
|
+
, path = "" -- TODO include path here
|
|
119
|
+
, message = buildError.body |> TerminalText.fromAnsiString
|
|
120
|
+
, fatal = True
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
Nothing ->
|
|
125
|
+
FinishedWithErrors
|
|
126
|
+
[ BuildError.internal "TODO error message"
|
|
127
|
+
]
|
|
@@ -89,7 +89,7 @@ headCodec canonicalSiteUrl currentPagePath =
|
|
|
89
89
|
type ToJsSuccessPayloadNewCombined
|
|
90
90
|
= PageProgress ToJsSuccessPayloadNew
|
|
91
91
|
| SendApiResponse { body : Json.Encode.Value, staticHttpCache : Dict String String, statusCode : Int }
|
|
92
|
-
| DoHttp Pages.StaticHttp.Request.Request
|
|
92
|
+
| DoHttp (List ( String, Pages.StaticHttp.Request.Request ))
|
|
93
93
|
| Port String
|
|
94
94
|
| Errors (List BuildError)
|
|
95
95
|
| ApiResponse
|
|
@@ -109,8 +109,8 @@ successCodecNew2 canonicalSiteUrl currentPagePath =
|
|
|
109
109
|
PageProgress payload ->
|
|
110
110
|
success payload
|
|
111
111
|
|
|
112
|
-
DoHttp
|
|
113
|
-
vDoHttp
|
|
112
|
+
DoHttp hashRequestPairs ->
|
|
113
|
+
vDoHttp hashRequestPairs
|
|
114
114
|
|
|
115
115
|
SendApiResponse record ->
|
|
116
116
|
vSendApiResponse record
|
|
@@ -121,10 +121,7 @@ successCodecNew2 canonicalSiteUrl currentPagePath =
|
|
|
121
121
|
|> Codec.variant1 "Errors" Errors errorCodec
|
|
122
122
|
|> Codec.variant0 "ApiResponse" ApiResponse
|
|
123
123
|
|> Codec.variant1 "PageProgress" PageProgress (successCodecNew canonicalSiteUrl currentPagePath)
|
|
124
|
-
|> Codec.
|
|
125
|
-
DoHttp
|
|
126
|
-
Pages.StaticHttp.Request.codec
|
|
127
|
-
Codec.bool
|
|
124
|
+
|> Codec.variant1 "DoHttp" DoHttp (Codec.list (Codec.tuple Codec.string Pages.StaticHttp.Request.codec))
|
|
128
125
|
|> Codec.variant1 "ApiResponse"
|
|
129
126
|
SendApiResponse
|
|
130
127
|
(Codec.object (\body staticHttpCache statusCode -> { body = body, staticHttpCache = staticHttpCache, statusCode = statusCode })
|