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
@@ -150,7 +150,7 @@ module Dependabot
|
|
150
150
|
)
|
151
151
|
end
|
152
152
|
|
153
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
153
|
+
# rubocop:disable Metrics/PerceivedComplexity, Metrics/MethodLength
|
154
154
|
sig do
|
155
155
|
params(
|
156
156
|
path: String,
|
@@ -163,8 +163,10 @@ module Dependabot
|
|
163
163
|
Dir.chdir(path) do
|
164
164
|
if top_level_dependency_updates.any?
|
165
165
|
if Helpers.yarn_berry?(yarn_lock)
|
166
|
-
run_yarn_berry_top_level_updater(
|
167
|
-
|
166
|
+
run_yarn_berry_top_level_updater(
|
167
|
+
top_level_dependency_updates: top_level_dependency_updates,
|
168
|
+
yarn_lock: yarn_lock
|
169
|
+
)
|
168
170
|
else
|
169
171
|
run_yarn_top_level_updater(
|
170
172
|
top_level_dependency_updates: top_level_dependency_updates
|
@@ -181,9 +183,12 @@ module Dependabot
|
|
181
183
|
package_missing = error_handler.package_missing(e.message)
|
182
184
|
|
183
185
|
unless package_missing
|
184
|
-
error_handler.handle_error(
|
185
|
-
|
186
|
-
|
186
|
+
error_handler.handle_error(
|
187
|
+
e,
|
188
|
+
{
|
189
|
+
yarn_lock: yarn_lock
|
190
|
+
}
|
191
|
+
)
|
187
192
|
end
|
188
193
|
|
189
194
|
raise unless package_missing
|
@@ -195,7 +200,7 @@ module Dependabot
|
|
195
200
|
sleep(rand(3.0..10.0))
|
196
201
|
retry
|
197
202
|
end
|
198
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
203
|
+
# rubocop:enable Metrics/PerceivedComplexity, Metrics/MethodLength
|
199
204
|
|
200
205
|
sig do
|
201
206
|
params(
|
@@ -268,10 +273,12 @@ module Dependabot
|
|
268
273
|
SharedHelpers.run_helper_subprocess(
|
269
274
|
command: NativeHelpers.helper_path,
|
270
275
|
function: "yarn:update",
|
271
|
-
args: T.unsafe(
|
272
|
-
|
273
|
-
|
274
|
-
|
276
|
+
args: T.unsafe(
|
277
|
+
[
|
278
|
+
Dir.pwd,
|
279
|
+
top_level_dependency_updates
|
280
|
+
]
|
281
|
+
)
|
275
282
|
),
|
276
283
|
T::Hash[String, String]
|
277
284
|
)
|
@@ -322,9 +329,12 @@ module Dependabot
|
|
322
329
|
def handle_yarn_lock_updater_error(error, yarn_lock)
|
323
330
|
error_message = error.message
|
324
331
|
|
325
|
-
error_handler.handle_error(
|
326
|
-
|
327
|
-
|
332
|
+
error_handler.handle_error(
|
333
|
+
error,
|
334
|
+
{
|
335
|
+
yarn_lock: yarn_lock
|
336
|
+
}
|
337
|
+
)
|
328
338
|
|
329
339
|
package_not_found = error_handler.handle_package_not_found(error_message, yarn_lock)
|
330
340
|
|
@@ -372,8 +382,10 @@ module Dependabot
|
|
372
382
|
error_message.include?(DEPENDENCY_MATCH_NOT_FOUND)
|
373
383
|
|
374
384
|
unless resolvable_before_update?(yarn_lock)
|
375
|
-
error_handler.raise_resolvability_error(
|
376
|
-
|
385
|
+
error_handler.raise_resolvability_error(
|
386
|
+
error_message,
|
387
|
+
yarn_lock
|
388
|
+
)
|
377
389
|
end
|
378
390
|
|
379
391
|
# Dependabot has probably messed something up with the update and we
|
@@ -587,10 +599,11 @@ module Dependabot
|
|
587
599
|
.find { |d| d.name == sanitized_name }
|
588
600
|
return unless dep
|
589
601
|
|
590
|
-
raise PrivateSourceTimedOut,
|
591
|
-
|
592
|
-
|
593
|
-
|
602
|
+
raise PrivateSourceTimedOut,
|
603
|
+
url.gsub(
|
604
|
+
HTTP_CHECK_REGEX,
|
605
|
+
""
|
606
|
+
)
|
594
607
|
end
|
595
608
|
|
596
609
|
sig { returns(String) }
|
@@ -814,11 +827,15 @@ module Dependabot
|
|
814
827
|
).returns(Dependabot::DependabotError)
|
815
828
|
end
|
816
829
|
def create_error(handler, message, error, params)
|
817
|
-
handler.call(
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
830
|
+
handler.call(
|
831
|
+
message,
|
832
|
+
error,
|
833
|
+
{
|
834
|
+
dependencies: dependencies,
|
835
|
+
dependency_files: dependency_files,
|
836
|
+
**params
|
837
|
+
}
|
838
|
+
)
|
822
839
|
end
|
823
840
|
|
824
841
|
# Raises a resolvability error for a dependency file
|
@@ -216,7 +216,8 @@ module Dependabot
|
|
216
216
|
dependency_files: dependency_files,
|
217
217
|
updated_dependencies: dependencies
|
218
218
|
).files_requiring_update
|
219
|
-
end,
|
219
|
+
end,
|
220
|
+
T.nilable(T::Array[DependencyFile])
|
220
221
|
)
|
221
222
|
end
|
222
223
|
|
@@ -311,7 +312,8 @@ module Dependabot
|
|
311
312
|
@package_files ||= T.let(
|
312
313
|
filtered_dependency_files.select do |f|
|
313
314
|
f.name.end_with?("package.json")
|
314
|
-
end,
|
315
|
+
end,
|
316
|
+
T.nilable(T::Array[DependencyFile])
|
315
317
|
)
|
316
318
|
end
|
317
319
|
|
@@ -112,7 +112,7 @@ module Dependabot
|
|
112
112
|
|
113
113
|
sig do
|
114
114
|
params(
|
115
|
-
details: T.nilable(T.any(String, T::Hash[String, T.untyped]))
|
115
|
+
details: T.nilable(T.any(String, T::Array[T.untyped], T::Hash[String, T.untyped]))
|
116
116
|
)
|
117
117
|
.returns(T.nilable(Dependabot::Source))
|
118
118
|
end
|
@@ -151,7 +151,7 @@ module Dependabot
|
|
151
151
|
|
152
152
|
sig do
|
153
153
|
params(
|
154
|
-
details: T.nilable(T.any(String, T::Hash[String, T.untyped]))
|
154
|
+
details: T.nilable(T.any(String, T::Array[T.untyped], T::Hash[String, T.untyped]))
|
155
155
|
)
|
156
156
|
.returns(T.nilable(String))
|
157
157
|
end
|
@@ -25,12 +25,15 @@ module Dependabot
|
|
25
25
|
NPM_V10 = "10"
|
26
26
|
|
27
27
|
# Keep versions in ascending order
|
28
|
-
SUPPORTED_VERSIONS = T.let(
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
SUPPORTED_VERSIONS = T.let(
|
29
|
+
[
|
30
|
+
Version.new(NPM_V7),
|
31
|
+
Version.new(NPM_V8),
|
32
|
+
Version.new(NPM_V9),
|
33
|
+
Version.new(NPM_V10)
|
34
|
+
].freeze,
|
35
|
+
T::Array[Dependabot::Version]
|
36
|
+
)
|
34
37
|
|
35
38
|
DEPRECATED_VERSIONS = T.let([Version.new(NPM_V6)].freeze, T::Array[Dependabot::Version])
|
36
39
|
|
@@ -35,8 +35,13 @@ module Dependabot
|
|
35
35
|
yarnrc_yml_file: T.nilable(Dependabot::DependencyFile)
|
36
36
|
).void
|
37
37
|
end
|
38
|
-
def initialize(
|
39
|
-
|
38
|
+
def initialize(
|
39
|
+
dependency:,
|
40
|
+
credentials:,
|
41
|
+
npmrc_file: nil,
|
42
|
+
yarnrc_file: nil,
|
43
|
+
yarnrc_yml_file: nil
|
44
|
+
)
|
40
45
|
@dependency = dependency
|
41
46
|
@credentials = credentials
|
42
47
|
@npmrc_file = npmrc_file
|
@@ -103,10 +108,13 @@ module Dependabot
|
|
103
108
|
|
104
109
|
sig { returns(T::Array[Dependabot::Credential]) }
|
105
110
|
attr_reader :credentials
|
111
|
+
|
106
112
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
107
113
|
attr_reader :npmrc_file
|
114
|
+
|
108
115
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
109
116
|
attr_reader :yarnrc_file
|
117
|
+
|
110
118
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
111
119
|
attr_reader :yarnrc_yml_file
|
112
120
|
|
@@ -65,12 +65,15 @@ module Dependabot
|
|
65
65
|
)
|
66
66
|
end
|
67
67
|
|
68
|
-
PACKAGE_MANAGER_CLASSES = T.let(
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
68
|
+
PACKAGE_MANAGER_CLASSES = T.let(
|
69
|
+
{
|
70
|
+
NpmPackageManager::NAME => NpmPackageManager,
|
71
|
+
YarnPackageManager::NAME => YarnPackageManager,
|
72
|
+
PNPMPackageManager::NAME => PNPMPackageManager,
|
73
|
+
BunPackageManager::NAME => BunPackageManager
|
74
|
+
}.freeze,
|
75
|
+
T::Hash[String, NpmAndYarnPackageManagerClassType]
|
76
|
+
)
|
74
77
|
|
75
78
|
# Error malformed version number string
|
76
79
|
ERROR_MALFORMED_VERSION_NUMBER = "Malformed version number"
|
@@ -22,12 +22,15 @@ module Dependabot
|
|
22
22
|
PNPM_V9 = "9"
|
23
23
|
PNPM_V10 = "10"
|
24
24
|
|
25
|
-
SUPPORTED_VERSIONS = T.let(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
SUPPORTED_VERSIONS = T.let(
|
26
|
+
[
|
27
|
+
Version.new(PNPM_V7),
|
28
|
+
Version.new(PNPM_V8),
|
29
|
+
Version.new(PNPM_V9),
|
30
|
+
Version.new(PNPM_V10)
|
31
|
+
].freeze,
|
32
|
+
T::Array[Dependabot::Version]
|
33
|
+
)
|
31
34
|
|
32
35
|
DEPRECATED_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version])
|
33
36
|
|
@@ -48,8 +48,14 @@ module Dependabot
|
|
48
48
|
repo_contents_path: T.nilable(String)
|
49
49
|
).void
|
50
50
|
end
|
51
|
-
def initialize(
|
52
|
-
|
51
|
+
def initialize(
|
52
|
+
dependency:,
|
53
|
+
credentials:,
|
54
|
+
dependency_files:,
|
55
|
+
ignored_versions:,
|
56
|
+
latest_allowable_version:,
|
57
|
+
repo_contents_path:
|
58
|
+
)
|
53
59
|
@dependency = dependency
|
54
60
|
@credentials = credentials
|
55
61
|
@dependency_files = dependency_files
|
@@ -27,9 +27,12 @@ module Dependabot
|
|
27
27
|
|
28
28
|
require_relative "latest_version_finder"
|
29
29
|
|
30
|
-
TIGHTLY_COUPLED_MONOREPOS = T.let(
|
31
|
-
|
32
|
-
|
30
|
+
TIGHTLY_COUPLED_MONOREPOS = T.let(
|
31
|
+
{
|
32
|
+
"vue" => %w(vue vue-template-compiler)
|
33
|
+
}.freeze,
|
34
|
+
T::Hash[String, T::Array[String]]
|
35
|
+
)
|
33
36
|
|
34
37
|
# Error message returned by `yarn add` (for Yarn classic):
|
35
38
|
# " > @reach/router@1.2.1" has incorrect peer dependency "react@15.x || 16.x || 16.4.0-alpha.0911da3"
|
@@ -105,10 +108,15 @@ module Dependabot
|
|
105
108
|
).void
|
106
109
|
end
|
107
110
|
def initialize( # rubocop:disable Metrics/AbcSize
|
108
|
-
dependency:,
|
109
|
-
|
110
|
-
|
111
|
-
|
111
|
+
dependency:,
|
112
|
+
dependency_files:,
|
113
|
+
credentials:,
|
114
|
+
latest_allowable_version:,
|
115
|
+
latest_version_finder:,
|
116
|
+
repo_contents_path:,
|
117
|
+
dependency_group: nil,
|
118
|
+
raise_on_ignored: false,
|
119
|
+
update_cooldown: nil
|
112
120
|
)
|
113
121
|
@dependency = dependency
|
114
122
|
@dependency_files = dependency_files
|
@@ -209,22 +217,29 @@ module Dependabot
|
|
209
217
|
|
210
218
|
sig { returns(Dependabot::Dependency) }
|
211
219
|
attr_reader :dependency
|
220
|
+
|
212
221
|
sig { returns(T::Array[Dependabot::DependencyFile]) }
|
213
222
|
attr_reader :dependency_files
|
223
|
+
|
214
224
|
sig { returns(T::Array[Dependabot::Credential]) }
|
215
225
|
attr_reader :credentials
|
226
|
+
|
216
227
|
sig { returns(T.nilable(T.any(String, Gem::Version))) }
|
217
228
|
attr_reader :latest_allowable_version
|
229
|
+
|
218
230
|
sig { returns(T.nilable(String)) }
|
219
231
|
attr_reader :repo_contents_path
|
232
|
+
|
220
233
|
sig { returns(T.nilable(Dependabot::DependencyGroup)) }
|
221
234
|
attr_reader :dependency_group
|
235
|
+
|
222
236
|
sig { returns(T.nilable(Dependabot::Package::ReleaseCooldownOptions)) }
|
223
237
|
attr_reader :update_cooldown
|
238
|
+
|
224
239
|
sig { returns(T::Boolean) }
|
225
240
|
attr_reader :raise_on_ignored
|
226
241
|
|
227
|
-
sig { params(dep: Dependabot::Dependency)
|
242
|
+
sig { params(dep: Dependabot::Dependency).returns(PackageLatestVersionFinder) }
|
228
243
|
def latest_version_finder(dep)
|
229
244
|
@latest_version_finder[dep] ||=
|
230
245
|
PackageLatestVersionFinder.new(
|
@@ -200,8 +200,10 @@ module Dependabot
|
|
200
200
|
end
|
201
201
|
|
202
202
|
sig do
|
203
|
-
params(
|
204
|
-
|
203
|
+
params(
|
204
|
+
dependency: Dependabot::Dependency,
|
205
|
+
error: Dependabot::SharedHelpers::HelperSubprocessFailed
|
206
|
+
).void
|
205
207
|
end
|
206
208
|
def log_helper_subprocess_failure(dependency, error)
|
207
209
|
# See `Dependabot::SharedHelpers.run_helper_subprocess` for details on error context
|
@@ -36,11 +36,19 @@ module Dependabot
|
|
36
36
|
)
|
37
37
|
.void
|
38
38
|
end
|
39
|
-
def initialize(
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
def initialize( # rubocop:disable Metrics/AbcSize
|
40
|
+
dependency:,
|
41
|
+
dependency_files:,
|
42
|
+
credentials:,
|
43
|
+
repo_contents_path: nil,
|
44
|
+
ignored_versions: [],
|
45
|
+
raise_on_ignored: false,
|
46
|
+
security_advisories: [],
|
47
|
+
requirements_update_strategy: nil,
|
48
|
+
dependency_group: nil,
|
49
|
+
update_cooldown: nil,
|
50
|
+
options: {}
|
51
|
+
)
|
44
52
|
@latest_version = T.let(nil, T.nilable(T.any(String, Gem::Version)))
|
45
53
|
@latest_resolvable_version = T.let(nil, T.nilable(T.any(String, Dependabot::Version)))
|
46
54
|
@updated_requirements = T.let(nil, T.nilable(T::Array[T::Hash[Symbol, T.untyped]]))
|
@@ -391,8 +399,10 @@ module Dependabot
|
|
391
399
|
def latest_version_for_git_dependency
|
392
400
|
@latest_version_for_git_dependency ||=
|
393
401
|
if version_class.correct?(dependency.version)
|
394
|
-
T.unsafe(
|
395
|
-
|
402
|
+
T.unsafe(
|
403
|
+
latest_git_version_details[:version] &&
|
404
|
+
version_class.new(latest_git_version_details[:version])
|
405
|
+
)
|
396
406
|
else
|
397
407
|
latest_git_version_details[:sha]
|
398
408
|
end
|
@@ -21,20 +21,23 @@ module Dependabot
|
|
21
21
|
|
22
22
|
# These are possible npm versioning tags that can be used in place of a version.
|
23
23
|
# See https://docs.npmjs.com/cli/v10/commands/npm-dist-tag#purpose for more details.
|
24
|
-
VERSION_TAGS = T.let(
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
24
|
+
VERSION_TAGS = T.let(
|
25
|
+
[
|
26
|
+
"alpha", # Alpha version, early testing phase
|
27
|
+
"beta", # Beta version, more stable than alpha
|
28
|
+
"canary", # Canary version, often used for cutting-edge builds
|
29
|
+
"dev", # Development version, ongoing development
|
30
|
+
"experimental", # Experimental version, unstable and new features
|
31
|
+
"latest", # Latest stable version, used by npm to identify the current version of a package
|
32
|
+
"legacy", # Legacy version, older version maintained for compatibility
|
33
|
+
"next", # Next version, used by some projects to identify the upcoming version
|
34
|
+
"nightly", # Nightly build, daily builds often including latest changes
|
35
|
+
"rc", # Release candidate, potential final version
|
36
|
+
"release", # General release version
|
37
|
+
"stable" # Stable version, thoroughly tested and stable
|
38
|
+
].freeze.map(&:freeze),
|
39
|
+
T::Array[String]
|
40
|
+
)
|
38
41
|
|
39
42
|
VERSION_PATTERN = T.let(Gem::Version::VERSION_PATTERN + '(\+[0-9a-zA-Z\-.]+)?', String)
|
40
43
|
ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/
|
@@ -23,12 +23,15 @@ module Dependabot
|
|
23
23
|
YARN_V3 = "3"
|
24
24
|
YARN_V4 = "4"
|
25
25
|
|
26
|
-
SUPPORTED_VERSIONS = T.let(
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
SUPPORTED_VERSIONS = T.let(
|
27
|
+
[
|
28
|
+
Version.new(YARN_V1),
|
29
|
+
Version.new(YARN_V2),
|
30
|
+
Version.new(YARN_V3),
|
31
|
+
Version.new(YARN_V4)
|
32
|
+
].freeze,
|
33
|
+
T::Array[Dependabot::Version]
|
34
|
+
)
|
32
35
|
|
33
36
|
DEPRECATED_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version])
|
34
37
|
|