Skip to main content

Module warm

Module warm 

Source
Expand description

Warm state: scratch state a task runs faster with, kept between runs of the same task and restored before it runs, but never part of a result. A target opts in with qk:warm:

  • outputs: true: the task’s previous outputs, so an incremental tool such as tsc --build starts from its last build;
  • paths: scratch directories in the workspace;
  • env: variables for the task, which may name {warm}, a directory qk keeps for the task outside the working tree.

A group already present on disk is left alone. Otherwise it is restored from this worktree’s own save. portable: true also permits other worktrees’ and remote saves. It is saved after successful runs, one record per worktree.

qk:warm may also be an array of such objects, each restored and saved on its own, so state that relocates can be portable beside state that cannot.

Structs§

Kept
Paths moved aside while a dependency that deletes them runs, and moved back, over whatever it left there, when this is dropped.
Restored
What a restore brought back.
Warm
A target’s qk:warm.
WarmReport
What warm state did for one run of a task.

Enums§

KeyPart
One part of a warm key.

Constants§

FIELDS
The fields a qk:warm object can set. Others are ignored, as Nx ignores keys it does not know, so a configuration can use fields a newer qk added; qk doctor reports them.
RESTORED_AT
When restored files say they were written. Warm state comes from another checkout, so it must look older than every file in this one: tools that trust timestamps, as tsc --build does, then check the sources against it instead of taking a restored build for an up-to-date one.

Functions§

check_overlaps
Two tasks in a run cannot keep the same scratch path, since both would write it.
config
The target’s qk:warm entries, none without one.
keep_across
Moves aside the warm paths of every task in the graph that depends on task and names it in survive, so that task cannot delete them.
kept_paths
The scratch paths every entry keeps.