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:cf51d203f9119859b7628364a64433e4a73a44a577d2ffd0dfd5dd737a980bc6cddc70ed15c1faf959fc2ad6a8e103ce52fe188f2b175b5f4371d4381544d74e#npm:3.1.3' } } } } } }, locator: 'react-apollo:virtual:2499dbb93d824027565d71b0716c4fb8b548ad61955d0a0286bfb3c5b4058e227894b6691d96808c00f576db14870018375210362c26ee321ea99fd6ed041c74#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:cf51d203f9119859b7628364a64433e4a73a44a577d2ffd0dfd5dd737a980bc6cddc70ed15c1faf959fc2ad6a8e103ce52fe188f2b175b5f4371d4381544d74e#npm:3.1.3' } } } } } }, locator: 'react-apollo:virtual:2499dbb93d824027565d71b0716c4fb8b548ad61955d0a0286bfb3c5b4058e227894b6691d96808c00f576db14870018375210362c26ee321ea99fd6ed041c74#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,]

Generated using TypeDoc