Skip to main content
Module

x/cav/deps.ts>graph.CreateGraphOptions

A server framework for Deno
Go to Latest
interface graph.CreateGraphOptions
import { type graph } from "https://deno.land/x/cav@0.0.21/deps.ts";
const { CreateGraphOptions } = graph;

Properties

optional
kind: "all" | "typesOnly" | "codeOnly"

The type of graph to build. "all" includes all dependencies of the roots. "typesOnly" skips any code only dependencies that do not impact the types of the graph, and "codeOnly" only includes dependencies that are runnable code.

optional
jsxImportSourceModule: string

When identifying a @jsxImportSource pragma, what module name will be appended to the import source. This defaults to jsx-runtime.

optional
lockFilename: string

An optional string to be used when generating an error when the integrity check of the module graph fails.

optional
imports: Record<string, string[]>

An optional record of "injected" dependencies to the module graph. This allows adding things like TypeScript's "types" values into the graph.

Methods

optional
load(specifier: string, isDynamic: boolean): Promise<LoadResponse | undefined>

A callback that is called with the URL string of the resource to be loaded and a flag indicating if the module was required dynamically. The callback should resolve with a LoadResponse or undefined if the module is not found. If there are other errors encountered, a rejected promise should be returned.

optional
cacheInfo(specifier: string): CacheInfo

An optional callback that will be called with a URL string of the resource to provide additional meta data about the resource to enrich the module graph.

optional
resolve(specifier: string, referrer: string): string | ResolveResult

An optional callback that allows the default resolution logic of the module graph to be "overridden". This is intended to allow items like an import map to be used with the module graph. The callback takes the string of the module specifier from the referrer and the string URL of the referrer. The callback then returns a fully qualified resolved URL string specifier or an object which contains the URL string and the module kind. If just the string is returned, the module kind is inferred to be ESM.

optional
resolveTypes(specifier: string): TypesDependency | undefined

An optional callback that can allow custom logic of how type dependencies of a module to be provided. This will be called if a module is being added to the graph that is is non-typed source code (e.g. JavaScript/JSX) and allow resolution of a type only dependency for the module (e.g. @types or a .d.ts file).

optional
check(specifier: string, content: Uint8Array): boolean

An optional callback that returns true if the sub-resource integrity of the provided specifier and content is valid, otherwise false. This allows for items like lock files to be applied to the module graph.

optional
getChecksum(content: Uint8Array): string

An optional callback that returns the sub-resource integrity checksum for a given set of content.