elm-pages 3.0.19 → 3.0.21
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 +1 -1
- package/generator/dead-code-review/elm.json +2 -3
- package/generator/dead-code-review/tests/Pages/Review/DeadCodeEliminateDataTest.elm +1 -1
- package/generator/review/elm.json +4 -4
- package/generator/src/build.js +27 -17
- package/generator/src/cli.js +3 -1
- package/generator/src/compatibility-key.js +1 -1
- package/generator/src/dev-server.js +6 -4
- package/generator/src/generate-template-module-connector.js +3 -1
- package/generator/src/pre-render-html.js +6 -5
- package/generator/src/request-cache.js +12 -6
- package/generator/src/spinnies/index.js +76 -43
- package/generator/src/spinnies/utils.js +74 -41
- package/generator/static-code/hmr.js +2 -3
- package/generator/template/elm.json +8 -7
- package/generator/template/index.ts +2 -1
- package/generator/template/package.json +6 -6
- package/generator/template/script/.elm-pages/compiled-ports/custom-backend-task.mjs +1 -3
- package/generator/template/script/elm.json +7 -7
- package/generator/template/script/src/AddRoute.elm +77 -73
- package/generator/template/script/src/AddStaticRoute.elm +5 -3
- package/package.json +21 -19
- package/src/AriaLiveAnnouncer.elm +1 -0
- package/src/Pages/Internal/Platform/Cli.elm +2 -1
- package/src/Pages/Internal/Platform.elm +10 -2
- package/src/TerminalText.elm +47 -43
- package/generator/src/codegen-template-builder.js +0 -0
- package/generator/src/hello.ts +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
// source: https://github.com/jbcarpanelli/spinnies/blob/master/utils.js
|
|
4
4
|
// Code vemodified to ESM syntax from original repo
|
|
@@ -6,20 +6,42 @@
|
|
|
6
6
|
import * as readline from "readline";
|
|
7
7
|
// original code dependend on this for `getLinesLength`. Is this necessary?
|
|
8
8
|
// const stripAnsi = require('strip-ansi');
|
|
9
|
-
export const { dashes,dots } =
|
|
10
|
-
{
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"frames": ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
|
9
|
+
export const { dashes, dots } = {
|
|
10
|
+
dots: {
|
|
11
|
+
interval: 50,
|
|
12
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
|
|
14
13
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const VALID_STATUSES = [
|
|
22
|
-
|
|
14
|
+
dashes: {
|
|
15
|
+
interval: 80,
|
|
16
|
+
frames: ["-", "_"],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const VALID_STATUSES = [
|
|
21
|
+
"succeed",
|
|
22
|
+
"fail",
|
|
23
|
+
"spinning",
|
|
24
|
+
"non-spinnable",
|
|
25
|
+
"stopped",
|
|
26
|
+
];
|
|
27
|
+
const VALID_COLORS = [
|
|
28
|
+
"black",
|
|
29
|
+
"red",
|
|
30
|
+
"green",
|
|
31
|
+
"yellow",
|
|
32
|
+
"blue",
|
|
33
|
+
"magenta",
|
|
34
|
+
"cyan",
|
|
35
|
+
"white",
|
|
36
|
+
"gray",
|
|
37
|
+
"redBright",
|
|
38
|
+
"greenBright",
|
|
39
|
+
"yellowBright",
|
|
40
|
+
"blueBright",
|
|
41
|
+
"magentaBright",
|
|
42
|
+
"cyanBright",
|
|
43
|
+
"whiteBright",
|
|
44
|
+
];
|
|
23
45
|
|
|
24
46
|
export function purgeSpinnerOptions(options) {
|
|
25
47
|
const { text, status, indent } = options;
|
|
@@ -27,8 +49,8 @@ export function purgeSpinnerOptions(options) {
|
|
|
27
49
|
const colors = colorOptions(options);
|
|
28
50
|
|
|
29
51
|
if (!VALID_STATUSES.includes(status)) delete opts.status;
|
|
30
|
-
if (typeof text !==
|
|
31
|
-
if (typeof indent !==
|
|
52
|
+
if (typeof text !== "string") delete opts.text;
|
|
53
|
+
if (typeof indent !== "number") delete opts.indent;
|
|
32
54
|
|
|
33
55
|
return { ...colors, ...opts };
|
|
34
56
|
}
|
|
@@ -36,25 +58,27 @@ export function purgeSpinnerOptions(options) {
|
|
|
36
58
|
export function purgeSpinnersOptions({ spinner, disableSpins, ...others }) {
|
|
37
59
|
const colors = colorOptions(others);
|
|
38
60
|
const prefixes = prefixOptions(others);
|
|
39
|
-
const disableSpinsOption =
|
|
61
|
+
const disableSpinsOption =
|
|
62
|
+
typeof disableSpins === "boolean" ? { disableSpins } : {};
|
|
40
63
|
spinner = turnToValidSpinner(spinner);
|
|
41
64
|
|
|
42
|
-
return { ...colors, ...prefixes, ...disableSpinsOption, spinner }
|
|
65
|
+
return { ...colors, ...prefixes, ...disableSpinsOption, spinner };
|
|
43
66
|
}
|
|
44
67
|
|
|
45
68
|
function turnToValidSpinner(spinner = {}) {
|
|
46
69
|
const platformSpinner = terminalSupportsUnicode() ? dots : dashes;
|
|
47
|
-
if (!typeof spinner ===
|
|
70
|
+
if (!typeof spinner === "object") return platformSpinner;
|
|
48
71
|
let { interval, frames } = spinner;
|
|
49
|
-
if (!Array.isArray(frames) || frames.length < 1)
|
|
50
|
-
|
|
72
|
+
if (!Array.isArray(frames) || frames.length < 1)
|
|
73
|
+
frames = platformSpinner.frames;
|
|
74
|
+
if (typeof interval !== "number") interval = platformSpinner.interval;
|
|
51
75
|
|
|
52
76
|
return { interval, frames };
|
|
53
77
|
}
|
|
54
78
|
|
|
55
79
|
export function colorOptions({ color, succeedColor, failColor, spinnerColor }) {
|
|
56
80
|
const colors = { color, succeedColor, failColor, spinnerColor };
|
|
57
|
-
Object.keys(colors).forEach(key => {
|
|
81
|
+
Object.keys(colors).forEach((key) => {
|
|
58
82
|
if (!VALID_COLORS.includes(colors[key])) delete colors[key];
|
|
59
83
|
});
|
|
60
84
|
|
|
@@ -62,29 +86,33 @@ export function colorOptions({ color, succeedColor, failColor, spinnerColor }) {
|
|
|
62
86
|
}
|
|
63
87
|
|
|
64
88
|
function prefixOptions({ succeedPrefix, failPrefix }) {
|
|
65
|
-
if(terminalSupportsUnicode()) {
|
|
66
|
-
succeedPrefix = succeedPrefix ||
|
|
67
|
-
failPrefix = failPrefix ||
|
|
89
|
+
if (terminalSupportsUnicode()) {
|
|
90
|
+
succeedPrefix = succeedPrefix || "✓";
|
|
91
|
+
failPrefix = failPrefix || "✖";
|
|
68
92
|
} else {
|
|
69
|
-
succeedPrefix = succeedPrefix ||
|
|
70
|
-
failPrefix = failPrefix ||
|
|
93
|
+
succeedPrefix = succeedPrefix || "√";
|
|
94
|
+
failPrefix = failPrefix || "×";
|
|
71
95
|
}
|
|
72
96
|
|
|
73
97
|
return { succeedPrefix, failPrefix };
|
|
74
98
|
}
|
|
75
99
|
|
|
76
100
|
export function breakText(text, prefixLength) {
|
|
77
|
-
return text
|
|
78
|
-
.
|
|
79
|
-
.
|
|
101
|
+
return text
|
|
102
|
+
.split("\n")
|
|
103
|
+
.map((line, index) =>
|
|
104
|
+
index === 0 ? breakLine(line, prefixLength) : breakLine(line, 0)
|
|
105
|
+
)
|
|
106
|
+
.join("\n");
|
|
80
107
|
}
|
|
81
108
|
|
|
82
109
|
function breakLine(line, prefixLength) {
|
|
83
110
|
const columns = process.stderr.columns || 95;
|
|
84
|
-
return line.length
|
|
85
|
-
? `${line.substring(0, columns - prefixLength - 1)}\n${
|
|
86
|
-
|
|
87
|
-
|
|
111
|
+
return line.length >= columns - prefixLength
|
|
112
|
+
? `${line.substring(0, columns - prefixLength - 1)}\n${breakLine(
|
|
113
|
+
line.substring(columns - prefixLength - 1, line.length),
|
|
114
|
+
0
|
|
115
|
+
)}`
|
|
88
116
|
: line;
|
|
89
117
|
}
|
|
90
118
|
|
|
@@ -94,8 +122,11 @@ function breakLine(line, prefixLength) {
|
|
|
94
122
|
// .map((line, index) => index === 0 ? line.length + prefixLength : line.length);
|
|
95
123
|
// }
|
|
96
124
|
export function getLinesLength(text, prefixLength) {
|
|
97
|
-
return text
|
|
98
|
-
.
|
|
125
|
+
return text
|
|
126
|
+
.split("\n")
|
|
127
|
+
.map((line, index) =>
|
|
128
|
+
index === 0 ? line.length + prefixLength : line.length
|
|
129
|
+
);
|
|
99
130
|
}
|
|
100
131
|
|
|
101
132
|
export function writeStream(stream, output, rawLines) {
|
|
@@ -115,9 +146,11 @@ export function cleanStream(stream, rawLines) {
|
|
|
115
146
|
}
|
|
116
147
|
|
|
117
148
|
export function terminalSupportsUnicode() {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
149
|
+
// The default command prompt and powershell in Windows do not support Unicode characters.
|
|
150
|
+
// However, the VSCode integrated terminal and the Windows Terminal both do.
|
|
151
|
+
return (
|
|
152
|
+
process.platform !== "win32" ||
|
|
153
|
+
process.env.TERM_PROGRAM === "vscode" ||
|
|
154
|
+
!!process.env.WT_SESSION
|
|
155
|
+
);
|
|
123
156
|
}
|
|
@@ -510,9 +510,8 @@ function hideError(velocity) {
|
|
|
510
510
|
} catch (error) {}
|
|
511
511
|
} else {
|
|
512
512
|
try {
|
|
513
|
-
document.getElementById(
|
|
514
|
-
|
|
515
|
-
).style.opacity = 0;
|
|
513
|
+
document.getElementById("elm-live:elmErrorBackground").style.opacity =
|
|
514
|
+
0;
|
|
516
515
|
document.getElementById("elm-live:elmError").style.transform =
|
|
517
516
|
"rotateX(90deg)";
|
|
518
517
|
} catch (error) {}
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"danfishgold/base64-bytes": "1.1.0",
|
|
13
13
|
"danyx23/elm-mimetype": "4.0.1",
|
|
14
14
|
"dillonkearns/elm-bcp47-language-tag": "2.0.0",
|
|
15
|
-
"dillonkearns/elm-form": "3.0.
|
|
15
|
+
"dillonkearns/elm-form": "3.0.1",
|
|
16
16
|
"dillonkearns/elm-markdown": "7.0.1",
|
|
17
|
-
"dillonkearns/elm-pages": "10.
|
|
17
|
+
"dillonkearns/elm-pages": "10.2.0",
|
|
18
18
|
"elm/browser": "1.0.2",
|
|
19
19
|
"elm/bytes": "1.0.8",
|
|
20
20
|
"elm/core": "1.0.5",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"elm-community/result-extra": "2.4.0",
|
|
32
32
|
"jluckyiv/elm-utc-date-strings": "1.0.0",
|
|
33
33
|
"justinmimbs/date": "4.1.0",
|
|
34
|
-
"mdgriffith/elm-codegen": "
|
|
35
|
-
"miniBill/elm-codec": "2.
|
|
34
|
+
"mdgriffith/elm-codegen": "5.2.0",
|
|
35
|
+
"miniBill/elm-codec": "2.2.0",
|
|
36
36
|
"noahzgordon/elm-color-extra": "1.0.2",
|
|
37
37
|
"robinheghan/fnv1a": "1.0.0",
|
|
38
38
|
"rtfeldman/elm-css": "18.0.0",
|
|
39
|
-
"the-sett/elm-syntax-dsl": "6.0.
|
|
39
|
+
"the-sett/elm-syntax-dsl": "6.0.3",
|
|
40
40
|
"turboMaCk/non-empty-list-alias": "1.4.0",
|
|
41
41
|
"vito/elm-ansi": "10.0.1"
|
|
42
42
|
},
|
|
@@ -53,9 +53,10 @@
|
|
|
53
53
|
"robinheghan/murmur3": "1.0.0",
|
|
54
54
|
"rtfeldman/elm-hex": "1.0.0",
|
|
55
55
|
"rtfeldman/elm-iso8601-date-strings": "1.1.4",
|
|
56
|
-
"stil4m/elm-syntax": "7.3.
|
|
56
|
+
"stil4m/elm-syntax": "7.3.8",
|
|
57
57
|
"stil4m/structured-writer": "1.0.3",
|
|
58
|
-
"the-sett/elm-pretty-printer": "3.1.
|
|
58
|
+
"the-sett/elm-pretty-printer": "3.1.1",
|
|
59
|
+
"wolfadex/elm-ansi": "3.0.0"
|
|
59
60
|
}
|
|
60
61
|
},
|
|
61
62
|
"test-dependencies": {
|
|
@@ -5,7 +5,8 @@ type ElmPagesInit = {
|
|
|
5
5
|
|
|
6
6
|
const config: ElmPagesInit = {
|
|
7
7
|
load: async function (elmLoaded) {
|
|
8
|
-
await elmLoaded;
|
|
8
|
+
const app = await elmLoaded;
|
|
9
|
+
console.log("App loaded", app);
|
|
9
10
|
},
|
|
10
11
|
flags: function () {
|
|
11
12
|
return "You can decode this in Shared.elm using Json.Decode.string!";
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
"build": "elm-pages build"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"elm-codegen": "^0.
|
|
10
|
+
"elm-codegen": "^0.6.1",
|
|
11
11
|
"elm-optimize-level-2": "^0.3.5",
|
|
12
|
-
"elm-pages": "
|
|
12
|
+
"elm-pages": "3.0.21",
|
|
13
13
|
"elm-review": "^2.12.0",
|
|
14
14
|
"elm-tooling": "^1.15.1",
|
|
15
|
-
"lamdera": "^0.19.1-1.2
|
|
16
|
-
"vite": "^
|
|
15
|
+
"lamdera": "^0.19.1-1.3.2",
|
|
16
|
+
"vite": "^6.0.6"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@netlify/functions": "^
|
|
19
|
+
"@netlify/functions": "^3.0.0"
|
|
20
20
|
}
|
|
21
|
-
}
|
|
21
|
+
}
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"direct": {
|
|
10
10
|
"dillonkearns/elm-cli-options-parser": "3.2.0",
|
|
11
|
-
"dillonkearns/elm-pages": "10.
|
|
11
|
+
"dillonkearns/elm-pages": "10.2.0",
|
|
12
12
|
"elm/bytes": "1.0.8",
|
|
13
13
|
"elm/core": "1.0.5",
|
|
14
14
|
"elm/html": "1.0.0",
|
|
15
15
|
"elm/json": "1.1.3",
|
|
16
|
-
"mdgriffith/elm-codegen": "
|
|
16
|
+
"mdgriffith/elm-codegen": "5.2.0"
|
|
17
17
|
},
|
|
18
18
|
"indirect": {
|
|
19
19
|
"Chadtech/elm-bool-extra": "2.4.2",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"danyx23/elm-mimetype": "4.0.1",
|
|
23
23
|
"dillonkearns/elm-bcp47-language-tag": "2.0.0",
|
|
24
24
|
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
|
25
|
-
"dillonkearns/elm-form": "3.0.
|
|
25
|
+
"dillonkearns/elm-form": "3.0.1",
|
|
26
26
|
"elm/browser": "1.0.2",
|
|
27
27
|
"elm/file": "1.0.5",
|
|
28
28
|
"elm/http": "2.0.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"fredcy/elm-parseint": "2.0.1",
|
|
39
39
|
"jluckyiv/elm-utc-date-strings": "1.0.0",
|
|
40
40
|
"justinmimbs/date": "4.1.0",
|
|
41
|
-
"miniBill/elm-codec": "2.
|
|
41
|
+
"miniBill/elm-codec": "2.2.0",
|
|
42
42
|
"miniBill/elm-unicode": "1.1.1",
|
|
43
43
|
"noahzgordon/elm-color-extra": "1.0.2",
|
|
44
44
|
"robinheghan/fnv1a": "1.0.0",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"rtfeldman/elm-css": "18.0.0",
|
|
47
47
|
"rtfeldman/elm-hex": "1.0.0",
|
|
48
48
|
"rtfeldman/elm-iso8601-date-strings": "1.1.4",
|
|
49
|
-
"stil4m/elm-syntax": "7.3.
|
|
49
|
+
"stil4m/elm-syntax": "7.3.8",
|
|
50
50
|
"stil4m/structured-writer": "1.0.3",
|
|
51
51
|
"the-sett/elm-pretty-printer": "3.1.0",
|
|
52
|
-
"the-sett/elm-syntax-dsl": "6.0.
|
|
53
|
-
"
|
|
52
|
+
"the-sett/elm-syntax-dsl": "6.0.3",
|
|
53
|
+
"wolfadex/elm-ansi": "3.0.0"
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"test-dependencies": {
|
|
@@ -6,8 +6,9 @@ import Cli.OptionsParser as OptionsParser
|
|
|
6
6
|
import Cli.Program as Program
|
|
7
7
|
import Elm
|
|
8
8
|
import Elm.Annotation as Type
|
|
9
|
+
import Elm.Arg
|
|
9
10
|
import Elm.Case
|
|
10
|
-
import Elm.Declare
|
|
11
|
+
import Elm.Declare exposing (Function, fn2)
|
|
11
12
|
import Elm.Let
|
|
12
13
|
import Elm.Op
|
|
13
14
|
import Gen.BackendTask
|
|
@@ -22,6 +23,7 @@ import Gen.List
|
|
|
22
23
|
import Gen.Maybe
|
|
23
24
|
import Gen.Pages.Form as PagesForm
|
|
24
25
|
import Gen.Pages.Script
|
|
26
|
+
import Gen.Platform.Sub
|
|
25
27
|
import Gen.Server.Request as Request
|
|
26
28
|
import Gen.Server.Response as Response
|
|
27
29
|
import Gen.View
|
|
@@ -96,8 +98,8 @@ createFile { moduleName, fields } =
|
|
|
96
98
|
)
|
|
97
99
|
)
|
|
98
100
|
|> Elm.Let.fn2 "fieldView"
|
|
99
|
-
( "label"
|
|
100
|
-
( "field"
|
|
101
|
+
(Elm.Arg.var "label")
|
|
102
|
+
(Elm.Arg.var "field")
|
|
101
103
|
(\label field ->
|
|
102
104
|
Html.div []
|
|
103
105
|
[ Html.label []
|
|
@@ -130,57 +132,71 @@ createFile { moduleName, fields } =
|
|
|
130
132
|
(\justFormHelp ->
|
|
131
133
|
Request.formData justFormHelp.formHandlers request
|
|
132
134
|
|> Gen.Maybe.call_.map
|
|
133
|
-
(Elm.fn ( "formData"
|
|
135
|
+
(Elm.fn (Elm.Arg.var "formData")
|
|
134
136
|
(\formData ->
|
|
135
|
-
Elm.Case.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
Elm.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
137
|
+
Elm.Case.custom
|
|
138
|
+
formData
|
|
139
|
+
Type.unit
|
|
140
|
+
[ Elm.Case.branch
|
|
141
|
+
(Elm.Arg.tuple
|
|
142
|
+
(Elm.Arg.var "response")
|
|
143
|
+
(Elm.Arg.var "parsedForm")
|
|
144
|
+
)
|
|
145
|
+
(\( response, parsedForm ) ->
|
|
146
|
+
Elm.Case.custom parsedForm
|
|
147
|
+
Type.int
|
|
148
|
+
[ Elm.Case.branch
|
|
149
|
+
(Elm.Arg.customType "Form.Valid" identity
|
|
150
|
+
|> Elm.Arg.item (Elm.Arg.var "validatedForm")
|
|
151
|
+
)
|
|
152
|
+
(\validatedForm ->
|
|
153
|
+
Elm.Case.custom validatedForm
|
|
154
|
+
Type.int
|
|
155
|
+
[ Elm.Case.branch
|
|
156
|
+
(Elm.Arg.customType "Action" identity
|
|
157
|
+
|> Elm.Arg.item (Elm.Arg.var "parsed")
|
|
158
|
+
)
|
|
159
|
+
(\parsed ->
|
|
160
|
+
Scaffold.Form.recordEncoder parsed fields
|
|
161
|
+
|> Gen.Json.Encode.encode 2
|
|
162
|
+
|> Gen.Pages.Script.call_.log
|
|
163
|
+
|> Gen.BackendTask.call_.map
|
|
164
|
+
(Elm.fn Elm.Arg.ignore
|
|
165
|
+
(\_ ->
|
|
166
|
+
Response.render
|
|
167
|
+
(Elm.record
|
|
168
|
+
[ ( "errors", response )
|
|
169
|
+
]
|
|
170
|
+
)
|
|
171
|
+
)
|
|
160
172
|
)
|
|
161
|
-
)
|
|
162
|
-
)
|
|
163
|
-
]
|
|
164
|
-
)
|
|
165
|
-
, Elm.Case.branch2 "Form.Invalid"
|
|
166
|
-
( "parsed", Type.int )
|
|
167
|
-
( "error", Type.int )
|
|
168
|
-
(\_ _ ->
|
|
169
|
-
"Form validations did not succeed!"
|
|
170
|
-
|> Gen.Pages.Script.log
|
|
171
|
-
|> Gen.BackendTask.call_.map
|
|
172
|
-
(Elm.fn ( "_", Nothing )
|
|
173
|
-
(\_ ->
|
|
174
|
-
Response.render
|
|
175
|
-
(Elm.record
|
|
176
|
-
[ ( "errors", response )
|
|
177
|
-
]
|
|
178
|
-
)
|
|
179
173
|
)
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
174
|
+
]
|
|
175
|
+
)
|
|
176
|
+
, Elm.Case.branch
|
|
177
|
+
(Elm.Arg.customType
|
|
178
|
+
"Form.Invalid"
|
|
179
|
+
Tuple.pair
|
|
180
|
+
|> Elm.Arg.item (Elm.Arg.var "parsed")
|
|
181
|
+
|> Elm.Arg.item (Elm.Arg.var "error")
|
|
182
|
+
)
|
|
183
|
+
(\( _, _ ) ->
|
|
184
|
+
"Form validations did not succeed!"
|
|
185
|
+
|> Gen.Pages.Script.log
|
|
186
|
+
|> Gen.BackendTask.call_.map
|
|
187
|
+
(Elm.fn Elm.Arg.ignore
|
|
188
|
+
(\_ ->
|
|
189
|
+
Response.render
|
|
190
|
+
(Elm.record
|
|
191
|
+
[ ( "errors", response )
|
|
192
|
+
]
|
|
193
|
+
)
|
|
194
|
+
)
|
|
195
|
+
)
|
|
196
|
+
)
|
|
197
|
+
]
|
|
198
|
+
)
|
|
199
|
+
]
|
|
184
200
|
)
|
|
185
201
|
)
|
|
186
202
|
|> Gen.Maybe.withDefault
|
|
@@ -243,9 +259,10 @@ createFile { moduleName, fields } =
|
|
|
243
259
|
\{ shared, app, msg, model } ->
|
|
244
260
|
Elm.Case.custom msg
|
|
245
261
|
(Type.named [] "Msg")
|
|
246
|
-
[ Elm.Case.
|
|
247
|
-
(
|
|
248
|
-
|
|
262
|
+
[ Elm.Case.branch (Elm.Arg.customType "NoOp" ())
|
|
263
|
+
(\() ->
|
|
264
|
+
Elm.tuple model
|
|
265
|
+
Effect.none
|
|
249
266
|
)
|
|
250
267
|
]
|
|
251
268
|
, init =
|
|
@@ -253,7 +270,7 @@ createFile { moduleName, fields } =
|
|
|
253
270
|
Elm.tuple (Elm.record []) Effect.none
|
|
254
271
|
, subscriptions =
|
|
255
272
|
\{ routeParams, path, shared, model } ->
|
|
256
|
-
|
|
273
|
+
Gen.Platform.Sub.none
|
|
257
274
|
, model =
|
|
258
275
|
Alias (Type.record [])
|
|
259
276
|
, msg =
|
|
@@ -261,24 +278,11 @@ createFile { moduleName, fields } =
|
|
|
261
278
|
}
|
|
262
279
|
|
|
263
280
|
|
|
264
|
-
errorsView :
|
|
265
|
-
{ declaration : Elm.Declaration
|
|
266
|
-
, call : Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
267
|
-
, callFrom : List String -> Elm.Expression -> Elm.Expression -> Elm.Expression
|
|
268
|
-
, value : List String -> Elm.Expression
|
|
269
|
-
}
|
|
281
|
+
errorsView : Function (Elm.Expression -> Elm.Expression -> Elm.Expression)
|
|
270
282
|
errorsView =
|
|
271
|
-
|
|
272
|
-
( "errors"
|
|
273
|
-
( "field"
|
|
274
|
-
, Type.namedWith [ "Form", "Validation" ]
|
|
275
|
-
"Field"
|
|
276
|
-
[ Type.string
|
|
277
|
-
, Type.var "parsed"
|
|
278
|
-
, Type.var "kind"
|
|
279
|
-
]
|
|
280
|
-
|> Just
|
|
281
|
-
)
|
|
283
|
+
fn2 "errorsView"
|
|
284
|
+
(Elm.Arg.var "errors")
|
|
285
|
+
(Elm.Arg.var "field")
|
|
282
286
|
(\errors field ->
|
|
283
287
|
Elm.ifThen
|
|
284
288
|
(Gen.List.call_.isEmpty (Form.errorsForField field errors))
|
|
@@ -287,7 +291,7 @@ errorsView =
|
|
|
287
291
|
[]
|
|
288
292
|
[ Html.call_.ul (Elm.list [])
|
|
289
293
|
(Gen.List.call_.map
|
|
290
|
-
(Elm.fn ( "error"
|
|
294
|
+
(Elm.fn (Elm.Arg.var "error")
|
|
291
295
|
(\error ->
|
|
292
296
|
Html.li
|
|
293
297
|
[ Attr.style "color" "red"
|
|
@@ -6,6 +6,7 @@ import Cli.OptionsParser as OptionsParser
|
|
|
6
6
|
import Cli.Program as Program
|
|
7
7
|
import Elm
|
|
8
8
|
import Elm.Annotation as Type
|
|
9
|
+
import Elm.Arg
|
|
9
10
|
import Elm.Case
|
|
10
11
|
import Gen.BackendTask
|
|
11
12
|
import Gen.Effect as Effect
|
|
@@ -69,9 +70,10 @@ createFile { moduleName } =
|
|
|
69
70
|
\{ shared, app, msg, model } ->
|
|
70
71
|
Elm.Case.custom msg
|
|
71
72
|
(Type.named [] "Msg")
|
|
72
|
-
[ Elm.Case.
|
|
73
|
-
(
|
|
74
|
-
|
|
73
|
+
[ Elm.Case.branch (Elm.Arg.customType "NoOp" ())
|
|
74
|
+
(\() ->
|
|
75
|
+
Elm.tuple model
|
|
76
|
+
Effect.none
|
|
75
77
|
)
|
|
76
78
|
]
|
|
77
79
|
, init =
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elm-pages",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.21",
|
|
5
5
|
"homepage": "https://elm-pages.com",
|
|
6
6
|
"moduleResolution": "node",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "Hybrid Elm framework with full-stack and static routes.",
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "cd examples/end-to-end && npm i && npx elm-pages dev",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"test:snapshot": "(cd examples/escaping && npm install && npm test) && (cd examples/base-path && npm install && npm test)",
|
|
13
13
|
"cypress": "npm start & cypress run",
|
|
14
14
|
"build:generator": "elm-codegen install && (cd codegen && lamdera make Generate.elm --output elm-pages-codegen.js && mv elm-pages-codegen.js elm-pages-codegen.cjs)",
|
|
15
|
-
"review": "elm-review"
|
|
15
|
+
"review": "elm-review",
|
|
16
|
+
"format": "prettier . --write --cache --cache-location='node_modules/.cache/.prettiercache' --log-level=warn"
|
|
16
17
|
},
|
|
17
18
|
"repository": "https://github.com/dillonkearns/elm-pages",
|
|
18
19
|
"keywords": [
|
|
@@ -27,26 +28,27 @@
|
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@sindresorhus/merge-streams": "^4.0.0",
|
|
29
30
|
"busboy": "^1.6.0",
|
|
30
|
-
"chokidar": "^4.0.
|
|
31
|
+
"chokidar": "^4.0.3",
|
|
31
32
|
"cli-cursor": "^5.0.0",
|
|
32
|
-
"commander": "^
|
|
33
|
+
"commander": "^13.1.0",
|
|
33
34
|
"connect": "^3.7.0",
|
|
34
35
|
"cookie-signature": "^1.2.2",
|
|
35
36
|
"cross-spawn": "7.0.6",
|
|
36
37
|
"devcert": "^1.2.2",
|
|
37
|
-
"elm-doc-preview": "^
|
|
38
|
+
"elm-doc-preview": "^6.0.1",
|
|
38
39
|
"elm-hot": "^1.1.6",
|
|
39
|
-
"esbuild": "^0.
|
|
40
|
-
"fs-extra": "^11.
|
|
41
|
-
"globby": "14.0
|
|
40
|
+
"esbuild": "^0.25.0",
|
|
41
|
+
"fs-extra": "^11.3.0",
|
|
42
|
+
"globby": "14.1.0",
|
|
42
43
|
"gray-matter": "^4.0.3",
|
|
43
|
-
"jsesc": "^3.0
|
|
44
|
+
"jsesc": "^3.1.0",
|
|
44
45
|
"kleur": "^4.1.5",
|
|
45
46
|
"make-fetch-happen": "^14.0.3",
|
|
46
|
-
"memfs": "^4.
|
|
47
|
+
"memfs": "^4.17.0",
|
|
47
48
|
"micromatch": "^4.0.8",
|
|
48
49
|
"serve-static": "^1.16.2",
|
|
49
|
-
"terser": "^5.
|
|
50
|
+
"terser": "^5.39.0",
|
|
51
|
+
"vite": "^6.2.0",
|
|
50
52
|
"which": "^5.0.0"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
@@ -54,19 +56,19 @@
|
|
|
54
56
|
"@types/fs-extra": "^11.0.4",
|
|
55
57
|
"@types/make-fetch-happen": "^10.0.4",
|
|
56
58
|
"@types/micromatch": "^4.0.9",
|
|
57
|
-
"@types/node": "^22.
|
|
59
|
+
"@types/node": "^22.13.9",
|
|
58
60
|
"@types/serve-static": "^1.15.7",
|
|
59
|
-
"cypress": "^
|
|
61
|
+
"cypress": "^14.1.0",
|
|
60
62
|
"elm-codegen": "^0.6.1",
|
|
61
63
|
"elm-optimize-level-2": "^0.3.5",
|
|
62
|
-
"elm-review": "^2.
|
|
63
|
-
"elm-test": "^0.19.1-
|
|
64
|
+
"elm-review": "^2.13.2",
|
|
65
|
+
"elm-test": "^0.19.1-revision15",
|
|
64
66
|
"elm-tooling": "^1.15.1",
|
|
65
67
|
"elm-verify-examples": "^6.0.3",
|
|
66
68
|
"lamdera": "^0.19.1-1.3.2",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"vitest": "^
|
|
69
|
+
"prettier": "^3.5.3",
|
|
70
|
+
"typescript": "^5.8.2",
|
|
71
|
+
"vitest": "^3.0.7"
|
|
70
72
|
},
|
|
71
73
|
"files": [
|
|
72
74
|
"adapter/",
|