elm-pages 3.0.0-beta.8 → 3.0.0
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 +11 -2
- package/adapter/netlify.js +207 -0
- package/codegen/{elm-pages-codegen.js → elm-pages-codegen.cjs} +2730 -2938
- 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.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/o.dat +0 -0
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/elm.json +1 -1
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/Reporter.elm.js +1527 -422
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/Runner.elm.js +16840 -13653
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_runner.js +1 -1
- package/generator/dead-code-review/elm-stuff/tests-0.19.1/js/node_supervisor.js +2 -2
- package/generator/dead-code-review/elm.json +9 -7
- package/generator/dead-code-review/src/Pages/Review/DeadCodeEliminateData.elm +59 -10
- package/generator/dead-code-review/tests/Pages/Review/DeadCodeEliminateDataTest.elm +52 -36
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Internal-RoutePattern.elmi +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Internal-RoutePattern.elmo +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-NoContractViolations.elmi +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Review-NoContractViolations.elmo +0 -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/elm-stuff/0.19.1/i.dat +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/o.dat +0 -0
- package/generator/review/elm-stuff/tests-0.19.1/elm.json +1 -1
- package/generator/review/elm-stuff/tests-0.19.1/js/Reporter.elm.js +1527 -422
- package/generator/review/elm-stuff/tests-0.19.1/js/Runner.elm.js +25118 -21832
- 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 +2 -2
- package/generator/review/elm.json +10 -10
- package/generator/src/RouteBuilder.elm +93 -128
- package/generator/src/SharedTemplate.elm +8 -7
- package/generator/src/SiteConfig.elm +3 -2
- package/generator/src/basepath-middleware.js +3 -3
- package/generator/src/build.js +147 -63
- package/generator/src/cli.js +292 -88
- package/generator/src/codegen.js +29 -27
- package/generator/src/compatibility-key.js +3 -0
- package/generator/src/compile-elm.js +43 -26
- package/generator/src/config.js +2 -4
- package/generator/src/copy-dir.js +2 -2
- package/generator/src/dev-server.js +159 -92
- package/generator/src/dir-helpers.js +9 -26
- package/generator/src/elm-codegen.js +5 -4
- package/generator/src/elm-file-constants.js +2 -3
- package/generator/src/error-formatter.js +12 -11
- package/generator/src/file-helpers.js +3 -4
- package/generator/src/generate-template-module-connector.js +23 -23
- package/generator/src/init.js +9 -8
- package/generator/src/pre-render-html.js +10 -13
- package/generator/src/render-test.js +109 -0
- package/generator/src/render-worker.js +25 -28
- package/generator/src/render.js +321 -142
- package/generator/src/request-cache.js +265 -162
- package/generator/src/resolve-elm-module.js +64 -0
- package/generator/src/rewrite-client-elm-json.js +6 -5
- package/generator/src/rewrite-elm-json-help.js +56 -0
- package/generator/src/rewrite-elm-json.js +17 -7
- package/generator/src/route-codegen-helpers.js +16 -31
- package/generator/src/seo-renderer.js +12 -7
- package/generator/src/vite-utils.js +1 -2
- package/generator/static-code/elm-pages.js +10 -0
- package/generator/static-code/hmr.js +79 -13
- package/generator/template/app/Api.elm +3 -2
- package/generator/template/app/Effect.elm +155 -0
- package/generator/template/app/ErrorPage.elm +49 -6
- package/generator/template/app/Route/Blog/Slug_.elm +86 -0
- package/generator/template/app/Route/Greet.elm +107 -0
- package/generator/template/app/Route/Hello.elm +119 -0
- package/generator/template/app/Route/Index.elm +26 -25
- package/generator/template/app/Shared.elm +38 -39
- package/generator/template/app/Site.elm +4 -7
- package/generator/template/app/View.elm +9 -8
- package/generator/template/codegen/elm.codegen.json +18 -0
- package/generator/template/custom-backend-task.ts +3 -0
- package/generator/template/elm-pages.config.mjs +13 -0
- package/generator/template/elm-tooling.json +0 -3
- package/generator/template/elm.json +25 -20
- package/generator/template/index.ts +1 -2
- package/generator/template/netlify.toml +4 -1
- package/generator/template/package.json +10 -4
- package/generator/template/script/.elm-pages/compiled-ports/custom-backend-task.mjs +7 -0
- package/generator/template/script/custom-backend-task.ts +3 -0
- package/generator/template/script/elm.json +61 -0
- package/generator/template/script/src/AddRoute.elm +312 -0
- package/generator/template/script/src/Stars.elm +42 -0
- package/package.json +30 -27
- package/src/ApiRoute.elm +249 -85
- package/src/BackendTask/Custom.elm +325 -0
- package/src/BackendTask/Env.elm +90 -0
- package/src/{DataSource → BackendTask}/File.elm +171 -56
- package/src/{DataSource → BackendTask}/Glob.elm +136 -125
- package/src/BackendTask/Http.elm +679 -0
- package/src/{DataSource → BackendTask}/Internal/Glob.elm +1 -1
- package/src/BackendTask/Internal/Request.elm +69 -0
- package/src/BackendTask/Random.elm +79 -0
- package/src/BackendTask/Time.elm +47 -0
- package/src/BackendTask.elm +531 -0
- package/src/FatalError.elm +90 -0
- package/src/FormData.elm +21 -18
- package/src/Head/Seo.elm +4 -4
- package/src/Head.elm +237 -7
- package/src/Internal/ApiRoute.elm +7 -5
- package/src/Internal/Request.elm +84 -4
- package/src/PageServerResponse.elm +6 -1
- package/src/Pages/ConcurrentSubmission.elm +127 -0
- package/src/Pages/Form.elm +340 -0
- package/src/Pages/FormData.elm +19 -0
- package/src/Pages/GeneratorProgramConfig.elm +15 -0
- package/src/Pages/Internal/FatalError.elm +5 -0
- package/src/Pages/Internal/Msg.elm +93 -0
- package/src/Pages/Internal/NotFoundReason.elm +4 -4
- package/src/Pages/Internal/Platform/Cli.elm +629 -767
- package/src/Pages/Internal/Platform/CompatibilityKey.elm +6 -0
- package/src/Pages/Internal/Platform/Effect.elm +1 -2
- package/src/Pages/Internal/Platform/GeneratorApplication.elm +379 -0
- package/src/Pages/Internal/Platform/StaticResponses.elm +65 -276
- package/src/Pages/Internal/Platform/ToJsPayload.elm +6 -9
- package/src/Pages/Internal/Platform.elm +330 -203
- package/src/Pages/Internal/ResponseSketch.elm +2 -2
- package/src/Pages/Internal/Script.elm +17 -0
- package/src/Pages/Internal/StaticHttpBody.elm +35 -1
- package/src/Pages/Manifest.elm +52 -11
- package/src/Pages/Navigation.elm +85 -0
- package/src/Pages/PageUrl.elm +26 -12
- package/src/Pages/ProgramConfig.elm +32 -22
- package/src/Pages/Script.elm +166 -0
- package/src/Pages/SiteConfig.elm +3 -2
- package/src/Pages/StaticHttp/Request.elm +2 -2
- package/src/Pages/StaticHttpRequest.elm +23 -99
- package/src/Pages/Url.elm +3 -3
- package/src/PagesMsg.elm +88 -0
- package/src/QueryParams.elm +21 -172
- package/src/RenderRequest.elm +7 -7
- package/src/RequestsAndPending.elm +37 -20
- package/src/Result/Extra.elm +26 -0
- package/src/Scaffold/Form.elm +569 -0
- package/src/Scaffold/Route.elm +1431 -0
- package/src/Server/Request.elm +476 -1001
- package/src/Server/Response.elm +130 -36
- package/src/Server/Session.elm +181 -111
- package/src/Server/SetCookie.elm +80 -32
- package/src/Stub.elm +53 -0
- package/src/Test/Html/Internal/ElmHtml/ToString.elm +8 -9
- package/src/{Path.elm → UrlPath.elm} +33 -36
- package/generator/template/public/images/icon-png.png +0 -0
- package/src/DataSource/Env.elm +0 -38
- package/src/DataSource/Http.elm +0 -446
- package/src/DataSource/Internal/Request.elm +0 -20
- package/src/DataSource/Port.elm +0 -90
- package/src/DataSource.elm +0 -538
- package/src/Form/Field.elm +0 -717
- package/src/Form/FieldStatus.elm +0 -36
- package/src/Form/FieldView.elm +0 -417
- package/src/Form/FormData.elm +0 -22
- package/src/Form/Validation.elm +0 -391
- package/src/Form/Value.elm +0 -118
- package/src/Form.elm +0 -1683
- package/src/FormDecoder.elm +0 -102
- package/src/Pages/FormState.elm +0 -256
- package/src/Pages/Generate.elm +0 -1151
- package/src/Pages/Internal/Form.elm +0 -17
- package/src/Pages/Msg.elm +0 -79
- package/src/Pages/Transition.elm +0 -70
|
@@ -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: 3222932734, 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,12 +82,12 @@ 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:
|
|
85
|
+
initialSeed: 3222932734,
|
|
86
86
|
fuzzRuns: 100,
|
|
87
87
|
mode: "consoleNoColor",
|
|
88
88
|
verbosity: verbosity,
|
|
89
89
|
globs: [],
|
|
90
|
-
paths: ["/home/runner/work/elm-pages
|
|
90
|
+
paths: ["/home/runner/work/elm-pages/elm-pages/generator/dead-code-review/tests/Pages/Review/DeadCodeEliminateDataTest.elm"],
|
|
91
91
|
};
|
|
92
92
|
reporter = Elm.Reporter.init({ flags: flags });
|
|
93
93
|
|
|
@@ -8,27 +8,29 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"direct": {
|
|
10
10
|
"elm/core": "1.0.5",
|
|
11
|
+
"elm/json": "1.1.3",
|
|
11
12
|
"elm-community/result-extra": "2.4.0",
|
|
12
|
-
"jfmengels/elm-review": "2.
|
|
13
|
-
"stil4m/elm-syntax": "7.2.
|
|
13
|
+
"jfmengels/elm-review": "2.13.0",
|
|
14
|
+
"stil4m/elm-syntax": "7.2.9"
|
|
14
15
|
},
|
|
15
16
|
"indirect": {
|
|
17
|
+
"elm/bytes": "1.0.8",
|
|
16
18
|
"elm/html": "1.0.0",
|
|
17
|
-
"elm/json": "1.1.3",
|
|
18
19
|
"elm/parser": "1.1.0",
|
|
19
20
|
"elm/project-metadata-utils": "1.0.2",
|
|
20
21
|
"elm/random": "1.0.0",
|
|
21
22
|
"elm/time": "1.0.0",
|
|
22
|
-
"elm/virtual-dom": "1.0.
|
|
23
|
-
"elm-community/list-extra": "8.
|
|
24
|
-
"
|
|
23
|
+
"elm/virtual-dom": "1.0.3",
|
|
24
|
+
"elm-community/list-extra": "8.7.0",
|
|
25
|
+
"elm-explorations/test": "2.1.1",
|
|
26
|
+
"miniBill/elm-unicode": "1.0.3",
|
|
25
27
|
"rtfeldman/elm-hex": "1.0.0",
|
|
26
28
|
"stil4m/structured-writer": "1.0.3"
|
|
27
29
|
}
|
|
28
30
|
},
|
|
29
31
|
"test-dependencies": {
|
|
30
32
|
"direct": {
|
|
31
|
-
"elm-explorations/test": "1.
|
|
33
|
+
"elm-explorations/test": "2.1.1"
|
|
32
34
|
},
|
|
33
35
|
"indirect": {}
|
|
34
36
|
}
|
|
@@ -7,6 +7,7 @@ import Elm.Syntax.Expression as Expression exposing (Expression)
|
|
|
7
7
|
import Elm.Syntax.Import exposing (Import)
|
|
8
8
|
import Elm.Syntax.ModuleName exposing (ModuleName)
|
|
9
9
|
import Elm.Syntax.Node as Node exposing (Node)
|
|
10
|
+
import Elm.Syntax.Range exposing (Range)
|
|
10
11
|
import Review.Fix
|
|
11
12
|
import Review.ModuleNameLookupTable as ModuleNameLookupTable exposing (ModuleNameLookupTable)
|
|
12
13
|
import Review.Rule as Rule exposing (Error, Rule)
|
|
@@ -15,6 +16,7 @@ import Review.Rule as Rule exposing (Error, Rule)
|
|
|
15
16
|
type alias Context =
|
|
16
17
|
{ lookupTable : ModuleNameLookupTable
|
|
17
18
|
, importContext : Dict (List String) ImportContext
|
|
19
|
+
, firstImport : Maybe Range
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
|
|
@@ -62,18 +64,43 @@ toImportContext import_ =
|
|
|
62
64
|
rule : Rule
|
|
63
65
|
rule =
|
|
64
66
|
Rule.newModuleRuleSchemaUsingContextCreator "Pages.Review.DeadCodeEliminateData" initialContext
|
|
67
|
+
|> Rule.providesFixesForModuleRule
|
|
65
68
|
|> Rule.withExpressionEnterVisitor expressionVisitor
|
|
66
69
|
|> Rule.withDeclarationEnterVisitor declarationVisitor
|
|
67
70
|
|> Rule.withImportVisitor importVisitor
|
|
71
|
+
|> Rule.withFinalModuleEvaluation finalEvaluation
|
|
68
72
|
|> Rule.fromModuleRuleSchema
|
|
69
73
|
|
|
70
74
|
|
|
75
|
+
finalEvaluation : Context -> List (Rule.Error {})
|
|
76
|
+
finalEvaluation context =
|
|
77
|
+
case Dict.get [ "FatalError" ] context.importContext of
|
|
78
|
+
Nothing ->
|
|
79
|
+
let
|
|
80
|
+
importAddRange : { start : { row : Int, column : Int }, end : { row : Int, column : Int } }
|
|
81
|
+
importAddRange =
|
|
82
|
+
context.firstImport |> Maybe.withDefault { start = { row = 0, column = 0 }, end = { row = 0, column = 0 } }
|
|
83
|
+
in
|
|
84
|
+
[ Rule.errorWithFix
|
|
85
|
+
{ message = "Codemod"
|
|
86
|
+
, details = [ "" ]
|
|
87
|
+
}
|
|
88
|
+
importAddRange
|
|
89
|
+
[ Review.Fix.insertAt importAddRange.end "\nimport FatalError\n"
|
|
90
|
+
]
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
_ ->
|
|
94
|
+
[]
|
|
95
|
+
|
|
96
|
+
|
|
71
97
|
initialContext : Rule.ContextCreator () Context
|
|
72
98
|
initialContext =
|
|
73
99
|
Rule.initContextCreator
|
|
74
100
|
(\lookupTable () ->
|
|
75
101
|
{ lookupTable = lookupTable
|
|
76
102
|
, importContext = Dict.empty
|
|
103
|
+
, firstImport = Nothing
|
|
77
104
|
}
|
|
78
105
|
)
|
|
79
106
|
|> Rule.withModuleNameLookupTable
|
|
@@ -90,12 +117,20 @@ importVisitor node context =
|
|
|
90
117
|
, { context
|
|
91
118
|
| importContext =
|
|
92
119
|
context.importContext |> Dict.insert key value
|
|
120
|
+
, firstImport = context.firstImport |> Maybe.withDefault (Node.range node) |> Just
|
|
93
121
|
}
|
|
94
122
|
)
|
|
95
123
|
|
|
96
124
|
|
|
97
125
|
declarationVisitor : Node Declaration -> Context -> ( List (Error {}), Context )
|
|
98
126
|
declarationVisitor node context =
|
|
127
|
+
let
|
|
128
|
+
exceptionFromString : String
|
|
129
|
+
exceptionFromString =
|
|
130
|
+
"("
|
|
131
|
+
++ referenceFunction context.importContext ( [ "FatalError" ], "fromString" )
|
|
132
|
+
++ " \"\")"
|
|
133
|
+
in
|
|
99
134
|
case Node.value node of
|
|
100
135
|
Declaration.FunctionDeclaration { declaration } ->
|
|
101
136
|
case Node.value declaration of
|
|
@@ -132,8 +167,11 @@ declarationVisitor node context =
|
|
|
132
167
|
(Node.range dataValue)
|
|
133
168
|
-- TODO need to replace `action` as well
|
|
134
169
|
[ ("data = "
|
|
135
|
-
++ referenceFunction context.importContext ( [ "
|
|
136
|
-
|
|
170
|
+
++ referenceFunction context.importContext ( [ "BackendTask" ], "fail" )
|
|
171
|
+
-- TODO add `import FatalError` if not present (and use alias if present)
|
|
172
|
+
++ " "
|
|
173
|
+
++ exceptionFromString
|
|
174
|
+
++ "\n "
|
|
137
175
|
)
|
|
138
176
|
|> Review.Fix.replaceRangeBy (Node.range dataValue)
|
|
139
177
|
]
|
|
@@ -179,6 +217,13 @@ expressionVisitor node context =
|
|
|
179
217
|
( dataFieldValue
|
|
180
218
|
|> List.concatMap
|
|
181
219
|
(\( key, dataValue ) ->
|
|
220
|
+
let
|
|
221
|
+
exceptionFromString : String
|
|
222
|
+
exceptionFromString =
|
|
223
|
+
"("
|
|
224
|
+
++ referenceFunction context.importContext ( [ "FatalError" ], "fromString" )
|
|
225
|
+
++ " \"\")"
|
|
226
|
+
in
|
|
182
227
|
[ Rule.errorWithFix
|
|
183
228
|
{ message = "Codemod"
|
|
184
229
|
, details = [ "" ]
|
|
@@ -190,13 +235,15 @@ expressionVisitor node context =
|
|
|
190
235
|
++ (case pageBuilderName of
|
|
191
236
|
"preRender" ->
|
|
192
237
|
"\\_ -> "
|
|
193
|
-
++ referenceFunction context.importContext ( [ "
|
|
194
|
-
++ "
|
|
238
|
+
++ referenceFunction context.importContext ( [ "BackendTask" ], "fail" )
|
|
239
|
+
++ " "
|
|
240
|
+
++ exceptionFromString
|
|
195
241
|
|
|
196
242
|
"preRenderWithFallback" ->
|
|
197
243
|
"\\_ -> "
|
|
198
|
-
++ referenceFunction context.importContext ( [ "
|
|
199
|
-
++ "
|
|
244
|
+
++ referenceFunction context.importContext ( [ "BackendTask" ], "fail" )
|
|
245
|
+
++ " "
|
|
246
|
+
++ exceptionFromString
|
|
200
247
|
|
|
201
248
|
"serverRender" ->
|
|
202
249
|
"\\_ -> "
|
|
@@ -204,8 +251,10 @@ expressionVisitor node context =
|
|
|
204
251
|
++ " []\n "
|
|
205
252
|
|
|
206
253
|
"single" ->
|
|
207
|
-
referenceFunction context.importContext ( [ "
|
|
208
|
-
++ "
|
|
254
|
+
referenceFunction context.importContext ( [ "BackendTask" ], "fail" )
|
|
255
|
+
++ " "
|
|
256
|
+
++ exceptionFromString
|
|
257
|
+
++ "\n "
|
|
209
258
|
|
|
210
259
|
_ ->
|
|
211
260
|
"data"
|
|
@@ -259,7 +308,7 @@ isAlreadyApplied lookupTable expression =
|
|
|
259
308
|
)
|
|
260
309
|
|> Maybe.withDefault []
|
|
261
310
|
in
|
|
262
|
-
resolvedModuleName == [ "
|
|
311
|
+
resolvedModuleName == [ "BackendTask" ]
|
|
263
312
|
|
|
264
313
|
(Expression.FunctionOrValue _ "oneOf") :: (Expression.ListExpr []) :: _ ->
|
|
265
314
|
let
|
|
@@ -295,7 +344,7 @@ isAlreadyApplied lookupTable expression =
|
|
|
295
344
|
)
|
|
296
345
|
|> Maybe.withDefault []
|
|
297
346
|
in
|
|
298
|
-
resolvedModuleName == [ "
|
|
347
|
+
resolvedModuleName == [ "BackendTask" ]
|
|
299
348
|
|
|
300
349
|
_ ->
|
|
301
350
|
False
|
|
@@ -14,8 +14,9 @@ all =
|
|
|
14
14
|
|
|
15
15
|
import Server.Request as Request
|
|
16
16
|
|
|
17
|
-
import
|
|
18
|
-
import
|
|
17
|
+
import BackendTask exposing (BackendTask)
|
|
18
|
+
import FatalError
|
|
19
|
+
import RouteBuilder exposing (Page, App, single)
|
|
19
20
|
import Pages.PageUrl exposing (PageUrl)
|
|
20
21
|
import Pages.Url
|
|
21
22
|
import Path
|
|
@@ -49,9 +50,9 @@ route =
|
|
|
49
50
|
|> RouteBuilder.buildNoState { view = view }
|
|
50
51
|
|
|
51
52
|
|
|
52
|
-
data :
|
|
53
|
+
data : BackendTask Data
|
|
53
54
|
data =
|
|
54
|
-
|
|
55
|
+
BackendTask.succeed ()
|
|
55
56
|
"""
|
|
56
57
|
|> Review.Test.run rule
|
|
57
58
|
|> Review.Test.expectErrors
|
|
@@ -68,8 +69,9 @@ data =
|
|
|
68
69
|
|
|
69
70
|
import Server.Request as Request
|
|
70
71
|
|
|
71
|
-
import
|
|
72
|
-
import
|
|
72
|
+
import BackendTask exposing (BackendTask)
|
|
73
|
+
import FatalError
|
|
74
|
+
import RouteBuilder exposing (Page, App, single)
|
|
73
75
|
import Pages.PageUrl exposing (PageUrl)
|
|
74
76
|
import Pages.Url
|
|
75
77
|
import Path
|
|
@@ -98,23 +100,24 @@ route : StatelessRoute RouteParams Data ActionData
|
|
|
98
100
|
route =
|
|
99
101
|
single
|
|
100
102
|
{ head = head
|
|
101
|
-
, data =
|
|
103
|
+
, data = BackendTask.fail (FatalError.fromString "")
|
|
102
104
|
}
|
|
103
105
|
|> RouteBuilder.buildNoState { view = view }
|
|
104
106
|
|
|
105
107
|
|
|
106
|
-
data :
|
|
108
|
+
data : BackendTask Data
|
|
107
109
|
data =
|
|
108
|
-
|
|
110
|
+
BackendTask.succeed ()
|
|
109
111
|
"""
|
|
110
112
|
]
|
|
111
|
-
, test "supports aliased
|
|
113
|
+
, test "supports aliased BackendTask module import" <|
|
|
112
114
|
\() ->
|
|
113
115
|
"""module Route.Index exposing (Data, Model, Msg, route)
|
|
114
116
|
|
|
115
117
|
import Server.Request as Request
|
|
116
|
-
import
|
|
117
|
-
import
|
|
118
|
+
import FatalError
|
|
119
|
+
import BackendTask as DS
|
|
120
|
+
import RouteBuilder exposing (Page, App, single)
|
|
118
121
|
import Pages.PageUrl exposing (PageUrl)
|
|
119
122
|
import Pages.Url
|
|
120
123
|
import Path
|
|
@@ -148,9 +151,9 @@ route =
|
|
|
148
151
|
|> RouteBuilder.buildNoState { view = view }
|
|
149
152
|
|
|
150
153
|
|
|
151
|
-
data :
|
|
154
|
+
data : BackendTask Data
|
|
152
155
|
data =
|
|
153
|
-
|
|
156
|
+
BackendTask.succeed ()
|
|
154
157
|
"""
|
|
155
158
|
|> Review.Test.run rule
|
|
156
159
|
|> Review.Test.expectErrors
|
|
@@ -166,8 +169,9 @@ data =
|
|
|
166
169
|
"""module Route.Index exposing (Data, Model, Msg, route)
|
|
167
170
|
|
|
168
171
|
import Server.Request as Request
|
|
169
|
-
import
|
|
170
|
-
import
|
|
172
|
+
import FatalError
|
|
173
|
+
import BackendTask as DS
|
|
174
|
+
import RouteBuilder exposing (Page, App, single)
|
|
171
175
|
import Pages.PageUrl exposing (PageUrl)
|
|
172
176
|
import Pages.Url
|
|
173
177
|
import Path
|
|
@@ -196,14 +200,14 @@ route : StatelessRoute RouteParams Data ActionData
|
|
|
196
200
|
route =
|
|
197
201
|
single
|
|
198
202
|
{ head = head
|
|
199
|
-
, data = DS.fail ""
|
|
203
|
+
, data = DS.fail (FatalError.fromString "")
|
|
200
204
|
}
|
|
201
205
|
|> RouteBuilder.buildNoState { view = view }
|
|
202
206
|
|
|
203
207
|
|
|
204
|
-
data :
|
|
208
|
+
data : BackendTask Data
|
|
205
209
|
data =
|
|
206
|
-
|
|
210
|
+
BackendTask.succeed ()
|
|
207
211
|
"""
|
|
208
212
|
]
|
|
209
213
|
, test "replaces data record setter with non-empty RouteParams" <|
|
|
@@ -212,8 +216,9 @@ data =
|
|
|
212
216
|
|
|
213
217
|
import Server.Request as Request
|
|
214
218
|
|
|
215
|
-
import
|
|
216
|
-
import
|
|
219
|
+
import BackendTask exposing (BackendTask)
|
|
220
|
+
import FatalError
|
|
221
|
+
import RouteBuilder exposing (Page, App)
|
|
217
222
|
import Pages.PageUrl exposing (PageUrl)
|
|
218
223
|
import Pages.Url
|
|
219
224
|
import Path
|
|
@@ -248,9 +253,9 @@ route =
|
|
|
248
253
|
|> RouteBuilder.buildNoState { view = view }
|
|
249
254
|
|
|
250
255
|
|
|
251
|
-
data :
|
|
256
|
+
data : BackendTask Data
|
|
252
257
|
data =
|
|
253
|
-
|
|
258
|
+
BackendTask.succeed ()
|
|
254
259
|
"""
|
|
255
260
|
|> Review.Test.run rule
|
|
256
261
|
|> Review.Test.expectErrors
|
|
@@ -266,8 +271,9 @@ data =
|
|
|
266
271
|
|
|
267
272
|
import Server.Request as Request
|
|
268
273
|
|
|
269
|
-
import
|
|
270
|
-
import
|
|
274
|
+
import BackendTask exposing (BackendTask)
|
|
275
|
+
import FatalError
|
|
276
|
+
import RouteBuilder exposing (Page, App)
|
|
271
277
|
import Pages.PageUrl exposing (PageUrl)
|
|
272
278
|
import Pages.Url
|
|
273
279
|
import Path
|
|
@@ -295,16 +301,16 @@ type alias Data =
|
|
|
295
301
|
route : StatelessRoute RouteParams Data ActionData
|
|
296
302
|
route =
|
|
297
303
|
RouteBuilder.preRender
|
|
298
|
-
{ data = \\_ ->
|
|
304
|
+
{ data = \\_ -> BackendTask.fail (FatalError.fromString "")
|
|
299
305
|
, head = head
|
|
300
306
|
, pages = pages
|
|
301
307
|
}
|
|
302
308
|
|> RouteBuilder.buildNoState { view = view }
|
|
303
309
|
|
|
304
310
|
|
|
305
|
-
data :
|
|
311
|
+
data : BackendTask Data
|
|
306
312
|
data =
|
|
307
|
-
|
|
313
|
+
BackendTask.succeed ()
|
|
308
314
|
"""
|
|
309
315
|
]
|
|
310
316
|
, test "replaces data record setter with RouteBuilder.serverRendered" <|
|
|
@@ -312,6 +318,7 @@ data =
|
|
|
312
318
|
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
313
319
|
|
|
314
320
|
import Server.Request as Request
|
|
321
|
+
import FatalError
|
|
315
322
|
|
|
316
323
|
type alias Model =
|
|
317
324
|
{}
|
|
@@ -348,6 +355,7 @@ route =
|
|
|
348
355
|
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
349
356
|
|
|
350
357
|
import Server.Request as Request
|
|
358
|
+
import FatalError
|
|
351
359
|
|
|
352
360
|
type alias Model =
|
|
353
361
|
{}
|
|
@@ -382,6 +390,7 @@ route =
|
|
|
382
390
|
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
383
391
|
|
|
384
392
|
import Server.Request as Request
|
|
393
|
+
import FatalError
|
|
385
394
|
|
|
386
395
|
type alias Model =
|
|
387
396
|
{}
|
|
@@ -410,6 +419,7 @@ route =
|
|
|
410
419
|
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
411
420
|
|
|
412
421
|
import Server.Request
|
|
422
|
+
import FatalError
|
|
413
423
|
|
|
414
424
|
type alias Model =
|
|
415
425
|
{}
|
|
@@ -446,6 +456,7 @@ route =
|
|
|
446
456
|
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
447
457
|
|
|
448
458
|
import Server.Request
|
|
459
|
+
import FatalError
|
|
449
460
|
|
|
450
461
|
type alias Model =
|
|
451
462
|
{}
|
|
@@ -480,6 +491,7 @@ route =
|
|
|
480
491
|
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
481
492
|
|
|
482
493
|
import Server.Request
|
|
494
|
+
import FatalError
|
|
483
495
|
|
|
484
496
|
type alias Model =
|
|
485
497
|
{}
|
|
@@ -508,6 +520,7 @@ route =
|
|
|
508
520
|
"""module Route.Login exposing (Data, Model, Msg, route)
|
|
509
521
|
|
|
510
522
|
import Server.Request as Request
|
|
523
|
+
import FatalError
|
|
511
524
|
|
|
512
525
|
type alias Model =
|
|
513
526
|
{}
|
|
@@ -536,9 +549,10 @@ route =
|
|
|
536
549
|
"""module Route.Index exposing (Data, Model, Msg, route)
|
|
537
550
|
|
|
538
551
|
import Server.Request as Request
|
|
552
|
+
import FatalError
|
|
539
553
|
|
|
540
|
-
import
|
|
541
|
-
import RouteBuilder exposing (Page,
|
|
554
|
+
import BackendTask exposing (BackendTask)
|
|
555
|
+
import RouteBuilder exposing (Page, App)
|
|
542
556
|
import Pages.PageUrl exposing (PageUrl)
|
|
543
557
|
import Pages.Url
|
|
544
558
|
import Path
|
|
@@ -567,14 +581,14 @@ route : StatelessRoute RouteParams Data ActionData
|
|
|
567
581
|
route =
|
|
568
582
|
RouteBuilder.single
|
|
569
583
|
{ head = head
|
|
570
|
-
, data =
|
|
584
|
+
, data = BackendTask.fail (FatalError.fromString "")
|
|
571
585
|
}
|
|
572
586
|
|> RouteBuilder.buildNoState { view = view }
|
|
573
587
|
|
|
574
588
|
|
|
575
|
-
data :
|
|
589
|
+
data : BackendTask Data
|
|
576
590
|
data =
|
|
577
|
-
|
|
591
|
+
BackendTask.succeed ()
|
|
578
592
|
"""
|
|
579
593
|
|> Review.Test.run rule
|
|
580
594
|
|> Review.Test.expectNoErrors
|
|
@@ -583,9 +597,10 @@ data =
|
|
|
583
597
|
"""module Shared exposing (Data, Model, Msg, template)
|
|
584
598
|
|
|
585
599
|
import Server.Request as Request
|
|
600
|
+
import FatalError
|
|
586
601
|
|
|
587
602
|
import Browser.Navigation
|
|
588
|
-
import
|
|
603
|
+
import BackendTask
|
|
589
604
|
import Html exposing (Html)
|
|
590
605
|
import Html.Styled
|
|
591
606
|
import Pages.Flags
|
|
@@ -633,9 +648,10 @@ type alias Model =
|
|
|
633
648
|
"""module Shared exposing (Data, Model, Msg, template)
|
|
634
649
|
|
|
635
650
|
import Server.Request as Request
|
|
651
|
+
import FatalError
|
|
636
652
|
|
|
637
653
|
import Browser.Navigation
|
|
638
|
-
import
|
|
654
|
+
import BackendTask
|
|
639
655
|
import Html exposing (Html)
|
|
640
656
|
import Html.Styled
|
|
641
657
|
import Pages.Flags
|
|
@@ -653,7 +669,7 @@ template =
|
|
|
653
669
|
{ init = init
|
|
654
670
|
, update = update
|
|
655
671
|
, view = view
|
|
656
|
-
, data =
|
|
672
|
+
, data = BackendTask.fail (FatalError.fromString "")
|
|
657
673
|
, subscriptions = subscriptions
|
|
658
674
|
, onPageChange = Just OnPageChange
|
|
659
675
|
}
|
package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Internal-RoutePattern.elmi
CHANGED
|
Binary file
|
package/generator/review/elm-stuff/tests-0.19.1/elm-stuff/0.19.1/Pages-Internal-RoutePattern.elmo
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"application","source-directories":["../../src","../../tests","../../../../src","src"],"elm-version":"0.19.1","dependencies":{"direct":{"elm/core":"1.0.5","elm/html":"1.0.0","elm/json":"1.1.3","elm/regex":"1.0.0","elm-
|
|
1
|
+
{"type":"application","source-directories":["../../src","../../tests","../../../../src","src"],"elm-version":"0.19.1","dependencies":{"direct":{"elm/core":"1.0.5","elm/html":"1.0.0","elm/json":"1.1.3","elm/regex":"1.0.0","elm-explorations/test":"2.1.1","jfmengels/elm-review":"2.13.0","mdgriffith/elm-codegen":"3.0.0","mpizenberg/elm-test-runner":"6.0.0","stil4m/elm-syntax":"7.2.9","the-sett/elm-syntax-dsl":"6.0.2"},"indirect":{"Chadtech/elm-bool-extra":"2.4.2","elm/bytes":"1.0.8","elm/parser":"1.1.0","elm/project-metadata-utils":"1.0.2","elm/random":"1.0.0","elm/time":"1.0.0","elm/virtual-dom":"1.0.3","elm-community/basics-extra":"4.1.0","elm-community/list-extra":"8.7.0","elm-community/maybe-extra":"5.3.0","miniBill/elm-unicode":"1.0.3","rtfeldman/elm-hex":"1.0.0","stil4m/structured-writer":"1.0.3","the-sett/elm-pretty-printer":"3.0.0"}},"test-dependencies":{"direct":{},"indirect":{}}}
|