Back to Turborepo

turborepo-task-hash

crates/turborepo-task-hash/README.md

2.9.9836 B
Original Source

turborepo-task-hash

Purpose

Computes cache keys for tasks based on their inputs. Determines when a task's cache should be invalidated by hashing all relevant inputs.

Architecture

Task inputs
    ├── File contents (via SCM)
    ├── Environment variables
    ├── Task definition (from turbo.json)
    ├── Dependencies' hashes
    └── Global hash inputs
        │
        └── turborepo-hash
            └── Cache key

Key components:

  • TaskHasher - Coordinates hash computation for tasks
  • GlobalHash - Repository-wide inputs affecting all tasks
  • Framework detection for automatic env var inclusion

Notes

Uses SCM-based hashing for file contents. Framework detection (Next.js, Vite, etc.) automatically includes framework-specific environment variables in the hash.