elm-pages 3.0.0-beta.33 → 3.0.0-beta.35

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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/codegen/elm-pages-codegen.cjs +165 -134
  3. package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/d.dat +0 -0
  4. package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_runner.js +1 -1
  5. package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_supervisor.js +1 -1
  6. package/generator/dead-code-review/elm.json +1 -1
  7. package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/d.dat +0 -0
  8. package/generator/review/elm-stuff/tests-0.19.1/js/node_runner.js +1 -1
  9. package/generator/review/elm-stuff/tests-0.19.1/js/node_supervisor.js +1 -1
  10. package/generator/review/elm.json +1 -1
  11. package/generator/src/RouteBuilder.elm +2 -2
  12. package/generator/src/cli.js +5 -9
  13. package/generator/src/compatibility-key.js +2 -2
  14. package/generator/static-code/elm-pages.js +10 -0
  15. package/package.json +3 -3
  16. package/src/BackendTask/File.elm +43 -13
  17. package/src/BackendTask/Internal/Request.elm +48 -3
  18. package/src/FatalError.elm +4 -3
  19. package/src/Internal/Field.elm +19 -0
  20. package/src/Internal/Input.elm +81 -0
  21. package/src/Pages/Form.elm +229 -0
  22. package/src/Pages/Internal/Msg.elm +70 -61
  23. package/src/Pages/Internal/Platform/Cli.elm +423 -425
  24. package/src/Pages/Internal/Platform/CompatibilityKey.elm +1 -1
  25. package/src/Pages/Internal/Platform/GeneratorApplication.elm +14 -8
  26. package/src/Pages/Internal/Platform/StaticResponses.elm +1 -7
  27. package/src/Pages/Internal/Platform.elm +119 -100
  28. package/src/Pages/ProgramConfig.elm +12 -5
  29. package/src/Pages/StaticHttpRequest.elm +0 -1
  30. package/src/Pages/Transition.elm +9 -1
  31. package/src/PagesMsg.elm +0 -10
  32. package/src/Scaffold/Form.elm +9 -9
  33. package/src/Server/Request.elm +57 -61
  34. package/src/Form/Field.elm +0 -729
  35. package/src/Form/FieldStatus.elm +0 -36
  36. package/src/Form/FieldView.elm +0 -497
  37. package/src/Form/FormData.elm +0 -22
  38. package/src/Form/Validation.elm +0 -391
  39. package/src/Form/Value.elm +0 -118
  40. package/src/Form.elm +0 -1558
  41. package/src/FormDecoder.elm +0 -102
  42. package/src/Pages/FormState.elm +0 -257
  43. package/src/Pages/Internal/Form.elm +0 -37
package/README.md CHANGED
@@ -81,7 +81,7 @@ https://github.com/dillonkearns/elm-pages/projects
81
81
  You will see an error if the NPM and Elm package do not have a matching Compatibility Key. Usually it's best to upgrade to the latest version of both the Elm and NPM
82
82
  packages when you upgrade. However, in case you want to install versions that are behind the latest, the Compatibility Key is included here for reference.
83
83
 
84
- Current Compatibility Key: 13.
84
+ Current Compatibility Key: 15.
85
85
 
86
86
  ## Contributors ✨
87
87
 
@@ -25043,6 +25043,41 @@ var $author$project$Elm$Extra$topLevelValue = F2(
25043
25043
  }
25044
25044
  };
25045
25045
  });
25046
+ var $elm$core$String$isEmpty = function (string) {
25047
+ return string === '';
25048
+ };
25049
+ var $author$project$Internal$Compiler$documentation = F2(
25050
+ function (rawDoc, decl) {
25051
+ var doc = $elm$core$String$trim(rawDoc);
25052
+ if ($elm$core$String$isEmpty(doc)) {
25053
+ return decl;
25054
+ } else {
25055
+ switch (decl.$) {
25056
+ case 'Comment':
25057
+ return decl;
25058
+ case 'Block':
25059
+ var source = decl.a;
25060
+ return decl;
25061
+ default:
25062
+ var details = decl.a;
25063
+ return $author$project$Internal$Compiler$Declaration(
25064
+ _Utils_update(
25065
+ details,
25066
+ {
25067
+ docs: function () {
25068
+ var _v1 = details.docs;
25069
+ if (_v1.$ === 'Nothing') {
25070
+ return $elm$core$Maybe$Just(doc);
25071
+ } else {
25072
+ var existing = _v1.a;
25073
+ return $elm$core$Maybe$Just(doc + ('\n\n' + existing));
25074
+ }
25075
+ }()
25076
+ }));
25077
+ }
25078
+ }
25079
+ });
25080
+ var $author$project$Elm$withDocumentation = $author$project$Internal$Compiler$documentation;
25046
25081
  var $author$project$Generate$file = F2(
25047
25082
  function (templates, basePath) {
25048
25083
  var routes = A2($elm$core$List$filterMap, $author$project$Pages$Internal$RoutePattern$fromModuleName, templates);
@@ -25124,8 +25159,11 @@ var $author$project$Generate$file = F2(
25124
25159
  $elm$core$Maybe$Just(
25125
25160
  A2($author$project$Elm$Annotation$named, _List_Nil, 'Route'))),
25126
25161
  function (route) {
25127
- return $author$project$Gen$Path$toAbsolute(
25128
- toPath.call(route));
25162
+ return A2(
25163
+ $author$project$Elm$withType,
25164
+ $author$project$Elm$Annotation$string,
25165
+ $author$project$Gen$Path$toAbsolute(
25166
+ toPath.call(route)));
25129
25167
  });
25130
25168
  var redirectTo = A2(
25131
25169
  $author$project$Elm$declaration,
@@ -25155,7 +25193,25 @@ var $author$project$Generate$file = F2(
25155
25193
  var toLink = A4(
25156
25194
  $author$project$Elm$Declare$fn2,
25157
25195
  'toLink',
25158
- _Utils_Tuple2('toAnchorTag', $elm$core$Maybe$Nothing),
25196
+ _Utils_Tuple2(
25197
+ 'toAnchorTag',
25198
+ $elm$core$Maybe$Just(
25199
+ A2(
25200
+ $author$project$Elm$Annotation$function,
25201
+ _List_fromArray(
25202
+ [
25203
+ $author$project$Elm$Annotation$list(
25204
+ A3(
25205
+ $author$project$Elm$Annotation$namedWith,
25206
+ _List_fromArray(
25207
+ ['Html']),
25208
+ 'Attribute',
25209
+ _List_fromArray(
25210
+ [
25211
+ $author$project$Elm$Annotation$var('msg')
25212
+ ])))
25213
+ ]),
25214
+ $author$project$Elm$Annotation$var('a')))),
25159
25215
  _Utils_Tuple2(
25160
25216
  'route',
25161
25217
  $elm$core$Maybe$Just(
@@ -25163,45 +25219,85 @@ var $author$project$Generate$file = F2(
25163
25219
  F2(
25164
25220
  function (toAnchorTag, route) {
25165
25221
  return A2(
25166
- $author$project$Elm$apply,
25167
- toAnchorTag,
25168
- _List_fromArray(
25169
- [
25170
- $author$project$Elm$list(
25171
- _List_fromArray(
25172
- [
25173
- $author$project$Gen$Html$Attributes$call_.href(
25174
- toString.call(route)),
25175
- A2($author$project$Gen$Html$Attributes$attribute, 'elm-pages:prefetch', '')
25176
- ]))
25177
- ]));
25222
+ $author$project$Elm$withType,
25223
+ $author$project$Elm$Annotation$var('a'),
25224
+ A2(
25225
+ $author$project$Elm$apply,
25226
+ toAnchorTag,
25227
+ _List_fromArray(
25228
+ [
25229
+ $author$project$Elm$list(
25230
+ _List_fromArray(
25231
+ [
25232
+ $author$project$Gen$Html$Attributes$call_.href(
25233
+ toString.call(route)),
25234
+ A2($author$project$Gen$Html$Attributes$attribute, 'elm-pages:prefetch', '')
25235
+ ]))
25236
+ ])));
25178
25237
  }));
25179
25238
  var link = A2(
25180
25239
  $author$project$Elm$declaration,
25181
25240
  'link',
25182
- A4(
25183
- $author$project$Elm$fn3,
25184
- _Utils_Tuple2('attributes', $elm$core$Maybe$Nothing),
25185
- _Utils_Tuple2('children', $elm$core$Maybe$Nothing),
25186
- _Utils_Tuple2(
25187
- 'route',
25188
- $elm$core$Maybe$Just(
25189
- A2($author$project$Elm$Annotation$named, _List_Nil, 'Route'))),
25190
- F3(
25191
- function (attributes, children, route) {
25192
- return A2(
25193
- toLink.call,
25194
- A2(
25195
- $author$project$Elm$fn,
25196
- _Utils_Tuple2('anchorAttrs', $elm$core$Maybe$Nothing),
25197
- function (anchorAttrs) {
25198
- return A2(
25199
- $author$project$Gen$Html$call_.a,
25200
- A2($author$project$Elm$Op$append, anchorAttrs, attributes),
25201
- children);
25202
- }),
25203
- route);
25204
- })));
25241
+ A2(
25242
+ $author$project$Elm$withType,
25243
+ A2(
25244
+ $author$project$Elm$Annotation$function,
25245
+ _List_fromArray(
25246
+ [
25247
+ $author$project$Elm$Annotation$list(
25248
+ A3(
25249
+ $author$project$Elm$Annotation$namedWith,
25250
+ _List_fromArray(
25251
+ ['Html']),
25252
+ 'Attribute',
25253
+ _List_fromArray(
25254
+ [
25255
+ $author$project$Elm$Annotation$var('msg')
25256
+ ]))),
25257
+ $author$project$Elm$Annotation$list(
25258
+ A3(
25259
+ $author$project$Elm$Annotation$namedWith,
25260
+ _List_fromArray(
25261
+ ['Html']),
25262
+ 'Html',
25263
+ _List_fromArray(
25264
+ [
25265
+ $author$project$Elm$Annotation$var('msg')
25266
+ ]))),
25267
+ A2($author$project$Elm$Annotation$named, _List_Nil, 'Route')
25268
+ ]),
25269
+ A3(
25270
+ $author$project$Elm$Annotation$namedWith,
25271
+ _List_fromArray(
25272
+ ['Html']),
25273
+ 'Html',
25274
+ _List_fromArray(
25275
+ [
25276
+ $author$project$Elm$Annotation$var('msg')
25277
+ ]))),
25278
+ A4(
25279
+ $author$project$Elm$fn3,
25280
+ _Utils_Tuple2('attributes', $elm$core$Maybe$Nothing),
25281
+ _Utils_Tuple2('children', $elm$core$Maybe$Nothing),
25282
+ _Utils_Tuple2(
25283
+ 'route',
25284
+ $elm$core$Maybe$Just(
25285
+ A2($author$project$Elm$Annotation$named, _List_Nil, 'Route'))),
25286
+ F3(
25287
+ function (attributes, children, route) {
25288
+ return A2(
25289
+ toLink.call,
25290
+ A2(
25291
+ $author$project$Elm$fn,
25292
+ _Utils_Tuple2('anchorAttrs', $elm$core$Maybe$Nothing),
25293
+ function (anchorAttrs) {
25294
+ return A2(
25295
+ $author$project$Gen$Html$call_.a,
25296
+ A2($author$project$Elm$Op$append, anchorAttrs, attributes),
25297
+ children);
25298
+ }),
25299
+ route);
25300
+ }))));
25205
25301
  var withoutBaseUrl = A2(
25206
25302
  $author$project$Elm$declaration,
25207
25303
  'withoutBaseUrl',
@@ -25230,24 +25326,27 @@ var $author$project$Generate$file = F2(
25230
25326
  A2(
25231
25327
  $elm$core$List$map,
25232
25328
  $author$project$Generate$expose,
25233
- _List_fromArray(
25234
- [
25235
- A2(
25236
- $author$project$Elm$customType,
25237
- 'Route',
25238
- A2($elm$core$List$map, $author$project$Pages$Internal$RoutePattern$toVariant, routes)),
25239
- segmentsToRouteFn.declaration,
25240
- urlToRoute,
25241
- baseUrl.declaration,
25242
- routeToPathFn.declaration,
25243
- baseUrlAsPath.declaration,
25244
- toPath.declaration,
25245
- toString.declaration,
25246
- redirectTo,
25247
- toLink.declaration,
25248
- link,
25249
- withoutBaseUrl
25250
- ])),
25329
+ A2(
25330
+ $elm$core$List$map,
25331
+ $author$project$Elm$withDocumentation('.'),
25332
+ _List_fromArray(
25333
+ [
25334
+ A2(
25335
+ $author$project$Elm$customType,
25336
+ 'Route',
25337
+ A2($elm$core$List$map, $author$project$Pages$Internal$RoutePattern$toVariant, routes)),
25338
+ segmentsToRouteFn.declaration,
25339
+ urlToRoute,
25340
+ baseUrl.declaration,
25341
+ routeToPathFn.declaration,
25342
+ baseUrlAsPath.declaration,
25343
+ toPath.declaration,
25344
+ toString.declaration,
25345
+ redirectTo,
25346
+ toLink.declaration,
25347
+ link,
25348
+ withoutBaseUrl
25349
+ ]))),
25251
25350
  _List_fromArray(
25252
25351
  [$author$project$Generate$splitPath.declaration, $author$project$Generate$maybeToList.declaration])
25253
25352
  ])));
@@ -25769,79 +25868,6 @@ var $author$project$Gen$Json$Encode$annotation_ = {
25769
25868
  'Value',
25770
25869
  _List_Nil)
25771
25870
  };
25772
- var $author$project$Gen$Pages$FormState$moduleName_ = _List_fromArray(
25773
- ['Pages', 'FormState']);
25774
- var $author$project$Gen$Pages$FormState$annotation_ = {
25775
- event: A3(
25776
- $author$project$Elm$Annotation$namedWith,
25777
- _List_fromArray(
25778
- ['Pages', 'FormState']),
25779
- 'Event',
25780
- _List_Nil),
25781
- fieldEvent: A4(
25782
- $author$project$Elm$Annotation$alias,
25783
- $author$project$Gen$Pages$FormState$moduleName_,
25784
- 'FieldEvent',
25785
- _List_Nil,
25786
- $author$project$Elm$Annotation$record(
25787
- _List_fromArray(
25788
- [
25789
- _Utils_Tuple2('value', $author$project$Elm$Annotation$string),
25790
- _Utils_Tuple2('formId', $author$project$Elm$Annotation$string),
25791
- _Utils_Tuple2('name', $author$project$Elm$Annotation$string),
25792
- _Utils_Tuple2(
25793
- 'event',
25794
- A3($author$project$Elm$Annotation$namedWith, _List_Nil, 'Event', _List_Nil))
25795
- ]))),
25796
- fieldState: A4(
25797
- $author$project$Elm$Annotation$alias,
25798
- $author$project$Gen$Pages$FormState$moduleName_,
25799
- 'FieldState',
25800
- _List_Nil,
25801
- $author$project$Elm$Annotation$record(
25802
- _List_fromArray(
25803
- [
25804
- _Utils_Tuple2('value', $author$project$Elm$Annotation$string),
25805
- _Utils_Tuple2(
25806
- 'status',
25807
- A3($author$project$Elm$Annotation$namedWith, _List_Nil, 'FieldStatus', _List_Nil))
25808
- ]))),
25809
- formState: A4(
25810
- $author$project$Elm$Annotation$alias,
25811
- $author$project$Gen$Pages$FormState$moduleName_,
25812
- 'FormState',
25813
- _List_Nil,
25814
- $author$project$Elm$Annotation$record(
25815
- _List_fromArray(
25816
- [
25817
- _Utils_Tuple2(
25818
- 'fields',
25819
- A3(
25820
- $author$project$Elm$Annotation$namedWith,
25821
- _List_Nil,
25822
- 'Dict',
25823
- _List_fromArray(
25824
- [
25825
- $author$project$Elm$Annotation$string,
25826
- A3($author$project$Elm$Annotation$namedWith, _List_Nil, 'FieldState', _List_Nil)
25827
- ]))),
25828
- _Utils_Tuple2('submitAttempted', $author$project$Elm$Annotation$bool)
25829
- ]))),
25830
- pageFormState: A4(
25831
- $author$project$Elm$Annotation$alias,
25832
- $author$project$Gen$Pages$FormState$moduleName_,
25833
- 'PageFormState',
25834
- _List_Nil,
25835
- A3(
25836
- $author$project$Elm$Annotation$namedWith,
25837
- _List_Nil,
25838
- 'Dict',
25839
- _List_fromArray(
25840
- [
25841
- $author$project$Elm$Annotation$string,
25842
- A3($author$project$Elm$Annotation$namedWith, _List_Nil, 'FormState', _List_Nil)
25843
- ])))
25844
- };
25845
25871
  var $author$project$Gen$Pages$Internal$NotFoundReason$moduleName_ = _List_fromArray(
25846
25872
  ['Pages', 'Internal', 'NotFoundReason']);
25847
25873
  var $author$project$Gen$Pages$Internal$NotFoundReason$annotation_ = {
@@ -26079,8 +26105,8 @@ var $author$project$Gen$Pages$Internal$Platform$annotation_ = {
26079
26105
  A3(
26080
26106
  $author$project$Elm$Annotation$namedWith,
26081
26107
  _List_fromArray(
26082
- ['Pages', 'FormState']),
26083
- 'PageFormState',
26108
+ ['Form']),
26109
+ 'Model',
26084
26110
  _List_Nil)),
26085
26111
  _Utils_Tuple2('pendingRedirect', $author$project$Elm$Annotation$bool),
26086
26112
  _Utils_Tuple2(
@@ -35396,7 +35422,12 @@ var $author$project$GenerateMain$otherFile = F2(
35396
35422
  [
35397
35423
  _Utils_Tuple2(
35398
35424
  'pageFormState',
35399
- $elm$core$Maybe$Just($author$project$Gen$Pages$FormState$annotation_.pageFormState)),
35425
+ $elm$core$Maybe$Just(
35426
+ A2(
35427
+ $author$project$Elm$Annotation$named,
35428
+ _List_fromArray(
35429
+ ['Form']),
35430
+ 'Model'))),
35400
35431
  _Utils_Tuple2(
35401
35432
  'fetchers',
35402
35433
  $elm$core$Maybe$Just(
@@ -36636,8 +36667,8 @@ var $author$project$GenerateMain$otherFile = F2(
36636
36667
  A2(
36637
36668
  $author$project$Elm$Annotation$named,
36638
36669
  _List_fromArray(
36639
- ['Pages', 'FormState']),
36640
- 'PageFormState'))),
36670
+ ['Form']),
36671
+ 'Model'))),
36641
36672
  _Utils_Tuple2(
36642
36673
  'fetchers',
36643
36674
  $elm$core$Maybe$Just(
@@ -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: 929039856, fuzzRuns: 100, filter: null };
78
+ const flags = { initialSeed: 3680802640, 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
@@ -82,7 +82,7 @@ const verbosity = 0;
82
82
  // Create a long lived reporter worker
83
83
  const { Elm } = require("./Reporter.elm.js");
84
84
  const flags = {
85
- initialSeed: 929039856,
85
+ initialSeed: 3680802640,
86
86
  fuzzRuns: 100,
87
87
  mode: "consoleColor",
88
88
  verbosity: verbosity,
@@ -10,7 +10,7 @@
10
10
  "elm/core": "1.0.5",
11
11
  "elm/json": "1.1.3",
12
12
  "elm-community/result-extra": "2.4.0",
13
- "jfmengels/elm-review": "2.12.2",
13
+ "jfmengels/elm-review": "2.13.0",
14
14
  "stil4m/elm-syntax": "7.2.9"
15
15
  },
16
16
  "indirect": {
@@ -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: 3355512856, fuzzRuns: 100, filter: null };
78
+ const flags = { initialSeed: 1263909344, 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
@@ -82,7 +82,7 @@ const verbosity = 0;
82
82
  // Create a long lived reporter worker
83
83
  const { Elm } = require("./Reporter.elm.js");
84
84
  const flags = {
85
- initialSeed: 3355512856,
85
+ initialSeed: 1263909344,
86
86
  fuzzRuns: 100,
87
87
  mode: "consoleColor",
88
88
  verbosity: verbosity,
@@ -11,7 +11,7 @@
11
11
  "elm/html": "1.0.0",
12
12
  "elm/json": "1.1.3",
13
13
  "elm/regex": "1.0.0",
14
- "jfmengels/elm-review": "2.12.2",
14
+ "jfmengels/elm-review": "2.13.0",
15
15
  "mdgriffith/elm-codegen": "3.0.0",
16
16
  "stil4m/elm-syntax": "7.2.9",
17
17
  "the-sett/elm-syntax-dsl": "6.0.2"
@@ -90,11 +90,11 @@ import Dict exposing (Dict)
90
90
  import Effect exposing (Effect)
91
91
  import ErrorPage exposing (ErrorPage)
92
92
  import FatalError exposing (FatalError)
93
+ import Form
93
94
  import Head
94
95
  import Http
95
96
  import Json.Decode
96
97
  import Pages.Fetcher
97
- import Pages.FormState
98
98
  import Pages.Internal.NotFoundReason exposing (NotFoundReason)
99
99
  import Pages.Internal.RoutePattern exposing (RoutePattern)
100
100
  import Pages.PageUrl exposing (PageUrl)
@@ -147,7 +147,7 @@ type alias App data action routeParams =
147
147
  -> Pages.Fetcher.Fetcher (Result Http.Error action)
148
148
  , transition : Maybe Pages.Transition.Transition
149
149
  , fetchers : Dict String (Pages.Transition.FetcherState (Maybe action))
150
- , pageFormState : Pages.FormState.PageFormState
150
+ , pageFormState : Form.Model
151
151
  }
152
152
 
153
153
 
@@ -90,6 +90,7 @@ async function main() {
90
90
  .description("run an elm-pages script")
91
91
  .allowUnknownOption()
92
92
  .allowExcessArguments()
93
+ .helpOption(false) // allow --help to propogate to the Script to show usage
93
94
  .action(async (elmModulePath, options, options2) => {
94
95
  const unprocessedCliOptions = options2.args.splice(
95
96
  options2.processedArgs.length,
@@ -325,16 +326,11 @@ async function requireElm(compiledElmPath) {
325
326
  function generatorWrapperFile(moduleName) {
326
327
  return `port module Main exposing (main)
327
328
 
328
- import BackendTask exposing (BackendTask)
329
- import FatalError
330
- import Cli.Program as Program
331
- import Json.Decode as Decode
332
- import Json.Encode as Encode
333
329
  import Pages.Internal.Platform.GeneratorApplication
334
330
  import ${moduleName}
335
331
 
336
332
 
337
- main : Program.StatefulProgram Pages.Internal.Platform.GeneratorApplication.Model Pages.Internal.Platform.GeneratorApplication.Msg (BackendTask FatalError.FatalError ()) Pages.Internal.Platform.GeneratorApplication.Flags
333
+ main : Pages.Internal.Platform.GeneratorApplication.Program
338
334
  main =
339
335
  Pages.Internal.Platform.GeneratorApplication.app
340
336
  { data = ${moduleName}.run
@@ -345,13 +341,13 @@ main =
345
341
  }
346
342
 
347
343
 
348
- port toJsPort : Encode.Value -> Cmd msg
344
+ port toJsPort : Pages.Internal.Platform.GeneratorApplication.JsonValue -> Cmd msg
349
345
 
350
346
 
351
- port fromJsPort : (Decode.Value -> msg) -> Sub msg
347
+ port fromJsPort : (Pages.Internal.Platform.GeneratorApplication.JsonValue -> msg) -> Sub msg
352
348
 
353
349
 
354
- port gotBatchSub : (Decode.Value -> msg) -> Sub msg
350
+ port gotBatchSub : (Pages.Internal.Platform.GeneratorApplication.JsonValue -> msg) -> Sub msg
355
351
  `;
356
352
  }
357
353
  function collect(value, previous) {
@@ -1,3 +1,3 @@
1
- export const compatibilityKey = 13;
1
+ export const compatibilityKey = 15;
2
2
 
3
- export const packageVersion = "3.0.0-beta.33";
3
+ export const packageVersion = "3.0.0-beta.35";
@@ -103,4 +103,14 @@ function find_anchor(node) {
103
103
  return /** @type {HTMLAnchorElement} */ (node);
104
104
  }
105
105
 
106
+ Object.defineProperty(SubmitEvent.prototype, "fields", {
107
+ get: function fields() {
108
+ let formData = new FormData(this.currentTarget);
109
+ if (this.submitter?.name) {
110
+ formData.append(this.submitter.name, this.submitter.value);
111
+ }
112
+ return [...formData.entries()];
113
+ },
114
+ });
115
+
106
116
  setup();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elm-pages",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.33",
4
+ "version": "3.0.0-beta.35",
5
5
  "homepage": "https://elm-pages.com",
6
6
  "moduleResolution": "node",
7
7
  "description": "Type-safe static sites, written in pure elm with your own custom elm-markup syntax.",
@@ -44,8 +44,8 @@
44
44
  "memfs": "^3.4.13",
45
45
  "micromatch": "^4.0.5",
46
46
  "serve-static": "^1.15.0",
47
- "vite": "^4.2.1",
48
47
  "terser": "^5.16.8",
48
+ "vite": "^4.2.1",
49
49
  "which": "^3.0.0"
50
50
  },
51
51
  "devDependencies": {
@@ -58,7 +58,7 @@
58
58
  "cypress": "^12.8.1",
59
59
  "elm-codegen": "^0.3.0",
60
60
  "elm-optimize-level-2": "^0.3.5",
61
- "elm-review": "^2.9.2",
61
+ "elm-review": "^2.10.1",
62
62
  "elm-test": "^0.19.1-revision11",
63
63
  "elm-tooling": "^1.13.1",
64
64
  "elm-verify-examples": "^5.2.0",
@@ -65,7 +65,7 @@ frontmatter frontmatterDecoder =
65
65
 
66
66
  import BackendTask exposing (BackendTask)
67
67
  import BackendTask.File as File
68
- import Decode as Decode exposing (Decoder)
68
+ import Decode exposing (Decoder)
69
69
 
70
70
  blogPost : BackendTask BlogPostMetadata
71
71
  blogPost =
@@ -101,7 +101,7 @@ It's common to parse the body with a markdown parser or other format.
101
101
 
102
102
  import BackendTask exposing (BackendTask)
103
103
  import BackendTask.File as File
104
- import Decode as Decode exposing (Decoder)
104
+ import Decode exposing (Decoder)
105
105
  import Html exposing (Html)
106
106
 
107
107
  example :
@@ -151,13 +151,28 @@ bodyWithFrontmatter :
151
151
  }
152
152
  frontmatter
153
153
  bodyWithFrontmatter frontmatterDecoder filePath =
154
- read filePath
155
- (body
156
- |> Decode.andThen
157
- (\bodyString ->
158
- frontmatter (frontmatterDecoder bodyString)
159
- )
160
- )
154
+ BackendTask.Internal.Request.request2
155
+ { name = "read-file"
156
+ , body = BackendTask.Http.stringBody "" filePath
157
+ , expect =
158
+ body
159
+ |> Decode.andThen
160
+ (\bodyString ->
161
+ frontmatter (frontmatterDecoder bodyString)
162
+ )
163
+ , errorDecoder = Decode.field "errorCode" (errorDecoder filePath)
164
+ , onError =
165
+ \frontmatterDecodeError ->
166
+ { fatal =
167
+ { title = "BackendTask.File Decoder Error"
168
+ , body =
169
+ "I encountered a Json Decoder error from a call to BackendTask.File.bodyWithFrontmatter.\n\n"
170
+ ++ Decode.errorToString frontmatterDecodeError
171
+ }
172
+ |> FatalError.build
173
+ , recoverable = DecodingError frontmatterDecodeError
174
+ }
175
+ }
161
176
 
162
177
 
163
178
  {-| -}
@@ -174,7 +189,7 @@ just the metadata.
174
189
 
175
190
  import BackendTask exposing (BackendTask)
176
191
  import BackendTask.File as File
177
- import Decode as Decode exposing (Decoder)
192
+ import Decode exposing (Decoder)
178
193
 
179
194
  blogPost : BackendTask BlogPostMetadata
180
195
  blogPost =
@@ -198,7 +213,7 @@ the [`BackendTask`](BackendTask) API along with [`BackendTask.Glob`](BackendTask
198
213
 
199
214
  import BackendTask exposing (BackendTask)
200
215
  import BackendTask.File as File
201
- import Decode as Decode exposing (Decoder)
216
+ import Decode exposing (Decoder)
202
217
 
203
218
  blogPostFiles : BackendTask (List String)
204
219
  blogPostFiles =
@@ -231,8 +246,23 @@ onlyFrontmatter :
231
246
  }
232
247
  frontmatter
233
248
  onlyFrontmatter frontmatterDecoder filePath =
234
- read filePath
235
- (frontmatter frontmatterDecoder)
249
+ BackendTask.Internal.Request.request2
250
+ { name = "read-file"
251
+ , body = BackendTask.Http.stringBody "" filePath
252
+ , expect = frontmatter frontmatterDecoder
253
+ , errorDecoder = Decode.field "errorCode" (errorDecoder filePath)
254
+ , onError =
255
+ \frontmatterDecodeError ->
256
+ { fatal =
257
+ { title = "BackendTask.File Decoder Error"
258
+ , body =
259
+ "I encountered a Json Decoder error from a call to BackendTask.File.onlyFrontmatter.\n\n"
260
+ ++ Decode.errorToString frontmatterDecodeError
261
+ }
262
+ |> FatalError.build
263
+ , recoverable = DecodingError frontmatterDecodeError
264
+ }
265
+ }
236
266
 
237
267
 
238
268
  {-| Same as `bodyWithFrontmatter` except it doesn't include the frontmatter.