property WatchSession.esbuild

esbuild's incremental BuildContextunstable, esbuild's type.

null until the first build has created one, and again after a restart() until that session's first build. Genuinely nullable rather than defensively typed: the context is created lazily by the first bundle, so a caller reaching for it early would find nothing.

import type { WatchSession } from './watch.ts';

// Defined, not invoked: needs a live session that has built at least once.
async function rebuild(session: WatchSession) {
  return session.esbuild ? await session.esbuild.rebuild() : null;
}

Type

BuildContext | null

Usage

import { type WatchSession } from "lib/api/watch.ts";