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

x/deno_graph/mod.ts

The module graph logic for Deno CLI
Go to Latest
import * as denoGraph from "https://deno.land/x/deno_graph@0.63.3/mod.ts";

A JavaScript/TypeScript interface to the Deno CLI's module graph logic.

Example

To build and output a graph as a JSON structure to the console:

import { createGraph } from "https://deno.land/x/deno_graph@{VERSION}/mod.ts";

const graph = await createGraph("https://deno.land/x/std/testing/asserts.ts");

console.log(JSON.stringify(graph, undefined, "  "));

Functions

Create a module graph using the same algorithms that are used in the Deno CLI, resolving with the module graph for further processing.

Instantiates the Wasm module used within deno_graph.

A Deno specific loader function that can be passed to the createModuleGraph which will use Deno.readTextFile for local files, or use fetch() for remote modules.

Parse a module based on the supplied information and return its analyzed representation. If an error is encountered when parsing, the function will throw.

Interfaces

Additional meta data that is used to enrich the output of the module graph.

The plain-object representation of a module graph that is suitable for serialization to JSON.