Skip to content

core/resolver

Classes

ResolverError

Defined in: venpm/src/core/resolver.ts:12

Extends

  • Error

Constructors

Constructor
ts
new ResolverError(message): ResolverError;

Defined in: venpm/src/core/resolver.ts:13

Parameters
ParameterType
messagestring
Returns

ResolverError

Overrides
ts
Error.constructor

Properties

cause?
ts
optional cause?: unknown;

Defined in: venpm-docs/node_modules/typescript/lib/lib.es2022.error.d.ts:24

Inherited from
ts
Error.cause
message
ts
message: string;

Defined in: venpm-docs/node_modules/typescript/lib/lib.es5.d.ts:1075

Inherited from
ts
Error.message
name
ts
name: string;

Defined in: venpm-docs/node_modules/typescript/lib/lib.es5.d.ts:1074

Inherited from
ts
Error.name
stack?
ts
optional stack?: string;

Defined in: venpm-docs/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from
ts
Error.stack
stackTraceLimit
ts
static stackTraceLimit: number;

Defined in: venpm/node_modules/@types/node/globals.d.ts:68

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from
ts
Error.stackTraceLimit

Methods

captureStackTrace()
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: venpm/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
ParameterType
targetObjectobject
constructorOpt?Function
Returns

void

Inherited from
ts
Error.captureStackTrace
prepareStackTrace()
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: venpm/node_modules/@types/node/globals.d.ts:56

Parameters
ParameterType
errError
stackTracesCallSite[]
Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from
ts
Error.prepareStackTrace

Interfaces

ResolveOptions

Defined in: venpm/src/core/resolver.ts:21

Properties

forceMethod?
ts
optional forceMethod?: FetchMethod;

Defined in: venpm/src/core/resolver.ts:23

fromRepo?
ts
optional fromRepo?: string;

Defined in: venpm/src/core/resolver.ts:25

gitAvailable
ts
gitAvailable: boolean;

Defined in: venpm/src/core/resolver.ts:22

version?
ts
optional version?: string;

Defined in: venpm/src/core/resolver.ts:24

Functions

buildDependencyGraph()

ts
function buildDependencyGraph(indexes, pluginName): string[];

Defined in: venpm/src/core/resolver.ts:79

Build a topologically-sorted install order for pluginName and all its transitive dependencies. Circular dependencies are detected and will throw a ResolverError. Missing dependencies also throw.

Returns an array of plugin names in dependency-first order (deps before dependents).

Parameters

ParameterType
indexesPluginIndex[]
pluginNamestring

Returns

string[]


collectMissingOptionalDeps()

ts
function collectMissingOptionalDeps(
   indexes, 
   pluginName, 
   lockfile): string[];

Defined in: venpm/src/core/resolver.ts:158

Collect optional dependencies that are not currently installed. These are surfaced as warnings, not auto-installed.

Parameters

ParameterType
indexesPluginIndex[]
pluginNamestring
lockfileLockfileData

Returns

string[]


findPlugin()

ts
function findPlugin(
   indexes, 
   name, 
   fromRepo?): 
  | {
  entry: PluginEntry;
  repoName: string;
}
  | null;

Defined in: venpm/src/core/resolver.ts:34

Find a plugin by name across all indexes, optionally filtered by repo name. Returns the first match found. If fromRepo is given, only that repo is searched.

Parameters

ParameterType
indexesPluginIndex[]
namestring
fromRepo?string

Returns

| { entry: PluginEntry; repoName: string; } | null


generateInstallPlan()

ts
function generateInstallPlan(
   indexes, 
   pluginName, 
   lockfile, 
   options): InstallPlan;

Defined in: venpm/src/core/resolver.ts:175

Generate a full install plan for pluginName, resolving dependencies and skipping already-installed plugins. Returns an InstallPlan with entries in dependency-first order, plus any missing optional deps as warnings.

Parameters

ParameterType
indexesPluginIndex[]
pluginNamestring
lockfileLockfileData
optionsResolveOptions

Returns

InstallPlan


resolveVersion()

ts
function resolveVersion(entry, constraint?): string;

Defined in: venpm/src/core/resolver.ts:57

Resolve a version string for a plugin entry.

  • No constraint → return the entry's latest version field.
  • Constraint provided → look up in the entry's versions map and return it.
  • Version not found → throw ResolverError.

Parameters

ParameterType
entryPluginEntry
constraint?string

Returns

string


selectMethodFromSource()

ts
function selectMethodFromSource(source, gitAvailable): FetchMethod;

Defined in: venpm/src/core/resolver.ts:113

Parameters

ParameterType
sourcePluginSource
gitAvailableboolean

Returns

FetchMethod