DocShell.Build.Tree (DocShell v2.0.0)

Copy Markdown View Source

Encodes a completed build once and publishes it as one artifact generation.

DocShell.Build extracts and projects; this module turns that result into files. Every payload is encoded exactly once, as canonical JSON iodata. When the build has a collection descriptor, the artifact digests in collection.json are computed from those bytes, and the same bytes are then spliced into each file's envelope. Nothing is encoded, decoded or hashed a second time, and no artifact is flattened into a single binary before it reaches DocShell.Artifact.Transaction.

Every encoding error is returned tagged with the destination path before any file is staged, so a payload that cannot be encoded never replaces a published artifact. pretty: true changes only the bytes on disk; digests always cover canonical data.

Summary

Functions

Writes the public and private artifact trees for a build result.

Functions

write(config, result)

@spec write(keyword(), map()) :: :ok | {:error, term()}

Writes the public and private artifact trees for a build result.

config is a resolved DocShell.Config keyword list; result is the map DocShell.Build.run/1 returns, including :presentation and, when configured, :collection.