Module

server.reload_controller

ReloadController: Decide when and how to reload based on output diffs.

Scans the built output directory (e.g., public/) after each build and compares against the prior snapshot to determine whether:

  • no reload is needed
  • CSS-only hot reload is sufficient
  • a full page reload is required

Uses file size and modification time for fast diffing. This is sufficient for dev; a hashing option can be added later if needed.

Classes

SnapshotEntry dataclass
0

Attributes

Name Type Description
size int
mtime float
OutputSnapshot dataclass
0

Attributes

Name Type Description
files dict[str, SnapshotEntry]
ReloadDecision dataclass
0

Attributes

Name Type Description
action str
reason str
changed_paths list[str]
ReloadController
6

Methods 5

set_min_notify_interval_ms
1 None
def set_min_notify_interval_ms(self, value: int) -> None
Parameters 1
value int
set_ignored_globs
1 None
def set_ignored_globs(self, globs: list[str] | None) -> None
Parameters 1
globs list[str] | None
set_hashing_options
0 None
def set_hashing_options(self) -> None
decide_and_update
1 ReloadDecision
def decide_and_update(self, output_dir: Path) -> ReloadDecision
Parameters 1
output_dir Path
Returns

ReloadDecision

decide_from_changed_paths
Classify a given list of changed output paths. Applies ignore globs and thrott…
1 ReloadDecision
def decide_from_changed_paths(self, changed_paths: list[str]) -> ReloadDecision

Classify a given list of changed output paths.

Applies ignore globs and throttling consistently with decide_and_update.

Parameters 1
changed_paths list[str]
Returns

ReloadDecision

Internal Methods 1
__init__
5 None
def __init__(self, min_notify_interval_ms: int = 300, ignored_globs: list[str] | None = None, hash_on_suspect: bool = True, suspect_hash_limit: int = 200, suspect_size_limit_bytes: int = 2000000) -> None
Parameters 5
min_notify_interval_ms int
ignored_globs list[str] | None
hash_on_suspect bool
suspect_hash_limit int
suspect_size_limit_bytes int