@yarnpkg/nm 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ import { Project, MessageName } from '@yarnpkg/core';
2
+ import { PortablePath, Filename } from '@yarnpkg/fslib';
3
+ import { PnpApi } from '@yarnpkg/pnp';
4
+ export declare enum LinkType {
5
+ HARD = "HARD",
6
+ SOFT = "SOFT"
7
+ }
8
+ export declare enum NodeModulesHoistingLimits {
9
+ WORKSPACES = "workspaces",
10
+ DEPENDENCIES = "dependencies",
11
+ NONE = "none"
12
+ }
13
+ export declare type NodeModulesBaseNode = {
14
+ dirList: Set<Filename>;
15
+ };
16
+ export declare type NodeModulesPackageNode = {
17
+ locator: LocatorKey;
18
+ target: PortablePath;
19
+ linkType: LinkType;
20
+ dirList?: undefined;
21
+ nodePath: string;
22
+ aliases: Array<string>;
23
+ };
24
+ /**
25
+ * Node modules tree - a map of every folder within the node_modules, along with their
26
+ * directory listing and whether they are a symlink and their location.
27
+ *
28
+ * Sample contents:
29
+ * /home/user/project/node_modules -> {dirList: ['foo', 'bar']}
30
+ * /home/user/project/node_modules/foo -> {target: '/home/user/project/.yarn/.cache/foo.zip/node_modules/foo', linkType: 'HARD'}
31
+ * /home/user/project/node_modules/bar -> {target: '/home/user/project/packages/bar', linkType: 'SOFT'}
32
+ */
33
+ export declare type NodeModulesTree = Map<PortablePath, NodeModulesBaseNode | NodeModulesPackageNode>;
34
+ export declare type NodeModulesTreeErrors = Array<{
35
+ messageName: MessageName;
36
+ text: string;
37
+ }>;
38
+ export interface NodeModulesTreeOptions {
39
+ pnpifyFs?: boolean;
40
+ validateExternalSoftLinks?: boolean;
41
+ hoistingLimitsByCwd?: Map<PortablePath, NodeModulesHoistingLimits>;
42
+ selfReferencesByCwd?: Map<PortablePath, Boolean>;
43
+ project?: Project;
44
+ }
45
+ /** Package locator key for usage inside maps */
46
+ declare type LocatorKey = string;
47
+ /**
48
+ * Returns path to archive, if package location is inside the archive.
49
+ *
50
+ * @param packagePath package location
51
+ *
52
+ * @returns path to archive is location is insde the archive or null otherwise
53
+ */
54
+ export declare const getArchivePath: (packagePath: PortablePath) => PortablePath | null;
55
+ /**
56
+ * Retrieve full package list and build hoisted `node_modules` directories
57
+ * representation in-memory.
58
+ *
59
+ * @param pnp PnP API
60
+ *
61
+ * @returns hoisted `node_modules` directories representation in-memory
62
+ */
63
+ export declare const buildNodeModulesTree: (pnp: PnpApi, options: NodeModulesTreeOptions) => {
64
+ tree: NodeModulesTree | null;
65
+ errors: NodeModulesTreeErrors;
66
+ preserveSymlinksRequired: boolean;
67
+ };
68
+ export declare type NodeModulesLocatorMap = Map<LocatorKey, {
69
+ target: PortablePath;
70
+ linkType: LinkType;
71
+ locations: Array<PortablePath>;
72
+ aliases: Array<string>;
73
+ }>;
74
+ export declare const buildLocatorMap: (nodeModulesTree: NodeModulesTree) => NodeModulesLocatorMap;
75
+ export {};