elm-pages 3.0.26 → 3.0.27
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.cjs +14408 -17538
- package/generator/dead-code-review/src/Pages/Review/DeadCodeEliminateData.elm +22 -10
- package/generator/dead-code-review/tests/Pages/Review/DeadCodeEliminateDataTest.elm +105 -2
- package/generator/src/compatibility-key.js +1 -1
- package/package.json +26 -23
|
@@ -145,7 +145,7 @@ declarationVisitor node context =
|
|
|
145
145
|
(\recordSetter ->
|
|
146
146
|
case Node.value recordSetter of
|
|
147
147
|
( keyNode, valueNode ) ->
|
|
148
|
-
if Node.value keyNode == "data" || Node.value keyNode == "action" then
|
|
148
|
+
if Node.value keyNode == "data" || Node.value keyNode == "action" || Node.value keyNode == "pages" then
|
|
149
149
|
if isAlreadyApplied context.lookupTable (Node.value valueNode) then
|
|
150
150
|
Nothing
|
|
151
151
|
|
|
@@ -203,7 +203,7 @@ expressionVisitor node context =
|
|
|
203
203
|
(\recordSetter ->
|
|
204
204
|
case Node.value recordSetter of
|
|
205
205
|
( keyNode, valueNode ) ->
|
|
206
|
-
if Node.value keyNode == "data" || Node.value keyNode == "action" then
|
|
206
|
+
if Node.value keyNode == "data" || Node.value keyNode == "action" || Node.value keyNode == "pages" then
|
|
207
207
|
if isAlreadyApplied context.lookupTable (Node.value valueNode) then
|
|
208
208
|
Nothing
|
|
209
209
|
|
|
@@ -234,16 +234,28 @@ expressionVisitor node context =
|
|
|
234
234
|
++ " = "
|
|
235
235
|
++ (case pageBuilderName of
|
|
236
236
|
"preRender" ->
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
if key == "pages" then
|
|
238
|
+
referenceFunction context.importContext ( [ "BackendTask" ], "fail" )
|
|
239
|
+
++ " "
|
|
240
|
+
++ exceptionFromString
|
|
241
|
+
|
|
242
|
+
else
|
|
243
|
+
"\\_ -> "
|
|
244
|
+
++ referenceFunction context.importContext ( [ "BackendTask" ], "fail" )
|
|
245
|
+
++ " "
|
|
246
|
+
++ exceptionFromString
|
|
241
247
|
|
|
242
248
|
"preRenderWithFallback" ->
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
249
|
+
if key == "pages" then
|
|
250
|
+
referenceFunction context.importContext ( [ "BackendTask" ], "fail" )
|
|
251
|
+
++ " "
|
|
252
|
+
++ exceptionFromString
|
|
253
|
+
|
|
254
|
+
else
|
|
255
|
+
"\\_ -> "
|
|
256
|
+
++ referenceFunction context.importContext ( [ "BackendTask" ], "fail" )
|
|
257
|
+
++ " "
|
|
258
|
+
++ exceptionFromString
|
|
247
259
|
|
|
248
260
|
"serverRender" ->
|
|
249
261
|
"\\_ _ -> "
|
|
@@ -311,7 +311,7 @@ route =
|
|
|
311
311
|
RouteBuilder.preRender
|
|
312
312
|
{ data = data
|
|
313
313
|
, head = head
|
|
314
|
-
, pages =
|
|
314
|
+
, pages = BackendTask.fail (FatalError.fromString "")
|
|
315
315
|
}
|
|
316
316
|
|> RouteBuilder.buildNoState { view = view }
|
|
317
317
|
|
|
@@ -366,7 +366,7 @@ route =
|
|
|
366
366
|
RouteBuilder.preRender
|
|
367
367
|
{ data = \\_ -> BackendTask.fail (FatalError.fromString "")
|
|
368
368
|
, head = head
|
|
369
|
-
, pages =
|
|
369
|
+
, pages = BackendTask.fail (FatalError.fromString "")
|
|
370
370
|
}
|
|
371
371
|
|> RouteBuilder.buildNoState { view = view }
|
|
372
372
|
|
|
@@ -374,6 +374,109 @@ route =
|
|
|
374
374
|
data : BackendTask Data
|
|
375
375
|
data =
|
|
376
376
|
BackendTask.succeed ()
|
|
377
|
+
"""
|
|
378
|
+
]
|
|
379
|
+
, test "replaces pages record setter in preRender" <|
|
|
380
|
+
\() ->
|
|
381
|
+
"""module Route.Blog.Slug_ exposing (Data, Model, Msg, route)
|
|
382
|
+
|
|
383
|
+
import Server.Request as Request
|
|
384
|
+
|
|
385
|
+
import BackendTask exposing (BackendTask)
|
|
386
|
+
import FatalError
|
|
387
|
+
import RouteBuilder exposing (Page, App)
|
|
388
|
+
import Pages.PageUrl exposing (PageUrl)
|
|
389
|
+
import Pages.Url
|
|
390
|
+
import UrlPath
|
|
391
|
+
import Route exposing (Route)
|
|
392
|
+
import Shared
|
|
393
|
+
import View exposing (View)
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
type alias Model =
|
|
397
|
+
{}
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
type alias Msg =
|
|
401
|
+
()
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
type alias RouteParams =
|
|
405
|
+
{ slug : String }
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
type alias Data =
|
|
409
|
+
()
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
413
|
+
route =
|
|
414
|
+
RouteBuilder.preRender
|
|
415
|
+
{ data = \\_ -> BackendTask.fail (FatalError.fromString "")
|
|
416
|
+
, head = head
|
|
417
|
+
, pages = pages
|
|
418
|
+
}
|
|
419
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
pages : BackendTask (List RouteParams)
|
|
423
|
+
pages =
|
|
424
|
+
BackendTask.succeed [ { slug = "hello" } ]
|
|
425
|
+
"""
|
|
426
|
+
|> Review.Test.run rule
|
|
427
|
+
|> Review.Test.expectErrors
|
|
428
|
+
[ Review.Test.error
|
|
429
|
+
{ message = "Codemod"
|
|
430
|
+
, details =
|
|
431
|
+
[ "" ]
|
|
432
|
+
, under =
|
|
433
|
+
"""pages = pages
|
|
434
|
+
}"""
|
|
435
|
+
}
|
|
436
|
+
|> Review.Test.whenFixed
|
|
437
|
+
"""module Route.Blog.Slug_ exposing (Data, Model, Msg, route)
|
|
438
|
+
|
|
439
|
+
import Server.Request as Request
|
|
440
|
+
|
|
441
|
+
import BackendTask exposing (BackendTask)
|
|
442
|
+
import FatalError
|
|
443
|
+
import RouteBuilder exposing (Page, App)
|
|
444
|
+
import Pages.PageUrl exposing (PageUrl)
|
|
445
|
+
import Pages.Url
|
|
446
|
+
import UrlPath
|
|
447
|
+
import Route exposing (Route)
|
|
448
|
+
import Shared
|
|
449
|
+
import View exposing (View)
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
type alias Model =
|
|
453
|
+
{}
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
type alias Msg =
|
|
457
|
+
()
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
type alias RouteParams =
|
|
461
|
+
{ slug : String }
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
type alias Data =
|
|
465
|
+
()
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
route : StatelessRoute RouteParams Data ActionData
|
|
469
|
+
route =
|
|
470
|
+
RouteBuilder.preRender
|
|
471
|
+
{ data = \\_ -> BackendTask.fail (FatalError.fromString "")
|
|
472
|
+
, head = head
|
|
473
|
+
, pages = BackendTask.fail (FatalError.fromString "")}
|
|
474
|
+
|> RouteBuilder.buildNoState { view = view }
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
pages : BackendTask (List RouteParams)
|
|
478
|
+
pages =
|
|
479
|
+
BackendTask.succeed [ { slug = "hello" } ]
|
|
377
480
|
"""
|
|
378
481
|
]
|
|
379
482
|
, test "replaces data record setter with RouteBuilder.serverRendered" <|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elm-pages",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.27",
|
|
5
5
|
"homepage": "https://elm-pages.com",
|
|
6
6
|
"moduleResolution": "node",
|
|
7
7
|
"description": "Hybrid Elm framework with full-stack and static routes.",
|
|
@@ -28,47 +28,50 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@sindresorhus/merge-streams": "^4.0.0",
|
|
30
30
|
"busboy": "^1.6.0",
|
|
31
|
-
"chokidar": "^
|
|
31
|
+
"chokidar": "^5.0.0",
|
|
32
32
|
"cli-cursor": "^5.0.0",
|
|
33
|
-
"commander": "^
|
|
33
|
+
"commander": "^14.0.2",
|
|
34
34
|
"connect": "^3.7.0",
|
|
35
35
|
"cookie-signature": "^1.2.2",
|
|
36
36
|
"cross-spawn": "7.0.6",
|
|
37
37
|
"devcert": "^1.2.2",
|
|
38
38
|
"elm-doc-preview": "^6.0.1",
|
|
39
39
|
"elm-hot": "^1.1.6",
|
|
40
|
-
"esbuild": "^0.
|
|
41
|
-
"fs-extra": "^11.3.
|
|
42
|
-
"globby": "
|
|
40
|
+
"esbuild": "^0.27.2",
|
|
41
|
+
"fs-extra": "^11.3.3",
|
|
42
|
+
"globby": "16.1.0",
|
|
43
43
|
"gray-matter": "^4.0.3",
|
|
44
44
|
"jsesc": "^3.1.0",
|
|
45
45
|
"kleur": "^4.1.5",
|
|
46
|
-
"make-fetch-happen": "^
|
|
47
|
-
"memfs": "^4.
|
|
46
|
+
"make-fetch-happen": "^15.0.3",
|
|
47
|
+
"memfs": "^4.51.1",
|
|
48
48
|
"micromatch": "^4.0.8",
|
|
49
|
-
"serve-static": "^
|
|
50
|
-
"terser": "^5.
|
|
51
|
-
"vite": "^
|
|
52
|
-
"which": "^
|
|
49
|
+
"serve-static": "^2.2.1",
|
|
50
|
+
"terser": "^5.44.1",
|
|
51
|
+
"vite": "^7.3.1",
|
|
52
|
+
"which": "^6.0.0"
|
|
53
|
+
},
|
|
54
|
+
"optionalDependencies": {
|
|
55
|
+
"@rollup/rollup-linux-x64-gnu": "4.55.1"
|
|
53
56
|
},
|
|
54
57
|
"devDependencies": {
|
|
55
58
|
"@types/cross-spawn": "^6.0.6",
|
|
56
59
|
"@types/fs-extra": "^11.0.4",
|
|
57
60
|
"@types/make-fetch-happen": "^10.0.4",
|
|
58
|
-
"@types/micromatch": "^4.0.
|
|
59
|
-
"@types/node": "^
|
|
60
|
-
"@types/serve-static": "^
|
|
61
|
-
"cypress": "^
|
|
61
|
+
"@types/micromatch": "^4.0.10",
|
|
62
|
+
"@types/node": "^25.0.3",
|
|
63
|
+
"@types/serve-static": "^2.2.0",
|
|
64
|
+
"cypress": "^15.8.2",
|
|
62
65
|
"elm-codegen": "^0.6.1",
|
|
63
66
|
"elm-optimize-level-2": "^0.3.5",
|
|
64
|
-
"elm-review": "^2.13.
|
|
65
|
-
"elm-test": "^0.19.1-
|
|
66
|
-
"elm-tooling": "^1.
|
|
67
|
+
"elm-review": "^2.13.5",
|
|
68
|
+
"elm-test": "^0.19.1-revision17",
|
|
69
|
+
"elm-tooling": "^1.17.0",
|
|
67
70
|
"elm-verify-examples": "^6.0.3",
|
|
68
|
-
"lamdera": "^0.19.1-1.
|
|
69
|
-
"prettier": "^3.
|
|
70
|
-
"typescript": "^5.
|
|
71
|
-
"vitest": "^
|
|
71
|
+
"lamdera": "^0.19.1-1.4.0",
|
|
72
|
+
"prettier": "^3.7.4",
|
|
73
|
+
"typescript": "^5.9.3",
|
|
74
|
+
"vitest": "^4.0.16"
|
|
72
75
|
},
|
|
73
76
|
"files": [
|
|
74
77
|
"adapter/",
|