dependabot-npm_and_yarn 0.216.1 → 0.217.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/package-lock.json +33 -30
- data/helpers/package.json +2 -2
- data/lib/dependabot/npm_and_yarn/file_fetcher.rb +54 -19
- data/lib/dependabot/npm_and_yarn/helpers.rb +8 -0
- data/lib/dependabot/npm_and_yarn/update_checker/latest_version_finder.rb +2 -2
- data/lib/dependabot/npm_and_yarn/update_checker/subdependency_version_resolver.rb +1 -1
- data/lib/dependabot/npm_and_yarn/update_checker/version_resolver.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a823eeb3c53a01ed5def55c048e922f0d7a0321b3c0e3a5fb72a6d6a00fbf46b
|
4
|
+
data.tar.gz: '086d8ec9bd1a36a0fb1c65f2eba91e8b5f6d6c64a3cf700774a275eeb07f3767'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0d9706d209830b65e374334508f962a93442f48e7fd024f0a0436edb8381e3388e52f08ce1acaef7b39fc4a72a5a1df05813128e03c429a90ab971ef37969a7
|
7
|
+
data.tar.gz: cd710eb25983ce630ddfd87e816ab7c0f99264f78f2251c96393ebc32eba4b6c844a319c4f4b25113e46a1c4b2b48ff65a5f00a3a3f9d9b6601c4b71cb8c8e94
|
data/helpers/package-lock.json
CHANGED
@@ -17,10 +17,10 @@
|
|
17
17
|
"helper": "run.js"
|
18
18
|
},
|
19
19
|
"devDependencies": {
|
20
|
-
"eslint": "^8.
|
20
|
+
"eslint": "^8.39.0",
|
21
21
|
"eslint-config-prettier": "^8.8.0",
|
22
22
|
"jest": "^29.5.0",
|
23
|
-
"prettier": "^2.8.
|
23
|
+
"prettier": "^2.8.8"
|
24
24
|
}
|
25
25
|
},
|
26
26
|
"node_modules/@ampproject/remapping": {
|
@@ -799,9 +799,9 @@
|
|
799
799
|
"dev": true
|
800
800
|
},
|
801
801
|
"node_modules/@eslint/js": {
|
802
|
-
"version": "8.
|
803
|
-
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.
|
804
|
-
"integrity": "sha512-
|
802
|
+
"version": "8.39.0",
|
803
|
+
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.39.0.tgz",
|
804
|
+
"integrity": "sha512-kf9RB0Fg7NZfap83B3QOqOGg9QmD9yBudqQXzzOtn3i4y7ZUXe5ONeW34Gwi+TxhH4mvj72R1Zc300KUMa9Bng==",
|
805
805
|
"dev": true,
|
806
806
|
"engines": {
|
807
807
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
@@ -3675,15 +3675,15 @@
|
|
3675
3675
|
}
|
3676
3676
|
},
|
3677
3677
|
"node_modules/eslint": {
|
3678
|
-
"version": "8.
|
3679
|
-
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.
|
3680
|
-
"integrity": "sha512-
|
3678
|
+
"version": "8.39.0",
|
3679
|
+
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.39.0.tgz",
|
3680
|
+
"integrity": "sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og==",
|
3681
3681
|
"dev": true,
|
3682
3682
|
"dependencies": {
|
3683
3683
|
"@eslint-community/eslint-utils": "^4.2.0",
|
3684
3684
|
"@eslint-community/regexpp": "^4.4.0",
|
3685
3685
|
"@eslint/eslintrc": "^2.0.2",
|
3686
|
-
"@eslint/js": "8.
|
3686
|
+
"@eslint/js": "8.39.0",
|
3687
3687
|
"@humanwhocodes/config-array": "^0.11.8",
|
3688
3688
|
"@humanwhocodes/module-importer": "^1.0.1",
|
3689
3689
|
"@nodelib/fs.walk": "^1.2.8",
|
@@ -3693,7 +3693,7 @@
|
|
3693
3693
|
"debug": "^4.3.2",
|
3694
3694
|
"doctrine": "^3.0.0",
|
3695
3695
|
"escape-string-regexp": "^4.0.0",
|
3696
|
-
"eslint-scope": "^7.
|
3696
|
+
"eslint-scope": "^7.2.0",
|
3697
3697
|
"eslint-visitor-keys": "^3.4.0",
|
3698
3698
|
"espree": "^9.5.1",
|
3699
3699
|
"esquery": "^1.4.2",
|
@@ -3744,9 +3744,9 @@
|
|
3744
3744
|
}
|
3745
3745
|
},
|
3746
3746
|
"node_modules/eslint-scope": {
|
3747
|
-
"version": "7.
|
3748
|
-
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.
|
3749
|
-
"integrity": "sha512-
|
3747
|
+
"version": "7.2.0",
|
3748
|
+
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz",
|
3749
|
+
"integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==",
|
3750
3750
|
"dev": true,
|
3751
3751
|
"dependencies": {
|
3752
3752
|
"esrecurse": "^4.3.0",
|
@@ -3754,6 +3754,9 @@
|
|
3754
3754
|
},
|
3755
3755
|
"engines": {
|
3756
3756
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
3757
|
+
},
|
3758
|
+
"funding": {
|
3759
|
+
"url": "https://opencollective.com/eslint"
|
3757
3760
|
}
|
3758
3761
|
},
|
3759
3762
|
"node_modules/eslint-visitor-keys": {
|
@@ -13227,9 +13230,9 @@
|
|
13227
13230
|
}
|
13228
13231
|
},
|
13229
13232
|
"node_modules/prettier": {
|
13230
|
-
"version": "2.8.
|
13231
|
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.
|
13232
|
-
"integrity": "sha512-
|
13233
|
+
"version": "2.8.8",
|
13234
|
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
|
13235
|
+
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
|
13233
13236
|
"dev": true,
|
13234
13237
|
"bin": {
|
13235
13238
|
"prettier": "bin-prettier.js"
|
@@ -15637,9 +15640,9 @@
|
|
15637
15640
|
}
|
15638
15641
|
},
|
15639
15642
|
"@eslint/js": {
|
15640
|
-
"version": "8.
|
15641
|
-
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.
|
15642
|
-
"integrity": "sha512-
|
15643
|
+
"version": "8.39.0",
|
15644
|
+
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.39.0.tgz",
|
15645
|
+
"integrity": "sha512-kf9RB0Fg7NZfap83B3QOqOGg9QmD9yBudqQXzzOtn3i4y7ZUXe5ONeW34Gwi+TxhH4mvj72R1Zc300KUMa9Bng==",
|
15643
15646
|
"dev": true
|
15644
15647
|
},
|
15645
15648
|
"@gar/promisify": {
|
@@ -17850,15 +17853,15 @@
|
|
17850
17853
|
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
17851
17854
|
},
|
17852
17855
|
"eslint": {
|
17853
|
-
"version": "8.
|
17854
|
-
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.
|
17855
|
-
"integrity": "sha512-
|
17856
|
+
"version": "8.39.0",
|
17857
|
+
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.39.0.tgz",
|
17858
|
+
"integrity": "sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og==",
|
17856
17859
|
"dev": true,
|
17857
17860
|
"requires": {
|
17858
17861
|
"@eslint-community/eslint-utils": "^4.2.0",
|
17859
17862
|
"@eslint-community/regexpp": "^4.4.0",
|
17860
17863
|
"@eslint/eslintrc": "^2.0.2",
|
17861
|
-
"@eslint/js": "8.
|
17864
|
+
"@eslint/js": "8.39.0",
|
17862
17865
|
"@humanwhocodes/config-array": "^0.11.8",
|
17863
17866
|
"@humanwhocodes/module-importer": "^1.0.1",
|
17864
17867
|
"@nodelib/fs.walk": "^1.2.8",
|
@@ -17868,7 +17871,7 @@
|
|
17868
17871
|
"debug": "^4.3.2",
|
17869
17872
|
"doctrine": "^3.0.0",
|
17870
17873
|
"escape-string-regexp": "^4.0.0",
|
17871
|
-
"eslint-scope": "^7.
|
17874
|
+
"eslint-scope": "^7.2.0",
|
17872
17875
|
"eslint-visitor-keys": "^3.4.0",
|
17873
17876
|
"espree": "^9.5.1",
|
17874
17877
|
"esquery": "^1.4.2",
|
@@ -18029,9 +18032,9 @@
|
|
18029
18032
|
"requires": {}
|
18030
18033
|
},
|
18031
18034
|
"eslint-scope": {
|
18032
|
-
"version": "7.
|
18033
|
-
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.
|
18034
|
-
"integrity": "sha512-
|
18035
|
+
"version": "7.2.0",
|
18036
|
+
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz",
|
18037
|
+
"integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==",
|
18035
18038
|
"dev": true,
|
18036
18039
|
"requires": {
|
18037
18040
|
"esrecurse": "^4.3.0",
|
@@ -24977,9 +24980,9 @@
|
|
24977
24980
|
"integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks="
|
24978
24981
|
},
|
24979
24982
|
"prettier": {
|
24980
|
-
"version": "2.8.
|
24981
|
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.
|
24982
|
-
"integrity": "sha512-
|
24983
|
+
"version": "2.8.8",
|
24984
|
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
|
24985
|
+
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
|
24983
24986
|
"dev": true
|
24984
24987
|
},
|
24985
24988
|
"pretty-format": {
|
data/helpers/package.json
CHANGED
@@ -10,7 +10,7 @@ require "dependabot/npm_and_yarn/file_parser/lockfile_parser"
|
|
10
10
|
|
11
11
|
module Dependabot
|
12
12
|
module NpmAndYarn
|
13
|
-
class FileFetcher < Dependabot::FileFetchers::Base
|
13
|
+
class FileFetcher < Dependabot::FileFetchers::Base # rubocop:disable Metrics/ClassLength
|
14
14
|
require_relative "file_fetcher/path_dependency_builder"
|
15
15
|
|
16
16
|
# Npm always prefixes file paths in the lockfile "version" with "file:"
|
@@ -22,6 +22,7 @@ module Dependabot
|
|
22
22
|
# "yarn link", e.g. "link:react"
|
23
23
|
PATH_DEPENDENCY_STARTS = %w(file: link:. link:/ link:~/ / ./ ../ ~/).freeze
|
24
24
|
PATH_DEPENDENCY_CLEAN_REGEX = /^file:|^link:/
|
25
|
+
DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org"
|
25
26
|
|
26
27
|
def self.required_files_in?(filenames)
|
27
28
|
filenames.include?("package.json")
|
@@ -55,6 +56,7 @@ module Dependabot
|
|
55
56
|
package_managers["npm"] = Helpers.npm_version_numeric(package_lock.content) if package_lock
|
56
57
|
package_managers["yarn"] = yarn_version if yarn_version
|
57
58
|
package_managers["shrinkwrap"] = 1 if shrinkwrap
|
59
|
+
package_managers["unknown"] = 1 if package_managers.empty?
|
58
60
|
|
59
61
|
{
|
60
62
|
ecosystem: "npm",
|
@@ -67,43 +69,76 @@ module Dependabot
|
|
67
69
|
def fetch_files
|
68
70
|
fetched_files = []
|
69
71
|
fetched_files << package_json
|
70
|
-
fetched_files
|
71
|
-
fetched_files
|
72
|
-
fetched_files
|
73
|
-
fetched_files << lerna_json if lerna_json
|
74
|
-
fetched_files << npmrc if npmrc
|
75
|
-
fetched_files << yarnrc if yarnrc
|
76
|
-
fetched_files << yarnrc_yml if yarnrc_yml
|
72
|
+
fetched_files += npm_files
|
73
|
+
fetched_files += yarn_files
|
74
|
+
fetched_files += lerna_files
|
77
75
|
fetched_files += workspace_package_jsons
|
78
|
-
fetched_files += lerna_packages
|
79
76
|
fetched_files += path_dependencies(fetched_files)
|
80
77
|
|
81
|
-
fetched_files << inferred_npmrc if inferred_npmrc
|
82
|
-
|
83
78
|
fetched_files.uniq
|
84
79
|
end
|
85
80
|
|
81
|
+
def npm_files
|
82
|
+
fetched_npm_files = []
|
83
|
+
fetched_npm_files << package_lock if package_lock && !ignore_package_lock?
|
84
|
+
fetched_npm_files << shrinkwrap if shrinkwrap
|
85
|
+
fetched_npm_files << npmrc if npmrc
|
86
|
+
fetched_npm_files << inferred_npmrc if inferred_npmrc
|
87
|
+
fetched_npm_files
|
88
|
+
end
|
89
|
+
|
90
|
+
def yarn_files
|
91
|
+
fetched_yarn_files = []
|
92
|
+
fetched_yarn_files << yarn_lock if yarn_lock
|
93
|
+
fetched_yarn_files << yarnrc if yarnrc
|
94
|
+
fetched_yarn_files << yarnrc_yml if yarnrc_yml
|
95
|
+
fetched_yarn_files
|
96
|
+
end
|
97
|
+
|
98
|
+
def lerna_files
|
99
|
+
fetched_lerna_files = []
|
100
|
+
fetched_lerna_files << lerna_json if lerna_json
|
101
|
+
fetched_lerna_files += lerna_packages
|
102
|
+
fetched_lerna_files
|
103
|
+
end
|
104
|
+
|
86
105
|
# If every entry in the lockfile uses the same registry, we can infer
|
87
106
|
# that there is a global .npmrc file, so add it here as if it were in the repo.
|
88
|
-
|
107
|
+
|
108
|
+
def inferred_npmrc # rubocop:disable Metrics/PerceivedComplexity
|
89
109
|
return @inferred_npmrc if defined?(@inferred_npmrc)
|
90
110
|
return @inferred_npmrc = nil unless npmrc.nil? && package_lock
|
91
111
|
|
92
112
|
known_registries = []
|
93
|
-
JSON.parse(package_lock.content).fetch("dependencies", {}).each do |
|
94
|
-
resolved = details.fetch("resolved",
|
113
|
+
JSON.parse(package_lock.content).fetch("dependencies", {}).each do |dependency_name, details|
|
114
|
+
resolved = details.fetch("resolved", DEFAULT_NPM_REGISTRY)
|
115
|
+
|
95
116
|
begin
|
96
117
|
uri = URI.parse(resolved)
|
97
118
|
rescue URI::InvalidURIError
|
98
119
|
# Ignoring non-URIs since they're not registries.
|
99
|
-
# This can happen if resolved is false
|
120
|
+
# This can happen if resolved is `false`, for instance
|
121
|
+
# npm6 bug https://github.com/npm/cli/issues/1138
|
100
122
|
next
|
101
123
|
end
|
102
|
-
|
103
|
-
|
124
|
+
|
125
|
+
next unless uri.scheme && uri.host
|
126
|
+
|
127
|
+
known_registry = "#{uri.scheme}://#{uri.host}"
|
128
|
+
path = uri.path
|
129
|
+
|
130
|
+
next unless path
|
131
|
+
|
132
|
+
index = path.index(dependency_name)
|
133
|
+
if index
|
134
|
+
registry_base_path = path[0...index].delete_suffix("/")
|
135
|
+
known_registry << registry_base_path
|
136
|
+
end
|
137
|
+
|
138
|
+
known_registries << known_registry
|
104
139
|
end
|
105
140
|
|
106
|
-
if known_registries.uniq.length == 1 && known_registries.first !=
|
141
|
+
if known_registries.uniq.length == 1 && known_registries.first != DEFAULT_NPM_REGISTRY
|
107
142
|
Dependabot.logger.info("Inferred global NPM registry is: #{known_registries.first}")
|
108
143
|
return @inferred_npmrc = Dependabot::DependencyFile.new(
|
109
144
|
name: ".npmrc",
|
@@ -121,7 +156,7 @@ module Dependabot
|
|
121
156
|
if (package_manager = package.fetch("packageManager", nil))
|
122
157
|
get_yarn_version_from_package_json(package_manager)
|
123
158
|
elsif yarn_lock
|
124
|
-
|
159
|
+
Helpers.yarn_version_numeric(yarn_lock)
|
125
160
|
end
|
126
161
|
end
|
127
162
|
|
@@ -16,6 +16,14 @@ module Dependabot
|
|
16
16
|
6
|
17
17
|
end
|
18
18
|
|
19
|
+
def self.yarn_version_numeric(yarn_lock)
|
20
|
+
if yarn_berry?(yarn_lock)
|
21
|
+
3
|
22
|
+
else
|
23
|
+
1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
19
27
|
def self.fetch_yarnrc_yml_value(key, default_value)
|
20
28
|
if File.exist?(".yarnrc.yml") && (yarnrc = YAML.load_file(".yarnrc.yml"))
|
21
29
|
yarnrc.fetch(key, default_value)
|
@@ -375,11 +375,11 @@ module Dependabot
|
|
375
375
|
end
|
376
376
|
|
377
377
|
def version_class
|
378
|
-
|
378
|
+
dependency.version_class
|
379
379
|
end
|
380
380
|
|
381
381
|
def requirement_class
|
382
|
-
|
382
|
+
dependency.requirement_class
|
383
383
|
end
|
384
384
|
|
385
385
|
def npmrc_file
|
@@ -642,11 +642,11 @@ module Dependabot
|
|
642
642
|
end
|
643
643
|
|
644
644
|
def version_class
|
645
|
-
|
645
|
+
dependency.version_class
|
646
646
|
end
|
647
647
|
|
648
648
|
def requirement_class
|
649
|
-
|
649
|
+
dependency.requirement_class
|
650
650
|
end
|
651
651
|
|
652
652
|
def version_regex
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-npm_and_yarn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.217.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.217.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.217.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: debug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|