elm-pages 3.0.0-beta.0 → 3.0.0-beta.2
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/codegen/elm-pages-codegen.js +38516 -0
- 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.elmi +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/Reporter.elmi +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Reporter.elmo +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Runner.elmi +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Runner.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/lock +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 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/Reporter.elm.js +6795 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/Runner.elm.js +25651 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_runner.js +110 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_supervisor.js +187 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/package.json +1 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/src/Reporter.elm +26 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/src/Runner.elm +62 -0
- package/generator/dead-code-review/elm.json +35 -0
- package/generator/dead-code-review/src/Pages/Review/DeadCodeEliminateData.elm +181 -0
- package/generator/dead-code-review/src/ReviewConfig.elm +9 -0
- package/generator/dead-code-review/tests/Pages/Review/DeadCodeEliminateDataTest.elm +455 -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/js/node_runner.js +1 -1
- package/generator/review/elm-stuff/tests-0.19.1/js/node_supervisor.js +1 -1
- package/generator/src/SharedTemplate.elm +1 -1
- package/generator/src/generate-template-module-connector.js +2 -22
- package/package.json +5 -2
- package/src/DataSource/File.elm +1 -1
- package/src/DataSource/Internal/Request.elm +0 -5
- package/src/Form.elm +1 -1
- package/src/Head/Seo.elm +16 -27
- package/src/Pages/Internal/NotFoundReason.elm +3 -2
- package/src/Pages/Internal/Platform/Cli.elm +13 -8
- package/src/Pages/Internal/Platform.elm +3 -3
- package/src/Pages/ProgramConfig.elm +1 -1
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
module Pages.Review.DeadCodeEliminateDataTest exposing (all)
|
|
2
|
+
|
|
3
|
+
import Pages.Review.DeadCodeEliminateData exposing (rule)
|
|
4
|
+
import Review.Test
|
|
5
|
+
import Test exposing (Test, describe, test)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
all : Test
|
|
9
|
+
all =
|
|
10
|
+
describe "dead code elimination"
|
|
11
|
+
[ test "replaces data record setter" <|
|
|
12
|
+
\() ->
|
|
13
|
+
"""module Route.Index exposing (Data, Model, Msg, route)
|
|
14
|
+
|
|
15
|
+
import DataSource exposing (DataSource)
|
|
16
|
+
import RouteBuilder exposing (Page, StaticPayload, single)
|
|
17
|
+
import Pages.PageUrl exposing (PageUrl)
|
|
18
|
+
import Pages.Url
|
|
19
|
+
import Path
|
|
20
|
+
import Route exposing (Route)
|
|
21
|
+
import Shared
|
|
22
|
+
import View exposing (View)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
type alias Model =
|
|
26
|
+
{}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
type alias Msg =
|
|
30
|
+
()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
type alias RouteParams =
|
|
34
|
+
{}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
type alias Data =
|
|
38
|
+
()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
42
|
+
route =
|
|
43
|
+
single
|
|
44
|
+
{ head = head
|
|
45
|
+
, data = data
|
|
46
|
+
}
|
|
47
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
data : DataSource Data
|
|
51
|
+
data =
|
|
52
|
+
DataSource.succeed ()
|
|
53
|
+
"""
|
|
54
|
+
|> Review.Test.run rule
|
|
55
|
+
|> Review.Test.expectErrors
|
|
56
|
+
[ Review.Test.error
|
|
57
|
+
{ message = "Codemod"
|
|
58
|
+
, details =
|
|
59
|
+
[ "" ]
|
|
60
|
+
, under =
|
|
61
|
+
"""data = data
|
|
62
|
+
}"""
|
|
63
|
+
}
|
|
64
|
+
|> Review.Test.whenFixed
|
|
65
|
+
"""module Route.Index exposing (Data, Model, Msg, route)
|
|
66
|
+
|
|
67
|
+
import DataSource exposing (DataSource)
|
|
68
|
+
import RouteBuilder exposing (Page, StaticPayload, single)
|
|
69
|
+
import Pages.PageUrl exposing (PageUrl)
|
|
70
|
+
import Pages.Url
|
|
71
|
+
import Path
|
|
72
|
+
import Route exposing (Route)
|
|
73
|
+
import Shared
|
|
74
|
+
import View exposing (View)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
type alias Model =
|
|
78
|
+
{}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
type alias Msg =
|
|
82
|
+
()
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
type alias RouteParams =
|
|
86
|
+
{}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
type alias Data =
|
|
90
|
+
()
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
94
|
+
route =
|
|
95
|
+
single
|
|
96
|
+
{ head = head
|
|
97
|
+
, data = DataSource.fail ""
|
|
98
|
+
}
|
|
99
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
data : DataSource Data
|
|
103
|
+
data =
|
|
104
|
+
DataSource.succeed ()
|
|
105
|
+
"""
|
|
106
|
+
]
|
|
107
|
+
, test "replaces data record setter with non-empty RouteParams" <|
|
|
108
|
+
\() ->
|
|
109
|
+
"""module Route.Blog.Slug_ exposing (Data, Model, Msg, route)
|
|
110
|
+
|
|
111
|
+
import DataSource exposing (DataSource)
|
|
112
|
+
import RouteBuilder exposing (Page, StaticPayload)
|
|
113
|
+
import Pages.PageUrl exposing (PageUrl)
|
|
114
|
+
import Pages.Url
|
|
115
|
+
import Path
|
|
116
|
+
import Route exposing (Route)
|
|
117
|
+
import Shared
|
|
118
|
+
import View exposing (View)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
type alias Model =
|
|
122
|
+
{}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
type alias Msg =
|
|
126
|
+
()
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
type alias RouteParams =
|
|
130
|
+
{ slug : String }
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
type alias Data =
|
|
134
|
+
()
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
138
|
+
route =
|
|
139
|
+
RouteBuilder.preRender
|
|
140
|
+
{ data = data
|
|
141
|
+
, head = head
|
|
142
|
+
, pages = pages
|
|
143
|
+
}
|
|
144
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
data : DataSource Data
|
|
148
|
+
data =
|
|
149
|
+
DataSource.succeed ()
|
|
150
|
+
"""
|
|
151
|
+
|> Review.Test.run rule
|
|
152
|
+
|> Review.Test.expectErrors
|
|
153
|
+
[ Review.Test.error
|
|
154
|
+
{ message = "Codemod"
|
|
155
|
+
, details =
|
|
156
|
+
[ "" ]
|
|
157
|
+
, under =
|
|
158
|
+
"""data = data"""
|
|
159
|
+
}
|
|
160
|
+
|> Review.Test.whenFixed
|
|
161
|
+
"""module Route.Blog.Slug_ exposing (Data, Model, Msg, route)
|
|
162
|
+
|
|
163
|
+
import DataSource exposing (DataSource)
|
|
164
|
+
import RouteBuilder exposing (Page, StaticPayload)
|
|
165
|
+
import Pages.PageUrl exposing (PageUrl)
|
|
166
|
+
import Pages.Url
|
|
167
|
+
import Path
|
|
168
|
+
import Route exposing (Route)
|
|
169
|
+
import Shared
|
|
170
|
+
import View exposing (View)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
type alias Model =
|
|
174
|
+
{}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
type alias Msg =
|
|
178
|
+
()
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
type alias RouteParams =
|
|
182
|
+
{ slug : String }
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
type alias Data =
|
|
186
|
+
()
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
190
|
+
route =
|
|
191
|
+
RouteBuilder.preRender
|
|
192
|
+
{ data = \\_ -> DataSource.fail ""
|
|
193
|
+
, head = head
|
|
194
|
+
, pages = pages
|
|
195
|
+
}
|
|
196
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
data : DataSource Data
|
|
200
|
+
data =
|
|
201
|
+
DataSource.succeed ()
|
|
202
|
+
"""
|
|
203
|
+
]
|
|
204
|
+
, test "replaces data record setter with RouteBuilder.serverRendered" <|
|
|
205
|
+
\() ->
|
|
206
|
+
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
207
|
+
|
|
208
|
+
type alias Model =
|
|
209
|
+
{}
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
type alias Msg =
|
|
213
|
+
()
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
type alias RouteParams =
|
|
217
|
+
{}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
221
|
+
route =
|
|
222
|
+
RouteBuilder.serverRender
|
|
223
|
+
{ head = head
|
|
224
|
+
, data = data
|
|
225
|
+
, action = action
|
|
226
|
+
}
|
|
227
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
228
|
+
"""
|
|
229
|
+
|> Review.Test.run rule
|
|
230
|
+
|> Review.Test.expectErrors
|
|
231
|
+
[ Review.Test.error
|
|
232
|
+
{ message = "Codemod"
|
|
233
|
+
, details =
|
|
234
|
+
[ "" ]
|
|
235
|
+
, under =
|
|
236
|
+
"""data = data
|
|
237
|
+
,"""
|
|
238
|
+
}
|
|
239
|
+
|> Review.Test.whenFixed
|
|
240
|
+
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
241
|
+
|
|
242
|
+
type alias Model =
|
|
243
|
+
{}
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
type alias Msg =
|
|
247
|
+
()
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
type alias RouteParams =
|
|
251
|
+
{}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
255
|
+
route =
|
|
256
|
+
RouteBuilder.serverRender
|
|
257
|
+
{ head = head
|
|
258
|
+
, data = \\_ -> Request.oneOf []
|
|
259
|
+
, action = action
|
|
260
|
+
}
|
|
261
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
262
|
+
"""
|
|
263
|
+
, Review.Test.error
|
|
264
|
+
{ message = "Codemod"
|
|
265
|
+
, details =
|
|
266
|
+
[ "" ]
|
|
267
|
+
, under =
|
|
268
|
+
"""action = action
|
|
269
|
+
}"""
|
|
270
|
+
}
|
|
271
|
+
|> Review.Test.whenFixed
|
|
272
|
+
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
273
|
+
|
|
274
|
+
type alias Model =
|
|
275
|
+
{}
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
type alias Msg =
|
|
279
|
+
()
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
type alias RouteParams =
|
|
283
|
+
{}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
287
|
+
route =
|
|
288
|
+
RouteBuilder.serverRender
|
|
289
|
+
{ head = head
|
|
290
|
+
, data = data
|
|
291
|
+
, action = \\_ -> Request.oneOf []
|
|
292
|
+
}
|
|
293
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
294
|
+
"""
|
|
295
|
+
]
|
|
296
|
+
, test "no Request.oneOf fix after replacement is made" <|
|
|
297
|
+
\() ->
|
|
298
|
+
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
299
|
+
|
|
300
|
+
type alias Model =
|
|
301
|
+
{}
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
type alias Msg =
|
|
305
|
+
()
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
type alias RouteParams =
|
|
309
|
+
{}
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
313
|
+
route =
|
|
314
|
+
RouteBuilder.serverRender
|
|
315
|
+
{ head = head
|
|
316
|
+
, data = \\_ -> Request.oneOf []
|
|
317
|
+
}
|
|
318
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
319
|
+
"""
|
|
320
|
+
|> Review.Test.run rule
|
|
321
|
+
|> Review.Test.expectNoErrors
|
|
322
|
+
, test "no fix after replacement is made" <|
|
|
323
|
+
\() ->
|
|
324
|
+
"""module Route.Index exposing (Data, Model, Msg, route)
|
|
325
|
+
|
|
326
|
+
import DataSource exposing (DataSource)
|
|
327
|
+
import RouteBuilder exposing (Page, StaticPayload)
|
|
328
|
+
import Pages.PageUrl exposing (PageUrl)
|
|
329
|
+
import Pages.Url
|
|
330
|
+
import Path
|
|
331
|
+
import Route exposing (Route)
|
|
332
|
+
import Shared
|
|
333
|
+
import View exposing (View)
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
type alias Model =
|
|
337
|
+
{}
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
type alias Msg =
|
|
341
|
+
()
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
type alias RouteParams =
|
|
345
|
+
{}
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
type alias Data =
|
|
349
|
+
()
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
353
|
+
route =
|
|
354
|
+
RouteBuilder.single
|
|
355
|
+
{ head = head
|
|
356
|
+
, data = DataSource.fail ""
|
|
357
|
+
}
|
|
358
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
data : DataSource Data
|
|
362
|
+
data =
|
|
363
|
+
DataSource.succeed ()
|
|
364
|
+
"""
|
|
365
|
+
|> Review.Test.run rule
|
|
366
|
+
|> Review.Test.expectNoErrors
|
|
367
|
+
, test "replaces data record setter in Shared module" <|
|
|
368
|
+
\() ->
|
|
369
|
+
"""module Shared exposing (Data, Model, Msg, template)
|
|
370
|
+
|
|
371
|
+
import Browser.Navigation
|
|
372
|
+
import DataSource
|
|
373
|
+
import Html exposing (Html)
|
|
374
|
+
import Html.Styled
|
|
375
|
+
import Pages.Flags
|
|
376
|
+
import Pages.PageUrl exposing (PageUrl)
|
|
377
|
+
import Path exposing (Path)
|
|
378
|
+
import Route exposing (Route)
|
|
379
|
+
import SharedTemplate exposing (SharedTemplate)
|
|
380
|
+
import TableOfContents
|
|
381
|
+
import View exposing (View)
|
|
382
|
+
import View.Header
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
template : SharedTemplate Msg Model Data msg
|
|
386
|
+
template =
|
|
387
|
+
{ init = init
|
|
388
|
+
, update = update
|
|
389
|
+
, view = view
|
|
390
|
+
, data = data
|
|
391
|
+
, subscriptions = subscriptions
|
|
392
|
+
, onPageChange = Just OnPageChange
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
type alias Data =
|
|
397
|
+
TableOfContents.TableOfContents TableOfContents.Data
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
type alias Model =
|
|
401
|
+
{ showMobileMenu : Bool
|
|
402
|
+
, counter : Int
|
|
403
|
+
, navigationKey : Maybe Browser.Navigation.Key
|
|
404
|
+
}
|
|
405
|
+
"""
|
|
406
|
+
|> Review.Test.run rule
|
|
407
|
+
|> Review.Test.expectErrors
|
|
408
|
+
[ Review.Test.error
|
|
409
|
+
{ message = "Codemod"
|
|
410
|
+
, details =
|
|
411
|
+
[ "" ]
|
|
412
|
+
, under =
|
|
413
|
+
"""data = data
|
|
414
|
+
,"""
|
|
415
|
+
}
|
|
416
|
+
|> Review.Test.whenFixed
|
|
417
|
+
"""module Shared exposing (Data, Model, Msg, template)
|
|
418
|
+
|
|
419
|
+
import Browser.Navigation
|
|
420
|
+
import DataSource
|
|
421
|
+
import Html exposing (Html)
|
|
422
|
+
import Html.Styled
|
|
423
|
+
import Pages.Flags
|
|
424
|
+
import Pages.PageUrl exposing (PageUrl)
|
|
425
|
+
import Path exposing (Path)
|
|
426
|
+
import Route exposing (Route)
|
|
427
|
+
import SharedTemplate exposing (SharedTemplate)
|
|
428
|
+
import TableOfContents
|
|
429
|
+
import View exposing (View)
|
|
430
|
+
import View.Header
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
template : SharedTemplate Msg Model Data msg
|
|
434
|
+
template =
|
|
435
|
+
{ init = init
|
|
436
|
+
, update = update
|
|
437
|
+
, view = view
|
|
438
|
+
, data = DataSource.fail ""
|
|
439
|
+
, subscriptions = subscriptions
|
|
440
|
+
, onPageChange = Just OnPageChange
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
type alias Data =
|
|
445
|
+
TableOfContents.TableOfContents TableOfContents.Data
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
type alias Model =
|
|
449
|
+
{ showMobileMenu : Bool
|
|
450
|
+
, counter : Int
|
|
451
|
+
, navigationKey : Maybe Browser.Navigation.Key
|
|
452
|
+
}
|
|
453
|
+
"""
|
|
454
|
+
]
|
|
455
|
+
]
|
|
Binary file
|
|
@@ -75,7 +75,7 @@ console.elmlog = (str) => logs.push(str + "\n");
|
|
|
75
75
|
const { Elm } = require("./Runner.elm.js");
|
|
76
76
|
|
|
77
77
|
// Start the Elm app
|
|
78
|
-
const flags = { initialSeed:
|
|
78
|
+
const flags = { initialSeed: 2471752417, fuzzRuns: 100, filter: null };
|
|
79
79
|
const app = Elm.Runner.init({ flags: flags });
|
|
80
80
|
|
|
81
81
|
// Record the timing at which we received the last "runTest" message
|
|
@@ -34,7 +34,7 @@ type alias SharedTemplate msg sharedModel sharedData mappedMsg =
|
|
|
34
34
|
-> sharedModel
|
|
35
35
|
-> (msg -> mappedMsg)
|
|
36
36
|
-> View mappedMsg
|
|
37
|
-
-> { body : Html mappedMsg, title : String }
|
|
37
|
+
-> { body : List (Html mappedMsg), title : String }
|
|
38
38
|
, data : DataSource.DataSource sharedData
|
|
39
39
|
, subscriptions : Path -> sharedModel -> Sub msg
|
|
40
40
|
, onPageChange :
|
|
@@ -63,30 +63,10 @@ async function generateTemplateModuleConnector(basePath, phase) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
async function runElmCodegenCli(templates, basePath, phase) {
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
await compileCliApp(
|
|
69
|
-
// { debug: true },
|
|
70
|
-
{},
|
|
71
|
-
`Generate.elm`,
|
|
72
|
-
path.join(process.cwd(), "elm-stuff/elm-pages-codegen.js"),
|
|
73
|
-
path.join(__dirname, "../../codegen"),
|
|
74
|
-
|
|
75
|
-
path.join(process.cwd(), "elm-stuff/elm-pages-codegen.js")
|
|
76
|
-
);
|
|
77
|
-
} catch (error) {
|
|
78
|
-
console.log(restoreColorSafe(error));
|
|
79
|
-
process.exit(1);
|
|
80
|
-
// throw error;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// TODO use uncached require here to prevent stale code from running
|
|
66
|
+
const filePath = path.join(__dirname, `../../codegen/elm-pages-codegen.js`);
|
|
84
67
|
|
|
85
68
|
const promise = new Promise((resolve, reject) => {
|
|
86
|
-
const elmPagesCodegen = require(
|
|
87
|
-
process.cwd(),
|
|
88
|
-
"./elm-stuff/elm-pages-codegen.js"
|
|
89
|
-
)).Elm.Generate;
|
|
69
|
+
const elmPagesCodegen = require(filePath).Elm.Generate;
|
|
90
70
|
|
|
91
71
|
const app = elmPagesCodegen.init({
|
|
92
72
|
flags: { templates: templates, basePath, phase },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elm-pages",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"homepage": "https://elm-pages.com",
|
|
5
5
|
"moduleResolution": "node",
|
|
6
6
|
"description": "Type-safe static sites, written in pure elm with your own custom elm-markup syntax.",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"test": "./test.sh",
|
|
11
11
|
"test:snapshot": "(cd examples/escaping && npm install && npm test) && (cd examples/base-path && npm install && npm test)",
|
|
12
12
|
"cypress": "npm start & cypress run",
|
|
13
|
-
"prepare": "
|
|
13
|
+
"prepare": "npm run build:generator",
|
|
14
|
+
"build:generator": "elm-codegen install && (cd codegen && lamdera make Generate.elm --output elm-pages-codegen.js)",
|
|
14
15
|
"review": "elm-review"
|
|
15
16
|
},
|
|
16
17
|
"repository": "https://github.com/dillonkearns/elm-pages",
|
|
@@ -68,7 +69,9 @@
|
|
|
68
69
|
"files": [
|
|
69
70
|
"generator/src/",
|
|
70
71
|
"generator/review/",
|
|
72
|
+
"generator/dead-code-review/",
|
|
71
73
|
"src/",
|
|
74
|
+
"codegen/elm-pages-codegen.js",
|
|
72
75
|
"generator/template/",
|
|
73
76
|
"generator/static-code/"
|
|
74
77
|
],
|
package/src/DataSource/File.elm
CHANGED
|
@@ -171,7 +171,7 @@ just the metadata.
|
|
|
171
171
|
(Decode.field "tags" (Decode.list Decode.string))
|
|
172
172
|
|
|
173
173
|
If you wanted to use this to get this metadata for all blog posts in a folder, you could use
|
|
174
|
-
the [`DataSource`](DataSource) API along with [`DataSource.Glob`](DataSource
|
|
174
|
+
the [`DataSource`](DataSource) API along with [`DataSource.Glob`](DataSource-Glob).
|
|
175
175
|
|
|
176
176
|
import DataSource exposing (DataSource)
|
|
177
177
|
import DataSource.File as File
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
module DataSource.Internal.Request exposing (request)
|
|
2
2
|
|
|
3
|
-
{-| Build a `DataSource.Http` request (analogous to [Http.request](https://package.elm-lang.org/packages/elm/http/latest/Http#request)).
|
|
4
|
-
This function takes in all the details to build a `DataSource.Http` request, but you can build your own simplified helper functions
|
|
5
|
-
with this as a low-level detail, or you can use functions like [DataSource.Http.get](#get).
|
|
6
|
-
-}
|
|
7
|
-
|
|
8
3
|
import DataSource exposing (DataSource)
|
|
9
4
|
import DataSource.Http exposing (Body, Expect)
|
|
10
5
|
|
package/src/Form.elm
CHANGED
|
@@ -575,7 +575,7 @@ field name (Field fieldParser kind) (Form definitions parseFn toInitialValues) =
|
|
|
575
575
|
|
|
576
576
|
{-| Declare a hidden field for the form.
|
|
577
577
|
|
|
578
|
-
Unlike [`field`](#field) declarations which are rendered using [`Form.
|
|
578
|
+
Unlike [`field`](#field) declarations which are rendered using [`Form.FieldView`](Form-FieldView)
|
|
579
579
|
functions, `hiddenField` inputs are automatically inserted into the form when you render it.
|
|
580
580
|
|
|
581
581
|
You define the field's validations the same way as for `field`, with the
|
package/src/Head/Seo.elm
CHANGED
|
@@ -49,10 +49,12 @@ with the `head` function that you pass to your Pages config (`Pages.application`
|
|
|
49
49
|
|
|
50
50
|
-}
|
|
51
51
|
|
|
52
|
+
import DateOrDateTime exposing (DateOrDateTime)
|
|
52
53
|
import Head
|
|
53
54
|
import Head.Twitter as Twitter
|
|
54
55
|
import LanguageTag.Country
|
|
55
56
|
import LanguageTag.Language
|
|
57
|
+
import MimeType exposing (MimeType)
|
|
56
58
|
import Pages.Url
|
|
57
59
|
|
|
58
60
|
|
|
@@ -235,9 +237,9 @@ website common =
|
|
|
235
237
|
article :
|
|
236
238
|
{ tags : List String
|
|
237
239
|
, section : Maybe String
|
|
238
|
-
, publishedTime : Maybe
|
|
239
|
-
, modifiedTime : Maybe
|
|
240
|
-
, expirationTime : Maybe
|
|
240
|
+
, publishedTime : Maybe DateOrDateTime
|
|
241
|
+
, modifiedTime : Maybe DateOrDateTime
|
|
242
|
+
, expirationTime : Maybe DateOrDateTime
|
|
241
243
|
}
|
|
242
244
|
-> Common
|
|
243
245
|
-> List Head.Tag
|
|
@@ -252,7 +254,7 @@ book :
|
|
|
252
254
|
->
|
|
253
255
|
{ tags : List String
|
|
254
256
|
, isbn : Maybe String
|
|
255
|
-
, releaseDate : Maybe
|
|
257
|
+
, releaseDate : Maybe DateOrDateTime
|
|
256
258
|
}
|
|
257
259
|
-> List Head.Tag
|
|
258
260
|
book common details =
|
|
@@ -354,7 +356,7 @@ tagsForAudio : Audio -> List ( String, Maybe Head.AttributeValue )
|
|
|
354
356
|
tagsForAudio audio =
|
|
355
357
|
[ ( "og:audio", audio.url |> Head.raw |> Just )
|
|
356
358
|
, ( "og:audio:secure_url", audio.url |> Head.raw |> Just )
|
|
357
|
-
, ( "og:audio:type", audio.mimeType |> Maybe.map Head.raw )
|
|
359
|
+
, ( "og:audio:type", audio.mimeType |> Maybe.map (MimeType.toString >> Head.raw) )
|
|
358
360
|
]
|
|
359
361
|
|
|
360
362
|
|
|
@@ -371,14 +373,14 @@ type ContentDetails
|
|
|
371
373
|
| Article
|
|
372
374
|
{ tags : List String
|
|
373
375
|
, section : Maybe String
|
|
374
|
-
, publishedTime : Maybe
|
|
375
|
-
, modifiedTime : Maybe
|
|
376
|
-
, expirationTime : Maybe
|
|
376
|
+
, publishedTime : Maybe DateOrDateTime
|
|
377
|
+
, modifiedTime : Maybe DateOrDateTime
|
|
378
|
+
, expirationTime : Maybe DateOrDateTime
|
|
377
379
|
}
|
|
378
380
|
| Book
|
|
379
381
|
{ tags : List String
|
|
380
382
|
, isbn : Maybe String
|
|
381
|
-
, releaseDate : Maybe
|
|
383
|
+
, releaseDate : Maybe DateOrDateTime
|
|
382
384
|
}
|
|
383
385
|
| Song
|
|
384
386
|
{-
|
|
@@ -399,20 +401,6 @@ type ContentDetails
|
|
|
399
401
|
}
|
|
400
402
|
|
|
401
403
|
|
|
402
|
-
{-| <https://en.wikipedia.org/wiki/ISO_8601>
|
|
403
|
-
-}
|
|
404
|
-
type alias Iso8601DateTime =
|
|
405
|
-
-- TODO should be more type-safe here
|
|
406
|
-
String
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
{-| <https://en.wikipedia.org/wiki/Media_type>
|
|
410
|
-
-}
|
|
411
|
-
type alias MimeType =
|
|
412
|
-
-- TODO should be more type-safe here
|
|
413
|
-
String
|
|
414
|
-
|
|
415
|
-
|
|
416
404
|
{-| See <https://ogp.me/#structured>
|
|
417
405
|
-}
|
|
418
406
|
type alias Image =
|
|
@@ -448,6 +436,7 @@ tagsForVideo video =
|
|
|
448
436
|
, ( "og:video:secure_url", video.url |> Head.raw |> Just )
|
|
449
437
|
, ( "og:video:width", video.dimensions |> Maybe.map .width |> Maybe.map String.fromInt |> Maybe.map Head.raw )
|
|
450
438
|
, ( "og:video:height", video.dimensions |> Maybe.map .height |> Maybe.map String.fromInt |> Maybe.map Head.raw )
|
|
439
|
+
, ( "og:video:type", video.mimeType |> Maybe.map (MimeType.toString >> Head.raw) )
|
|
451
440
|
]
|
|
452
441
|
|
|
453
442
|
|
|
@@ -466,9 +455,9 @@ tags (Content common details) =
|
|
|
466
455
|
-}
|
|
467
456
|
[ ( "og:type", "article" |> Head.raw |> Just )
|
|
468
457
|
, ( "article:section", articleDetails.section |> Maybe.map Head.raw )
|
|
469
|
-
, ( "article:published_time", articleDetails.publishedTime |> Maybe.map Head.raw )
|
|
470
|
-
, ( "article:modified_time", articleDetails.modifiedTime |> Maybe.map Head.raw )
|
|
471
|
-
, ( "article:expiration_time", articleDetails.expirationTime |> Maybe.map Head.raw )
|
|
458
|
+
, ( "article:published_time", articleDetails.publishedTime |> Maybe.map (DateOrDateTime.dateOrDateTimeToIso8601String >> Head.raw) )
|
|
459
|
+
, ( "article:modified_time", articleDetails.modifiedTime |> Maybe.map (DateOrDateTime.dateOrDateTimeToIso8601String >> Head.raw) )
|
|
460
|
+
, ( "article:expiration_time", articleDetails.expirationTime |> Maybe.map (DateOrDateTime.dateOrDateTimeToIso8601String >> Head.raw) )
|
|
472
461
|
]
|
|
473
462
|
++ List.map
|
|
474
463
|
(\tag -> ( "article:tag", tag |> Head.raw |> Just ))
|
|
@@ -477,7 +466,7 @@ tags (Content common details) =
|
|
|
477
466
|
Book bookDetails ->
|
|
478
467
|
[ ( "og:type", "book" |> Head.raw |> Just )
|
|
479
468
|
, ( "og:isbn", bookDetails.isbn |> Maybe.map Head.raw )
|
|
480
|
-
, ( "og:release_date", bookDetails.releaseDate |> Maybe.map Head.raw )
|
|
469
|
+
, ( "og:release_date", bookDetails.releaseDate |> Maybe.map (DateOrDateTime.dateOrDateTimeToIso8601String >> Head.raw) )
|
|
481
470
|
]
|
|
482
471
|
++ List.map
|
|
483
472
|
(\tag -> ( "book:tag", tag |> Head.raw |> Just ))
|