Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IPackageNode

Hierarchy

  • IPackageNode

Implemented by

Index

Properties

children

children: object

Child nodes inside of a node_modules path under this package.

Type declaration

dependencies

dependencies: IPackageNode[]

An array of resolved dependencies of this package.

dependencyResolved

dependencyResolved: boolean

Indicates all dependencies are resolved or not.

see

validate

id

id: string

A package's unique id as {package name}/{package version} format.

linked

linked: boolean

Indicates this node and it's dependencies are linked or not. This value is changed as true after linkDependencies call.

see

linkDependencies

manifest

manifest: IPackageJson

Contents of the package.json file of this package.

see

IPackageJson

name

name: string

Name of the package. The name field of package.json. If the name field of package.json is empty, directory name of the package will be used.

parent

parent: IPackageNode | undefined

An upper directory node of child nodes in a node_modules directory.

parent1/node_modules/child1

path

path: string

An absolute path of this node.

unresolvedDependencies

unresolvedDependencies: IDependencyMap

An array of dependencies which remain unresolved after dependency resolution try.

see

linkDependencies

validated

validated: boolean

Indicates this node is validated.

see

validate

Methods

getDependency

  • Returns a node with the given name which this node depends on.

    Parameters

    • depName: string

      The name of a dependency.

    Returns IPackageNode | void

hasDependency

  • hasDependency(name: string, version?: undefined | string): boolean
  • Returns true if this node depends on the package with the given name and optional version.

    Parameters

    • name: string

      The name of a dependency.

    • Optional version: undefined | string

      The version of the dependency.

    Returns boolean

linkDependencies

  • linkDependencies(): void
  • For each unresolved dependencies, this method check if the dependency node exist, and if it exists and satisfies version then add to dependencies and remove from unresolvedDependencies.

    If the package.json has the optionalDependencies and some of it also exists unresolved dependencies, this method will remove them from the unresolved dependencies.

    Returns void

resolve

  • resolve(cb?: undefined | function, resolveDevDependency?: undefined | false | true): void
  • Calls linkDependencies, then calls validate

    Parameters

    • Optional cb: undefined | function

      Called when the resolution process for this node has been ended.

    • Optional resolveDevDependency: undefined | false | true

      If this value is true this node will resolve devDependencies too.

    Returns void

validate

  • validate(cb?: undefined | function): boolean
  • Validates all of this node's dependencies recursively.

    Parameters

    • Optional cb: undefined | function

    Returns boolean

Generated using TypeDoc