lib/licensed/sources/npm.rb in licensed-3.4.2 vs lib/licensed/sources/npm.rb in licensed-3.4.3
- old
+ new
@@ -133,10 +133,18 @@
def include_non_production?
config.dig("npm", "production_only") == false
end
def missing_peer?(parent, dependency, name)
- dependency["peerMissing"] || (dependency["missing"] && peer_dependency(parent, name))
+ # return true if dependency is marked as "peerMissing"
+ return true if dependency["peerMissing"]
+
+ # return false unless the parent has registered the dependency
+ # as a peer
+ return false unless peer_dependency(parent, name)
+ # return true if the dependency itself is marked as missing
+ return true if dependency["missing"]
+ dependency.empty? && parent&.dig("peerDependenciesMeta", name, "optional")
end
def peer_dependency(parent, name)
parent&.dig("peerDependencies", name)
end