DataLoaderContext #

What load() can use to read local files; whatever it reads is tracked.

Fields #

read(path: string): Promise<string>

Reads a UTF-8 text file and records it as a dependency of this loader. A relative path starts from the loader file.

glob(pattern: string | readonly string[]): Promise<string[]>

Finds files and returns their absolute paths, sorted. The pattern is recorded as a dependency of this loader, so files that appear or go also refresh it. A relative pattern starts from the loader file.

Full type signature
TypeScript
interface DataLoaderContext {
  read: (path: string) => Promise<string>
  glob: (pattern: string | readonly string[]) => Promise<string[]>
}

Edit this page

Comments