dependabot-common 0.400.0 → 0.401.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/package/npm_package_json.rb +56 -0
- data/lib/dependabot.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e7c9b0f34b253c6689d4cdd2d2bb85af222a8d65e336201471f374d51cca42c3
|
|
4
|
+
data.tar.gz: 65ec188d41768539a3bc7b17480dcc2babfaeb0189318aea7ae5a7a3fee6bae3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 35db428ec5f1c2f7f4f45c6b8d4c28a6b8a8e44cc08aa1330c283df92837ee08b62bacbb69027ff3ca4a57be1d00eadc5762e0b640849f66f9a5b788a90ae256
|
|
7
|
+
data.tar.gz: 82b376c4f531f0b4a8e03128a6d942ba80b236b58d21d568c8604561281abaca6448e75ac1f4fee8ef55fce77f5f6c26db10138c5fa6c5cdc43395d3ba13ba92
|
|
@@ -13,7 +13,9 @@ module Dependabot
|
|
|
13
13
|
extend T::Sig
|
|
14
14
|
|
|
15
15
|
ObjectHash = T.type_alias { T::Hash[String, Object] }
|
|
16
|
+
CatalogEntries = T.type_alias { T::Hash[String, String] }
|
|
16
17
|
DEPENDENCY_TYPES = %w(dependencies devDependencies optionalDependencies).freeze
|
|
18
|
+
CATALOG_FIELDS = %w(catalog catalogs).freeze
|
|
17
19
|
|
|
18
20
|
sig { params(file: DependencyFile).returns(NpmPackageJson) }
|
|
19
21
|
def self.from_file(file)
|
|
@@ -63,8 +65,62 @@ module Dependabot
|
|
|
63
65
|
NpmPackageManagerConfig.from_package_json(@data)
|
|
64
66
|
end
|
|
65
67
|
|
|
68
|
+
# The default catalog that `catalog:` requirements resolve against.
|
|
69
|
+
sig { returns(CatalogEntries) }
|
|
70
|
+
def catalog
|
|
71
|
+
prefix, fields = catalog_fields
|
|
72
|
+
value = fields["catalog"]
|
|
73
|
+
return {} unless value
|
|
74
|
+
|
|
75
|
+
catalog_entries(value, "#{prefix}catalog")
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Named catalogs that `catalog:<name>` requirements resolve against,
|
|
79
|
+
# keyed by catalog name. `default` extends the default catalog.
|
|
80
|
+
sig { returns(T::Hash[String, CatalogEntries]) }
|
|
81
|
+
def catalogs
|
|
82
|
+
prefix, fields = catalog_fields
|
|
83
|
+
value = fields["catalogs"]
|
|
84
|
+
return {} unless value
|
|
85
|
+
|
|
86
|
+
field = "#{prefix}catalogs"
|
|
87
|
+
result = T.let({}, T::Hash[String, CatalogEntries])
|
|
88
|
+
object_hash(value, field).each do |name, entries|
|
|
89
|
+
result[name] = catalog_entries(entries, "#{field}.#{name}")
|
|
90
|
+
end
|
|
91
|
+
result
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# The key of the object Bun reads both catalog fields from, or nil for
|
|
95
|
+
# the root. Bun reads them from `workspaces` when it declares either of
|
|
96
|
+
# them, and ignores the root fields in that case.
|
|
97
|
+
sig { returns(T.nilable(String)) }
|
|
98
|
+
def catalog_container
|
|
99
|
+
workspaces = @data["workspaces"]
|
|
100
|
+
return unless workspaces.is_a?(Hash)
|
|
101
|
+
|
|
102
|
+
"workspaces" if CATALOG_FIELDS.any? { |field| object_hash(workspaces, "workspaces").key?(field) }
|
|
103
|
+
end
|
|
104
|
+
|
|
66
105
|
private
|
|
67
106
|
|
|
107
|
+
sig { returns([String, ObjectHash]) }
|
|
108
|
+
def catalog_fields
|
|
109
|
+
container = catalog_container
|
|
110
|
+
return ["", @data] unless container
|
|
111
|
+
|
|
112
|
+
["#{container}.", object_hash(@data[container], container)]
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
sig { params(value: Object, field: String).returns(CatalogEntries) }
|
|
116
|
+
def catalog_entries(value, field)
|
|
117
|
+
entries = T.let({}, CatalogEntries)
|
|
118
|
+
object_hash(value, field).each do |name, requirement|
|
|
119
|
+
entries[name] = requirement if requirement.is_a?(String)
|
|
120
|
+
end
|
|
121
|
+
entries
|
|
122
|
+
end
|
|
123
|
+
|
|
68
124
|
sig { params(value: Object, field: String).returns(ObjectHash) }
|
|
69
125
|
def object_hash(value, field)
|
|
70
126
|
raise TypeError, "#{@path}: #{field} must be an object" unless value.is_a?(Hash)
|
data/lib/dependabot.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dependabot-common
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.401.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dependabot
|
|
@@ -635,7 +635,7 @@ licenses:
|
|
|
635
635
|
- MIT
|
|
636
636
|
metadata:
|
|
637
637
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
638
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
638
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.401.0
|
|
639
639
|
rdoc_options: []
|
|
640
640
|
require_paths:
|
|
641
641
|
- lib
|