elm-pages 3.0.26 → 3.0.28
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 +2 -2
- package/codegen/elm-pages-codegen.cjs +14756 -17529
- 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/review/elm.json +1 -1
- package/generator/src/compatibility-key.js +2 -2
- package/generator/src/render.js +194 -53
- package/generator/template/elm.json +1 -1
- package/generator/template/script/elm.json +1 -1
- package/package.json +26 -23
- package/src/BackendTask/Stream.elm +52 -37
- package/src/Pages/Internal/Platform/CompatibilityKey.elm +1 -1
- package/src/Pages/Script.elm +73 -2
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.28",
|
|
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/",
|
|
@@ -884,44 +884,59 @@ readJson decoder ((Stream ( _, metadataDecoder ) _) as stream) =
|
|
|
884
884
|
, body = BackendTask.Http.jsonBody (pipelineEncoder stream "json")
|
|
885
885
|
, expect =
|
|
886
886
|
BackendTask.Http.expectJson
|
|
887
|
-
(Decode.
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
)
|
|
898
|
-
|
|
899
|
-
bodyResult
|
|
900
|
-
|> Decode.map
|
|
901
|
-
(\result ->
|
|
902
|
-
case result1 of
|
|
903
|
-
Ok metadata ->
|
|
904
|
-
case result of
|
|
905
|
-
Ok body ->
|
|
906
|
-
Ok
|
|
907
|
-
{ metadata = metadata
|
|
908
|
-
, body = body
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
Err decoderError ->
|
|
912
|
-
FatalError.recoverable
|
|
913
|
-
{ title = "Failed to decode body"
|
|
914
|
-
, body = "Failed to decode body"
|
|
915
|
-
}
|
|
916
|
-
(StreamError (Decode.errorToString decoderError))
|
|
917
|
-
|> Err
|
|
918
|
-
|
|
919
|
-
Err error ->
|
|
920
|
-
error
|
|
921
|
-
|> mapRecoverable (Result.toMaybe result)
|
|
922
|
-
|> Err
|
|
887
|
+
(Decode.oneOf
|
|
888
|
+
[ Decode.field "error" Decode.string
|
|
889
|
+
|> Decode.andThen
|
|
890
|
+
(\error ->
|
|
891
|
+
Decode.succeed
|
|
892
|
+
(Err
|
|
893
|
+
(FatalError.recoverable
|
|
894
|
+
{ title = "Stream Error"
|
|
895
|
+
, body = error
|
|
896
|
+
}
|
|
897
|
+
(StreamError error)
|
|
898
|
+
)
|
|
923
899
|
)
|
|
924
|
-
|
|
900
|
+
)
|
|
901
|
+
, Decode.field "metadata" metadataDecoder
|
|
902
|
+
|> Decode.andThen
|
|
903
|
+
(\result1 ->
|
|
904
|
+
let
|
|
905
|
+
bodyResult : Decoder (Result Decode.Error value)
|
|
906
|
+
bodyResult =
|
|
907
|
+
Decode.field "body" Decode.value
|
|
908
|
+
|> Decode.map
|
|
909
|
+
(\bodyValue ->
|
|
910
|
+
Decode.decodeValue decoder bodyValue
|
|
911
|
+
)
|
|
912
|
+
in
|
|
913
|
+
bodyResult
|
|
914
|
+
|> Decode.map
|
|
915
|
+
(\result ->
|
|
916
|
+
case result1 of
|
|
917
|
+
Ok metadata ->
|
|
918
|
+
case result of
|
|
919
|
+
Ok body ->
|
|
920
|
+
Ok
|
|
921
|
+
{ metadata = metadata
|
|
922
|
+
, body = body
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
Err decoderError ->
|
|
926
|
+
FatalError.recoverable
|
|
927
|
+
{ title = "Failed to decode body"
|
|
928
|
+
, body = "Failed to decode body"
|
|
929
|
+
}
|
|
930
|
+
(StreamError (Decode.errorToString decoderError))
|
|
931
|
+
|> Err
|
|
932
|
+
|
|
933
|
+
Err error ->
|
|
934
|
+
error
|
|
935
|
+
|> mapRecoverable (Result.toMaybe result)
|
|
936
|
+
|> Err
|
|
937
|
+
)
|
|
938
|
+
)
|
|
939
|
+
]
|
|
925
940
|
)
|
|
926
941
|
}
|
|
927
942
|
|> BackendTask.andThen BackendTask.fromResult
|
package/src/Pages/Script.elm
CHANGED
|
@@ -3,7 +3,7 @@ module Pages.Script exposing
|
|
|
3
3
|
, withCliOptions, withoutCliOptions
|
|
4
4
|
, writeFile
|
|
5
5
|
, command, exec
|
|
6
|
-
, log, sleep, doThen, which, expectWhich, question
|
|
6
|
+
, log, sleep, doThen, which, expectWhich, question, readKey, readKeyWithDefault
|
|
7
7
|
, Error(..)
|
|
8
8
|
)
|
|
9
9
|
|
|
@@ -31,7 +31,7 @@ Read more about using the `elm-pages` CLI to run (or bundle) scripts, plus a bri
|
|
|
31
31
|
|
|
32
32
|
## Utilities
|
|
33
33
|
|
|
34
|
-
@docs log, sleep, doThen, which, expectWhich, question
|
|
34
|
+
@docs log, sleep, doThen, which, expectWhich, question, readKey, readKeyWithDefault
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
## Errors
|
|
@@ -313,6 +313,77 @@ question prompt =
|
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
|
|
316
|
+
{-| Read a single keypress from stdin without requiring Enter.
|
|
317
|
+
|
|
318
|
+
This is useful for interactive prompts where you want immediate response
|
|
319
|
+
to a single key, like confirmation dialogs (y/n) or menu navigation.
|
|
320
|
+
|
|
321
|
+
module ConfirmDemo exposing (run)
|
|
322
|
+
|
|
323
|
+
import BackendTask
|
|
324
|
+
|
|
325
|
+
run : Script
|
|
326
|
+
run =
|
|
327
|
+
Script.withoutCliOptions
|
|
328
|
+
(Script.log "Approve this change? [y/n] "
|
|
329
|
+
|> BackendTask.andThen (\_ -> Script.readKey)
|
|
330
|
+
|> BackendTask.andThen
|
|
331
|
+
(\key ->
|
|
332
|
+
if key == "y" then
|
|
333
|
+
Script.log "Approved!"
|
|
334
|
+
|
|
335
|
+
else
|
|
336
|
+
Script.log "Rejected."
|
|
337
|
+
)
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
Note: Returns the raw key character. Control characters like Ctrl+C will
|
|
341
|
+
terminate the process.
|
|
342
|
+
|
|
343
|
+
When not running in an interactive terminal (e.g., piped input or CI),
|
|
344
|
+
falls back to line-buffered input and returns the first character of the line.
|
|
345
|
+
This allows scripts to work both interactively and with piped input like
|
|
346
|
+
`echo "y" | elm-pages run MyScript.elm`.
|
|
347
|
+
|
|
348
|
+
-}
|
|
349
|
+
readKey : BackendTask error String
|
|
350
|
+
readKey =
|
|
351
|
+
BackendTask.Internal.Request.request
|
|
352
|
+
{ body = BackendTask.Http.emptyBody
|
|
353
|
+
, expect = BackendTask.Http.expectJson Decode.string
|
|
354
|
+
, name = "readKey"
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
{-| Like [`readKey`](#readKey), but returns a default value when Enter is pressed.
|
|
359
|
+
|
|
360
|
+
Script.log "Continue? [Y/n] "
|
|
361
|
+
|> BackendTask.andThen (\_ -> Script.readKeyWithDefault "y")
|
|
362
|
+
|> BackendTask.andThen
|
|
363
|
+
(\key ->
|
|
364
|
+
if String.toLower key == "y" then
|
|
365
|
+
continue
|
|
366
|
+
|
|
367
|
+
else
|
|
368
|
+
abort
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
Useful for prompts where pressing Enter should accept a default option.
|
|
372
|
+
|
|
373
|
+
-}
|
|
374
|
+
readKeyWithDefault : String -> BackendTask error String
|
|
375
|
+
readKeyWithDefault default =
|
|
376
|
+
readKey
|
|
377
|
+
|> BackendTask.map
|
|
378
|
+
(\key ->
|
|
379
|
+
if key == "\u{000D}" || key == "\n" then
|
|
380
|
+
default
|
|
381
|
+
|
|
382
|
+
else
|
|
383
|
+
key
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
|
|
316
387
|
{-| Like [`command`](#command), but prints stderr and stdout to the console as the command runs instead of capturing them.
|
|
317
388
|
|
|
318
389
|
module MyScript exposing (run)
|