method ReplSession.refresh
ReplSession.refresh(file: string): Promise<string[] | string | null>

Loads a file again the way it was loaded the first time, for one that has changed on disk.

A file this session has in scope and a file on disk are the same file, and an editor is how the second one changes. Re-running it the way it came in — the same namespace, the same names an import statement asked for — is what keeps the first one from going stale under you.

null for a file this session does not have: editing something it never loaded is editing, and running it would be a decision nobody made.

Parameters

file: string

Return Type

Promise<string[] | string | null>

Usage

import { type ReplSession } from "lib/repl/session.ts";