Coerces a semver version to its base release tuple (major.minor.patch),
stripping any prerelease/build identifiers: 6.2.0-edge.3 → 6.2.0.
Used for the HOST MJ version before checking it against an app's
mjVersionRange. Plain semver.satisfies excludes prerelease versions
from ranges unless the range itself is tuple-anchored, so an -edge.N
dev host would reject every app install the moment MJ's Edge prerelease
grammar activates — even when the app's range is era-correct.
Why base-tuple coercion and NOT semver.satisfies(v, range, { includePrerelease: true }):
semver orders a prerelease BELOW its release (7.0.0-edge.0 < 7.0.0), so with
includePrerelease a 7-era Edge host would wrongly PASS a <7.0.0 cap —
satisfies('7.0.0-edge.0', '>=6.1.0 <7.0.0', { includePrerelease: true }) === true.
Coercing to the base tuple gives the era-correct answer: 7.0.0 fails <7.0.0.
The host gate cares about which release ERA the host is in, not prerelease
ordering — an -edge.N build of 6.2.0 is a 6.2-era host.
Parameters
version: string
A semver version string, possibly with prerelease/build suffix
Returns string
The major.minor.patch base version, or null if the input is not valid semver
Coerces a semver version to its base release tuple (
major.minor.patch), stripping any prerelease/build identifiers:6.2.0-edge.3→6.2.0.Used for the HOST MJ version before checking it against an app's
mjVersionRange. Plainsemver.satisfiesexcludes prerelease versions from ranges unless the range itself is tuple-anchored, so an-edge.Ndev host would reject every app install the moment MJ's Edge prerelease grammar activates — even when the app's range is era-correct.Why base-tuple coercion and NOT
semver.satisfies(v, range, { includePrerelease: true }): semver orders a prerelease BELOW its release (7.0.0-edge.0 < 7.0.0), so withincludePrereleasea 7-era Edge host would wrongly PASS a<7.0.0cap —satisfies('7.0.0-edge.0', '>=6.1.0 <7.0.0', { includePrerelease: true }) === true. Coercing to the base tuple gives the era-correct answer:7.0.0fails<7.0.0. The host gate cares about which release ERA the host is in, not prerelease ordering — an-edge.Nbuild of 6.2.0 is a 6.2-era host.