constants.js 873 B

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