Options
All
  • Public
  • Public/Protected
  • All
Menu

Package plugin-node-modules

@yarnpkg/plugin-node-modules

This plugin adds support for installing packages through a node_modules folder.

Install

This plugin is included by default in Yarn 2, but is still considered experimental. For this reason, you must enable it manually by adding the following to your .yarnrc.yml file:

nodeLinker: node-modules

Word of caution

While they are supported by virtually every tool, installs using the node_modules strategy have various fundamental issues that the default Plug'n'Play installations don't suffer from (for more details, check out our documentation). Carefully consider the pros and cons before enabling this plugin.

Type aliases

BinSymlinkMap

BinSymlinkMap: Map<PortablePath, Map<Filename, PortablePath>>

InstallState

InstallState: object

Type declaration

LocationNode

LocationNode: object

Type declaration

LocationRoot

LocationRoot: PortablePath

LocationTree

LocationTree: Map<LocationRoot, LocationNode>

Locations tree. It starts with the map of location roots and continues as maps of nested directory entries.

Example: Map { '' => children: Map { 'react-apollo' => { children: Map { 'node_modules' => { children: Map { '@apollo' => { children: Map { 'react-hooks' => { children: Map {}, locator: '@apollo/react-hooks:virtual:cf...#npm:3.1.3' } } } } } }, locator: 'react-apollo:virtual:24...#npm:3.1.3' }, }, 'packages/client' => children: Map { 'node_modules' => Map { ... } } ... }

Example: Map { '' => children: Map { 'react-apollo' => { children: Map { 'node_modules' => { children: Map { '@apollo' => { children: Map { 'react-hooks' => { children: Map {}, locator: '@apollo/react-hooks:virtual:cf...#npm:3.1.3' } } } } } }, locator: 'react-apollo:virtual:24...#npm:3.1.3' }, }, 'packages/client' => children: Map { 'node_modules' => Map { ... } } ... }

LocatorKey

LocatorKey: string

Variables

Const CONCURRENT_OPERATION_LIMIT

CONCURRENT_OPERATION_LIMIT: 4 = 4

Const DOT_BIN

DOT_BIN: string & object = `.bin` as Filename

Const INSTALL_STATE_FILE

INSTALL_STATE_FILE: string & object = `.yarn-state.yml` as Filename

Const NODE_MODULES

NODE_MODULES: string & object = `node_modules` as Filename

Const STATE_FILE_VERSION

STATE_FILE_VERSION: 1 = 1

Functions

Const areRealLocatorsEqual

Const buildLocationTree

Const copyPromise

createBinSymlinkMap

findInstallState

Const getPnpPath

  • getPnpPath(project: Project): string & object

isLinkLocator

Const parseLocation

  • parseLocation(location: PortablePath, __namedParameters: object): object

persistBinSymlinks

persistNodeModules

refineNodeModulesRoots

  • This function removes node_modules roots that do not exist on the filesystem from the location tree.

    This is needed to transparently support workflows on CI systems. When user caches only top-level node_modules and forgets to cache node_modules from deeper workspaces. By removing non-existent node_modules roots we make our location tree to represent the real tree on the file system.

    Please note, that this function doesn't help with any other inconsistency on a deeper level inside node_modules tree, it helps only when some node_modules roots do not exist at all

    This is needed to transparently support workflows on CI systems. When user caches only top-level node_modules and forgets to cache node_modules from deeper workspaces. By removing non-existent node_modules roots we make our location tree to represent the real tree on the file system.

    Please note, that this function doesn't help with any other inconsistency on a deeper level inside node_modules tree, it helps only when some node_modules roots do not exist at all

    Parameters

    Returns object

    location tree with non-existent node_modules roots stripped

Const removeDir

  • removeDir(dir: PortablePath, options: object): Promise<any>

Const symlinkPromise

writeInstallState

Object literals

Const plugin

plugin: object

linkers

linkers: (NodeModulesLinker | PnpLooseLinker)[] = [NodeModulesLinker,PnpLooseLinker,]

configuration

configuration: object

nmHoistingLimits

nmHoistingLimits: object

default

default: string = `none`

description

description: string = `Prevent packages can be hoisted past specific levels`

type

type: STRING = SettingsType.STRING

values

values: string[] = [`workspaces`, `dependencies`, `none`]

Generated using TypeDoc