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 +4 -4
- data/helpers/lib/pnpm/index.js +5 -0
- data/helpers/lib/pnpm/lockfile-parser.js +77 -0
- data/helpers/package-lock.json +794 -177
- data/helpers/package.json +2 -0
- data/lib/dependabot/npm_and_yarn/dependency_files_filterer.rb +33 -2
- data/lib/dependabot/npm_and_yarn/file_fetcher.rb +103 -46
- data/lib/dependabot/npm_and_yarn/file_parser/lockfile_parser.rb +13 -4
- data/lib/dependabot/npm_and_yarn/file_parser/pnpm_lock.rb +68 -0
- data/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb +6 -0
- data/lib/dependabot/npm_and_yarn/file_updater/npmrc_builder.rb +6 -4
- data/lib/dependabot/npm_and_yarn/file_updater/package_json_updater.rb +3 -2
- data/lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb +145 -0
- data/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb +1 -1
- data/lib/dependabot/npm_and_yarn/file_updater.rb +38 -1
- data/lib/dependabot/npm_and_yarn/helpers.rb +13 -0
- data/lib/dependabot/npm_and_yarn/package_manager.rb +19 -0
- data/lib/dependabot/npm_and_yarn/sub_dependency_files_filterer.rb +2 -1
- data/lib/dependabot/npm_and_yarn/update_checker/dependency_files_builder.rb +19 -2
- data/lib/dependabot/npm_and_yarn/update_checker/requirements_updater.rb +3 -1
- data/lib/dependabot/npm_and_yarn/update_checker/subdependency_version_resolver.rb +15 -5
- data/lib/dependabot/npm_and_yarn/update_checker/version_resolver.rb +56 -21
- data/lib/dependabot/npm_and_yarn/update_checker.rb +4 -0
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52b96c5a1b446a0f40069145f66c08157c4527a46b69d34950682ba6d9314d52
|
4
|
+
data.tar.gz: fd8a27a2f2861e19335b5a22dc7f924db28d012ab13dca6080dbe942274f84d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96d9e21b4e4244ae17342d1c2bd3a8027ace795abb4c464631d37c712cd3c5071bea5ebf1019e5a20bf8ef03029dc67e138a2bb988c5aa95c9950b44a228dbc0
|
7
|
+
data.tar.gz: 65fddbca2e316348df46fff16ccd76030dbb4f41010fbc5470b04cf885113864475619055fb23ef663b7b06b28f13ea9cb05f7ab57419f23e6b5d9a988a617a3
|
@@ -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 };
|