Swift Package Manager defines targets and products separately: targets constitute Swift modules, and products constitute targets that are exposed to other packages.
This implies that targets that are not part of a product are not exposed. Unfortunately, that doesn’t seem to be the case in Swift 5.2: consumers are able to import any target that is a dependency of a product. This is extremely inconvenient for sharing code between targets, especially when it comes to extensions. Even Apple’s own packages, like Swift Numerics and swift-format, suffer from this shortcoming.
Is there a way around this? I do not want to pollute the namespace of everything downstream. Personally, I think declarations that are not inside direct dependencies of packages should not be accessible outside the package at all, except through runtime behavior.