Semver ranges

Check which versions a range accepts, using the same rules as npm. Matches the reference semver package on thousands of test cases.

Prerelease versions (like 1.5.0-beta.1) only match a range that names a prerelease of the same major.minor.patch, as in npm. Sorting follows the semver rules, where 1.0.0-alpha < 1.0.0-beta < 1.0.0.