Compiler.Outline

Module for working with gren.json files.

type Outline
= App AppOutline
| Pkg PkgOutline

Representation of a gren.json file. These files are different based on the project type: applications and packages.

type alias AppOutline =
{ platform : Platform
, sourceDirectories : Array Path
, grenVersion : SemanticVersion
, dependencies : { direct : Dict String (VersionConstraint SemanticVersion)
, indirect : Dict String (VersionConstraint SemanticVersion)
}
}
type alias PkgOutline =
{ platform : Platform
, name : PackageName
, summary : String
, license : License
, version : SemanticVersion
, exposedModules : Exposed
, grenVersion : SemanticVersionRange
, dependencies : Dict String (VersionConstraint SemanticVersionRange)
}
type VersionConstraint a
= Version a
| LocalPath Path

A dependency version constraint. Either a SemanticVersion, SemanticVersionRange or a Path for a local dependency.

type Exposed
= ExposedArray (Array ModuleName)
| ExposedDict (Dict String (Array ModuleName))

Exposed modules in PkgOutline. Modules that become available when you're importing the package as a dependency.

defaultSummary : String

The default summary used when creating gren.json using gren init.

Read from disk

readFromPath : Permission -> Path -> Task ReadFromPathError Outline

Read the Outline located at the given Path.

type ReadFromPathError
= FromPathFileSystemError Error
| FromPathInvalidString
| FromPathInvalidJson Error

The types of errors that can occur when reading an Outline from the filesystem.

findSourceFiles :
Permission
-> Outline
-> Path
-> Task FindSourceFilesError (Array { path : Path, moduleName : ModuleName , source : String })

Find the source files of a given project.

When used on core packages, like gren-lang/core, this function can return JavaScript files.

type FindSourceFilesError
= FileSystemError Error
| FilePathInvalidModuleName ({ path : Path, inferredModuleName : String })
| FileContentNotValidString Path

The types of errors that can occur when retrieving the source code of a project.

JSON

jsonDecoder : Decoder Outline

JSON Decoder for Outline.

pkgJsonDecoder : Decoder PkgOutline

JSON Decoder for PkgOutline.

toJson : Outline -> Value

JSON Encoder for Outline.