ReplSession.declaredAt(expression: string): Promise<{ file: string; line: number; } | null>
Where a value was written — the file and line of its declaration, or null for one that has
no source: a value typed at this prompt, or anything that is not a function.
V8 knows this for functions and for nothing else, so that is the honest limit of it.
The file:line header .doc and .view print, the path .open <value> hands the editor,
and what .copy attributes a copied function to — four callers, all asking the same question
a reader asks first: where is this written?
import type { ReplSession } from './session.ts'; // Defined, not invoked: a real session owns a browser and a bound port. async function whereWritten(session: ReplSession) { await session.declaredAt('double'); // { file: 'test/fixtures/repl-helpers.ts', line: 15 } return await session.declaredAt('GREETING'); // null — a string was never written anywhere }