# Deno

`cooldown` gates Deno projects through `--tool deno`.

## What it reads

A Deno project is a `deno.json` with its `deno.lock`.

## Registry

Deno mixes two registries, and each dependency is resolved against its own source:

- **`npm:` dependencies:** the npm registry.
- **`jsr:` dependencies:** JSR.

## How it is driven

`cooldown` runs `deno`, or the program `COOLDOWN_DENO` names:

- **`check`:** proves the lock current, as described below.
- **`--build`:** runs `deno install`.

### How `check` proves the lock current

`check` proves `deno.lock` current with `deno install --lockfile-only --frozen`. It runs in place,
with its cache and temporary files in a scratch directory, so the project stays as it was. It runs
twice:

- once for the configuration's dependencies;
- once with every source file of the project as an entrypoint, so an import only code makes is
  checked too.

A lock Deno refuses as out of date is stale, which `--allow-stale-lock` waives.

## Edge cases

The lock is `lock_unknown`:

- under `--offline`;
- when a Deno configuration or an npm workspace sits above the project;
- when `deno.json` sets `lock` or `vendor`;
- when `deno.jsonc` holds comments `cooldown` cannot read;
- when a project without a Deno configuration nests a `deno.json` or `package.json`;
- when the project has more than 400 source files;
- when Deno fails any other way.

Deno passes a JSR dependency whose metadata it cannot reach. So a JSR outage during the check can
let a lock that changed only there pass.
