@@ -14,6 +14,15 @@ module Compiler.Outline exposing
14
14
)
15
15
16
16
17
+ {-| Module for working with `gren.json` files.
18
+
19
+ @docs Outline, AppOutline, PkgOutline, VersionConstraint, Exposed, defaultSummary, findSourceFiles
20
+
21
+ ## JSON
22
+
23
+ @docs jsonDecoder, pkgJsonDecoder, toJson
24
+ -}
25
+
17
26
import Bytes
18
27
import SemanticVersion exposing (SemanticVersion)
19
28
import SemanticVersionRange exposing (SemanticVersionRange)
@@ -29,11 +38,13 @@ import Dict exposing (Dict)
29
38
import Task exposing (Task)
30
39
31
40
41
+ {-|-}
32
42
type Outline
33
43
= App AppOutline
34
44
| Pkg PkgOutline
35
45
36
46
47
+ {-|-}
37
48
type alias AppOutline =
38
49
{ platform : Platform
39
50
, sourceDirectories : Array Path
@@ -45,6 +56,7 @@ type alias AppOutline =
45
56
}
46
57
47
58
59
+ {-|-}
48
60
type alias PkgOutline =
49
61
{ platform : Platform
50
62
, name : PackageName
@@ -57,23 +69,29 @@ type alias PkgOutline =
57
69
}
58
70
59
71
72
+ {-| Exposed modules in [PkgOutline](#PkgOutline).
73
+ -}
60
74
type Exposed
61
75
= ExposedArray (Array ModuleName)
62
76
| ExposedDict (Dict String (Array ModuleName))
63
77
64
78
79
+ {-| A dependency version constraint. Either a `SemanticVersion`, `SemanticVersionRange` or a `Path` for a local dependency.
80
+ -}
65
81
type VersionConstraint a
66
82
= Version a
67
83
| LocalPath Path
68
84
69
85
86
+ {-| The default summary created by `gren init`.
87
+ -}
70
88
defaultSummary : String
71
89
defaultSummary =
72
90
"helpful summary of your project, less than 80 characters"
73
91
74
92
75
- -- TODO: Ignore hidden directories
76
- -- More info: https://github.com/gren-lang/compiler/pull/287
93
+ {-| Find the source files of a given project.
94
+ -}
77
95
findSourceFiles : FileSystem.Permission -> Outline -> Path -> Task FileSystem.Error (Array { path : Path, moduleName : String, source : String })
78
96
findSourceFiles fsPerm outline outlinePath =
79
97
let
@@ -138,6 +156,8 @@ readSourceFile fsPerm { absolute, relative } =
138
156
)
139
157
140
158
159
+ {-| JSON Decoder for [Outline](#Outline).
160
+ -}
141
161
jsonDecoder : Decoder Outline
142
162
jsonDecoder =
143
163
Decode.field "type" Decode.string
@@ -151,6 +171,8 @@ jsonDecoder =
151
171
)
152
172
153
173
174
+ {-| JSON Decoder for [PkgOutline](#PkgOutline).
175
+ -}
154
176
pkgJsonDecoder : Decoder PkgOutline
155
177
pkgJsonDecoder =
156
178
jsonDecoder
@@ -301,6 +323,8 @@ pkgDependenciesEncoder deps =
301
323
Encode.dict identity (constraintEncoder SemanticVersionRange.toJson) deps
302
324
303
325
326
+ {-| JSON Encoder for [Outline](#Outline).
327
+ -}
304
328
toJson : Outline -> Encode.Value
305
329
toJson outline =
306
330
when outline is
0 commit comments