tcmts.cli.kept

Server

computedInitializer (rec: DefRecord) => { start: number; end: number; } | undefined
Where a constant's initializer is in its stored text, if it's one that's computed (it calls something), when the module it's in loads: `const table = build()`, not `const f = () => …` or `const n = 3`, or one that waits.
holdsState (rec: DefRecord) => "fixed" | "maybe" | "none" | "state"
What a definition holds, as module state goes: nothing (a function, a type); a value nothing can change (a constant written as a number, a string, `true`…); maybe one (a computed constant: if its kept value is one of those); or state something could change (an object, an array, a top-level `let`, a class's statics).
keepValues (cb: CodebaseCore, hashes: string[], src: DefSource) => void
Evaluate pure constants once (`DefSource.keep`), and keep their values with them: constants whose initializer computes something, from code that reaches nothing outside the codebase (`reaches`) and uses no npm packages, with a value that can be written as code the same (`valueSource`), and nothing it uses holding state (`stateless`). All at once, in one process, from their modules (written already). Each is decided once: the rest are kept as not kept.
keptKey () => string
The metadata key kept values are under: they're evaluated on one runtime, which runs them.
keptValue (cb: CodebaseCore, rec: DefRecord | undefined) => Kept | null | undefined
A constant's kept value (`DefSource.kept`): null if it isn't kept, undefined if that isn't known yet. Its initializer's place is found again in the text shown now, when a rename since moved it (a constant's name isn't in its hash, so `tcm mv` changes its text: `const indexOpened = …` to `const registryOpened = …`).
stateless (src: DefSource, hash: string, fixed: (hash: string) => boolean | undefined) => boolean
Whether what a constant uses holds no state something else could change before it's computed (another module pushing to an array it reads, say): everything it uses, through what that uses, is a function, a type, or a value nothing can change. `fixed` says whether a computed constant among them has a kept value that's one.

Shared

isFixed (value: string) => boolean
A kept value that's a number, string, boolean, bigint, null or undefined: nothing can change it.
packaged Map<string, boolean>
Whether components use npm packages, through what they use (by component hash): what those do isn't seen.
usesPackages (src: DefSource, comp: string, pure?: (ref: string) => boolean) => boolean
Whether a component's code, or anything it uses, imports an npm package (or anything else that isn't Node's or the codebase's) not known to be pure: `pure` says which are, from the package's code (`isPureExport`); without it, none is.