import { type CreateGraphOptions } from "https://deno.land/x/deno_graph@0.38.0/mod.ts";
Properties
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.
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
.
When identifying a @jsxImportSource
pragma, what module name will be
appended to the import source. This defaults to jsx-runtime
.
An optional string to be used when generating an error when the integrity check of the module graph fails.
An optional record of "injected" dependencies to the module graph. This
allows adding things like TypeScript's "types"
values into the graph or
a JSX runtime. The key is the referrer specifier to use as a base when
resolving relative specifiers. The value is any module specifiers that are
being imported.
Methods
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.
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.
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.
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).
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.