Options
All
  • Public
  • Public/Protected
  • All
Menu

Package yarnpkg-pnpify

Type aliases

AncestorMap

AncestorMap: Map<Ident, Set<Ident>>

Mapping which packages depend on a given package. It is used to determine hoisting weight, e.g. which one among the group of packages with the same name should be hoisted. The package having the biggest number of ancestors using this package will be hoisted.

CloneTree

CloneTree: object

Type declaration

DirectoryWatcherMap

DirectoryWatcherMap: Map<PortablePath, DirectoryWatcher>

HoistCandidate

HoistCandidate: object

Type declaration

HoistCandidateSet

HoistCandidateSet: object

Type declaration

HoistCandidates

HoistCandidates: Map<PackageName, HoistCandidateSet>

HoistOptions

HoistOptions: object

Type declaration

  • Optional check?: undefined | false | true
  • Optional debugLevel?: undefined | number

HoisterResult

HoisterResult: object

Type declaration

HoisterTree

HoisterTree: object

Type declaration

HoisterWorkTree

HoisterWorkTree: object

Type declaration

Ident

Ident: string

InternalHoistOptions

InternalHoistOptions: object

Type declaration

  • Optional check?: undefined | false | true
  • debugLevel: number

Locator

Locator: string

LocatorKey

LocatorKey: string

Package locator key for usage inside maps

NodeModulesBaseNode

NodeModulesBaseNode: object

Type declaration

NodeModulesFSOptions

NodeModulesFSOptions: object

Type declaration

  • Optional pnpifyFs?: undefined | false | true
  • Optional realFs?: typeof fs

NodeModulesLocatorMap

NodeModulesLocatorMap: Map<LocatorKey, object>

NodeModulesPackageNode

NodeModulesPackageNode: object

Type declaration

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

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

PackageName

PackageName: string

TemplateOptions

TemplateOptions: object

Type declaration

  • Optional setupEnv?: undefined | false | true
  • Optional usePnpify?: undefined | false | true

Tuple

Tuple: object

Type declaration

Variables

Const MAX_NODES_TO_DUMP

MAX_NODES_TO_DUMP: 50000 = 50000

Const NODE_MODULES

NODE_MODULES: "node_modules" = "node_modules"

Const NODE_MODULES

NODE_MODULES: string & object & object & object = toFilename(`node_modules`)

node_modules path segment

Const SDKS

SDKS: Array<[string, function]> = [[`eslint`, generateEslintWrapper],[`prettier`, generatePrettierWrapper],[`typescript-language-server`, generateTypescriptLanguageServerWrapper],[`typescript`, generateTypescriptWrapper],]

__non_webpack_require__

__non_webpack_require__: any

Const dynamicRequire

dynamicRequire: any = typeof __non_webpack_require__ !== `undefined`? __non_webpack_require__: require

Let fsPatched

fsPatched: boolean = false

name

name: string

Let pnp

pnp: PnpApi

rest

rest: string[]

Functions

Const TEMPLATE

  • TEMPLATE(relPnpApiPath: PortablePath, module: string, __namedParameters: object): string

Const addVSCodeWorkspaceSettings

  • addVSCodeWorkspaceSettings(pnpApi: PnpApi, settings: any): Promise<void>

Const benchmarkBuildTree

Const benchmarkRawHoisting

  • benchmarkRawHoisting(packageTree: HoisterTree): number

Const buildAncestorMap

Const buildLocatorMap

Const buildNodeModulesTree

Const buildPackageTree

Const cloneTree

Const dumpDepTree

Const dumpDepTree

Const dumpNodeModulesTree

Const generateEslintWrapper

Const generatePrettierWrapper

Const generateSdk

  • generateSdk(pnpApi: PnpApi): Promise<any>

Const generateTypescriptLanguageServerWrapper

  • generateTypescriptLanguageServerWrapper(pnpApi: PnpApi, target: PortablePath): Promise<void>

Const generateTypescriptWrapper

Const getArchivePath

Const getHoistCandidates

Const getHoistedDependencies

Const getTreeHeight

help

  • help(error: boolean): void

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

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

    Parameters

    Returns HoisterResult

    hoisted tree copy

Const hoistTo

  • Performs hoisting all the dependencies down the tree to the root node.

    The algorithm used here reduces dependency graph by deduplicating instances of the packages while keeping:

    1. Regular dependency promise: the package should require the exact version of the dependency that was declared in its package.json
    2. Peer dependency promise: the package and its direct parent package must use the same instance of the peer dependency

    The regular and peer dependency promises are kept while performing transform on tree branches of packages at a time: root package -> parent package 1 ... parent package n -> dependency We check wether we can hoist dependency to root package, this boils down basically to checking:

    1. Wether root package does not depend on other version of dependency
    2. Wether all the peer dependencies of a dependency had already been hoisted from all parent packages

    If many versions of the dependency can be hoisted to the root package we choose the most used dependency version in the project among them.

    This function mutates the tree.

    The algorithm used here reduces dependency graph by deduplicating instances of the packages while keeping:

    1. Regular dependency promise: the package should require the exact version of the dependency that was declared in its package.json
    2. Peer dependency promise: the package and its direct parent package must use the same instance of the peer dependency

    The regular and peer dependency promises are kept while performing transform on tree branches of packages at a time: root package -> parent package 1 ... parent package n -> dependency We check wether we can hoist dependency to root package, this boils down basically to checking:

    1. Wether root package does not depend on other version of dependency
    2. Wether all the peer dependencies of a dependency had already been hoisted from all parent packages

    If many versions of the dependency can be hoisted to the root package we choose the most used dependency version in the project among them.

    This function mutates the tree.

    Parameters

    Returns undefined | 0

Const makeIdent

  • makeIdent(name: string, reference: string): string

Const makeLocator

  • makeLocator(name: string, reference: string): string

Const patchFs

  • patchFs(): void

Const populateNodeModulesTree

Const prettyPrintLocator

  • prettyPrintLocator(locator: Locator): string

Const resolveNodeModulesPath

run

  • run(name: string, argv: Array<string>): void

sdk

Const selfCheck

Const shrinkTree

Const stringifyLocator

Const toTree

  • toTree(obj: any, key?: string, nodes?: Map<any, any>): HoisterTree

Generated using TypeDoc