Class: Resolver

lib/bundler/resolve.Resolver(options)

Resolves module specifiers for one build.

Holds the virtual-module table the compiler populated and a manifest cache, so repeated resolution across a large graph reads each package.json once.

Constructor

new Resolver(options)

Parameters:
Name Type Description
options object

Resolver options.

Properties
Name Type Attributes Description
virtualModules Map:.<string:, string:> <optional>

Module id to source.

runtimeEntry string <optional>

Absolute path of the runtime barrel.

roots Array:.<string:> <optional>

Extra directories to search for packages.

Source:

Members

cache :Map:.<string:, string:>

Type:
  • Map:.<string:, string:>
Source:

manifests :Map:.<string:, (object:|null:)>

Type:
  • Map:.<string:, (object:|null:)>
Source:

roots :Array:.<string:>

Type:
  • Array:.<string:>
Source:

runtimeEntry :string

Type:
  • string
Source:

virtualModules :Map:.<string:, string:>

Type:
  • Map:.<string:, string:>
Source:

Methods

isVirtual(id) → {boolean}

Whether an id names a module the compiler generated rather than a file.

Parameters:
Name Type Description
id string

The module id.

Source:
Returns:

True for a virtual module.

Type
boolean

resolve(specifier, importer) → {string}

Resolves a specifier to a module id.

Parameters:
Name Type Description
specifier string

The import specifier as written.

importer string

Absolute path or virtual id of the importing module.

Source:
Throws:

When the specifier names nothing resolvable.

Type
ResolveError
Returns:

The resolved module id.

Type
string