dependabot-npm_and_yarn 0.217.0 → 0.219.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a823eeb3c53a01ed5def55c048e922f0d7a0321b3c0e3a5fb72a6d6a00fbf46b
4
- data.tar.gz: '086d8ec9bd1a36a0fb1c65f2eba91e8b5f6d6c64a3cf700774a275eeb07f3767'
3
+ metadata.gz: 52b96c5a1b446a0f40069145f66c08157c4527a46b69d34950682ba6d9314d52
4
+ data.tar.gz: fd8a27a2f2861e19335b5a22dc7f924db28d012ab13dca6080dbe942274f84d8
5
5
  SHA512:
6
- metadata.gz: a0d9706d209830b65e374334508f962a93442f48e7fd024f0a0436edb8381e3388e52f08ce1acaef7b39fc4a72a5a1df05813128e03c429a90ab971ef37969a7
7
- data.tar.gz: cd710eb25983ce630ddfd87e816ab7c0f99264f78f2251c96393ebc32eba4b6c844a319c4f4b25113e46a1c4b2b48ff65a5f00a3a3f9d9b6601c4b71cb8c8e94
6
+ metadata.gz: 96d9e21b4e4244ae17342d1c2bd3a8027ace795abb4c464631d37c712cd3c5071bea5ebf1019e5a20bf8ef03029dc67e138a2bb988c5aa95c9950b44a228dbc0
7
+ data.tar.gz: 65fddbca2e316348df46fff16ccd76030dbb4f41010fbc5470b04cf885113864475619055fb23ef663b7b06b28f13ea9cb05f7ab57419f23e6b5d9a988a617a3
@@ -0,0 +1,5 @@
1
+ const lockfileParser = require("./lockfile-parser");
2
+
3
+ module.exports = {
4
+ parseLockfile: lockfileParser.parse,
5
+ };
@@ -0,0 +1,77 @@
1
+ /* PNPM-LOCK.YAML PARSER
2
+ *
3
+ * Inputs:
4
+ * - directory containing a pnpm-lock.yaml file
5
+ *
6
+ * Outputs:
7
+ * - JSON formatted information of dependencies (name, version, dependency-type)
8
+ */
9
+ const { readWantedLockfile } = require("@pnpm/lockfile-file");
10
+ const dependencyPath = require("@pnpm/dependency-path");
11
+
12
+ async function parse(directory) {
13
+ const lockfile = await readWantedLockfile(directory, {
14
+ ignoreIncompatible: true
15
+ });
16
+
17
+ return Object.entries(lockfile.packages ?? {})
18
+ .map(([depPath, pkgSnapshot]) => nameVerDevFromPkgSnapshot(depPath, pkgSnapshot, Object.values(lockfile.importers)))
19
+ }
20
+
21
+ function nameVerDevFromPkgSnapshot(depPath, pkgSnapshot, projectSnapshots) {
22
+ let name;
23
+ let version;
24
+
25
+ if (!pkgSnapshot.name) {
26
+ const pkgInfo = dependencyPath.parse(depPath);
27
+ name = pkgInfo.name;
28
+ version = pkgInfo.version;
29
+ } else {
30
+ name = pkgSnapshot.name;
31
+ version = pkgSnapshot.version;
32
+ }
33
+
34
+ let specifiers = [];
35
+ let aliased = false;
36
+
37
+ projectSnapshots.every(projectSnapshot => {
38
+ const projectSpecifiers = projectSnapshot.specifiers;
39
+
40
+ if (Object.values(projectSpecifiers).some(specifier => specifier.startsWith(`npm:${name}@`) || specifier == `npm:${name}`)) {
41
+ aliased = true;
42
+ return false;
43
+ }
44
+
45
+ currentSpecifier = projectSpecifiers[name];
46
+
47
+ if (!currentSpecifier) {
48
+ return true;
49
+ }
50
+
51
+ let specifierVersion = currentSpecifier.version;
52
+
53
+ if (!currentSpecifier.version) {
54
+ specifierVersion = projectSnapshot.dependencies?.[name] || projectSnapshot.devDependencies?.[name] || projectSnapshot.optionalDependencies?.[name]
55
+ }
56
+
57
+ if (
58
+ specifierVersion == version ||
59
+ specifierVersion.startsWith(`${version}_`) || // lockfileVersion 5.4
60
+ specifierVersion.startsWith(`${version}(`) // lockfileVersion 6.0
61
+ ) {
62
+ specifiers.push(currentSpecifier.specifier || currentSpecifier);
63
+ }
64
+
65
+ return true;
66
+ });
67
+
68
+ return {
69
+ name: name,
70
+ version: version,
71
+ dev: pkgSnapshot.dev,
72
+ specifiers: specifiers,
73
+ aliased: aliased
74
+ }
75
+ }
76
+
77
+ module.exports = { parse };