1 | import { PortablePath, Filename } from '@yarnpkg/fslib';
|
2 | import { NodeModulesTree } from '@yarnpkg/nm';
|
3 | /**
|
4 | * Resolved `/node_modules` path inside PnP project info.
|
5 | *
|
6 | * Dirs ending with '/node_modules/foo/node_modules' or '.../node_modules/foo/node_modules/@scope'
|
7 | * do not physically exist, but we must pretend they do exist if package `foo` has dependencies
|
8 | * and there is some package `@scope/bar` inside these dependencies. We need two things to emulate
|
9 | * these dirs existence:
|
10 | *
|
11 | * 1. List of entries in these dirs. We retrieve them by calling PnP API and getting dependencies
|
12 | * for the issuer `.../foo/` and store into `dirList` field
|
13 | * 2. And we need either fake stats or we can forward underlying fs to stat the issuer dir.
|
14 | * The issuer dir exists on fs. We store issuer dir into `statPath` field
|
15 | */
|
16 | export interface ResolvedPath {
|
17 | /**
|
18 | * Fully resolved path `/node_modules/...` path within PnP project
|
19 | */
|
20 | resolvedPath: PortablePath;
|
21 | /**
|
22 | * This field is returned for pathes ending with `/node_modules[/@scope]`.
|
23 | *
|
24 | * These pathes are special in the sense they do not exists as physical dirs in PnP projects.
|
25 | *
|
26 | * We emulate these pathes by forwarding to real physical path on underlying fs.
|
27 | */
|
28 | forwardedDirPath?: PortablePath;
|
29 | /**
|
30 | * Directory entries list, returned for pathes ending with `/node_modules[/@scope]`
|
31 | */
|
32 | dirList?: Set<Filename>;
|
33 | /**
|
34 | * If true, the entry is meant to be a symbolic link to the location pointed by resolvedPath.
|
35 | */
|
36 | isSymlink?: boolean;
|
37 | }
|
38 | /**
|
39 | * Resolves paths containing `/node_modules` inside PnP projects. If path is outside PnP
|
40 | * project it is not changed.
|
41 | *
|
42 | * @param inputPath full path containing `node_modules`
|
43 | *
|
44 | * @returns resolved path
|
45 | */
|
46 | export declare const resolveNodeModulesPath: (inputPath: PortablePath, nodeModulesTree: NodeModulesTree) => ResolvedPath;
|