keep-a-changelog 2.2.1 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -2
- package/README.md +27 -8
- package/esm/_dnt.shims.js +0 -1
- package/esm/bin.js +8 -3
- package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/flags/mod.js +3 -2
- package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/_util.d.ts +3 -0
- package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_util.js +46 -0
- package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/mod.d.ts +3 -1
- package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/mod.js +4 -1
- package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/posix.d.ts +7 -5
- package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/posix.js +50 -108
- package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/win32.d.ts +7 -5
- package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/win32.js +23 -82
- package/esm/deps/deno.land/std@0.203.0/semver/_shared.d.ts +42 -0
- package/esm/deps/deno.land/std@0.203.0/semver/_shared.js +230 -0
- package/esm/deps/deno.land/std@0.203.0/semver/cmp.d.ts +9 -0
- package/esm/deps/deno.land/std@0.203.0/semver/cmp.js +35 -0
- package/esm/deps/deno.land/std@0.203.0/semver/comparator_format.d.ts +8 -0
- package/esm/deps/deno.land/std@0.203.0/semver/comparator_format.js +11 -0
- package/esm/deps/deno.land/std@0.203.0/semver/comparator_intersects.d.ts +8 -0
- package/esm/deps/deno.land/std@0.203.0/semver/comparator_intersects.js +45 -0
- package/esm/deps/deno.land/std@0.203.0/semver/comparator_max.d.ts +9 -0
- package/esm/deps/deno.land/std@0.203.0/semver/comparator_max.js +45 -0
- package/esm/deps/deno.land/std@0.203.0/semver/comparator_min.d.ts +8 -0
- package/esm/deps/deno.land/std@0.203.0/semver/comparator_min.js +32 -0
- package/esm/deps/deno.land/std@0.203.0/semver/compare.d.ts +10 -0
- package/esm/deps/deno.land/std@0.203.0/semver/compare.js +18 -0
- package/esm/deps/deno.land/std@0.203.0/semver/compare_build.d.ts +13 -0
- package/esm/deps/deno.land/std@0.203.0/semver/compare_build.js +23 -0
- package/esm/deps/deno.land/std@0.203.0/semver/constants.d.ts +42 -0
- package/esm/deps/deno.land/std@0.203.0/semver/constants.js +75 -0
- package/esm/deps/deno.land/std@0.203.0/semver/difference.d.ts +4 -0
- package/esm/deps/deno.land/std@0.203.0/semver/difference.js +26 -0
- package/esm/deps/deno.land/std@0.203.0/semver/eq.d.ts +4 -0
- package/esm/deps/deno.land/std@0.203.0/semver/eq.js +7 -0
- package/esm/deps/deno.land/std@0.203.0/semver/format.d.ts +12 -0
- package/esm/deps/deno.land/std@0.203.0/semver/format.js +54 -0
- package/esm/deps/deno.land/std@0.203.0/semver/gt.d.ts +3 -0
- package/esm/deps/deno.land/std@0.203.0/semver/gt.js +5 -0
- package/esm/deps/deno.land/std@0.203.0/semver/gte.d.ts +3 -0
- package/esm/deps/deno.land/std@0.203.0/semver/gte.js +5 -0
- package/esm/deps/deno.land/std@0.203.0/semver/gtr.d.ts +3 -0
- package/esm/deps/deno.land/std@0.203.0/semver/gtr.js +5 -0
- package/esm/deps/deno.land/std@0.203.0/semver/increment.d.ts +28 -0
- package/esm/deps/deno.land/std@0.203.0/semver/increment.js +207 -0
- package/esm/deps/deno.land/std@0.203.0/semver/is_semver.d.ts +17 -0
- package/esm/deps/deno.land/std@0.203.0/semver/is_semver.js +41 -0
- package/esm/deps/deno.land/std@0.203.0/semver/is_semver_comparator.d.ts +12 -0
- package/esm/deps/deno.land/std@0.203.0/semver/is_semver_comparator.js +31 -0
- package/esm/deps/deno.land/std@0.203.0/semver/is_semver_range.d.ts +12 -0
- package/esm/deps/deno.land/std@0.203.0/semver/is_semver_range.js +22 -0
- package/esm/deps/deno.land/std@0.203.0/semver/lt.d.ts +3 -0
- package/esm/deps/deno.land/std@0.203.0/semver/lt.js +5 -0
- package/esm/deps/deno.land/std@0.203.0/semver/lte.d.ts +3 -0
- package/esm/deps/deno.land/std@0.203.0/semver/lte.js +5 -0
- package/esm/deps/deno.land/std@0.203.0/semver/ltr.d.ts +3 -0
- package/esm/deps/deno.land/std@0.203.0/semver/ltr.js +5 -0
- package/esm/deps/deno.land/std@0.203.0/semver/max_satisfying.d.ts +9 -0
- package/esm/deps/deno.land/std@0.203.0/semver/max_satisfying.js +14 -0
- package/esm/deps/deno.land/std@0.203.0/semver/min_satisfying.d.ts +9 -0
- package/esm/deps/deno.land/std@0.203.0/semver/min_satisfying.js +14 -0
- package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.203.0}/semver/mod.d.ts +88 -176
- package/esm/deps/deno.land/std@0.203.0/semver/mod.js +313 -0
- package/esm/deps/deno.land/std@0.203.0/semver/neq.d.ts +3 -0
- package/esm/deps/deno.land/std@0.203.0/semver/neq.js +5 -0
- package/esm/deps/deno.land/std@0.203.0/semver/outside.d.ts +11 -0
- package/esm/deps/deno.land/std@0.203.0/semver/outside.js +67 -0
- package/esm/deps/deno.land/std@0.203.0/semver/parse.d.ts +8 -0
- package/esm/deps/deno.land/std@0.203.0/semver/parse.js +66 -0
- package/esm/deps/deno.land/std@0.203.0/semver/parse_comparator.d.ts +7 -0
- package/esm/deps/deno.land/std@0.203.0/semver/parse_comparator.js +28 -0
- package/esm/deps/deno.land/std@0.203.0/semver/parse_range.d.ts +7 -0
- package/esm/deps/deno.land/std@0.203.0/semver/parse_range.js +292 -0
- package/esm/deps/deno.land/std@0.203.0/semver/range_format.d.ts +8 -0
- package/esm/deps/deno.land/std@0.203.0/semver/range_format.js +11 -0
- package/esm/deps/deno.land/std@0.203.0/semver/range_intersects.d.ts +8 -0
- package/esm/deps/deno.land/std@0.203.0/semver/range_intersects.js +35 -0
- package/esm/deps/deno.land/std@0.203.0/semver/range_max.d.ts +7 -0
- package/esm/deps/deno.land/std@0.203.0/semver/range_max.js +15 -0
- package/esm/deps/deno.land/std@0.203.0/semver/range_min.d.ts +7 -0
- package/esm/deps/deno.land/std@0.203.0/semver/range_min.js +14 -0
- package/esm/deps/deno.land/std@0.203.0/semver/rcompare.d.ts +8 -0
- package/esm/deps/deno.land/std@0.203.0/semver/rcompare.js +10 -0
- package/esm/deps/deno.land/std@0.203.0/semver/rsort.d.ts +3 -0
- package/esm/deps/deno.land/std@0.203.0/semver/rsort.js +5 -0
- package/esm/deps/deno.land/std@0.203.0/semver/sort.d.ts +3 -0
- package/esm/deps/deno.land/std@0.203.0/semver/sort.js +5 -0
- package/esm/deps/deno.land/std@0.203.0/semver/test_comparator.d.ts +8 -0
- package/esm/deps/deno.land/std@0.203.0/semver/test_comparator.js +10 -0
- package/esm/deps/deno.land/std@0.203.0/semver/test_range.d.ts +8 -0
- package/esm/deps/deno.land/std@0.203.0/semver/test_range.js +16 -0
- package/esm/deps/deno.land/std@0.203.0/semver/types.d.ts +44 -0
- package/esm/deps/deno.land/std@0.203.0/semver/types.js +2 -0
- package/{types → esm}/src/Changelog.d.ts +4 -2
- package/esm/src/Changelog.js +25 -4
- package/{types → esm}/src/Release.d.ts +5 -4
- package/esm/src/Release.js +21 -22
- package/esm/src/deps.d.ts +2 -0
- package/esm/src/deps.js +1 -1
- package/esm/test/changelog.custom.type.md +2 -3
- package/esm/test/changelog.expected.linted.md +3 -4
- package/esm/test/changelog.expected.md +3 -4
- package/esm/test/changelog.md +3 -4
- package/esm/test/empty.expected.md +2 -2
- package/package.json +6 -13
- package/script/_dnt.polyfills.d.ts +11 -0
- package/script/_dnt.shims.d.ts +5 -0
- package/script/_dnt.shims.js +0 -1
- package/script/bin.d.ts +2 -0
- package/script/bin.js +8 -3
- package/script/deps/deno.land/std@0.189.0/_util/asserts.d.ts +10 -0
- package/script/deps/deno.land/std@0.189.0/_util/os.d.ts +4 -0
- package/script/deps/deno.land/std@0.189.0/flags/mod.d.ts +166 -0
- package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/flags/mod.js +4 -3
- package/script/deps/deno.land/std@0.189.0/path/_constants.d.ts +39 -0
- package/script/deps/deno.land/std@0.189.0/path/_interface.d.ts +26 -0
- package/script/deps/deno.land/std@0.189.0/path/_util.d.ts +11 -0
- package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_util.js +50 -1
- package/script/deps/deno.land/std@0.189.0/path/common.d.ts +13 -0
- package/script/deps/deno.land/std@0.189.0/path/glob.d.ts +83 -0
- package/script/deps/deno.land/std@0.189.0/path/mod.d.ts +11 -0
- package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/mod.js +5 -2
- package/script/deps/deno.land/std@0.189.0/path/posix.d.ts +86 -0
- package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/posix.js +48 -106
- package/script/deps/deno.land/std@0.189.0/path/separator.d.ts +2 -0
- package/script/deps/deno.land/std@0.189.0/path/win32.d.ts +91 -0
- package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/win32.js +22 -81
- package/script/deps/deno.land/std@0.203.0/semver/_shared.d.ts +42 -0
- package/script/deps/deno.land/std@0.203.0/semver/_shared.js +248 -0
- package/script/deps/deno.land/std@0.203.0/semver/cmp.d.ts +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/cmp.js +39 -0
- package/script/deps/deno.land/std@0.203.0/semver/comparator_format.d.ts +8 -0
- package/script/deps/deno.land/std@0.203.0/semver/comparator_format.js +15 -0
- package/script/deps/deno.land/std@0.203.0/semver/comparator_intersects.d.ts +8 -0
- package/script/deps/deno.land/std@0.203.0/semver/comparator_intersects.js +49 -0
- package/script/deps/deno.land/std@0.203.0/semver/comparator_max.d.ts +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/comparator_max.js +49 -0
- package/script/deps/deno.land/std@0.203.0/semver/comparator_min.d.ts +8 -0
- package/script/deps/deno.land/std@0.203.0/semver/comparator_min.js +36 -0
- package/script/deps/deno.land/std@0.203.0/semver/compare.d.ts +10 -0
- package/script/deps/deno.land/std@0.203.0/semver/compare.js +22 -0
- package/script/deps/deno.land/std@0.203.0/semver/compare_build.d.ts +13 -0
- package/script/deps/deno.land/std@0.203.0/semver/compare_build.js +27 -0
- package/script/deps/deno.land/std@0.203.0/semver/constants.d.ts +42 -0
- package/script/deps/deno.land/std@0.203.0/semver/constants.js +78 -0
- package/script/deps/deno.land/std@0.203.0/semver/difference.d.ts +4 -0
- package/script/deps/deno.land/std@0.203.0/semver/difference.js +30 -0
- package/script/deps/deno.land/std@0.203.0/semver/eq.d.ts +4 -0
- package/script/deps/deno.land/std@0.203.0/semver/eq.js +11 -0
- package/script/deps/deno.land/std@0.203.0/semver/format.d.ts +12 -0
- package/script/deps/deno.land/std@0.203.0/semver/format.js +58 -0
- package/script/deps/deno.land/std@0.203.0/semver/gt.d.ts +3 -0
- package/script/deps/deno.land/std@0.203.0/semver/gt.js +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/gte.d.ts +3 -0
- package/script/deps/deno.land/std@0.203.0/semver/gte.js +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/gtr.d.ts +3 -0
- package/script/deps/deno.land/std@0.203.0/semver/gtr.js +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/increment.d.ts +28 -0
- package/script/deps/deno.land/std@0.203.0/semver/increment.js +211 -0
- package/script/deps/deno.land/std@0.203.0/semver/is_semver.d.ts +17 -0
- package/script/deps/deno.land/std@0.203.0/semver/is_semver.js +45 -0
- package/script/deps/deno.land/std@0.203.0/semver/is_semver_comparator.d.ts +12 -0
- package/script/deps/deno.land/std@0.203.0/semver/is_semver_comparator.js +35 -0
- package/script/deps/deno.land/std@0.203.0/semver/is_semver_range.d.ts +12 -0
- package/script/deps/deno.land/std@0.203.0/semver/is_semver_range.js +26 -0
- package/script/deps/deno.land/std@0.203.0/semver/lt.d.ts +3 -0
- package/script/deps/deno.land/std@0.203.0/semver/lt.js +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/lte.d.ts +3 -0
- package/script/deps/deno.land/std@0.203.0/semver/lte.js +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/ltr.d.ts +3 -0
- package/script/deps/deno.land/std@0.203.0/semver/ltr.js +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/max_satisfying.d.ts +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/max_satisfying.js +18 -0
- package/script/deps/deno.land/std@0.203.0/semver/min_satisfying.d.ts +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/min_satisfying.js +18 -0
- package/script/deps/deno.land/std@0.203.0/semver/mod.d.ts +310 -0
- package/script/deps/deno.land/std@0.203.0/semver/mod.js +330 -0
- package/script/deps/deno.land/std@0.203.0/semver/neq.d.ts +3 -0
- package/script/deps/deno.land/std@0.203.0/semver/neq.js +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/outside.d.ts +11 -0
- package/script/deps/deno.land/std@0.203.0/semver/outside.js +71 -0
- package/script/deps/deno.land/std@0.203.0/semver/parse.d.ts +8 -0
- package/script/deps/deno.land/std@0.203.0/semver/parse.js +70 -0
- package/script/deps/deno.land/std@0.203.0/semver/parse_comparator.d.ts +7 -0
- package/script/deps/deno.land/std@0.203.0/semver/parse_comparator.js +32 -0
- package/script/deps/deno.land/std@0.203.0/semver/parse_range.d.ts +7 -0
- package/script/deps/deno.land/std@0.203.0/semver/parse_range.js +296 -0
- package/script/deps/deno.land/std@0.203.0/semver/range_format.d.ts +8 -0
- package/script/deps/deno.land/std@0.203.0/semver/range_format.js +15 -0
- package/script/deps/deno.land/std@0.203.0/semver/range_intersects.d.ts +8 -0
- package/script/deps/deno.land/std@0.203.0/semver/range_intersects.js +39 -0
- package/script/deps/deno.land/std@0.203.0/semver/range_max.d.ts +7 -0
- package/script/deps/deno.land/std@0.203.0/semver/range_max.js +19 -0
- package/script/deps/deno.land/std@0.203.0/semver/range_min.d.ts +7 -0
- package/script/deps/deno.land/std@0.203.0/semver/range_min.js +18 -0
- package/script/deps/deno.land/std@0.203.0/semver/rcompare.d.ts +8 -0
- package/script/deps/deno.land/std@0.203.0/semver/rcompare.js +14 -0
- package/script/deps/deno.land/std@0.203.0/semver/rsort.d.ts +3 -0
- package/script/deps/deno.land/std@0.203.0/semver/rsort.js +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/sort.d.ts +3 -0
- package/script/deps/deno.land/std@0.203.0/semver/sort.js +9 -0
- package/script/deps/deno.land/std@0.203.0/semver/test_comparator.d.ts +8 -0
- package/script/deps/deno.land/std@0.203.0/semver/test_comparator.js +14 -0
- package/script/deps/deno.land/std@0.203.0/semver/test_range.d.ts +8 -0
- package/script/deps/deno.land/std@0.203.0/semver/test_range.js +20 -0
- package/script/deps/deno.land/std@0.203.0/semver/types.d.ts +44 -0
- package/script/deps/deno.land/std@0.203.0/semver/types.js +3 -0
- package/script/deps/deno.land/std@0.51.0/fs/eol.d.ts +12 -0
- package/script/deps/deno.land/x/ini@v2.1.0/ini.d.ts +53 -0
- package/script/deps/deno.land/x/ini@v2.1.0/mod.d.ts +1 -0
- package/script/mod.d.ts +6 -0
- package/script/src/Change.d.ts +8 -0
- package/script/src/Changelog.d.ts +21 -0
- package/script/src/Changelog.js +24 -3
- package/script/src/Release.d.ts +28 -0
- package/script/src/Release.js +20 -21
- package/script/src/deps.d.ts +2 -0
- package/script/src/deps.js +5 -6
- package/script/src/parser.d.ts +11 -0
- package/script/test/changelog.custom.type.md +2 -3
- package/script/test/changelog.expected.linted.md +3 -4
- package/script/test/changelog.expected.md +3 -4
- package/script/test/changelog.md +3 -4
- package/script/test/empty.expected.md +2 -2
- package/esm/deps/deno.land/std@0.173.0/semver/mod.js +0 -1420
- package/script/deps/deno.land/std@0.173.0/semver/mod.js +0 -1458
- package/types/src/deps.d.ts +0 -1
- /package/{types → esm}/_dnt.polyfills.d.ts +0 -0
- /package/{types → esm}/_dnt.shims.d.ts +0 -0
- /package/{types → esm}/bin.d.ts +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/_util/asserts.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/asserts.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/_util/os.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/os.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/flags/mod.d.ts +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/_constants.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_constants.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/_interface.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_interface.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/common.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/common.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/glob.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/glob.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/separator.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/separator.js +0 -0
- /package/{types → esm}/deps/deno.land/std@0.51.0/fs/eol.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/x/ini@v2.1.0/ini.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/x/ini@v2.1.0/mod.d.ts +0 -0
- /package/{types → esm}/mod.d.ts +0 -0
- /package/{types → esm}/src/Change.d.ts +0 -0
- /package/{types → esm}/src/parser.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/asserts.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/os.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_constants.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_interface.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/common.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/glob.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/separator.js +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSemVer = void 0;
|
|
4
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
5
|
+
const constants_js_1 = require("./constants.js");
|
|
6
|
+
const _shared_js_1 = require("./_shared.js");
|
|
7
|
+
/**
|
|
8
|
+
* Checks to see if value is a valid SemVer object. It does a check
|
|
9
|
+
* into each field including prerelease and build.
|
|
10
|
+
*
|
|
11
|
+
* Some invalid SemVer sentinels can still return true such as ANY and INVALID.
|
|
12
|
+
* An object which has the same value as a sentinel but isn't reference equal
|
|
13
|
+
* will still fail.
|
|
14
|
+
*
|
|
15
|
+
* Objects which are valid SemVer objects but have _extra_ fields are still
|
|
16
|
+
* considered SemVer objects and this will return true.
|
|
17
|
+
*
|
|
18
|
+
* A type assertion is added to the value.
|
|
19
|
+
* @param value The value to check to see if its a valid SemVer object
|
|
20
|
+
* @returns True if value is a valid SemVer otherwise false
|
|
21
|
+
*/
|
|
22
|
+
function isSemVer(value) {
|
|
23
|
+
if (value === null || value === undefined)
|
|
24
|
+
return false;
|
|
25
|
+
if (Array.isArray(value))
|
|
26
|
+
return false;
|
|
27
|
+
if (typeof value !== "object")
|
|
28
|
+
return false;
|
|
29
|
+
if (value === constants_js_1.INVALID)
|
|
30
|
+
return true;
|
|
31
|
+
if (value === constants_js_1.ANY)
|
|
32
|
+
return true;
|
|
33
|
+
const { major, minor, patch, build, prerelease } = value;
|
|
34
|
+
const result = typeof major === "number" && (0, _shared_js_1.isValidNumber)(major) &&
|
|
35
|
+
typeof minor === "number" && (0, _shared_js_1.isValidNumber)(minor) &&
|
|
36
|
+
typeof patch === "number" && (0, _shared_js_1.isValidNumber)(patch) &&
|
|
37
|
+
Array.isArray(prerelease) &&
|
|
38
|
+
Array.isArray(build) &&
|
|
39
|
+
prerelease.every((v) => typeof v === "string" || typeof v === "number") &&
|
|
40
|
+
prerelease.filter((v) => typeof v === "string").every((v) => (0, _shared_js_1.isValidString)(v)) &&
|
|
41
|
+
prerelease.filter((v) => typeof v === "number").every((v) => (0, _shared_js_1.isValidNumber)(v)) &&
|
|
42
|
+
build.every((v) => typeof v === "string" && (0, _shared_js_1.isValidString)(v));
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
exports.isSemVer = isSemVer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SemVerComparator } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Does a deep check on the value to see if it is a valid SemVerComparator object.
|
|
4
|
+
*
|
|
5
|
+
* Objects with extra fields are still considered valid if they have at
|
|
6
|
+
* least the correct fields.
|
|
7
|
+
*
|
|
8
|
+
* Adds a type assertion if true.
|
|
9
|
+
* @param value The value to check if its a SemVerComparator
|
|
10
|
+
* @returns True if the object is a SemVerComparator otherwise false
|
|
11
|
+
*/
|
|
12
|
+
export declare function isSemVerComparator(value: unknown): value is SemVerComparator;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSemVerComparator = void 0;
|
|
4
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
5
|
+
const is_semver_js_1 = require("./is_semver.js");
|
|
6
|
+
const _shared_js_1 = require("./_shared.js");
|
|
7
|
+
const constants_js_1 = require("./constants.js");
|
|
8
|
+
/**
|
|
9
|
+
* Does a deep check on the value to see if it is a valid SemVerComparator object.
|
|
10
|
+
*
|
|
11
|
+
* Objects with extra fields are still considered valid if they have at
|
|
12
|
+
* least the correct fields.
|
|
13
|
+
*
|
|
14
|
+
* Adds a type assertion if true.
|
|
15
|
+
* @param value The value to check if its a SemVerComparator
|
|
16
|
+
* @returns True if the object is a SemVerComparator otherwise false
|
|
17
|
+
*/
|
|
18
|
+
function isSemVerComparator(value) {
|
|
19
|
+
if (value === null || value === undefined)
|
|
20
|
+
return false;
|
|
21
|
+
if (value === constants_js_1.NONE)
|
|
22
|
+
return true;
|
|
23
|
+
if (value === constants_js_1.ALL)
|
|
24
|
+
return true;
|
|
25
|
+
if (Array.isArray(value))
|
|
26
|
+
return false;
|
|
27
|
+
if (typeof value !== "object")
|
|
28
|
+
return false;
|
|
29
|
+
const { operator, semver, min, max } = value;
|
|
30
|
+
return ((0, _shared_js_1.isValidOperator)(operator) &&
|
|
31
|
+
(0, is_semver_js_1.isSemVer)(semver) &&
|
|
32
|
+
(0, is_semver_js_1.isSemVer)(min) &&
|
|
33
|
+
(0, is_semver_js_1.isSemVer)(max));
|
|
34
|
+
}
|
|
35
|
+
exports.isSemVerComparator = isSemVerComparator;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SemVerRange } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Does a deep check on the object to determine if its a valid range.
|
|
4
|
+
*
|
|
5
|
+
* Objects with extra fields are still considered valid if they have at
|
|
6
|
+
* least the correct fields.
|
|
7
|
+
*
|
|
8
|
+
* Adds a type assertion if true.
|
|
9
|
+
* @param value The value to check if its a valid SemVerRange
|
|
10
|
+
* @returns True if its a valid SemVerRange otherwise false.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isSemVerRange(value: unknown): value is SemVerRange;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSemVerRange = void 0;
|
|
4
|
+
const is_semver_comparator_js_1 = require("./is_semver_comparator.js");
|
|
5
|
+
/**
|
|
6
|
+
* Does a deep check on the object to determine if its a valid range.
|
|
7
|
+
*
|
|
8
|
+
* Objects with extra fields are still considered valid if they have at
|
|
9
|
+
* least the correct fields.
|
|
10
|
+
*
|
|
11
|
+
* Adds a type assertion if true.
|
|
12
|
+
* @param value The value to check if its a valid SemVerRange
|
|
13
|
+
* @returns True if its a valid SemVerRange otherwise false.
|
|
14
|
+
*/
|
|
15
|
+
function isSemVerRange(value) {
|
|
16
|
+
if (value === null || value === undefined)
|
|
17
|
+
return false;
|
|
18
|
+
if (Array.isArray(value))
|
|
19
|
+
return false;
|
|
20
|
+
if (typeof value !== "object")
|
|
21
|
+
return false;
|
|
22
|
+
const { ranges } = value;
|
|
23
|
+
return (Array.isArray(ranges),
|
|
24
|
+
ranges.every((r) => Array.isArray(r) && r.every((c) => (0, is_semver_comparator_js_1.isSemVerComparator)(c))));
|
|
25
|
+
}
|
|
26
|
+
exports.isSemVerRange = isSemVerRange;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lt = void 0;
|
|
4
|
+
const compare_js_1 = require("./compare.js");
|
|
5
|
+
/** Less than comparison */
|
|
6
|
+
function lt(s0, s1) {
|
|
7
|
+
return (0, compare_js_1.compare)(s0, s1) < 0;
|
|
8
|
+
}
|
|
9
|
+
exports.lt = lt;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lte = void 0;
|
|
4
|
+
const compare_js_1 = require("./compare.js");
|
|
5
|
+
/** Less than or equal to comparison */
|
|
6
|
+
function lte(s0, s1) {
|
|
7
|
+
return (0, compare_js_1.compare)(s0, s1) <= 0;
|
|
8
|
+
}
|
|
9
|
+
exports.lte = lte;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ltr = void 0;
|
|
4
|
+
const outside_js_1 = require("./outside.js");
|
|
5
|
+
/** Greater than range comparison */
|
|
6
|
+
function ltr(version, range) {
|
|
7
|
+
return (0, outside_js_1.outside)(version, range, "<");
|
|
8
|
+
}
|
|
9
|
+
exports.ltr = ltr;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SemVer, SemVerRange } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the highest version in the list that satisfies the range, or `undefined`
|
|
4
|
+
* if none of them do.
|
|
5
|
+
* @param versions The versions to check.
|
|
6
|
+
* @param range The range of possible versions to compare to.
|
|
7
|
+
* @returns The highest version in versions that satisfies the range.
|
|
8
|
+
*/
|
|
9
|
+
export declare function maxSatisfying(versions: SemVer[], range: SemVerRange): SemVer | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maxSatisfying = void 0;
|
|
4
|
+
const sort_js_1 = require("./sort.js");
|
|
5
|
+
const test_range_js_1 = require("./test_range.js");
|
|
6
|
+
/**
|
|
7
|
+
* Returns the highest version in the list that satisfies the range, or `undefined`
|
|
8
|
+
* if none of them do.
|
|
9
|
+
* @param versions The versions to check.
|
|
10
|
+
* @param range The range of possible versions to compare to.
|
|
11
|
+
* @returns The highest version in versions that satisfies the range.
|
|
12
|
+
*/
|
|
13
|
+
function maxSatisfying(versions, range) {
|
|
14
|
+
const satisfying = versions.filter((v) => (0, test_range_js_1.testRange)(v, range));
|
|
15
|
+
const sorted = (0, sort_js_1.sort)(satisfying);
|
|
16
|
+
return sorted.pop();
|
|
17
|
+
}
|
|
18
|
+
exports.maxSatisfying = maxSatisfying;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SemVer, SemVerRange } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the lowest version in the list that satisfies the range, or `undefined` if
|
|
4
|
+
* none of them do.
|
|
5
|
+
* @param versions The versions to check.
|
|
6
|
+
* @param range The range of possible versions to compare to.
|
|
7
|
+
* @returns The lowest version in versions that satisfies the range.
|
|
8
|
+
*/
|
|
9
|
+
export declare function minSatisfying(versions: SemVer[], range: SemVerRange): SemVer | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.minSatisfying = void 0;
|
|
4
|
+
const sort_js_1 = require("./sort.js");
|
|
5
|
+
const test_range_js_1 = require("./test_range.js");
|
|
6
|
+
/**
|
|
7
|
+
* Returns the lowest version in the list that satisfies the range, or `undefined` if
|
|
8
|
+
* none of them do.
|
|
9
|
+
* @param versions The versions to check.
|
|
10
|
+
* @param range The range of possible versions to compare to.
|
|
11
|
+
* @returns The lowest version in versions that satisfies the range.
|
|
12
|
+
*/
|
|
13
|
+
function minSatisfying(versions, range) {
|
|
14
|
+
const satisfying = versions.filter((v) => (0, test_range_js_1.testRange)(v, range));
|
|
15
|
+
const sorted = (0, sort_js_1.sort)(satisfying);
|
|
16
|
+
return sorted.shift();
|
|
17
|
+
}
|
|
18
|
+
exports.minSatisfying = minSatisfying;
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The semantic version parser.
|
|
3
|
+
*
|
|
4
|
+
* Adapted directly from [semver](https://github.com/npm/node-semver).
|
|
5
|
+
*
|
|
6
|
+
* ## Versions
|
|
7
|
+
*
|
|
8
|
+
* A "version" is described by the `v2.0.0` specification found at
|
|
9
|
+
* <https://semver.org>.
|
|
10
|
+
*
|
|
11
|
+
* A leading `"="` or `"v"` character is stripped off and ignored.
|
|
12
|
+
*
|
|
13
|
+
* ## Format
|
|
14
|
+
*
|
|
15
|
+
* Semantic versions can be formatted as strings, by default they
|
|
16
|
+
* are formatted as `full`. Below is a diagram showing the various
|
|
17
|
+
* formatting options.
|
|
18
|
+
*
|
|
19
|
+
* ```
|
|
20
|
+
* ┌───── full
|
|
21
|
+
* ┌───┴───┐
|
|
22
|
+
* ├───────── release
|
|
23
|
+
* ┌───┴───┐ │
|
|
24
|
+
* ├───────────── primary
|
|
25
|
+
* ┌─┴─┐ │ │
|
|
26
|
+
* 1.2.3-pre.1+b.1
|
|
27
|
+
* │ │ │ └─┬─┘ └┬┘
|
|
28
|
+
* │ │ │ │ └── build
|
|
29
|
+
* │ │ │ └─────── pre
|
|
30
|
+
* │ │ └─────────── patch
|
|
31
|
+
* │ └───────────── minor
|
|
32
|
+
* └─────────────── major
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* ## Ranges
|
|
36
|
+
*
|
|
37
|
+
* A `version range` is a set of `comparators` which specify versions that satisfy
|
|
38
|
+
* the range.
|
|
39
|
+
*
|
|
40
|
+
* A `comparator` is composed of an `operator` and a `version`. The set of
|
|
41
|
+
* primitive `operators` is:
|
|
42
|
+
*
|
|
43
|
+
* - `<` Less than
|
|
44
|
+
* - `<=` Less than or equal to
|
|
45
|
+
* - `>` Greater than
|
|
46
|
+
* - `>=` Greater than or equal to
|
|
47
|
+
* - `=` Equal. If no operator is specified, then equality is assumed, so this
|
|
48
|
+
* operator is optional, but MAY be included.
|
|
49
|
+
*
|
|
50
|
+
* For example, the comparator `>=1.2.7` would match the versions `1.2.7`, `1.2.8`,
|
|
51
|
+
* `2.5.3`, and `1.3.9`, but not the versions `1.2.6` or `1.1.0`.
|
|
52
|
+
*
|
|
53
|
+
* Comparators can be joined by whitespace to form a `comparator set`, which is
|
|
54
|
+
* satisfied by the **intersection** of all of the comparators it includes.
|
|
55
|
+
*
|
|
56
|
+
* A range is composed of one or more comparator sets, joined by `||`. A version
|
|
57
|
+
* matches a range if and only if every comparator in at least one of the
|
|
58
|
+
* `||`-separated comparator sets is satisfied by the version.
|
|
59
|
+
*
|
|
60
|
+
* For example, the range `>=1.2.7 <1.3.0` would match the versions `1.2.7`,
|
|
61
|
+
* `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, or `1.1.0`.
|
|
62
|
+
*
|
|
63
|
+
* The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, `1.2.9`,
|
|
64
|
+
* and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
|
65
|
+
*
|
|
66
|
+
* ### Prerelease Tags
|
|
67
|
+
*
|
|
68
|
+
* If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then it will
|
|
69
|
+
* only be allowed to satisfy comparator sets if at least one comparator with the
|
|
70
|
+
* same `[major, minor, patch]` tuple also has a prerelease tag.
|
|
71
|
+
*
|
|
72
|
+
* For example, the range `>1.2.3-alpha.3` would be allowed to match the version
|
|
73
|
+
* `1.2.3-alpha.7`, but it would _not_ be satisfied by `3.4.5-alpha.9`, even though
|
|
74
|
+
* `3.4.5-alpha.9` is technically "greater than" `1.2.3-alpha.3` according to the
|
|
75
|
+
* SemVer sort rules. The version range only accepts prerelease tags on the `1.2.3`
|
|
76
|
+
* version. The version `3.4.5` _would_ satisfy the range, because it does not have
|
|
77
|
+
* a prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
|
78
|
+
*
|
|
79
|
+
* The purpose for this behavior is twofold. First, prerelease versions frequently
|
|
80
|
+
* are updated very quickly, and contain many breaking changes that are (by the
|
|
81
|
+
* author"s design) not yet fit for public consumption. Therefore, by default, they
|
|
82
|
+
* are excluded from range matching semantics.
|
|
83
|
+
*
|
|
84
|
+
* Second, a user who has opted into using a prerelease version has clearly
|
|
85
|
+
* indicated the intent to use _that specific_ set of alpha/beta/rc versions. By
|
|
86
|
+
* including a prerelease tag in the range, the user is indicating that they are
|
|
87
|
+
* aware of the risk. However, it is still not appropriate to assume that they have
|
|
88
|
+
* opted into taking a similar risk on the _next_ set of prerelease versions.
|
|
89
|
+
*
|
|
90
|
+
* Note that this behavior can be suppressed (treating all prerelease versions as
|
|
91
|
+
* if they were normal versions, for the purpose of range matching) by setting the
|
|
92
|
+
* `includePrerelease` flag on the options object to any [functions](#functions)
|
|
93
|
+
* that do range matching.
|
|
94
|
+
*
|
|
95
|
+
* #### Prerelease Identifiers
|
|
96
|
+
*
|
|
97
|
+
* The method `.increment` takes an additional `identifier` string argument that
|
|
98
|
+
* will append the value of the string as a prerelease identifier:
|
|
99
|
+
*
|
|
100
|
+
* ```javascript
|
|
101
|
+
* semver.increment(parse("1.2.3"), "prerelease", "beta");
|
|
102
|
+
* // "1.2.4-beta.0"
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* ### Build Metadata
|
|
106
|
+
*
|
|
107
|
+
* Build metadata is `.` delimited alpha-numeric string.
|
|
108
|
+
* When parsing a version it is retained on the `build: string[]` field
|
|
109
|
+
* of the semver instance. When incrementing there is an additional parameter that
|
|
110
|
+
* can set the build metadata on the semver instance.
|
|
111
|
+
*
|
|
112
|
+
* ### Advanced Range Syntax
|
|
113
|
+
*
|
|
114
|
+
* Advanced range syntax desugars to primitive comparators in deterministic ways.
|
|
115
|
+
*
|
|
116
|
+
* Advanced ranges may be combined in the same way as primitive comparators using
|
|
117
|
+
* white space or `||`.
|
|
118
|
+
*
|
|
119
|
+
* #### Hyphen Ranges `X.Y.Z - A.B.C`
|
|
120
|
+
*
|
|
121
|
+
* Specifies an inclusive set.
|
|
122
|
+
*
|
|
123
|
+
* - `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
|
124
|
+
*
|
|
125
|
+
* If a partial version is provided as the first version in the inclusive range,
|
|
126
|
+
* then the missing pieces are replaced with zeroes.
|
|
127
|
+
*
|
|
128
|
+
* - `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
|
129
|
+
*
|
|
130
|
+
* If a partial version is provided as the second version in the inclusive range,
|
|
131
|
+
* then all versions that start with the supplied parts of the tuple are accepted,
|
|
132
|
+
* but nothing that would be greater than the provided tuple parts.
|
|
133
|
+
*
|
|
134
|
+
* - `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
|
|
135
|
+
* - `1.2.3 - 2` := `>=1.2.3 <3.0.0`
|
|
136
|
+
*
|
|
137
|
+
* #### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
|
138
|
+
*
|
|
139
|
+
* Any of `X`, `x`, or `*` may be used to "stand in" for one of the numeric values
|
|
140
|
+
* in the `[major, minor, patch]` tuple.
|
|
141
|
+
*
|
|
142
|
+
* - `*` := `>=0.0.0` (Any version satisfies)
|
|
143
|
+
* - `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
|
|
144
|
+
* - `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
|
|
145
|
+
*
|
|
146
|
+
* A partial version range is treated as an X-Range, so the special character is in
|
|
147
|
+
* fact optional.
|
|
148
|
+
*
|
|
149
|
+
* - `""` (empty string) := `*` := `>=0.0.0`
|
|
150
|
+
* - `1` := `1.x.x` := `>=1.0.0 <2.0.0`
|
|
151
|
+
* - `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
|
|
152
|
+
*
|
|
153
|
+
* #### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
|
154
|
+
*
|
|
155
|
+
* Allows patch-level changes if a minor version is specified on the comparator.
|
|
156
|
+
* Allows minor-level changes if not.
|
|
157
|
+
*
|
|
158
|
+
* - `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
|
|
159
|
+
* - `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
|
|
160
|
+
* - `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
|
|
161
|
+
* - `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
|
|
162
|
+
* - `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
|
|
163
|
+
* - `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
|
|
164
|
+
* - `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in the
|
|
165
|
+
* `1.2.3` version will be allowed, if they are greater than or equal to
|
|
166
|
+
* `beta.2`. So, `1.2.3-beta.4` would be allowed, but `1.2.4-beta.2` would not,
|
|
167
|
+
* because it is a prerelease of a different `[major, minor, patch]` tuple.
|
|
168
|
+
*
|
|
169
|
+
* #### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
|
170
|
+
*
|
|
171
|
+
* Allows changes that do not modify the left-most non-zero element in the
|
|
172
|
+
* `[major, minor, patch]` tuple. In other words, this allows patch and minor
|
|
173
|
+
* updates for versions `1.0.0` and above, patch updates for versions
|
|
174
|
+
* `0.X >=0.1.0`, and _no_ updates for versions `0.0.X`.
|
|
175
|
+
*
|
|
176
|
+
* Many authors treat a `0.x` version as if the `x` were the major
|
|
177
|
+
* "breaking-change" indicator.
|
|
178
|
+
*
|
|
179
|
+
* Caret ranges are ideal when an author may make breaking changes between `0.2.4`
|
|
180
|
+
* and `0.3.0` releases, which is a common practice. However, it presumes that
|
|
181
|
+
* there will _not_ be breaking changes between `0.2.4` and `0.2.5`. It allows for
|
|
182
|
+
* changes that are presumed to be additive (but non-breaking), according to
|
|
183
|
+
* commonly observed practices.
|
|
184
|
+
*
|
|
185
|
+
* - `^1.2.3` := `>=1.2.3 <2.0.0`
|
|
186
|
+
* - `^0.2.3` := `>=0.2.3 <0.3.0`
|
|
187
|
+
* - `^0.0.3` := `>=0.0.3 <0.0.4`
|
|
188
|
+
* - `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in the
|
|
189
|
+
* `1.2.3` version will be allowed, if they are greater than or equal to
|
|
190
|
+
* `beta.2`. So, `1.2.3-beta.4` would be allowed, but `1.2.4-beta.2` would not,
|
|
191
|
+
* because it is a prerelease of a different `[major, minor, patch]` tuple.
|
|
192
|
+
* - `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the `0.0.3`
|
|
193
|
+
* version _only_ will be allowed, if they are greater than or equal to `beta`.
|
|
194
|
+
* So, `0.0.3-pr.2` would be allowed.
|
|
195
|
+
*
|
|
196
|
+
* When parsing caret ranges, a missing `patch` value desugars to the number `0`,
|
|
197
|
+
* but will allow flexibility within that value, even if the major and minor
|
|
198
|
+
* versions are both `0`.
|
|
199
|
+
*
|
|
200
|
+
* - `^1.2.x` := `>=1.2.0 <2.0.0`
|
|
201
|
+
* - `^0.0.x` := `>=0.0.0 <0.1.0`
|
|
202
|
+
* - `^0.0` := `>=0.0.0 <0.1.0`
|
|
203
|
+
*
|
|
204
|
+
* A missing `minor` and `patch` values will desugar to zero, but also allow
|
|
205
|
+
* flexibility within those values, even if the major version is zero.
|
|
206
|
+
*
|
|
207
|
+
* - `^1.x` := `>=1.0.0 <2.0.0`
|
|
208
|
+
* - `^0.x` := `>=0.0.0 <1.0.0`
|
|
209
|
+
*
|
|
210
|
+
* ### Range Grammar
|
|
211
|
+
*
|
|
212
|
+
* Putting all this together, here is a Backus-Naur grammar for ranges, for the
|
|
213
|
+
* benefit of parser authors:
|
|
214
|
+
*
|
|
215
|
+
* ```bnf
|
|
216
|
+
* range-set ::= range ( logical-or range ) *
|
|
217
|
+
* logical-or ::= ( " " ) * "||" ( " " ) *
|
|
218
|
+
* range ::= hyphen | simple ( " " simple ) * | ""
|
|
219
|
+
* hyphen ::= partial " - " partial
|
|
220
|
+
* simple ::= primitive | partial | tilde | caret
|
|
221
|
+
* primitive ::= ( "<" | ">" | ">=" | "<=" | "=" ) partial
|
|
222
|
+
* partial ::= xr ( "." xr ( "." xr qualifier ? )? )?
|
|
223
|
+
* xr ::= "x" | "X" | "*" | nr
|
|
224
|
+
* nr ::= "0" | ["1"-"9"] ( ["0"-"9"] ) *
|
|
225
|
+
* tilde ::= "~" partial
|
|
226
|
+
* caret ::= "^" partial
|
|
227
|
+
* qualifier ::= ( "-" pre )? ( "+" build )?
|
|
228
|
+
* pre ::= parts
|
|
229
|
+
* build ::= parts
|
|
230
|
+
* parts ::= part ( "." part ) *
|
|
231
|
+
* part ::= nr | [-0-9A-Za-z]+
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* Note that, since ranges may be non-contiguous, a version might not be greater
|
|
235
|
+
* than a range, less than a range, _or_ satisfy a range! For example, the range
|
|
236
|
+
* `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` until `2.0.0`, so the
|
|
237
|
+
* version `1.2.10` would not be greater than the range (because `2.0.1` satisfies,
|
|
238
|
+
* which is higher), nor less than the range (since `1.2.8` satisfies, which is
|
|
239
|
+
* lower), and it also does not satisfy the range.
|
|
240
|
+
*
|
|
241
|
+
* If you want to know if a version satisfies or does not satisfy a range, use the
|
|
242
|
+
* {@linkcode satisfies} function.
|
|
243
|
+
*
|
|
244
|
+
* This module is browser compatible.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* import {
|
|
249
|
+
* parse,
|
|
250
|
+
* parseComparator,
|
|
251
|
+
* parseRange,
|
|
252
|
+
* gt,
|
|
253
|
+
* lt,
|
|
254
|
+
* format
|
|
255
|
+
* } from "https://deno.land/std@$STD_VERSION/semver/mod.ts";
|
|
256
|
+
*
|
|
257
|
+
* const semver = parse("1.2.3");
|
|
258
|
+
* const range = parseRange("1.x || >=2.5.0 || 5.0.0 - 7.2.3");
|
|
259
|
+
*
|
|
260
|
+
* const s0 = parse("1.2.3");
|
|
261
|
+
* const s1 = parse("9.8.7");
|
|
262
|
+
* gt(s0, s1); // false
|
|
263
|
+
* lt(s0, s1); // true
|
|
264
|
+
*
|
|
265
|
+
* format(semver) // "1.2.3"
|
|
266
|
+
* ```
|
|
267
|
+
*
|
|
268
|
+
* @module
|
|
269
|
+
*/
|
|
270
|
+
export * from "./cmp.js";
|
|
271
|
+
export * from "./comparator_format.js";
|
|
272
|
+
export * from "./comparator_intersects.js";
|
|
273
|
+
export * from "./comparator_max.js";
|
|
274
|
+
export * from "./comparator_min.js";
|
|
275
|
+
export * from "./compare_build.js";
|
|
276
|
+
export * from "./compare.js";
|
|
277
|
+
export * from "./constants.js";
|
|
278
|
+
export * from "./difference.js";
|
|
279
|
+
export * from "./eq.js";
|
|
280
|
+
export * from "./format.js";
|
|
281
|
+
export * from "./gt.js";
|
|
282
|
+
export * from "./gte.js";
|
|
283
|
+
export * from "./gtr.js";
|
|
284
|
+
export * from "./test_comparator.js";
|
|
285
|
+
export * from "./test_range.js";
|
|
286
|
+
export * from "./increment.js";
|
|
287
|
+
export * from "./is_semver_comparator.js";
|
|
288
|
+
export * from "./is_semver_range.js";
|
|
289
|
+
export * from "./is_semver.js";
|
|
290
|
+
export * from "./lt.js";
|
|
291
|
+
export * from "./lte.js";
|
|
292
|
+
export * from "./ltr.js";
|
|
293
|
+
export * from "./max_satisfying.js";
|
|
294
|
+
export * from "./min_satisfying.js";
|
|
295
|
+
export * from "./neq.js";
|
|
296
|
+
export * from "./outside.js";
|
|
297
|
+
export * from "./parse_comparator.js";
|
|
298
|
+
export * from "./parse_range.js";
|
|
299
|
+
export * from "./parse.js";
|
|
300
|
+
export * from "./range_format.js";
|
|
301
|
+
export * from "./range_intersects.js";
|
|
302
|
+
export * from "./range_max.js";
|
|
303
|
+
export * from "./range_min.js";
|
|
304
|
+
export * from "./rcompare.js";
|
|
305
|
+
export * from "./rsort.js";
|
|
306
|
+
export * from "./sort.js";
|
|
307
|
+
export * from "./types.js";
|
|
308
|
+
export * from "./lte.js";
|
|
309
|
+
export * from "./lte.js";
|
|
310
|
+
export declare const SEMVER_SPEC_VERSION = "2.0.0";
|