tcmts.core.hash

Types

IR type
An IR node: a tag-first S-expression. Arrays and strings only, so serialization is canonical.

Server

hashIR (ir: IR) => string
rehashComponent (irs: IR[], swap: (hash: string) => string) => { irs: IR[]; componentHash: string; hashes: string[]…
A component's hashes again after definitions it refers to outside itself moved (`swap` gives each one's new hash): what analyzing its code would give, worked out from its members' IR as stored (by member index, with references inside the cycle as `["Cyc", i]`). A cycle's members are ordered as the analyzer orders them, by a hash that leaves those references out, then by what they refer to; undefined if two can't be told apart that way (the analyzer orders those as written, which the IR doesn't say). `index[i]` is where member `i` goes.

Shared

ALPHABET "abcdefghijklmnopqrstuvwxyz234567"
DOMAIN "tcm-ir-v2\0"
HASH_RE RegExp
IR_VERSION 2
The hash format. Every hash depends on it (through DOMAIN). A change to it comes with a step for `tcmts.core.migrate.IR_STEPS`, so `tcm migrate` moves codebases to it, and the golden hashes pinned again.
base32 (bytes: Uint8Array<ArrayBufferLike>) => string
exportId (hash: string) => string
Identifier used as the export name of a definition in generated modules.
hashFromExportId (id: string) => string | undefined
serializeIR (ir: IR) => string
shortHash (hash: string, len?: number) => string