I agree that your lockfile must not be packaged and shipped within the library.
However, when developing libraries you probably have a set of development dependencies and/or normal dependencies. Here is where I disagree, because these should actually be in a lockfile (in my opinion). You are still pulling dependencies there, even ones not included in the publishes library.
The alternative of using exact versions is also possible. Although, for me, the tradeoffs of messy commit to update patches and losing the ability of quick updates (remove lockfile/npm update) is a no-go for me.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.