@pnpm/reviewing.dependencies-hierarchy 1.0.0

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.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
4
+ Copyright (c) 2016-2022 Zoltan Kochan and other contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @pnpm/reviewing.dependencies-hierarchy
2
+
3
+ > Creates a dependencies hierarchy for a symlinked \`node_modules\`
4
+
5
+ <!--@shields('npm')-->
6
+ [![npm version](https://img.shields.io/npm/v/dependencies-hierarchy.svg)](https://www.npmjs.com/package/dependencies-hierarchy)
7
+ <!--/@-->
8
+
9
+ A symlinked `node_modules` is created when installing using [pnpm](https://github.com/pnpm/pnpm).
10
+
11
+ ## Installation
12
+
13
+ ```
14
+ pnpm add @pnpm/reviewing.dependencies-hierarchy
15
+ ```
16
+
17
+ ## License
18
+
19
+ MIT
package/lib/index.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { DependenciesField, Registries } from '@pnpm/types';
2
+ export type SearchFunction = (pkg: {
3
+ name: string;
4
+ version: string;
5
+ }) => boolean;
6
+ export interface PackageNode {
7
+ alias: string;
8
+ circular?: true;
9
+ dependencies?: PackageNode[];
10
+ dev?: boolean;
11
+ isPeer: boolean;
12
+ isSkipped: boolean;
13
+ isMissing: boolean;
14
+ name: string;
15
+ optional?: true;
16
+ path: string;
17
+ resolved?: string;
18
+ searched?: true;
19
+ version: string;
20
+ }
21
+ export interface DependenciesHierarchy {
22
+ dependencies?: PackageNode[];
23
+ devDependencies?: PackageNode[];
24
+ optionalDependencies?: PackageNode[];
25
+ unsavedDependencies?: PackageNode[];
26
+ }
27
+ export declare function buildDependenciesHierarchy(projectPaths: string[], maybeOpts: {
28
+ depth: number;
29
+ include?: {
30
+ [dependenciesField in DependenciesField]: boolean;
31
+ };
32
+ registries?: Registries;
33
+ search?: SearchFunction;
34
+ lockfileDir: string;
35
+ }): Promise<{
36
+ [projectDir: string]: DependenciesHierarchy;
37
+ }>;
package/lib/index.js ADDED
@@ -0,0 +1,314 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildDependenciesHierarchy = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const lockfile_file_1 = require("@pnpm/lockfile-file");
9
+ const lockfile_utils_1 = require("@pnpm/lockfile-utils");
10
+ const modules_yaml_1 = require("@pnpm/modules-yaml");
11
+ const normalize_registries_1 = require("@pnpm/normalize-registries");
12
+ const read_modules_dir_1 = require("@pnpm/read-modules-dir");
13
+ const read_package_json_1 = require("@pnpm/read-package-json");
14
+ const types_1 = require("@pnpm/types");
15
+ const dependency_path_1 = require("@pnpm/dependency-path");
16
+ const normalize_path_1 = __importDefault(require("normalize-path"));
17
+ const realpath_missing_1 = __importDefault(require("realpath-missing"));
18
+ const resolve_link_target_1 = __importDefault(require("resolve-link-target"));
19
+ async function buildDependenciesHierarchy(projectPaths, maybeOpts) {
20
+ if (!maybeOpts?.lockfileDir) {
21
+ throw new TypeError('opts.lockfileDir is required');
22
+ }
23
+ const modulesDir = await (0, realpath_missing_1.default)(path_1.default.join(maybeOpts.lockfileDir, 'node_modules'));
24
+ const modules = await (0, modules_yaml_1.readModulesManifest)(modulesDir);
25
+ const registries = (0, normalize_registries_1.normalizeRegistries)({
26
+ ...maybeOpts?.registries,
27
+ ...modules?.registries,
28
+ });
29
+ const currentLockfile = (modules?.virtualStoreDir && await (0, lockfile_file_1.readCurrentLockfile)(modules.virtualStoreDir, { ignoreIncompatible: false })) ?? null;
30
+ const result = {};
31
+ if (!currentLockfile) {
32
+ for (const projectPath of projectPaths) {
33
+ result[projectPath] = {};
34
+ }
35
+ return result;
36
+ }
37
+ const opts = {
38
+ depth: maybeOpts.depth || 0,
39
+ include: maybeOpts.include ?? {
40
+ dependencies: true,
41
+ devDependencies: true,
42
+ optionalDependencies: true,
43
+ },
44
+ lockfileDir: maybeOpts.lockfileDir,
45
+ registries,
46
+ search: maybeOpts.search,
47
+ skipped: new Set(modules?.skipped ?? []),
48
+ };
49
+ (await Promise.all(projectPaths.map(async (projectPath) => {
50
+ return [
51
+ projectPath,
52
+ await dependenciesHierarchyForPackage(projectPath, currentLockfile, opts),
53
+ ];
54
+ }))).forEach(([projectPath, dependenciesHierarchy]) => {
55
+ result[projectPath] = dependenciesHierarchy;
56
+ });
57
+ return result;
58
+ }
59
+ exports.buildDependenciesHierarchy = buildDependenciesHierarchy;
60
+ async function dependenciesHierarchyForPackage(projectPath, currentLockfile, opts) {
61
+ const importerId = (0, lockfile_file_1.getLockfileImporterId)(opts.lockfileDir, projectPath);
62
+ if (!currentLockfile.importers[importerId])
63
+ return {};
64
+ const modulesDir = path_1.default.join(projectPath, 'node_modules');
65
+ const savedDeps = getAllDirectDependencies(currentLockfile.importers[importerId]);
66
+ const allDirectDeps = await (0, read_modules_dir_1.readModulesDir)(modulesDir) ?? [];
67
+ const unsavedDeps = allDirectDeps.filter((directDep) => !savedDeps[directDep]);
68
+ const wantedLockfile = await (0, lockfile_file_1.readWantedLockfile)(opts.lockfileDir, { ignoreIncompatible: false }) ?? { packages: {} };
69
+ const getChildrenTree = getTree.bind(null, {
70
+ currentDepth: 1,
71
+ currentPackages: currentLockfile.packages ?? {},
72
+ includeOptionalDependencies: opts.include.optionalDependencies,
73
+ lockfileDir: opts.lockfileDir,
74
+ maxDepth: opts.depth,
75
+ modulesDir,
76
+ registries: opts.registries,
77
+ search: opts.search,
78
+ skipped: opts.skipped,
79
+ wantedPackages: wantedLockfile.packages ?? {},
80
+ });
81
+ const result = {};
82
+ for (const dependenciesField of types_1.DEPENDENCIES_FIELDS.sort().filter(dependenciedField => opts.include[dependenciedField])) {
83
+ const topDeps = currentLockfile.importers[importerId][dependenciesField] ?? {};
84
+ result[dependenciesField] = [];
85
+ Object.entries(topDeps).forEach(([alias, ref]) => {
86
+ const { packageInfo, packageAbsolutePath } = getPkgInfo({
87
+ alias,
88
+ currentPackages: currentLockfile.packages ?? {},
89
+ lockfileDir: opts.lockfileDir,
90
+ modulesDir,
91
+ ref,
92
+ registries: opts.registries,
93
+ skipped: opts.skipped,
94
+ wantedPackages: wantedLockfile.packages ?? {},
95
+ });
96
+ let newEntry = null;
97
+ const matchedSearched = opts.search?.(packageInfo);
98
+ if (packageAbsolutePath === null) {
99
+ if ((opts.search != null) && !matchedSearched)
100
+ return;
101
+ newEntry = packageInfo;
102
+ }
103
+ else {
104
+ const relativeId = (0, dependency_path_1.refToRelative)(ref, alias);
105
+ if (relativeId) {
106
+ const dependencies = getChildrenTree([relativeId], relativeId);
107
+ if (dependencies.length > 0) {
108
+ newEntry = {
109
+ ...packageInfo,
110
+ dependencies,
111
+ };
112
+ }
113
+ else if ((opts.search == null) || matchedSearched) {
114
+ newEntry = packageInfo;
115
+ }
116
+ }
117
+ }
118
+ if (newEntry != null) {
119
+ if (matchedSearched) {
120
+ newEntry.searched = true;
121
+ }
122
+ result[dependenciesField].push(newEntry);
123
+ }
124
+ });
125
+ }
126
+ await Promise.all(unsavedDeps.map(async (unsavedDep) => {
127
+ let pkgPath = path_1.default.join(modulesDir, unsavedDep);
128
+ let version;
129
+ try {
130
+ pkgPath = await (0, resolve_link_target_1.default)(pkgPath);
131
+ version = `link:${(0, normalize_path_1.default)(path_1.default.relative(projectPath, pkgPath))}`;
132
+ }
133
+ catch (err) { // eslint-disable-line
134
+ // if error happened. The package is not a link
135
+ const pkg = await (0, read_package_json_1.safeReadPackageJsonFromDir)(pkgPath);
136
+ version = pkg?.version ?? 'undefined';
137
+ }
138
+ const pkg = {
139
+ alias: unsavedDep,
140
+ isMissing: false,
141
+ isPeer: false,
142
+ isSkipped: false,
143
+ name: unsavedDep,
144
+ path: pkgPath,
145
+ version,
146
+ };
147
+ const matchedSearched = opts.search?.(pkg);
148
+ if ((opts.search != null) && !matchedSearched)
149
+ return;
150
+ const newEntry = pkg;
151
+ if (matchedSearched) {
152
+ newEntry.searched = true;
153
+ }
154
+ result.unsavedDependencies = result.unsavedDependencies ?? [];
155
+ result.unsavedDependencies.push(newEntry);
156
+ }));
157
+ return result;
158
+ }
159
+ function getAllDirectDependencies(projectSnapshot) {
160
+ return {
161
+ ...projectSnapshot.dependencies,
162
+ ...projectSnapshot.devDependencies,
163
+ ...projectSnapshot.optionalDependencies,
164
+ };
165
+ }
166
+ function getTree(opts, keypath, parentId) {
167
+ const dependenciesCache = new Map();
168
+ return getTreeHelper(dependenciesCache, opts, keypath, parentId).dependencies;
169
+ }
170
+ function getTreeHelper(dependenciesCache, opts, keypath, parentId) {
171
+ const result = { dependencies: [] };
172
+ if (opts.currentDepth > opts.maxDepth || !opts.currentPackages || !opts.currentPackages[parentId])
173
+ return result;
174
+ const deps = !opts.includeOptionalDependencies
175
+ ? opts.currentPackages[parentId].dependencies
176
+ : {
177
+ ...opts.currentPackages[parentId].dependencies,
178
+ ...opts.currentPackages[parentId].optionalDependencies,
179
+ };
180
+ if (deps == null)
181
+ return result;
182
+ const getChildrenTree = getTreeHelper.bind(null, dependenciesCache, {
183
+ ...opts,
184
+ currentDepth: opts.currentDepth + 1,
185
+ });
186
+ const peers = new Set(Object.keys(opts.currentPackages[parentId].peerDependencies ?? {}));
187
+ Object.entries(deps).forEach(([alias, ref]) => {
188
+ const { packageInfo, packageAbsolutePath } = getPkgInfo({
189
+ alias,
190
+ currentPackages: opts.currentPackages,
191
+ lockfileDir: opts.lockfileDir,
192
+ modulesDir: opts.modulesDir,
193
+ peers,
194
+ ref,
195
+ registries: opts.registries,
196
+ skipped: opts.skipped,
197
+ wantedPackages: opts.wantedPackages,
198
+ });
199
+ let circular;
200
+ const matchedSearched = opts.search?.(packageInfo);
201
+ let newEntry = null;
202
+ if (packageAbsolutePath === null) {
203
+ circular = false;
204
+ if (opts.search == null || matchedSearched) {
205
+ newEntry = packageInfo;
206
+ }
207
+ }
208
+ else {
209
+ let dependencies;
210
+ const relativeId = (0, dependency_path_1.refToRelative)(ref, alias); // we know for sure that relative is not null if pkgPath is not null
211
+ circular = keypath.includes(relativeId);
212
+ if (circular) {
213
+ dependencies = [];
214
+ }
215
+ else {
216
+ dependencies = dependenciesCache.get(packageAbsolutePath);
217
+ if (dependencies == null) {
218
+ const children = getChildrenTree(keypath.concat([relativeId]), relativeId);
219
+ dependencies = children.dependencies;
220
+ if (children.circular) {
221
+ result.circular = true;
222
+ }
223
+ else {
224
+ dependenciesCache.set(packageAbsolutePath, dependencies);
225
+ }
226
+ }
227
+ }
228
+ if (dependencies.length > 0) {
229
+ newEntry = {
230
+ ...packageInfo,
231
+ dependencies,
232
+ };
233
+ }
234
+ else if ((opts.search == null) || matchedSearched) {
235
+ newEntry = packageInfo;
236
+ }
237
+ }
238
+ if (newEntry != null) {
239
+ if (circular) {
240
+ newEntry.circular = true;
241
+ result.circular = true;
242
+ }
243
+ if (matchedSearched) {
244
+ newEntry.searched = true;
245
+ }
246
+ result.dependencies.push(newEntry);
247
+ }
248
+ });
249
+ return result;
250
+ }
251
+ function getPkgInfo(opts) {
252
+ let name;
253
+ let version;
254
+ let resolved;
255
+ let dev;
256
+ let optional;
257
+ let isSkipped = false;
258
+ let isMissing = false;
259
+ const depPath = (0, dependency_path_1.refToRelative)(opts.ref, opts.alias);
260
+ if (depPath) {
261
+ let pkgSnapshot;
262
+ if (opts.currentPackages[depPath]) {
263
+ pkgSnapshot = opts.currentPackages[depPath];
264
+ const parsed = (0, lockfile_utils_1.nameVerFromPkgSnapshot)(depPath, pkgSnapshot);
265
+ name = parsed.name;
266
+ version = parsed.version;
267
+ }
268
+ else {
269
+ pkgSnapshot = opts.wantedPackages[depPath];
270
+ if (pkgSnapshot) {
271
+ const parsed = (0, lockfile_utils_1.nameVerFromPkgSnapshot)(depPath, pkgSnapshot);
272
+ name = parsed.name;
273
+ version = parsed.version;
274
+ }
275
+ else {
276
+ name = opts.alias;
277
+ version = opts.ref;
278
+ }
279
+ isMissing = true;
280
+ isSkipped = opts.skipped.has(depPath);
281
+ }
282
+ resolved = (0, lockfile_utils_1.pkgSnapshotToResolution)(depPath, pkgSnapshot, opts.registries)['tarball'];
283
+ dev = pkgSnapshot.dev;
284
+ optional = pkgSnapshot.optional;
285
+ }
286
+ else {
287
+ name = opts.alias;
288
+ version = opts.ref;
289
+ }
290
+ const packageAbsolutePath = (0, dependency_path_1.refToRelative)(opts.ref, opts.alias);
291
+ const packageInfo = {
292
+ alias: opts.alias,
293
+ isMissing,
294
+ isPeer: Boolean(opts.peers?.has(opts.alias)),
295
+ isSkipped,
296
+ name,
297
+ path: depPath ? path_1.default.join(opts.modulesDir, '.pnpm', (0, dependency_path_1.depPathToFilename)(depPath)) : path_1.default.join(opts.modulesDir, '..', opts.ref.slice(5)),
298
+ version,
299
+ };
300
+ if (resolved) {
301
+ packageInfo['resolved'] = resolved;
302
+ }
303
+ if (optional === true) {
304
+ packageInfo['optional'] = true;
305
+ }
306
+ if (typeof dev === 'boolean') {
307
+ packageInfo['dev'] = dev;
308
+ }
309
+ return {
310
+ packageAbsolutePath,
311
+ packageInfo,
312
+ };
313
+ }
314
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,uDAQ4B;AAC5B,yDAG6B;AAC7B,qDAAwD;AACxD,qEAAgE;AAChE,6DAAuD;AACvD,+DAAoE;AACpE,uCAAgF;AAChF,2DAAwE;AACxE,oEAA0C;AAC1C,wEAA8C;AAC9C,8EAAmD;AA2B5C,KAAK,UAAU,0BAA0B,CAC9C,YAAsB,EACtB,SAMC;IAED,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE;QAC3B,MAAM,IAAI,SAAS,CAAC,8BAA8B,CAAC,CAAA;KACpD;IACD,MAAM,UAAU,GAAG,MAAM,IAAA,0BAAe,EAAC,cAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAA;IAC1F,MAAM,OAAO,GAAG,MAAM,IAAA,kCAAmB,EAAC,UAAU,CAAC,CAAA;IACrD,MAAM,UAAU,GAAG,IAAA,0CAAmB,EAAC;QACrC,GAAG,SAAS,EAAE,UAAU;QACxB,GAAG,OAAO,EAAE,UAAU;KACvB,CAAC,CAAA;IACF,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,eAAe,IAAI,MAAM,IAAA,mCAAmB,EAAC,OAAO,CAAC,eAAe,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,IAAI,CAAA;IAE/I,MAAM,MAAM,GAAG,EAAqD,CAAA;IAEpE,IAAI,CAAC,eAAe,EAAE;QACpB,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE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CAAA;IAC/D,MAAM,WAAW,GAAG;QAClB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,SAAS;QACT,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,SAAS;QACT,IAAI;QACJ,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,IAAA,mCAAiB,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACrI,OAAO;KACR,CAAA;IACD,IAAI,QAAQ,EAAE;QACZ,WAAW,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAA;KACnC;IACD,IAAI,QAAQ,KAAK,IAAI,EAAE;QACrB,WAAW,CAAC,UAAU,CAAC,GAAG,IAAI,CAAA;KAC/B;IACD,IAAI,OAAO,GAAG,KAAK,SAAS,EAAE;QAC5B,WAAW,CAAC,KAAK,CAAC,GAAG,GAAG,CAAA;KACzB;IACD,OAAO;QACL,mBAAmB;QACnB,WAAW;KACZ,CAAA;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@pnpm/reviewing.dependencies-hierarchy",
3
+ "version": "1.0.0",
4
+ "description": "Creates a dependencies hierarchy for a symlinked `node_modules`",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "files": [
8
+ "lib",
9
+ "!*.map"
10
+ ],
11
+ "engines": {
12
+ "node": ">=14.6"
13
+ },
14
+ "repository": "https://github.com/pnpm/pnpm/blob/main/reviewing/dependencies-hierarchy",
15
+ "keywords": [
16
+ "pnpm7",
17
+ "hierarchy",
18
+ "pnpm",
19
+ "dependencies",
20
+ "node_modules"
21
+ ],
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/pnpm/pnpm/issues"
25
+ },
26
+ "homepage": "https://github.com/pnpm/pnpm/blob/main/reviewing/dependencies-hierarchy#readme",
27
+ "dependencies": {
28
+ "normalize-path": "^3.0.0",
29
+ "realpath-missing": "^1.1.0",
30
+ "resolve-link-target": "^2.0.0",
31
+ "@pnpm/lockfile-utils": "5.0.1",
32
+ "@pnpm/lockfile-file": "6.0.4",
33
+ "@pnpm/modules-yaml": "11.0.2",
34
+ "@pnpm/read-modules-dir": "5.0.0",
35
+ "@pnpm/normalize-registries": "4.0.2",
36
+ "@pnpm/read-package-json": "7.0.3",
37
+ "@pnpm/types": "8.9.0",
38
+ "@pnpm/dependency-path": "1.0.0"
39
+ },
40
+ "devDependencies": {
41
+ "@types/normalize-path": "^3.0.0",
42
+ "@pnpm/constants": "6.1.0",
43
+ "@pnpm/test-fixtures": "0.0.27",
44
+ "@pnpm/reviewing.dependencies-hierarchy": "1.0.0"
45
+ },
46
+ "funding": "https://opencollective.com/pnpm",
47
+ "exports": {
48
+ ".": "./lib/index.js"
49
+ },
50
+ "scripts": {
51
+ "lint": "eslint src/**/*.ts test/**/*.ts",
52
+ "_test": "jest",
53
+ "test": "pnpm run compile && pnpm run _test",
54
+ "compile": "tsc --build && pnpm run lint --fix"
55
+ }
56
+ }