Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno_graph/mod.ts>ParseModuleOptions

The module graph logic for Deno CLI
Go to Latest
interface ParseModuleOptions
import { type ParseModuleOptions } from "https://deno.land/x/deno_graph@0.38.0/mod.ts";

Properties

optional
headers: Record<string, string>

For remote resources, a record of headers should be set, where the key's have been normalized to be lower case values.

optional
defaultJsxImportSource: string

The default jsxImportSource to use in JSX/TSX files when no @jsxImportSource pragma is specified. In Deno, this is set to the compilerOptions.jsxImportSource value if compilerOptions.jsx is set to react-jsx or react-jsxdev.

optional
jsxImportSourceModule: string

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

optional
kind: ModuleKind

The kind of module to set on the resulting parsed module.

Methods

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): string | 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).