dependabot-npm_and_yarn 0.334.0 → 0.335.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.
- checksums.yaml +4 -4
- data/lib/dependabot/npm_and_yarn/constraint_helper.rb +30 -21
- data/lib/dependabot/npm_and_yarn/dependency_files_filterer.rb +12 -6
- data/lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb +21 -13
- data/lib/dependabot/npm_and_yarn/file_fetcher.rb +14 -7
- data/lib/dependabot/npm_and_yarn/file_parser.rb +84 -44
- data/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb +18 -10
- data/lib/dependabot/npm_and_yarn/file_updater/package_json_updater.rb +16 -8
- data/lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb +4 -2
- data/lib/dependabot/npm_and_yarn/file_updater/pnpm_workspace_updater.rb +5 -3
- data/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb +42 -25
- data/lib/dependabot/npm_and_yarn/file_updater.rb +4 -2
- data/lib/dependabot/npm_and_yarn/metadata_finder.rb +2 -2
- data/lib/dependabot/npm_and_yarn/npm_package_manager.rb +9 -6
- data/lib/dependabot/npm_and_yarn/package/registry_finder.rb +10 -2
- data/lib/dependabot/npm_and_yarn/package_manager.rb +9 -6
- data/lib/dependabot/npm_and_yarn/package_name.rb +2 -1
- data/lib/dependabot/npm_and_yarn/pnpm_package_manager.rb +9 -6
- data/lib/dependabot/npm_and_yarn/update_checker/subdependency_version_resolver.rb +8 -2
- data/lib/dependabot/npm_and_yarn/update_checker/version_resolver.rb +23 -8
- data/lib/dependabot/npm_and_yarn/update_checker/vulnerability_auditor.rb +4 -2
- data/lib/dependabot/npm_and_yarn/update_checker.rb +17 -7
- data/lib/dependabot/npm_and_yarn/version.rb +17 -14
- data/lib/dependabot/npm_and_yarn/yarn_package_manager.rb +9 -6
- data/lib/dependabot/npm_and_yarn.rb +435 -406
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 346d7b71bd954f3c940145a417d0fc72b0d53bd9328d38cad95eee321b962b16
|
4
|
+
data.tar.gz: f146f1b02e2ad0f8cde7ab2c57a3bff0a2e6da7fca80d78a51c88f243461c58b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44811e6584bcdf0aab4dd8bd5970fa8213d8a25c9e2c41656e02fc6bce9dca00fc039f6f8a36a7e7150fc8f68e4be63ca7ed129138109ba7d441a5dd92cd7177
|
7
|
+
data.tar.gz: 5669b41c7ad4b82807fbbed0142a4114f3c84a319b6133c6858311856824a53354ec09cfbb5d93feae3cf32c66b2e0a5989c643d554d6332140790b0005d1774
|
@@ -20,11 +20,14 @@ module Dependabot
|
|
20
20
|
|
21
21
|
# Base regex for SemVer (major.minor.patch[-prerelease][+build])
|
22
22
|
# This pattern extracts valid semantic versioning strings based on the SemVer 2.0 specification.
|
23
|
-
SEMVER_REGEX = T.let(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
SEMVER_REGEX = T.let(
|
24
|
+
/
|
25
|
+
(?<version>\d+\.\d+\.\d+) # Match major.minor.patch (e.g., 1.2.3)
|
26
|
+
(?:-(?<prerelease>[a-zA-Z0-9.-]+))? # Optional prerelease (e.g., -alpha.1, -rc.1, -beta.5)
|
27
|
+
(?:\+(?<build>[a-zA-Z0-9.-]+))? # Optional build metadata (e.g., +build.20231101, +exp.sha.5114f85)
|
28
|
+
/x,
|
29
|
+
Regexp
|
30
|
+
)
|
28
31
|
|
29
32
|
# Full SemVer validation regex (ensures the entire string is a valid SemVer)
|
30
33
|
# This ensures the entire input strictly follows SemVer, without extra characters before/after.
|
@@ -32,11 +35,14 @@ module Dependabot
|
|
32
35
|
|
33
36
|
# SemVer constraint regex (supports package.json version constraints)
|
34
37
|
# This pattern ensures proper parsing of SemVer versions with optional operators.
|
35
|
-
SEMVER_CONSTRAINT_REGEX = T.let(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
SEMVER_CONSTRAINT_REGEX = T.let(
|
39
|
+
/
|
40
|
+
(?: (>=|<=|>|<|=|~|\^)\s*)? # Make operators optional (e.g., >=, ^, ~)
|
41
|
+
(\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?(?:\+[a-zA-Z0-9.-]+)?) # Match full SemVer versions
|
42
|
+
| (\*|latest) # Match wildcard (*) or 'latest'
|
43
|
+
/x,
|
44
|
+
Regexp
|
45
|
+
)
|
40
46
|
|
41
47
|
# /(>=|<=|>|<|=|~|\^)\s*(\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?(?:\+[a-zA-Z0-9.-]+)?)|(\*|latest)/
|
42
48
|
|
@@ -55,17 +61,20 @@ module Dependabot
|
|
55
61
|
SEMVER_CONSTANTS = ["*", "latest"].freeze
|
56
62
|
|
57
63
|
# Unified Regex for Valid Constraints
|
58
|
-
VALID_CONSTRAINT_REGEX = T.let(
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
VALID_CONSTRAINT_REGEX = T.let(
|
65
|
+
Regexp.union(
|
66
|
+
CARET_CONSTRAINT_REGEX,
|
67
|
+
TILDE_CONSTRAINT_REGEX,
|
68
|
+
EXACT_CONSTRAINT_REGEX,
|
69
|
+
GREATER_THAN_EQUAL_REGEX,
|
70
|
+
LESS_THAN_EQUAL_REGEX,
|
71
|
+
GREATER_THAN_REGEX,
|
72
|
+
LESS_THAN_REGEX,
|
73
|
+
WILDCARD_REGEX,
|
74
|
+
LATEST_REGEX
|
75
|
+
).freeze,
|
76
|
+
Regexp
|
77
|
+
)
|
69
78
|
|
70
79
|
# Extract unique constraints from the given constraint expression.
|
71
80
|
# @param constraint_expression [T.nilable(String)] The semver constraint expression.
|
@@ -31,7 +31,8 @@ module Dependabot
|
|
31
31
|
package_files_requiring_update.include?(file) ||
|
32
32
|
package_required_lockfile?(file) ||
|
33
33
|
workspaces_lockfile?(file)
|
34
|
-
end,
|
34
|
+
end,
|
35
|
+
T.nilable(T::Array[DependencyFile])
|
35
36
|
)
|
36
37
|
end
|
37
38
|
|
@@ -40,7 +41,8 @@ module Dependabot
|
|
40
41
|
@package_files_requiring_update ||= T.let(
|
41
42
|
dependency_files.select do |file|
|
42
43
|
dependency_manifest_requirements.include?(file.name)
|
43
|
-
end,
|
44
|
+
end,
|
45
|
+
T.nilable(T::Array[DependencyFile])
|
44
46
|
)
|
45
47
|
end
|
46
48
|
|
@@ -67,7 +69,8 @@ module Dependabot
|
|
67
69
|
@dependency_manifest_requirements ||= T.let(
|
68
70
|
updated_dependencies.flat_map do |dep|
|
69
71
|
dep.requirements.map { |requirement| requirement[:file] }
|
70
|
-
end,
|
72
|
+
end,
|
73
|
+
T.nilable(T::Array[String])
|
71
74
|
)
|
72
75
|
end
|
73
76
|
|
@@ -96,7 +99,8 @@ module Dependabot
|
|
96
99
|
@root_lockfile ||= T.let(
|
97
100
|
lockfiles.find do |file|
|
98
101
|
File.dirname(file.name) == "."
|
99
|
-
end,
|
102
|
+
end,
|
103
|
+
T.nilable(DependencyFile)
|
100
104
|
)
|
101
105
|
end
|
102
106
|
|
@@ -105,7 +109,8 @@ module Dependabot
|
|
105
109
|
@lockfiles ||= T.let(
|
106
110
|
dependency_files.select do |file|
|
107
111
|
lockfile?(file)
|
108
|
-
end,
|
112
|
+
end,
|
113
|
+
T.nilable(T::Array[DependencyFile])
|
109
114
|
)
|
110
115
|
end
|
111
116
|
|
@@ -115,7 +120,8 @@ module Dependabot
|
|
115
120
|
begin
|
116
121
|
package = T.must(dependency_files.find { |f| f.name == "package.json" })
|
117
122
|
JSON.parse(T.must(package.content))
|
118
|
-
end,
|
123
|
+
end,
|
124
|
+
T.nilable(T::Hash[String, T.untyped])
|
119
125
|
)
|
120
126
|
end
|
121
127
|
|
@@ -23,8 +23,13 @@ module Dependabot
|
|
23
23
|
)
|
24
24
|
.void
|
25
25
|
end
|
26
|
-
def initialize(
|
27
|
-
|
26
|
+
def initialize(
|
27
|
+
dependency_name:,
|
28
|
+
path:,
|
29
|
+
directory:,
|
30
|
+
package_lock:,
|
31
|
+
yarn_lock:
|
32
|
+
)
|
28
33
|
@dependency_name = dependency_name
|
29
34
|
@path = path
|
30
35
|
@directory = directory
|
@@ -154,17 +159,20 @@ module Dependabot
|
|
154
159
|
return unless yarn_lock
|
155
160
|
return @parsed_yarn_lock if defined?(@parsed_yarn_lock)
|
156
161
|
|
157
|
-
parsed = T.cast(
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
162
|
+
parsed = T.cast(
|
163
|
+
SharedHelpers.in_a_temporary_directory do
|
164
|
+
File.write("yarn.lock", T.must(yarn_lock).content)
|
165
|
+
|
166
|
+
SharedHelpers.run_helper_subprocess(
|
167
|
+
command: NativeHelpers.helper_path,
|
168
|
+
function: "yarn:parseLockfile",
|
169
|
+
args: [Dir.pwd]
|
170
|
+
)
|
171
|
+
rescue SharedHelpers::HelperSubprocessFailed
|
172
|
+
raise Dependabot::DependencyFileNotParseable, T.must(yarn_lock).path
|
173
|
+
end,
|
174
|
+
T::Hash[String, T.untyped]
|
175
|
+
)
|
168
176
|
@parsed_yarn_lock = T.let(parsed, T.nilable(T::Hash[String, T.untyped]))
|
169
177
|
end
|
170
178
|
|
@@ -28,8 +28,10 @@ module Dependabot
|
|
28
28
|
# when it specifies a path. Only include Yarn "link:"'s that start with a
|
29
29
|
# path and ignore symlinked package names that have been registered with
|
30
30
|
# "yarn link", e.g. "link:react"
|
31
|
-
PATH_DEPENDENCY_STARTS = T.let(
|
32
|
-
|
31
|
+
PATH_DEPENDENCY_STARTS = T.let(
|
32
|
+
%w(file: link:. link:/ link:~/ / ./ ../ ~/).freeze,
|
33
|
+
[String, String, String, String, String, String, String, String]
|
34
|
+
)
|
33
35
|
PATH_DEPENDENCY_CLEAN_REGEX = /^file:|^link:/
|
34
36
|
DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org"
|
35
37
|
|
@@ -155,8 +157,10 @@ module Dependabot
|
|
155
157
|
return @inferred_npmrc ||= T.let(nil, T.nilable(DependencyFile)) unless npmrc.nil? && package_lock
|
156
158
|
|
157
159
|
known_registries = []
|
158
|
-
FileParser::JsonLock.new(T.must(package_lock)).parsed.fetch(
|
159
|
-
|
160
|
+
FileParser::JsonLock.new(T.must(package_lock)).parsed.fetch(
|
161
|
+
"dependencies",
|
162
|
+
{}
|
163
|
+
).each do |dependency_name, details|
|
160
164
|
resolved = details.fetch("resolved", DEFAULT_NPM_REGISTRY)
|
161
165
|
|
162
166
|
begin
|
@@ -236,7 +240,8 @@ module Dependabot
|
|
236
240
|
lockfiles,
|
237
241
|
registry_config_files,
|
238
242
|
credentials
|
239
|
-
),
|
243
|
+
),
|
244
|
+
T.nilable(PackageManagerHelper)
|
240
245
|
)
|
241
246
|
end
|
242
247
|
|
@@ -476,8 +481,10 @@ module Dependabot
|
|
476
481
|
# skip dependencies that contain invalid values such as inline comments, null, etc.
|
477
482
|
|
478
483
|
unless value.is_a?(String)
|
479
|
-
Dependabot.logger.warn(
|
480
|
-
|
484
|
+
Dependabot.logger.warn(
|
485
|
+
"File fetcher: Skipping dependency \"#{path}\" " \
|
486
|
+
"with value: \"#{value}\""
|
487
|
+
)
|
481
488
|
|
482
489
|
next
|
483
490
|
end
|
@@ -102,7 +102,8 @@ module Dependabot
|
|
102
102
|
lockfiles,
|
103
103
|
registry_config_files,
|
104
104
|
credentials
|
105
|
-
),
|
105
|
+
),
|
106
|
+
T.nilable(PackageManagerHelper)
|
106
107
|
)
|
107
108
|
end
|
108
109
|
|
@@ -143,65 +144,92 @@ module Dependabot
|
|
143
144
|
|
144
145
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
145
146
|
def shrinkwrap
|
146
|
-
@shrinkwrap ||= T.let(
|
147
|
-
f
|
148
|
-
|
147
|
+
@shrinkwrap ||= T.let(
|
148
|
+
dependency_files.find do |f|
|
149
|
+
f.name.end_with?(NpmPackageManager::SHRINKWRAP_LOCKFILE_NAME)
|
150
|
+
end,
|
151
|
+
T.nilable(Dependabot::DependencyFile)
|
152
|
+
)
|
149
153
|
end
|
150
154
|
|
151
155
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
152
156
|
def package_lock
|
153
|
-
@package_lock ||= T.let(
|
154
|
-
f
|
155
|
-
|
157
|
+
@package_lock ||= T.let(
|
158
|
+
dependency_files.find do |f|
|
159
|
+
f.name.end_with?(NpmPackageManager::LOCKFILE_NAME)
|
160
|
+
end,
|
161
|
+
T.nilable(Dependabot::DependencyFile)
|
162
|
+
)
|
156
163
|
end
|
157
164
|
|
158
165
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
159
166
|
def yarn_lock
|
160
|
-
@yarn_lock ||= T.let(
|
161
|
-
f
|
162
|
-
|
167
|
+
@yarn_lock ||= T.let(
|
168
|
+
dependency_files.find do |f|
|
169
|
+
f.name.end_with?(YarnPackageManager::LOCKFILE_NAME)
|
170
|
+
end,
|
171
|
+
T.nilable(Dependabot::DependencyFile)
|
172
|
+
)
|
163
173
|
end
|
164
174
|
|
165
175
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
166
176
|
def pnpm_lock
|
167
|
-
@pnpm_lock ||= T.let(
|
168
|
-
f
|
169
|
-
|
177
|
+
@pnpm_lock ||= T.let(
|
178
|
+
dependency_files.find do |f|
|
179
|
+
f.name.end_with?(PNPMPackageManager::LOCKFILE_NAME)
|
180
|
+
end,
|
181
|
+
T.nilable(Dependabot::DependencyFile)
|
182
|
+
)
|
170
183
|
end
|
171
184
|
|
172
185
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
173
186
|
def pnpm_workspace_yml
|
174
|
-
@pnpm_workspace_yml ||= T.let(
|
175
|
-
f
|
176
|
-
|
187
|
+
@pnpm_workspace_yml ||= T.let(
|
188
|
+
dependency_files.find do |f|
|
189
|
+
f.name.end_with?(PNPMPackageManager::PNPM_WS_YML_FILENAME)
|
190
|
+
end,
|
191
|
+
T.nilable(Dependabot::DependencyFile)
|
192
|
+
)
|
177
193
|
end
|
178
194
|
|
179
195
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
180
196
|
def bun_lock
|
181
|
-
@bun_lock ||= T.let(
|
182
|
-
f
|
183
|
-
|
197
|
+
@bun_lock ||= T.let(
|
198
|
+
dependency_files.find do |f|
|
199
|
+
f.name.end_with?(BunPackageManager::LOCKFILE_NAME)
|
200
|
+
end,
|
201
|
+
T.nilable(Dependabot::DependencyFile)
|
202
|
+
)
|
184
203
|
end
|
185
204
|
|
186
205
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
187
206
|
def npmrc
|
188
|
-
@npmrc ||= T.let(
|
189
|
-
f
|
190
|
-
|
207
|
+
@npmrc ||= T.let(
|
208
|
+
dependency_files.find do |f|
|
209
|
+
f.name.end_with?(NpmPackageManager::RC_FILENAME)
|
210
|
+
end,
|
211
|
+
T.nilable(Dependabot::DependencyFile)
|
212
|
+
)
|
191
213
|
end
|
192
214
|
|
193
215
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
194
216
|
def yarnrc
|
195
|
-
@yarnrc ||= T.let(
|
196
|
-
f
|
197
|
-
|
217
|
+
@yarnrc ||= T.let(
|
218
|
+
dependency_files.find do |f|
|
219
|
+
f.name.end_with?(YarnPackageManager::RC_FILENAME)
|
220
|
+
end,
|
221
|
+
T.nilable(Dependabot::DependencyFile)
|
222
|
+
)
|
198
223
|
end
|
199
224
|
|
200
225
|
sig { returns(T.nilable(DependencyFile)) }
|
201
226
|
def yarnrc_yml
|
202
|
-
@yarnrc_yml ||= T.let(
|
203
|
-
f
|
204
|
-
|
227
|
+
@yarnrc_yml ||= T.let(
|
228
|
+
dependency_files.find do |f|
|
229
|
+
f.name.end_with?(YarnPackageManager::RC_YML_FILENAME)
|
230
|
+
end,
|
231
|
+
T.nilable(Dependabot::DependencyFile)
|
232
|
+
)
|
205
233
|
end
|
206
234
|
|
207
235
|
sig { returns(Dependabot::FileParsers::Base::DependencySet) }
|
@@ -259,9 +287,12 @@ module Dependabot
|
|
259
287
|
|
260
288
|
sig { returns(LockfileParser) }
|
261
289
|
def lockfile_parser
|
262
|
-
@lockfile_parser ||= T.let(
|
263
|
-
|
264
|
-
|
290
|
+
@lockfile_parser ||= T.let(
|
291
|
+
LockfileParser.new(
|
292
|
+
dependency_files: dependency_files
|
293
|
+
),
|
294
|
+
T.nilable(Dependabot::NpmAndYarn::FileParser::LockfileParser)
|
295
|
+
)
|
265
296
|
end
|
266
297
|
|
267
298
|
sig { returns(Dependabot::FileParsers::Base::DependencySet) }
|
@@ -280,13 +311,16 @@ module Dependabot
|
|
280
311
|
manifest_name: file.name
|
281
312
|
)
|
282
313
|
version = version_for(requirement, lockfile_details)
|
283
|
-
converted_version = T.let(
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
314
|
+
converted_version = T.let(
|
315
|
+
if version.nil?
|
316
|
+
nil
|
317
|
+
elsif version.is_a?(String)
|
318
|
+
version
|
319
|
+
else
|
320
|
+
Dependabot::Version.new(version)
|
321
|
+
end,
|
322
|
+
T.nilable(T.any(String, Dependabot::Version))
|
323
|
+
)
|
290
324
|
|
291
325
|
return if lockfile_details && !version
|
292
326
|
return if ignore_requirement?(requirement)
|
@@ -316,8 +350,10 @@ module Dependabot
|
|
316
350
|
def check_required_files
|
317
351
|
return if get_original_file(MANIFEST_FILENAME)
|
318
352
|
|
319
|
-
raise DependencyFileNotFound.new(
|
320
|
-
|
353
|
+
raise DependencyFileNotFound.new(
|
354
|
+
nil,
|
355
|
+
"#{MANIFEST_FILENAME} not found."
|
356
|
+
)
|
321
357
|
end
|
322
358
|
|
323
359
|
sig { params(requirement: String).returns(T::Boolean) }
|
@@ -364,9 +400,12 @@ module Dependabot
|
|
364
400
|
|
365
401
|
sig { returns(T::Array[String]) }
|
366
402
|
def workspace_package_names
|
367
|
-
@workspace_package_names ||= T.let(
|
368
|
-
|
369
|
-
|
403
|
+
@workspace_package_names ||= T.let(
|
404
|
+
package_files.filter_map do |f|
|
405
|
+
JSON.parse(T.must(f.content))["name"]
|
406
|
+
end,
|
407
|
+
T.nilable(T::Array[String])
|
408
|
+
)
|
370
409
|
end
|
371
410
|
|
372
411
|
sig do
|
@@ -533,7 +572,8 @@ module Dependabot
|
|
533
572
|
[
|
534
573
|
dependency_files.find { |f| f.name == MANIFEST_FILENAME },
|
535
574
|
*sub_package_files
|
536
|
-
].compact,
|
575
|
+
].compact,
|
576
|
+
T.nilable(T::Array[DependencyFile])
|
537
577
|
)
|
538
578
|
end
|
539
579
|
|
@@ -84,8 +84,11 @@ module Dependabot
|
|
84
84
|
NPM_PACKAGE_REGISTRY = "https://npm.pkg.github.com"
|
85
85
|
EOVERRIDE = /EOVERRIDE\n *.* Override for (?<deps>.*) conflicts with direct dependency/
|
86
86
|
NESTED_ALIAS = /nested aliases not supported/
|
87
|
-
PEER_DEPS_PATTERNS = T.let(
|
88
|
-
|
87
|
+
PEER_DEPS_PATTERNS = T.let(
|
88
|
+
[/Cannot read properties of null/,
|
89
|
+
/ERESOLVE overriding peer dependency/].freeze,
|
90
|
+
T::Array[Regexp]
|
91
|
+
)
|
89
92
|
PREMATURE_CLOSE = /premature close/
|
90
93
|
EMPTY_OBJECT_ERROR = /Object for dependency "(?<package>.*)" is empty/
|
91
94
|
ERROR_E401 = /code E401/
|
@@ -93,10 +96,13 @@ module Dependabot
|
|
93
96
|
REQUEST_ERROR_E403 = /Request "(?<pkg>.*)" returned a 403/
|
94
97
|
ERROR_EAI_AGAIN = /request to (?<url>.*) failed, reason: getaddrinfo EAI_AGAIN/
|
95
98
|
|
96
|
-
NPM_PACKAGE_NOT_FOUND_CODES = T.let(
|
97
|
-
|
98
|
-
|
99
|
-
|
99
|
+
NPM_PACKAGE_NOT_FOUND_CODES = T.let(
|
100
|
+
[
|
101
|
+
/Couldn't find package "(?<pkg>.*)" on the "(?<regis>.*)" registry./,
|
102
|
+
/Couldn't find package "(?<pkg>.*)" required by "(?<dep>.*)" on the "(?<regis>.*)" registry./
|
103
|
+
].freeze,
|
104
|
+
T::Array[Regexp]
|
105
|
+
)
|
100
106
|
|
101
107
|
# dependency access protocol not supported by packagemanager
|
102
108
|
UNSUPPORTED_PROTOCOL = /EUNSUPPORTEDPROTOCOL\n(.*?)Unsupported URL Type "(?<access_method>.*)"/
|
@@ -222,8 +228,10 @@ module Dependabot
|
|
222
228
|
)
|
223
229
|
end
|
224
230
|
|
225
|
-
run_npm_updater(
|
226
|
-
|
231
|
+
run_npm_updater(
|
232
|
+
top_level_dependencies: previous_top_level_dependencies,
|
233
|
+
sub_dependencies: previous_sub_dependencies
|
234
|
+
)
|
227
235
|
end
|
228
236
|
|
229
237
|
sig do
|
@@ -646,8 +654,8 @@ module Dependabot
|
|
646
654
|
reg = Package::RegistryFinder.new(
|
647
655
|
dependency: missing_dep,
|
648
656
|
credentials: credentials,
|
649
|
-
npmrc_file: dependency_files.
|
650
|
-
yarnrc_file: dependency_files.
|
657
|
+
npmrc_file: dependency_files.find { |f| f.name.end_with?(".npmrc") },
|
658
|
+
yarnrc_file: dependency_files.find { |f| f.name.end_with?(".yarnrc") },
|
651
659
|
yarnrc_yml_file: dependency_files.find { |f| f.name.end_with?(".yarnrc.yml") }
|
652
660
|
).registry
|
653
661
|
|
@@ -69,8 +69,10 @@ module Dependabot
|
|
69
69
|
# a transitive dependency which only needs update in lockfile, So we avoid throwing exception and let
|
70
70
|
# the update continue.
|
71
71
|
|
72
|
-
Dependabot.logger.info(
|
73
|
-
|
72
|
+
Dependabot.logger.info(
|
73
|
+
"experiment: avoid_duplicate_updates_package_json.
|
74
|
+
Updating package.json for #{dep.name} "
|
75
|
+
)
|
74
76
|
|
75
77
|
raise "Expected content to change!"
|
76
78
|
end
|
@@ -225,8 +227,10 @@ module Dependabot
|
|
225
227
|
|
226
228
|
unless git_dependency
|
227
229
|
requirement = dependency_req&.fetch(:requirement)
|
228
|
-
return content.match(
|
229
|
-
|
230
|
+
return content.match(
|
231
|
+
/"#{Regexp.escape(dependency_name)}"\s*:\s*
|
232
|
+
"#{Regexp.escape(requirement)}"/x
|
233
|
+
).to_s
|
230
234
|
end
|
231
235
|
|
232
236
|
username, repo =
|
@@ -355,8 +359,10 @@ module Dependabot
|
|
355
359
|
|
356
360
|
# some deps are patched with local patches, we don't need to update them
|
357
361
|
if req.fetch(:requirement).match?(Regexp.union(PATCH_PACKAGE))
|
358
|
-
Dependabot.logger.info(
|
359
|
-
|
362
|
+
Dependabot.logger.info(
|
363
|
+
"Func: updated_requirements. dependency patched #{dependency.name}," \
|
364
|
+
" Requirement: '#{req.fetch(:requirement)}'"
|
365
|
+
)
|
360
366
|
|
361
367
|
raise DependencyFileNotResolvable,
|
362
368
|
"Dependency is patched locally, Update not required."
|
@@ -365,8 +371,10 @@ module Dependabot
|
|
365
371
|
# some deps are added as local packages, we don't need to update them as they are referred to a local path
|
366
372
|
next unless req.fetch(:requirement).match?(Regexp.union(LOCAL_PACKAGE))
|
367
373
|
|
368
|
-
Dependabot.logger.info(
|
369
|
-
|
374
|
+
Dependabot.logger.info(
|
375
|
+
"Func: updated_requirements. local package #{dependency.name}," \
|
376
|
+
" Requirement: '#{req.fetch(:requirement)}'"
|
377
|
+
)
|
370
378
|
|
371
379
|
raise DependencyFileNotResolvable,
|
372
380
|
"Local package, Update not required."
|
@@ -380,8 +380,10 @@ module Dependabot
|
|
380
380
|
.returns(T.noreturn)
|
381
381
|
end
|
382
382
|
def raise_package_access_error(error_message, dependency_url, pnpm_lock)
|
383
|
-
package_name = RegistryParser.new(
|
384
|
-
|
383
|
+
package_name = RegistryParser.new(
|
384
|
+
resolved_url: dependency_url,
|
385
|
+
credentials: credentials
|
386
|
+
).dependency_name
|
385
387
|
missing_dep = lockfile_dependencies(pnpm_lock)
|
386
388
|
.find { |dep| dep.name == package_name }
|
387
389
|
raise DependencyNotFound, package_name unless missing_dep
|
@@ -23,7 +23,7 @@ module Dependabot
|
|
23
23
|
params(
|
24
24
|
workspace_file: Dependabot::DependencyFile,
|
25
25
|
dependencies: T::Array[Dependabot::Dependency]
|
26
|
-
)
|
26
|
+
).void
|
27
27
|
end
|
28
28
|
def initialize(workspace_file:, dependencies:)
|
29
29
|
@dependencies = dependencies
|
@@ -119,8 +119,10 @@ module Dependabot
|
|
119
119
|
end
|
120
120
|
|
121
121
|
sig do
|
122
|
-
params(
|
123
|
-
|
122
|
+
params(
|
123
|
+
dependency: Dependabot::Dependency,
|
124
|
+
new_requirement: DependencyRequirement
|
125
|
+
).returns(T.nilable(DependencyRequirement))
|
124
126
|
end
|
125
127
|
def old_requirement(dependency, new_requirement)
|
126
128
|
matching_req = T.must(dependency.previous_requirements).find { |r| r[:groups] == new_requirement.groups }
|