Options
All
  • Public
  • Public/Protected
  • All
Menu

Package plugin-nm

@yarnpkg/plugin-nm

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>>

CustomPackageData

CustomPackageData: UnboxPromise<ReturnType<typeof extractCustomPackageData>>

DirEntry

DirEntry: object | object | object

InstallState

InstallState: object

Type declaration

LoadManifest

LoadManifest: function

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

UnboxPromise

UnboxPromise<T>: T extends Promise<infer U> ? U : never

Type parameters

  • T: Promise<any>

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 MTIME_ACCURANCY

MTIME_ACCURANCY: 1000 = 1000

Const NODE_MODULES

NODE_MODULES: string & object = `node_modules` as Filename

Const STATE_FILE_VERSION

STATE_FILE_VERSION: 1 = 1

Functions

Const areRealLocatorsEqual

atomicFileWrite

Const buildLocationTree

copyFilePromise

  • copyFilePromise(__namedParameters: object): Promise<void>

Const copyPromise

createBinSymlinkMap

extractCustomPackageData

findInstallState

getGlobalHardlinksStore

isLinkLocator

Const parseLocation

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

persistBinSymlinks

persistNodeModules

Const removeDir

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

Const symlinkPromise

syncPreinstallStateWithDisk

writeInstallState

Object literals

Const plugin

plugin: object

linkers

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

configuration

configuration: object

nmHoistingLimits

nmHoistingLimits: object

default

default: NodeModulesHoistingLimits = NodeModulesHoistingLimits.NONE

description

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

type

type: STRING = SettingsType.STRING

values

values: NodeModulesHoistingLimits[] = [NodeModulesHoistingLimits.WORKSPACES,NodeModulesHoistingLimits.DEPENDENCIES,NodeModulesHoistingLimits.NONE,]

nmMode

nmMode: object

default

default: NodeModulesMode = NodeModulesMode.CLASSIC

description

description: string = `If set to "hardlinks-local" Yarn will utilize hardlinks to reduce disk space consumption inside "node_modules" directories. With "hardlinks-global" Yarn will use global content addressable storage to reduce "node_modules" size across all the projects using this option.`

type

type: STRING = SettingsType.STRING

values

values: NodeModulesMode[] = [NodeModulesMode.CLASSIC,NodeModulesMode.HARDLINKS_LOCAL,NodeModulesMode.HARDLINKS_GLOBAL,]

nmSelfReferences

nmSelfReferences: object

default

default: boolean = true

description

description: string = `If set to 'false' the workspace will not be allowed to require itself and corresponding self-referencing symlink will not be created`

type

type: BOOLEAN = SettingsType.BOOLEAN

hooks

hooks: object

cleanGlobalArtifacts

  • cleanGlobalArtifacts(configuration: Configuration): Promise<void>

Generated using TypeDoc