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

x/mesozoic/lib/deps.ts>createGraph

A generic build system for Deno web apps
Go to Latest
function createGraph
import { createGraph } from "https://deno.land/x/mesozoic@v1.0.0-beta.1/lib/deps.ts";

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

A default load() function is provided which will attempt to load local modules via Deno.readFile() and will use fetch() to load remote modules. An alternative load() function can be provided via the options.

Example

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

const graph = await createGraph("https://example.com/a.ts");

console.log(graph.toString());

Parameters

rootSpecifier: string

A URL string of the root module specifier to build the graph from.

optional
options: CreateGraphOptions

A set of options for building the graph

Returns

Promise<ModuleGraph>

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

A default load() function is provided which will attempt to load local modules via Deno.readFile() and will use fetch() to load remote modules. An alternative load() function can be provided via the options.

Example

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

const graph = await createGraph([
  ["https://example.com/a.ts", "esm"],
  ["https://example.com/a.ts", "esm"],
]);

console.log(graph.toJSON());

Parameters

rootSpecifiers: string[] | [string, ModuleKind][]

An array of URL strings or tuples of URL strings and module kinds of the root module specifiers to build the graph from.

optional
options: CreateGraphOptions

A set of options for building the graph

Returns

Promise<ModuleGraph>