elm-pages 3.0.0-beta.34 → 3.0.0-beta.36
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/codegen/elm-pages-codegen.cjs +155 -56
- 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/Runner.elm.js +7692 -7239
- 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 +1 -1
- 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/Runner.elm.js +14976 -14484
- 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 +1 -1
- package/generator/src/build.js +1 -1
- package/generator/src/cli.js +27 -9
- package/generator/src/compatibility-key.js +2 -2
- package/package.json +17 -17
- package/src/BackendTask/File.elm +43 -13
- package/src/BackendTask/Internal/Request.elm +44 -3
- package/src/FatalError.elm +4 -3
- package/src/Pages/Internal/Platform/CompatibilityKey.elm +1 -1
- package/src/Pages/Internal/Platform/GeneratorApplication.elm +13 -3
- package/src/Pages/Internal/Platform/StaticResponses.elm +1 -7
- package/src/Stub.elm +56 -0
|
@@ -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: 2714937880, 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
|
package/generator/src/build.js
CHANGED
|
@@ -505,7 +505,7 @@ function runElmMake(mode, options, elmEntrypointPath, outputPath, cwd) {
|
|
|
505
505
|
/**
|
|
506
506
|
* @param {string} filePath
|
|
507
507
|
*/
|
|
508
|
-
async function runTerser(filePath) {
|
|
508
|
+
export async function runTerser(filePath) {
|
|
509
509
|
console.log("Running terser");
|
|
510
510
|
const minifiedElm = await terser.minify(
|
|
511
511
|
(await fsPromises.readFile(filePath)).toString(),
|
package/generator/src/cli.js
CHANGED
|
@@ -19,6 +19,7 @@ import * as commander from "commander";
|
|
|
19
19
|
import { runElmCodegenInstall } from "./elm-codegen.js";
|
|
20
20
|
import { packageVersion } from "./compatibility-key.js";
|
|
21
21
|
import { resolveInputPathOrModuleName } from "./resolve-elm-module.js";
|
|
22
|
+
import { runTerser } from "./build.js";
|
|
22
23
|
|
|
23
24
|
const Argument = commander.Argument;
|
|
24
25
|
const Option = commander.Option;
|
|
@@ -90,6 +91,7 @@ async function main() {
|
|
|
90
91
|
.description("run an elm-pages script")
|
|
91
92
|
.allowUnknownOption()
|
|
92
93
|
.allowExcessArguments()
|
|
94
|
+
.helpOption(false) // allow --help to propogate to the Script to show usage
|
|
93
95
|
.action(async (elmModulePath, options, options2) => {
|
|
94
96
|
const unprocessedCliOptions = options2.args.splice(
|
|
95
97
|
options2.processedArgs.length,
|
|
@@ -193,6 +195,7 @@ async function main() {
|
|
|
193
195
|
|
|
194
196
|
let executableName = await lamderaOrElmFallback();
|
|
195
197
|
await build.compileCliApp({ debug: options.debug, executableName });
|
|
198
|
+
// await runTerser(`${projectDirectory}/elm-stuff/elm-pages/elm.js`);
|
|
196
199
|
fs.renameSync(
|
|
197
200
|
`${projectDirectory}/elm-stuff/elm-pages/elm.js`,
|
|
198
201
|
`${projectDirectory}/elm-stuff/elm-pages/elm.cjs`
|
|
@@ -244,9 +247,29 @@ await(async()=>{let{dirname:e}=await import("path"),{fileURLToPath:i}=await impo
|
|
|
244
247
|
outfile: path.resolve(cwd, options.output),
|
|
245
248
|
external: ["node:*", ...options.external],
|
|
246
249
|
minify: true,
|
|
250
|
+
pure: [
|
|
251
|
+
"A2",
|
|
252
|
+
"A3",
|
|
253
|
+
"A4",
|
|
254
|
+
"A5",
|
|
255
|
+
"A6",
|
|
256
|
+
"A7",
|
|
257
|
+
"A8",
|
|
258
|
+
"A9",
|
|
259
|
+
"F2",
|
|
260
|
+
"F3",
|
|
261
|
+
"F3",
|
|
262
|
+
"F4",
|
|
263
|
+
"F5",
|
|
264
|
+
"F6",
|
|
265
|
+
"F7",
|
|
266
|
+
"F8",
|
|
267
|
+
"F9",
|
|
268
|
+
],
|
|
247
269
|
absWorkingDir: projectDirectory,
|
|
248
270
|
banner: { js: `#!/usr/bin/env node\n\n${ESM_REQUIRE_SHIM}` },
|
|
249
271
|
});
|
|
272
|
+
// await runTerser(path.resolve(cwd, options.output));
|
|
250
273
|
} catch (error) {
|
|
251
274
|
console.log(restoreColorSafe(error));
|
|
252
275
|
process.exit(1);
|
|
@@ -325,16 +348,11 @@ async function requireElm(compiledElmPath) {
|
|
|
325
348
|
function generatorWrapperFile(moduleName) {
|
|
326
349
|
return `port module Main exposing (main)
|
|
327
350
|
|
|
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
351
|
import Pages.Internal.Platform.GeneratorApplication
|
|
334
352
|
import ${moduleName}
|
|
335
353
|
|
|
336
354
|
|
|
337
|
-
main :
|
|
355
|
+
main : Pages.Internal.Platform.GeneratorApplication.Program
|
|
338
356
|
main =
|
|
339
357
|
Pages.Internal.Platform.GeneratorApplication.app
|
|
340
358
|
{ data = ${moduleName}.run
|
|
@@ -345,13 +363,13 @@ main =
|
|
|
345
363
|
}
|
|
346
364
|
|
|
347
365
|
|
|
348
|
-
port toJsPort :
|
|
366
|
+
port toJsPort : Pages.Internal.Platform.GeneratorApplication.JsonValue -> Cmd msg
|
|
349
367
|
|
|
350
368
|
|
|
351
|
-
port fromJsPort : (
|
|
369
|
+
port fromJsPort : (Pages.Internal.Platform.GeneratorApplication.JsonValue -> msg) -> Sub msg
|
|
352
370
|
|
|
353
371
|
|
|
354
|
-
port gotBatchSub : (
|
|
372
|
+
port gotBatchSub : (Pages.Internal.Platform.GeneratorApplication.JsonValue -> msg) -> Sub msg
|
|
355
373
|
`;
|
|
356
374
|
}
|
|
357
375
|
function collect(value, previous) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const compatibilityKey =
|
|
1
|
+
export const compatibilityKey = 15;
|
|
2
2
|
|
|
3
|
-
export const packageVersion = "3.0.0-beta.
|
|
3
|
+
export const packageVersion = "3.0.0-beta.36";
|
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.
|
|
4
|
+
"version": "3.0.0-beta.36",
|
|
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.",
|
|
@@ -27,45 +27,45 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"busboy": "^1.6.0",
|
|
29
29
|
"chokidar": "^3.5.3",
|
|
30
|
-
"commander": "^10.0.
|
|
30
|
+
"commander": "^10.0.1",
|
|
31
31
|
"connect": "^3.7.0",
|
|
32
32
|
"cookie-signature": "^1.2.1",
|
|
33
33
|
"cross-spawn": "7.0.3",
|
|
34
34
|
"devcert": "^1.2.2",
|
|
35
35
|
"elm-doc-preview": "^5.0.5",
|
|
36
36
|
"elm-hot": "^1.1.6",
|
|
37
|
-
"esbuild": "^0.17.
|
|
37
|
+
"esbuild": "^0.17.18",
|
|
38
38
|
"fs-extra": "^11.1.1",
|
|
39
|
-
"globby": "13.1.
|
|
39
|
+
"globby": "13.1.4",
|
|
40
40
|
"gray-matter": "^4.0.3",
|
|
41
41
|
"jsesc": "^3.0.2",
|
|
42
42
|
"kleur": "^4.1.5",
|
|
43
|
-
"make-fetch-happen": "^11.
|
|
44
|
-
"memfs": "^3.
|
|
43
|
+
"make-fetch-happen": "^11.1.1",
|
|
44
|
+
"memfs": "^3.5.1",
|
|
45
45
|
"micromatch": "^4.0.5",
|
|
46
46
|
"serve-static": "^1.15.0",
|
|
47
|
-
"terser": "^5.
|
|
48
|
-
"vite": "^4.
|
|
49
|
-
"which": "^3.0.
|
|
47
|
+
"terser": "^5.17.1",
|
|
48
|
+
"vite": "^4.3.5",
|
|
49
|
+
"which": "^3.0.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/cross-spawn": "^6.0.2",
|
|
53
53
|
"@types/fs-extra": "^11.0.1",
|
|
54
54
|
"@types/make-fetch-happen": "^10.0.1",
|
|
55
55
|
"@types/micromatch": "^4.0.2",
|
|
56
|
-
"@types/node": "^
|
|
56
|
+
"@types/node": "^20.1.0",
|
|
57
57
|
"@types/serve-static": "^1.15.1",
|
|
58
|
-
"cypress": "^12.
|
|
58
|
+
"cypress": "^12.11.0",
|
|
59
59
|
"elm-codegen": "^0.3.0",
|
|
60
60
|
"elm-optimize-level-2": "^0.3.5",
|
|
61
|
-
"elm-review": "^2.10.
|
|
62
|
-
"elm-test": "^0.19.1-
|
|
63
|
-
"elm-tooling": "^1.
|
|
61
|
+
"elm-review": "^2.10.2",
|
|
62
|
+
"elm-test": "^0.19.1-revision12",
|
|
63
|
+
"elm-tooling": "^1.14.0",
|
|
64
64
|
"elm-verify-examples": "^5.2.0",
|
|
65
65
|
"elmi-to-json": "^1.4.3",
|
|
66
|
-
"typescript": "^5.0.
|
|
67
|
-
"vite": "^4.
|
|
68
|
-
"vitest": "^0.
|
|
66
|
+
"typescript": "^5.0.4",
|
|
67
|
+
"vite": "^4.3.5",
|
|
68
|
+
"vitest": "^0.31.0"
|
|
69
69
|
},
|
|
70
70
|
"files": [
|
|
71
71
|
"generator/src/",
|
package/src/BackendTask/File.elm
CHANGED
|
@@ -65,7 +65,7 @@ frontmatter frontmatterDecoder =
|
|
|
65
65
|
|
|
66
66
|
import BackendTask exposing (BackendTask)
|
|
67
67
|
import BackendTask.File as File
|
|
68
|
-
import Decode
|
|
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
|
|
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
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
235
|
-
|
|
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.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
module BackendTask.Internal.Request exposing (request)
|
|
1
|
+
module BackendTask.Internal.Request exposing (request, request2)
|
|
2
2
|
|
|
3
3
|
import BackendTask exposing (BackendTask)
|
|
4
|
-
import BackendTask.Http exposing (Body, Expect)
|
|
4
|
+
import BackendTask.Http exposing (Body, Error(..), Expect)
|
|
5
|
+
import Json.Decode exposing (Decoder)
|
|
6
|
+
import Json.Encode as Encode
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
request :
|
|
@@ -22,7 +24,46 @@ request ({ name, body, expect } as params) =
|
|
|
22
24
|
}
|
|
23
25
|
expect
|
|
24
26
|
|> BackendTask.onError
|
|
25
|
-
(\
|
|
27
|
+
(\error ->
|
|
26
28
|
-- TODO avoid crash here, this should be handled as an internal error
|
|
27
29
|
request params
|
|
28
30
|
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
request2 :
|
|
34
|
+
{ name : String
|
|
35
|
+
, body : Body
|
|
36
|
+
, expect : Decoder a
|
|
37
|
+
, errorDecoder : Decoder error
|
|
38
|
+
, onError : Json.Decode.Error -> error
|
|
39
|
+
}
|
|
40
|
+
-> BackendTask error a
|
|
41
|
+
request2 ({ name, body, expect, onError, errorDecoder } as params) =
|
|
42
|
+
-- elm-review: known-unoptimized-recursion
|
|
43
|
+
BackendTask.Http.request
|
|
44
|
+
{ url = "elm-pages-internal://" ++ name
|
|
45
|
+
, method = "GET"
|
|
46
|
+
, headers = []
|
|
47
|
+
, body = body
|
|
48
|
+
, timeoutInMs = Nothing
|
|
49
|
+
, retries = Nothing
|
|
50
|
+
}
|
|
51
|
+
(BackendTask.Http.expectJson Json.Decode.value)
|
|
52
|
+
|> BackendTask.onError
|
|
53
|
+
(\error ->
|
|
54
|
+
BackendTask.succeed Encode.null
|
|
55
|
+
)
|
|
56
|
+
|> BackendTask.andThen
|
|
57
|
+
(\decodeValue ->
|
|
58
|
+
case Json.Decode.decodeValue errorDecoder decodeValue of
|
|
59
|
+
Ok a ->
|
|
60
|
+
BackendTask.fail a
|
|
61
|
+
|
|
62
|
+
Err _ ->
|
|
63
|
+
case Json.Decode.decodeValue expect decodeValue of
|
|
64
|
+
Ok a ->
|
|
65
|
+
BackendTask.succeed a
|
|
66
|
+
|
|
67
|
+
Err e ->
|
|
68
|
+
BackendTask.fail (onError e)
|
|
69
|
+
)
|
package/src/FatalError.elm
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module FatalError exposing (FatalError, fromString, recoverable)
|
|
1
|
+
module FatalError exposing (FatalError, build, fromString, recoverable)
|
|
2
2
|
|
|
3
3
|
{-| The Elm language doesn't have the concept of exceptions or special control flow for errors. It just has
|
|
4
4
|
Custom Types, and by convention types like `Result` and the `Err` variant are used to represent possible failure states
|
|
@@ -54,7 +54,7 @@ issue.
|
|
|
54
54
|
In the case of server-rendered Routes (`RouteBuilder.serverRender`), `elm-pages` will show your 500 error page
|
|
55
55
|
when these errors occur.
|
|
56
56
|
|
|
57
|
-
@docs FatalError, fromString, recoverable
|
|
57
|
+
@docs FatalError, build, fromString, recoverable
|
|
58
58
|
|
|
59
59
|
-}
|
|
60
60
|
|
|
@@ -66,7 +66,8 @@ type alias FatalError =
|
|
|
66
66
|
Pages.Internal.FatalError.FatalError
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
{-|
|
|
69
|
+
{-| Create a FatalError with a title and body.
|
|
70
|
+
-}
|
|
70
71
|
build : { title : String, body : String } -> FatalError
|
|
71
72
|
build info =
|
|
72
73
|
Pages.Internal.FatalError.FatalError info
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
module Pages.Internal.Platform.GeneratorApplication exposing (Flags, Model, Msg(..), init, requestDecoder, update, app)
|
|
1
|
+
module Pages.Internal.Platform.GeneratorApplication exposing (Program, Flags, Model, Msg(..), init, requestDecoder, update, app, JsonValue)
|
|
2
2
|
|
|
3
3
|
{-| Exposed for internal use only (used in generated code).
|
|
4
4
|
|
|
5
|
-
@docs Flags, Model, Msg, init, requestDecoder, update, app
|
|
5
|
+
@docs Program, Flags, Model, Msg, init, requestDecoder, update, app, JsonValue
|
|
6
6
|
|
|
7
7
|
-}
|
|
8
8
|
|
|
@@ -25,6 +25,16 @@ import Pages.StaticHttp.Request
|
|
|
25
25
|
import TerminalText as Terminal
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
{-| -}
|
|
29
|
+
type alias JsonValue =
|
|
30
|
+
Decode.Value
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
{-| -}
|
|
34
|
+
type alias Program =
|
|
35
|
+
Program.StatefulProgram Model Msg (BackendTask FatalError.FatalError ()) Flags
|
|
36
|
+
|
|
37
|
+
|
|
28
38
|
{-| -}
|
|
29
39
|
type alias Flags =
|
|
30
40
|
{ compatibilityKey : Int
|
|
@@ -47,7 +57,7 @@ type Msg
|
|
|
47
57
|
{-| -}
|
|
48
58
|
app :
|
|
49
59
|
GeneratorProgramConfig
|
|
50
|
-
-> Program
|
|
60
|
+
-> Program
|
|
51
61
|
app config =
|
|
52
62
|
let
|
|
53
63
|
cliConfig : Program.Config (BackendTask FatalError ())
|
|
@@ -68,13 +68,7 @@ nextStep allRawResponses staticResponses { errors } =
|
|
|
68
68
|
)
|
|
69
69
|
in
|
|
70
70
|
if pendingRequests then
|
|
71
|
-
|
|
72
|
-
newThing : List HashRequest.Request
|
|
73
|
-
newThing =
|
|
74
|
-
urlsToPerform
|
|
75
|
-
|> List.Extra.uniqueBy HashRequest.hash
|
|
76
|
-
in
|
|
77
|
-
Continue newThing progressedBackendTask
|
|
71
|
+
Continue urlsToPerform progressedBackendTask
|
|
78
72
|
|
|
79
73
|
else
|
|
80
74
|
let
|
package/src/Stub.elm
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module Stub exposing (..)
|
|
2
|
+
|
|
3
|
+
import Json.Decode as Decode
|
|
4
|
+
import Set exposing (Set)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
type alias Id =
|
|
8
|
+
Int
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
type alias Model =
|
|
12
|
+
{ nextId : Id
|
|
13
|
+
, sentIds : Set Id
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
--task : Task error value
|
|
19
|
+
--task =
|
|
20
|
+
-- Pending
|
|
21
|
+
-- (\id -> id)
|
|
22
|
+
-- (\value model -> ( model, Done (Ok value) ))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
type Task error value
|
|
26
|
+
= Pending (Id -> Id) (Decode.Value -> Model -> ( Model, Task error value ))
|
|
27
|
+
| Done (Result error value)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
map2 : (value1 -> value2 -> combined) -> Task error value1 -> Task error value2 -> Task error combined
|
|
31
|
+
map2 mapFn task1 task2 =
|
|
32
|
+
case ( task1, task2 ) of
|
|
33
|
+
( Done resolved1, Done resolved2 ) ->
|
|
34
|
+
Debug.todo ""
|
|
35
|
+
|
|
36
|
+
( Pending toId1 resolved1, Pending toId2 resolved2 ) ->
|
|
37
|
+
Pending
|
|
38
|
+
(\id ->
|
|
39
|
+
max (toId1 id) (toId2 id)
|
|
40
|
+
|> nextId
|
|
41
|
+
)
|
|
42
|
+
(\value id ->
|
|
43
|
+
Debug.todo ""
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
_ ->
|
|
47
|
+
Debug.todo ""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
nextId id =
|
|
51
|
+
id + 1
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
--(Task toId1 resolve1)
|
|
56
|
+
--(Task toId2 resolve2)
|