# Editor bundle vendor README

This directory contains pre-built JavaScript bundles produced by esbuild from
`l4d2web/scripts/editor-src/`:

- `editor.bundle.js` — CodeMirror 6 IIFE, exposes `window.__editor.mount(textarea, opts)`.
- `vocab-rank.bundle.js` — vocabulary ranking helpers used by the console autocomplete.
- `editor.bundle.css` — placeholder CSS file (always empty; cm6 injects styles at runtime via StyleModule).

## Rebuild

From repo root:

```
./l4d2web/scripts/build-editor.sh
```

This runs `npm install` inside `editor-src/` then `npm run build`, which
rebuilds **all bundles** (`editor.bundle.js` and `vocab-rank.bundle.js`) in one
pass. The output overwrites the bundles in this directory and refreshes
`editor.bundle.sha256`.

The build script uses `$TMPDIR/npm-cache` (override with the
`NPM_CACHE` env var) as the npm cache to avoid permission issues with
root-owned files in `~/.npm/_cacache/` from older npm versions.

## Pinned dependencies

See `l4d2web/scripts/editor-src/package.json` for semver ranges and
`package-lock.json` for the exact resolved versions. Run
`npm outdated` inside `editor-src/` to see upgrade candidates.

## Integrity

`editor.bundle.sha256` contains the hashes of the committed bundles
(`editor.bundle.js`, `editor.bundle.css`, `vocab-rank.bundle.js`).
If a bundle drifts from its hash in CI / review, the artifact was
rebuilt without committing the updated bundle.
