Module module_map

Module module_map 

Source
Expand description

Module map and module graph.

§Terms

  • Module graph: it maintains the relationships between a module and its dependencies tree.
  • Module map: it maintains all the dependencies loaded into the js rutime, i.e. the rsvim editor.

§Module

In the most popular js runtime node.js, a module is loaded by the keyword require (Common JS) or import (ECMAScript Module). And there’re two kinds of imports: static and dynamic. For example:

Case-1: Static Import

// ES Module
const _ = import "lodash";

// Common JS
const _ = require("lodash");

// Case-2: Dynamic Import

// Wait for import complete.
const _ = await import("lodash");

// Trigger callbacks on import complete.
import("lodash")
  .then((_) => {})
  .catch((err) => {});

Static import runs synchronizely, dynamic import runs asynchronizely.

Structs§

ModuleGraph
Module graph.
ModuleMap
Module map. It maintains all the modules inside js runtime, including already resolved and pending fetching.

Enums§

ImportKind
Import kind.

Type Aliases§

ModuleGraphRc
ModuleGraphWk