Module: lib/compiler/atlas/emit

Serializing the Atlas beside the bundle.

The artifact follows the convention bundle.trace.json already established: it is written next to bundle.js and is never referenced by it. An application that never runs avenx impact downloads nothing extra, a deployment that does not want the file simply does not upload it, and Atlas adds zero bytes to the runtime.

Source:

Methods

(static) atlasFileName(outputName) → {string}

The file name the Atlas is written under, given a bundle name.

Parameters:
Name Type Description
outputName string

The configured bundle name, e.g. bundle.

Source:
Returns:

The artifact's file name.

Type
string

(static) buildAtlas(model, metaopt) → {object}

Assembles the artifact.

generatedAt is the only field that changes between two builds of unchanged sources. Everything below it is sorted, so the artifact diffs cleanly in review and a golden test can compare it after dropping the timestamp.

Parameters:
Name Type Attributes Description
model AppModel

The model to serialize.

meta object <optional>

Extra envelope fields, such as the source directory.

Source:
Returns:

The serializable artifact.

Type
object

(static) parseAtlas(text) → {object}

Reads an artifact back, rejecting a format this build cannot interpret.

A newer major version may have changed what a field means, and answering an impact query from a model this build misreads would be worse than refusing. Unknown fields are tolerated; an unknown version is not.

Parameters:
Name Type Description
text string

The artifact's contents.

Source:
Throws:

When the document is not a readable Atlas.

Type
Error
Returns:

The parsed artifact.

Type
object

(static) serializeAtlas(model, metaopt) → {string}

Serializes the artifact to JSON text.

Parameters:
Name Type Attributes Description
model AppModel

The model.

meta object <optional>

Extra envelope fields.

Source:
Returns:

Pretty-printed JSON.

Type
string