DefSource

tcmts.loader.DefSource · #a3vlxsln · type

Where definitions come from: the store, possibly overlaid with not-yet-added scratch definitions.

import type { DefRecord } from "#codebase/tcmts/core/types";
import type { Kept } from "#codebase/tcmts/loader";

export interface DefSource {
  get(hash: string): DefRecord | undefined;
  members(componentHash: string): DefRecord[];
  /** current full name on the branch, if any */
  nameOf(hash: string): string | undefined;
  /**
   * Where a definition reads as you'd look at it: a file and the (0-based) line its declaration starts on there.
   * Generated modules carry a source map to it, so stack traces and debuggers show that file.
   */
  viewOf?(hash: string): { file: string; line: number; inserts?: number[] } | undefined;
  /** the directory views are in (a branch's own): a module whose source maps lead to another is rendered again */
  views?: string;
  /**
   * A constant's value, if it's pure and was evaluated before: kept, so it isn't computed again. Null if it isn't
   * kept (it isn't pure, or its value can't be written as code); undefined if that isn't known yet.
   */
  kept?(hash: string): Kept | null | undefined;
  /** evaluate these constants, whose modules are written, and keep what can be kept (`kept` says, after) */
  keep?(hashes: string[]): void;
}

uses

used by