• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Note: this is the semver.org version of the spec that it implements
2// Not necessarily the package version of this code.
3const SEMVER_SPEC_VERSION = '2.0.0'
4
5const MAX_LENGTH = 256
6const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
7/* istanbul ignore next */ 9007199254740991
8
9// Max safe segment length for coercion.
10const MAX_SAFE_COMPONENT_LENGTH = 16
11
12// Max safe length for a build identifier. The max length minus 6 characters for
13// the shortest version with a build 0.0.0+BUILD.
14const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
15
16const RELEASE_TYPES = [
17  'major',
18  'premajor',
19  'minor',
20  'preminor',
21  'patch',
22  'prepatch',
23  'prerelease',
24]
25
26module.exports = {
27  MAX_LENGTH,
28  MAX_SAFE_COMPONENT_LENGTH,
29  MAX_SAFE_BUILD_LENGTH,
30  MAX_SAFE_INTEGER,
31  RELEASE_TYPES,
32  SEMVER_SPEC_VERSION,
33  FLAG_INCLUDE_PRERELEASE: 0b001,
34  FLAG_LOOSE: 0b010,
35}
36