Skip to main content

@yarnpkg/nm

Index

Functions

buildLocatorMap

buildNodeModulesTree

  • Retrieve full package list and build hoisted node_modules directories representation in-memory.


    Parameters

    Returns { errors: NodeModulesTreeErrors; preserveSymlinksRequired: boolean; tree: null | NodeModulesTree }

    hoisted node_modules directories representation in-memory

    • errors: NodeModulesTreeErrors
    • preserveSymlinksRequired: boolean
    • tree: null | NodeModulesTree

getArchivePath

  • Returns path to archive, if package location is inside the archive.


    Parameters

    Returns null | PortablePath

    path to archive is location is insde the archive or null otherwise

hoist

  • Hoists package tree.

    The root node of a tree must has id: '.'. This function does not mutate its arguments, it hoists and returns tree copy.


    Parameters

    • tree: HoisterTree

      package tree (cycles in the tree are allowed)

    • opts: HoistOptions = {}

    Returns HoisterResult

    hoisted tree copy

Type Aliases

HoisterResult

HoisterResult: { dependencies: Set<HoisterResult>; identName: PackageName; name: PackageName; references: Set<string> }

Type declaration

  • dependencies: Set<HoisterResult>
  • identName: PackageName
  • name: PackageName
  • references: Set<string>

HoisterTree

HoisterTree: { dependencies: Set<HoisterTree>; dependencyKind?: HoisterDependencyKind; hoistPriority?: number; identName: PackageName; name: PackageName; peerNames: Set<PackageName>; reference: string }

Type declaration

  • dependencies: Set<HoisterTree>
  • optionaldependencyKind?: HoisterDependencyKind
  • optionalhoistPriority?: number
  • identName: PackageName
  • name: PackageName
  • peerNames: Set<PackageName>
  • reference: string

NodeModulesBaseNode

NodeModulesBaseNode: { dirList: Set<Filename> }

Type declaration

NodeModulesLocatorMap

NodeModulesLocatorMap: Map<LocatorKey, { aliases: string[]; linkType: LinkType; locations: PortablePath[]; target: PortablePath }>

NodeModulesPackageNode

NodeModulesPackageNode: { aliases: string[]; dirList?: undefined; linkType: LinkType; locator: LocatorKey; nodePath: string; target: PortablePath }

Type declaration

  • aliases: string[]
  • optionaldirList?: undefined
  • linkType: LinkType
  • locator: LocatorKey
  • nodePath: string
  • target: PortablePath

NodeModulesTree

Node modules tree - a map of every folder within the node_modules, along with their directory listing and whether they are a symlink and their location.

Sample contents: /home/user/project/node_modules -> {dirList: ['foo', 'bar']} /home/user/project/node_modules/foo -> {target: '/home/user/project/.yarn/.cache/foo.zip/node_modules/foo', linkType: 'HARD'} /home/user/project/node_modules/bar -> {target: '/home/user/project/packages/bar', linkType: 'SOFT'}