keep-a-changelog 2.5.2 → 2.6.0
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 +28 -1
- package/README.md +15 -14
- package/esm/keep-a-changelog/bin.d.ts +2 -0
- package/esm/{bin.js → keep-a-changelog/bin.js} +96 -18
- package/esm/{mod.d.ts → keep-a-changelog/mod.d.ts} +1 -1
- package/esm/{mod.js → keep-a-changelog/mod.js} +1 -1
- package/esm/keep-a-changelog/test/changelog.azdo.md +24 -0
- package/esm/keep-a-changelog/test/changelog.sort.md +17 -0
- package/esm/std/cli/parse_args.d.ts +193 -0
- package/esm/std/cli/parse_args.js +357 -0
- package/esm/std/ini/_ini_map.d.ts +90 -0
- package/esm/std/ini/_ini_map.js +371 -0
- package/esm/std/ini/mod.d.ts +31 -0
- package/esm/std/ini/mod.js +33 -0
- package/esm/std/ini/parse.d.ts +77 -0
- package/esm/std/ini/parse.js +72 -0
- package/esm/std/ini/stringify.d.ts +83 -0
- package/esm/std/ini/stringify.js +66 -0
- package/esm/std/path/_common/assert_path.d.ts +1 -0
- package/esm/std/path/_common/assert_path.js +7 -0
- package/esm/std/path/_common/basename.d.ts +3 -0
- package/esm/std/path/_common/basename.js +40 -0
- package/esm/std/path/_common/common.d.ts +1 -0
- package/esm/std/path/_common/common.js +23 -0
- package/esm/{deps/deno.land/std@0.189.0/path/_constants.js → std/path/_common/constants.js} +1 -1
- package/esm/std/path/_common/dirname.d.ts +1 -0
- package/esm/std/path/_common/dirname.js +8 -0
- package/esm/std/path/_common/format.d.ts +3 -0
- package/esm/std/path/_common/format.js +19 -0
- package/esm/std/path/_common/from_file_url.d.ts +2 -0
- package/esm/std/path/_common/from_file_url.js +9 -0
- package/esm/std/path/_common/glob_to_reg_exp.d.ts +34 -0
- package/esm/std/path/_common/glob_to_reg_exp.js +234 -0
- package/esm/std/path/_common/normalize.d.ts +1 -0
- package/esm/std/path/_common/normalize.js +8 -0
- package/esm/std/path/_common/normalize_string.d.ts +1 -0
- package/esm/std/path/_common/normalize_string.js +77 -0
- package/esm/std/path/_common/relative.d.ts +1 -0
- package/esm/std/path/_common/relative.js +9 -0
- package/esm/std/path/_common/strip_trailing_separators.d.ts +1 -0
- package/esm/std/path/_common/strip_trailing_separators.js +19 -0
- package/esm/std/path/_common/to_file_url.d.ts +1 -0
- package/esm/std/path/_common/to_file_url.js +15 -0
- package/esm/std/path/_os.d.ts +1 -0
- package/esm/std/path/_os.js +9 -0
- package/esm/std/path/basename.d.ts +27 -0
- package/esm/std/path/basename.js +36 -0
- package/esm/std/path/common.d.ts +27 -0
- package/esm/std/path/common.js +33 -0
- package/esm/std/path/constants.d.ts +14 -0
- package/esm/std/path/constants.js +17 -0
- package/esm/std/path/dirname.d.ts +22 -0
- package/esm/std/path/dirname.js +29 -0
- package/esm/std/path/extname.d.ts +22 -0
- package/esm/std/path/extname.js +29 -0
- package/esm/std/path/format.d.ts +21 -0
- package/esm/std/path/format.js +27 -0
- package/esm/std/path/from_file_url.d.ts +22 -0
- package/esm/std/path/from_file_url.js +28 -0
- package/esm/std/path/glob_to_regexp.d.ts +76 -0
- package/esm/std/path/glob_to_regexp.js +83 -0
- package/esm/std/path/is_absolute.d.ts +21 -0
- package/esm/std/path/is_absolute.js +28 -0
- package/esm/std/path/is_glob.d.ts +16 -0
- package/esm/std/path/is_glob.js +42 -0
- package/esm/std/path/join.d.ts +22 -0
- package/esm/std/path/join.js +29 -0
- package/esm/std/path/join_globs.d.ts +27 -0
- package/esm/std/path/join_globs.js +34 -0
- package/esm/std/path/mod.d.ts +53 -0
- package/esm/std/path/mod.js +57 -0
- package/esm/std/path/normalize.d.ts +26 -0
- package/esm/std/path/normalize.js +33 -0
- package/esm/std/path/normalize_glob.d.ts +28 -0
- package/esm/std/path/normalize_glob.js +35 -0
- package/esm/std/path/parse.d.ts +34 -0
- package/esm/std/path/parse.js +39 -0
- package/esm/std/path/posix/_util.d.ts +1 -0
- package/esm/std/path/posix/_util.js +8 -0
- package/esm/std/path/posix/basename.d.ts +39 -0
- package/esm/std/path/posix/basename.js +49 -0
- package/esm/std/path/posix/constants.d.ts +12 -0
- package/esm/std/path/posix/constants.js +14 -0
- package/esm/std/path/posix/dirname.d.ts +31 -0
- package/esm/std/path/posix/dirname.js +62 -0
- package/esm/std/path/posix/extname.d.ts +36 -0
- package/esm/std/path/posix/extname.js +89 -0
- package/esm/std/path/posix/format.d.ts +23 -0
- package/esm/std/path/posix/format.js +28 -0
- package/esm/std/path/posix/from_file_url.d.ts +16 -0
- package/esm/std/path/posix/from_file_url.js +21 -0
- package/esm/std/path/posix/glob_to_regexp.d.ts +71 -0
- package/{script/deps/deno.land/std@0.189.0/path/glob.d.ts → esm/std/path/posix/glob_to_regexp.js} +28 -29
- package/esm/std/path/posix/is_absolute.d.ts +16 -0
- package/esm/std/path/posix/is_absolute.js +23 -0
- package/esm/std/path/posix/join.d.ts +32 -0
- package/esm/std/path/posix/join.js +42 -0
- package/esm/std/path/posix/join_globs.d.ts +19 -0
- package/esm/std/path/posix/join_globs.js +40 -0
- package/esm/std/path/posix/normalize.d.ts +39 -0
- package/esm/std/path/posix/normalize.js +57 -0
- package/esm/std/path/posix/normalize_glob.d.ts +19 -0
- package/esm/std/path/posix/normalize_glob.js +32 -0
- package/esm/std/path/posix/parse.d.ts +24 -0
- package/esm/std/path/posix/parse.js +115 -0
- package/esm/std/path/posix/relative.d.ts +19 -0
- package/esm/std/path/posix/relative.js +106 -0
- package/esm/std/path/posix/resolve.d.ts +16 -0
- package/esm/std/path/posix/resolve.js +59 -0
- package/esm/std/path/posix/to_file_url.d.ts +17 -0
- package/esm/std/path/posix/to_file_url.js +27 -0
- package/esm/std/path/posix/to_namespaced_path.d.ts +15 -0
- package/esm/std/path/posix/to_namespaced_path.js +20 -0
- package/esm/std/path/relative.d.ts +23 -0
- package/esm/std/path/relative.js +30 -0
- package/esm/std/path/resolve.d.ts +21 -0
- package/esm/std/path/resolve.js +30 -0
- package/esm/std/path/to_file_url.d.ts +22 -0
- package/esm/std/path/to_file_url.js +28 -0
- package/esm/std/path/to_namespaced_path.d.ts +20 -0
- package/esm/std/path/to_namespaced_path.js +29 -0
- package/esm/{deps/deno.land/std@0.189.0/path/_interface.d.ts → std/path/types.d.ts} +13 -2
- package/esm/std/path/types.js +3 -0
- package/esm/std/path/windows/_util.d.ts +3 -0
- package/esm/std/path/windows/_util.js +15 -0
- package/esm/std/path/windows/basename.d.ts +22 -0
- package/esm/std/path/windows/basename.js +44 -0
- package/esm/std/path/windows/constants.d.ts +12 -0
- package/esm/std/path/windows/constants.js +14 -0
- package/esm/std/path/windows/dirname.d.ts +19 -0
- package/esm/std/path/windows/dirname.js +112 -0
- package/esm/std/path/windows/extname.d.ts +19 -0
- package/esm/std/path/windows/extname.js +81 -0
- package/esm/std/path/windows/format.d.ts +23 -0
- package/esm/std/path/windows/format.js +28 -0
- package/esm/std/path/windows/from_file_url.d.ts +18 -0
- package/esm/std/path/windows/from_file_url.js +30 -0
- package/esm/std/path/windows/glob_to_regexp.d.ts +70 -0
- package/esm/{deps/deno.land/std@0.189.0/path/glob.d.ts → std/path/windows/glob_to_regexp.js} +28 -29
- package/esm/std/path/windows/is_absolute.d.ts +16 -0
- package/esm/std/path/windows/is_absolute.js +38 -0
- package/esm/std/path/windows/join.d.ts +19 -0
- package/esm/std/path/windows/join.js +74 -0
- package/esm/std/path/windows/join_globs.d.ts +20 -0
- package/esm/std/path/windows/join_globs.js +41 -0
- package/esm/std/path/windows/normalize.d.ts +21 -0
- package/esm/std/path/windows/normalize.js +134 -0
- package/esm/std/path/windows/normalize_glob.d.ts +19 -0
- package/esm/std/path/windows/normalize_glob.js +32 -0
- package/esm/std/path/windows/parse.d.ts +24 -0
- package/esm/std/path/windows/parse.js +176 -0
- package/esm/std/path/windows/relative.d.ts +22 -0
- package/esm/std/path/windows/relative.js +131 -0
- package/esm/std/path/windows/resolve.d.ts +16 -0
- package/esm/std/path/windows/resolve.js +154 -0
- package/esm/std/path/windows/to_file_url.d.ts +17 -0
- package/esm/std/path/windows/to_file_url.js +34 -0
- package/esm/std/path/windows/to_namespaced_path.d.ts +16 -0
- package/esm/std/path/windows/to_namespaced_path.js +49 -0
- package/esm/std/semver/_constants.d.ts +15 -0
- package/esm/std/semver/_constants.js +38 -0
- package/esm/std/semver/_shared.d.ts +43 -0
- package/esm/std/semver/_shared.js +162 -0
- package/esm/std/semver/_test_comparator_set.d.ts +2 -0
- package/esm/std/semver/_test_comparator_set.js +58 -0
- package/esm/std/semver/can_parse.d.ts +16 -0
- package/esm/std/semver/can_parse.js +27 -0
- package/esm/std/semver/compare.d.ts +27 -0
- package/esm/std/semver/compare.js +35 -0
- package/esm/std/semver/difference.d.ts +26 -0
- package/esm/std/semver/difference.js +41 -0
- package/esm/std/semver/equals.d.ts +23 -0
- package/esm/std/semver/equals.js +27 -0
- package/esm/std/semver/format.d.ts +21 -0
- package/esm/std/semver/format.js +32 -0
- package/esm/std/semver/format_range.d.ts +17 -0
- package/esm/std/semver/format_range.js +27 -0
- package/esm/std/semver/greater_or_equal.d.ts +24 -0
- package/esm/std/semver/greater_or_equal.js +26 -0
- package/esm/std/semver/greater_than.d.ts +24 -0
- package/esm/std/semver/greater_than.js +28 -0
- package/esm/std/semver/greater_than_range.d.ts +22 -0
- package/esm/std/semver/greater_than_range.js +58 -0
- package/{script/deps/deno.land/std@0.205.0 → esm/std}/semver/increment.d.ts +27 -5
- package/esm/std/semver/increment.js +176 -0
- package/esm/std/semver/is_range.d.ts +22 -0
- package/esm/std/semver/is_range.js +38 -0
- package/{script/deps/deno.land/std@0.205.0 → esm/std}/semver/is_semver.d.ts +16 -0
- package/esm/{deps/deno.land/std@0.205.0 → std}/semver/is_semver.js +25 -13
- package/esm/std/semver/less_or_equal.d.ts +24 -0
- package/esm/std/semver/less_or_equal.js +26 -0
- package/esm/std/semver/less_than.d.ts +24 -0
- package/esm/std/semver/less_than.js +26 -0
- package/esm/std/semver/less_than_range.d.ts +22 -0
- package/esm/std/semver/less_than_range.js +58 -0
- package/esm/std/semver/max_satisfying.d.ts +21 -0
- package/esm/std/semver/max_satisfying.js +30 -0
- package/esm/std/semver/min_satisfying.d.ts +21 -0
- package/esm/std/semver/min_satisfying.js +30 -0
- package/{script/deps/deno.land/std@0.205.0 → esm/std}/semver/mod.d.ts +72 -85
- package/esm/{deps/deno.land/std@0.205.0 → std}/semver/mod.js +73 -86
- package/esm/std/semver/not_equals.d.ts +23 -0
- package/esm/std/semver/not_equals.js +25 -0
- package/esm/std/semver/parse.d.ts +24 -0
- package/esm/std/semver/parse.js +44 -0
- package/esm/std/semver/parse_range.d.ts +26 -0
- package/esm/std/semver/parse_range.js +358 -0
- package/esm/std/semver/range_intersects.d.ts +24 -0
- package/esm/std/semver/range_intersects.js +89 -0
- package/esm/std/semver/satisfies.d.ts +23 -0
- package/esm/std/semver/satisfies.js +26 -0
- package/esm/std/semver/try_parse.d.ts +20 -0
- package/esm/std/semver/try_parse.js +27 -0
- package/esm/std/semver/try_parse_range.d.ts +22 -0
- package/esm/std/semver/try_parse_range.js +33 -0
- package/esm/std/semver/types.d.ts +57 -0
- package/esm/std/semver/types.js +3 -0
- package/package.json +14 -13
- package/script/keep-a-changelog/bin.d.ts +2 -0
- package/script/{bin.js → keep-a-changelog/bin.js} +97 -19
- package/script/{mod.d.ts → keep-a-changelog/mod.d.ts} +1 -1
- package/script/{mod.js → keep-a-changelog/mod.js} +1 -1
- package/script/keep-a-changelog/test/changelog.azdo.md +24 -0
- package/script/keep-a-changelog/test/changelog.sort.md +17 -0
- package/script/std/cli/parse_args.d.ts +193 -0
- package/script/std/cli/parse_args.js +361 -0
- package/script/std/ini/_ini_map.d.ts +90 -0
- package/script/std/ini/_ini_map.js +375 -0
- package/script/std/ini/mod.d.ts +31 -0
- package/script/std/ini/mod.js +49 -0
- package/script/std/ini/parse.d.ts +77 -0
- package/script/std/ini/parse.js +76 -0
- package/script/std/ini/stringify.d.ts +83 -0
- package/script/std/ini/stringify.js +70 -0
- package/script/std/path/_common/assert_path.d.ts +1 -0
- package/script/std/path/_common/assert_path.js +11 -0
- package/script/std/path/_common/basename.d.ts +3 -0
- package/script/std/path/_common/basename.js +46 -0
- package/script/std/path/_common/common.d.ts +1 -0
- package/script/std/path/_common/common.js +27 -0
- package/script/{deps/deno.land/std@0.189.0/path/_constants.js → std/path/_common/constants.js} +1 -1
- package/script/std/path/_common/dirname.d.ts +1 -0
- package/script/std/path/_common/dirname.js +12 -0
- package/script/std/path/_common/format.d.ts +3 -0
- package/script/std/path/_common/format.js +24 -0
- package/script/std/path/_common/from_file_url.d.ts +2 -0
- package/script/std/path/_common/from_file_url.js +13 -0
- package/script/std/path/_common/glob_to_reg_exp.d.ts +34 -0
- package/script/std/path/_common/glob_to_reg_exp.js +238 -0
- package/script/std/path/_common/normalize.d.ts +1 -0
- package/script/std/path/_common/normalize.js +12 -0
- package/script/std/path/_common/normalize_string.d.ts +1 -0
- package/script/std/path/_common/normalize_string.js +81 -0
- package/script/std/path/_common/relative.d.ts +1 -0
- package/script/std/path/_common/relative.js +13 -0
- package/script/std/path/_common/strip_trailing_separators.d.ts +1 -0
- package/script/std/path/_common/strip_trailing_separators.js +23 -0
- package/script/std/path/_common/to_file_url.d.ts +1 -0
- package/script/std/path/_common/to_file_url.js +19 -0
- package/script/std/path/_os.d.ts +1 -0
- package/script/{deps/deno.land/std@0.189.0/_util/os.js → std/path/_os.js} +10 -19
- package/script/std/path/basename.d.ts +27 -0
- package/script/std/path/basename.js +40 -0
- package/script/std/path/common.d.ts +27 -0
- package/script/std/path/common.js +37 -0
- package/script/std/path/constants.d.ts +14 -0
- package/script/std/path/constants.js +20 -0
- package/script/std/path/dirname.d.ts +22 -0
- package/script/std/path/dirname.js +33 -0
- package/script/std/path/extname.d.ts +22 -0
- package/script/std/path/extname.js +33 -0
- package/script/std/path/format.d.ts +21 -0
- package/script/std/path/format.js +31 -0
- package/script/std/path/from_file_url.d.ts +22 -0
- package/script/std/path/from_file_url.js +32 -0
- package/script/std/path/glob_to_regexp.d.ts +76 -0
- package/script/std/path/glob_to_regexp.js +87 -0
- package/script/std/path/is_absolute.d.ts +21 -0
- package/script/std/path/is_absolute.js +32 -0
- package/script/std/path/is_glob.d.ts +16 -0
- package/script/std/path/is_glob.js +46 -0
- package/script/std/path/join.d.ts +22 -0
- package/script/std/path/join.js +33 -0
- package/script/std/path/join_globs.d.ts +27 -0
- package/script/std/path/join_globs.js +38 -0
- package/script/std/path/mod.d.ts +53 -0
- package/script/std/path/mod.js +73 -0
- package/script/std/path/normalize.d.ts +26 -0
- package/script/std/path/normalize.js +37 -0
- package/script/std/path/normalize_glob.d.ts +28 -0
- package/script/std/path/normalize_glob.js +39 -0
- package/script/std/path/parse.d.ts +34 -0
- package/script/std/path/parse.js +43 -0
- package/script/std/path/posix/_util.d.ts +1 -0
- package/script/std/path/posix/_util.js +12 -0
- package/script/std/path/posix/basename.d.ts +39 -0
- package/script/std/path/posix/basename.js +53 -0
- package/script/std/path/posix/constants.d.ts +12 -0
- package/script/std/path/posix/constants.js +17 -0
- package/script/std/path/posix/dirname.d.ts +31 -0
- package/script/std/path/posix/dirname.js +66 -0
- package/script/std/path/posix/extname.d.ts +36 -0
- package/script/std/path/posix/extname.js +93 -0
- package/script/std/path/posix/format.d.ts +23 -0
- package/script/std/path/posix/format.js +32 -0
- package/script/std/path/posix/from_file_url.d.ts +16 -0
- package/script/std/path/posix/from_file_url.js +25 -0
- package/script/std/path/posix/glob_to_regexp.d.ts +71 -0
- package/script/std/path/posix/glob_to_regexp.js +86 -0
- package/script/std/path/posix/is_absolute.d.ts +16 -0
- package/script/std/path/posix/is_absolute.js +27 -0
- package/script/std/path/posix/join.d.ts +32 -0
- package/script/std/path/posix/join.js +46 -0
- package/script/std/path/posix/join_globs.d.ts +19 -0
- package/script/std/path/posix/join_globs.js +44 -0
- package/script/std/path/posix/normalize.d.ts +39 -0
- package/script/std/path/posix/normalize.js +61 -0
- package/script/std/path/posix/normalize_glob.d.ts +19 -0
- package/script/std/path/posix/normalize_glob.js +36 -0
- package/script/std/path/posix/parse.d.ts +24 -0
- package/script/std/path/posix/parse.js +119 -0
- package/script/std/path/posix/relative.d.ts +19 -0
- package/script/std/path/posix/relative.js +110 -0
- package/script/std/path/posix/resolve.d.ts +16 -0
- package/script/std/path/posix/resolve.js +86 -0
- package/script/std/path/posix/to_file_url.d.ts +17 -0
- package/script/std/path/posix/to_file_url.js +31 -0
- package/script/std/path/posix/to_namespaced_path.d.ts +15 -0
- package/script/std/path/posix/to_namespaced_path.js +24 -0
- package/script/std/path/relative.d.ts +23 -0
- package/script/std/path/relative.js +34 -0
- package/script/std/path/resolve.d.ts +21 -0
- package/script/std/path/resolve.js +34 -0
- package/script/std/path/to_file_url.d.ts +22 -0
- package/script/std/path/to_file_url.js +32 -0
- package/script/std/path/to_namespaced_path.d.ts +20 -0
- package/script/std/path/to_namespaced_path.js +33 -0
- package/script/{deps/deno.land/std@0.189.0/path/_interface.d.ts → std/path/types.d.ts} +13 -2
- package/script/{deps/deno.land/std@0.189.0/path/_interface.js → std/path/types.js} +1 -1
- package/script/std/path/windows/_util.d.ts +3 -0
- package/script/std/path/windows/_util.js +21 -0
- package/script/std/path/windows/basename.d.ts +22 -0
- package/script/std/path/windows/basename.js +48 -0
- package/script/std/path/windows/constants.d.ts +12 -0
- package/script/std/path/windows/constants.js +17 -0
- package/script/std/path/windows/dirname.d.ts +19 -0
- package/script/std/path/windows/dirname.js +116 -0
- package/script/std/path/windows/extname.d.ts +19 -0
- package/script/std/path/windows/extname.js +85 -0
- package/script/std/path/windows/format.d.ts +23 -0
- package/script/std/path/windows/format.js +32 -0
- package/script/std/path/windows/from_file_url.d.ts +18 -0
- package/script/std/path/windows/from_file_url.js +34 -0
- package/script/std/path/windows/glob_to_regexp.d.ts +70 -0
- package/script/std/path/windows/glob_to_regexp.js +86 -0
- package/script/std/path/windows/is_absolute.d.ts +16 -0
- package/script/std/path/windows/is_absolute.js +42 -0
- package/script/std/path/windows/join.d.ts +19 -0
- package/script/std/path/windows/join.js +78 -0
- package/script/std/path/windows/join_globs.d.ts +20 -0
- package/script/std/path/windows/join_globs.js +45 -0
- package/script/std/path/windows/normalize.d.ts +21 -0
- package/script/std/path/windows/normalize.js +138 -0
- package/script/std/path/windows/normalize_glob.d.ts +19 -0
- package/script/std/path/windows/normalize_glob.js +36 -0
- package/script/std/path/windows/parse.d.ts +24 -0
- package/script/std/path/windows/parse.js +180 -0
- package/script/std/path/windows/relative.d.ts +22 -0
- package/script/std/path/windows/relative.js +135 -0
- package/script/std/path/windows/resolve.d.ts +16 -0
- package/script/std/path/windows/resolve.js +181 -0
- package/script/std/path/windows/to_file_url.d.ts +17 -0
- package/script/std/path/windows/to_file_url.js +38 -0
- package/script/std/path/windows/to_namespaced_path.d.ts +16 -0
- package/script/std/path/windows/to_namespaced_path.js +53 -0
- package/script/std/semver/_constants.d.ts +15 -0
- package/script/std/semver/_constants.js +41 -0
- package/script/std/semver/_shared.d.ts +43 -0
- package/script/std/semver/_shared.js +174 -0
- package/script/std/semver/_test_comparator_set.d.ts +2 -0
- package/script/std/semver/_test_comparator_set.js +62 -0
- package/script/std/semver/can_parse.d.ts +16 -0
- package/script/std/semver/can_parse.js +31 -0
- package/script/std/semver/compare.d.ts +27 -0
- package/script/std/semver/compare.js +39 -0
- package/script/std/semver/difference.d.ts +26 -0
- package/script/std/semver/difference.js +45 -0
- package/script/std/semver/equals.d.ts +23 -0
- package/script/std/semver/equals.js +31 -0
- package/script/std/semver/format.d.ts +21 -0
- package/script/std/semver/format.js +36 -0
- package/script/std/semver/format_range.d.ts +17 -0
- package/script/std/semver/format_range.js +31 -0
- package/script/std/semver/greater_or_equal.d.ts +24 -0
- package/script/std/semver/greater_or_equal.js +30 -0
- package/script/std/semver/greater_than.d.ts +24 -0
- package/script/std/semver/greater_than.js +32 -0
- package/script/std/semver/greater_than_range.d.ts +22 -0
- package/script/std/semver/greater_than_range.js +62 -0
- package/{esm/deps/deno.land/std@0.205.0 → script/std}/semver/increment.d.ts +27 -5
- package/script/std/semver/increment.js +180 -0
- package/script/std/semver/is_range.d.ts +22 -0
- package/script/std/semver/is_range.js +42 -0
- package/{esm/deps/deno.land/std@0.205.0 → script/std}/semver/is_semver.d.ts +16 -0
- package/script/{deps/deno.land/std@0.205.0 → std}/semver/is_semver.js +26 -14
- package/script/std/semver/less_or_equal.d.ts +24 -0
- package/script/std/semver/less_or_equal.js +30 -0
- package/script/std/semver/less_than.d.ts +24 -0
- package/script/std/semver/less_than.js +30 -0
- package/script/std/semver/less_than_range.d.ts +22 -0
- package/script/std/semver/less_than_range.js +62 -0
- package/script/std/semver/max_satisfying.d.ts +21 -0
- package/script/std/semver/max_satisfying.js +34 -0
- package/script/std/semver/min_satisfying.d.ts +21 -0
- package/script/std/semver/min_satisfying.js +34 -0
- package/{esm/deps/deno.land/std@0.205.0 → script/std}/semver/mod.d.ts +72 -85
- package/script/{deps/deno.land/std@0.205.0 → std}/semver/mod.js +73 -87
- package/script/std/semver/not_equals.d.ts +23 -0
- package/script/std/semver/not_equals.js +29 -0
- package/script/std/semver/parse.d.ts +24 -0
- package/script/std/semver/parse.js +48 -0
- package/script/std/semver/parse_range.d.ts +26 -0
- package/script/std/semver/parse_range.js +362 -0
- package/script/std/semver/range_intersects.d.ts +24 -0
- package/script/std/semver/range_intersects.js +93 -0
- package/script/std/semver/satisfies.d.ts +23 -0
- package/script/std/semver/satisfies.js +30 -0
- package/script/std/semver/try_parse.d.ts +20 -0
- package/script/std/semver/try_parse.js +31 -0
- package/script/std/semver/try_parse_range.d.ts +22 -0
- package/script/std/semver/try_parse_range.js +37 -0
- package/script/std/semver/types.d.ts +57 -0
- package/script/std/semver/types.js +4 -0
- package/esm/bin.d.ts +0 -2
- package/esm/deps/deno.land/std@0.189.0/_util/asserts.d.ts +0 -10
- package/esm/deps/deno.land/std@0.189.0/_util/asserts.js +0 -21
- package/esm/deps/deno.land/std@0.189.0/_util/os.d.ts +0 -4
- package/esm/deps/deno.land/std@0.189.0/_util/os.js +0 -18
- package/esm/deps/deno.land/std@0.189.0/flags/mod.d.ts +0 -166
- package/esm/deps/deno.land/std@0.189.0/flags/mod.js +0 -365
- package/esm/deps/deno.land/std@0.189.0/path/_interface.js +0 -3
- package/esm/deps/deno.land/std@0.189.0/path/_util.d.ts +0 -11
- package/esm/deps/deno.land/std@0.189.0/path/_util.js +0 -161
- package/esm/deps/deno.land/std@0.189.0/path/common.d.ts +0 -13
- package/esm/deps/deno.land/std@0.189.0/path/common.js +0 -36
- package/esm/deps/deno.land/std@0.189.0/path/glob.js +0 -361
- package/esm/deps/deno.land/std@0.189.0/path/mod.d.ts +0 -11
- package/esm/deps/deno.land/std@0.189.0/path/mod.js +0 -35
- package/esm/deps/deno.land/std@0.189.0/path/posix.d.ts +0 -86
- package/esm/deps/deno.land/std@0.189.0/path/posix.js +0 -442
- package/esm/deps/deno.land/std@0.189.0/path/separator.d.ts +0 -2
- package/esm/deps/deno.land/std@0.189.0/path/separator.js +0 -5
- package/esm/deps/deno.land/std@0.189.0/path/win32.d.ts +0 -91
- package/esm/deps/deno.land/std@0.189.0/path/win32.js +0 -909
- package/esm/deps/deno.land/std@0.205.0/semver/_shared.d.ts +0 -42
- package/esm/deps/deno.land/std@0.205.0/semver/_shared.js +0 -230
- package/esm/deps/deno.land/std@0.205.0/semver/cmp.d.ts +0 -9
- package/esm/deps/deno.land/std@0.205.0/semver/cmp.js +0 -35
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_format.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_format.js +0 -11
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_intersects.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_intersects.js +0 -45
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_max.d.ts +0 -9
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_max.js +0 -45
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_min.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_min.js +0 -32
- package/esm/deps/deno.land/std@0.205.0/semver/compare.d.ts +0 -10
- package/esm/deps/deno.land/std@0.205.0/semver/compare.js +0 -18
- package/esm/deps/deno.land/std@0.205.0/semver/compare_build.d.ts +0 -13
- package/esm/deps/deno.land/std@0.205.0/semver/compare_build.js +0 -23
- package/esm/deps/deno.land/std@0.205.0/semver/constants.d.ts +0 -42
- package/esm/deps/deno.land/std@0.205.0/semver/constants.js +0 -75
- package/esm/deps/deno.land/std@0.205.0/semver/difference.d.ts +0 -4
- package/esm/deps/deno.land/std@0.205.0/semver/difference.js +0 -26
- package/esm/deps/deno.land/std@0.205.0/semver/eq.d.ts +0 -4
- package/esm/deps/deno.land/std@0.205.0/semver/eq.js +0 -7
- package/esm/deps/deno.land/std@0.205.0/semver/format.d.ts +0 -12
- package/esm/deps/deno.land/std@0.205.0/semver/format.js +0 -54
- package/esm/deps/deno.land/std@0.205.0/semver/gt.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/gt.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/gte.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/gte.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/gtr.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/gtr.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/increment.js +0 -207
- package/esm/deps/deno.land/std@0.205.0/semver/is_semver_comparator.d.ts +0 -12
- package/esm/deps/deno.land/std@0.205.0/semver/is_semver_comparator.js +0 -31
- package/esm/deps/deno.land/std@0.205.0/semver/is_semver_range.d.ts +0 -12
- package/esm/deps/deno.land/std@0.205.0/semver/is_semver_range.js +0 -22
- package/esm/deps/deno.land/std@0.205.0/semver/lt.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/lt.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/lte.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/lte.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/ltr.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/ltr.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/max_satisfying.d.ts +0 -9
- package/esm/deps/deno.land/std@0.205.0/semver/max_satisfying.js +0 -14
- package/esm/deps/deno.land/std@0.205.0/semver/min_satisfying.d.ts +0 -9
- package/esm/deps/deno.land/std@0.205.0/semver/min_satisfying.js +0 -14
- package/esm/deps/deno.land/std@0.205.0/semver/neq.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/neq.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/outside.d.ts +0 -11
- package/esm/deps/deno.land/std@0.205.0/semver/outside.js +0 -67
- package/esm/deps/deno.land/std@0.205.0/semver/parse.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/parse.js +0 -66
- package/esm/deps/deno.land/std@0.205.0/semver/parse_comparator.d.ts +0 -7
- package/esm/deps/deno.land/std@0.205.0/semver/parse_comparator.js +0 -28
- package/esm/deps/deno.land/std@0.205.0/semver/parse_range.d.ts +0 -7
- package/esm/deps/deno.land/std@0.205.0/semver/parse_range.js +0 -292
- package/esm/deps/deno.land/std@0.205.0/semver/range_format.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/range_format.js +0 -11
- package/esm/deps/deno.land/std@0.205.0/semver/range_intersects.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/range_intersects.js +0 -35
- package/esm/deps/deno.land/std@0.205.0/semver/range_max.d.ts +0 -7
- package/esm/deps/deno.land/std@0.205.0/semver/range_max.js +0 -15
- package/esm/deps/deno.land/std@0.205.0/semver/range_min.d.ts +0 -7
- package/esm/deps/deno.land/std@0.205.0/semver/range_min.js +0 -14
- package/esm/deps/deno.land/std@0.205.0/semver/rcompare.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/rcompare.js +0 -10
- package/esm/deps/deno.land/std@0.205.0/semver/rsort.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/rsort.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/sort.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/sort.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/test_comparator.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/test_comparator.js +0 -10
- package/esm/deps/deno.land/std@0.205.0/semver/test_range.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/test_range.js +0 -16
- package/esm/deps/deno.land/std@0.205.0/semver/types.d.ts +0 -44
- package/esm/deps/deno.land/std@0.205.0/semver/types.js +0 -2
- package/esm/deps/deno.land/std@0.51.0/fs/eol.d.ts +0 -12
- package/esm/deps/deno.land/std@0.51.0/fs/eol.js +0 -29
- package/esm/deps/deno.land/x/ini@v2.1.0/ini.d.ts +0 -53
- package/esm/deps/deno.land/x/ini@v2.1.0/ini.js +0 -226
- package/esm/deps/deno.land/x/ini@v2.1.0/mod.d.ts +0 -1
- package/esm/deps/deno.land/x/ini@v2.1.0/mod.js +0 -1
- package/esm/src/Change.d.ts +0 -8
- package/esm/src/Change.js +0 -48
- package/esm/src/Changelog.d.ts +0 -23
- package/esm/src/Changelog.js +0 -183
- package/esm/src/Release.d.ts +0 -28
- package/esm/src/Release.js +0 -220
- package/esm/src/deps.d.ts +0 -2
- package/esm/src/deps.js +0 -1
- package/esm/src/parser.d.ts +0 -11
- package/esm/src/parser.js +0 -178
- package/esm/src/settings.d.ts +0 -17
- package/esm/src/settings.js +0 -47
- package/script/bin.d.ts +0 -2
- package/script/deps/deno.land/std@0.189.0/_util/asserts.d.ts +0 -10
- package/script/deps/deno.land/std@0.189.0/_util/asserts.js +0 -27
- package/script/deps/deno.land/std@0.189.0/_util/os.d.ts +0 -4
- package/script/deps/deno.land/std@0.189.0/flags/mod.d.ts +0 -166
- package/script/deps/deno.land/std@0.189.0/flags/mod.js +0 -369
- package/script/deps/deno.land/std@0.189.0/path/_util.d.ts +0 -11
- package/script/deps/deno.land/std@0.189.0/path/_util.js +0 -174
- package/script/deps/deno.land/std@0.189.0/path/common.d.ts +0 -13
- package/script/deps/deno.land/std@0.189.0/path/common.js +0 -40
- package/script/deps/deno.land/std@0.189.0/path/glob.js +0 -391
- package/script/deps/deno.land/std@0.189.0/path/mod.d.ts +0 -11
- package/script/deps/deno.land/std@0.189.0/path/mod.js +0 -66
- package/script/deps/deno.land/std@0.189.0/path/posix.d.ts +0 -86
- package/script/deps/deno.land/std@0.189.0/path/posix.js +0 -481
- package/script/deps/deno.land/std@0.189.0/path/separator.d.ts +0 -2
- package/script/deps/deno.land/std@0.189.0/path/separator.js +0 -8
- package/script/deps/deno.land/std@0.189.0/path/win32.d.ts +0 -91
- package/script/deps/deno.land/std@0.189.0/path/win32.js +0 -948
- package/script/deps/deno.land/std@0.205.0/semver/_shared.d.ts +0 -42
- package/script/deps/deno.land/std@0.205.0/semver/_shared.js +0 -248
- package/script/deps/deno.land/std@0.205.0/semver/cmp.d.ts +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/cmp.js +0 -39
- package/script/deps/deno.land/std@0.205.0/semver/comparator_format.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/comparator_format.js +0 -15
- package/script/deps/deno.land/std@0.205.0/semver/comparator_intersects.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/comparator_intersects.js +0 -49
- package/script/deps/deno.land/std@0.205.0/semver/comparator_max.d.ts +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/comparator_max.js +0 -49
- package/script/deps/deno.land/std@0.205.0/semver/comparator_min.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/comparator_min.js +0 -36
- package/script/deps/deno.land/std@0.205.0/semver/compare.d.ts +0 -10
- package/script/deps/deno.land/std@0.205.0/semver/compare.js +0 -22
- package/script/deps/deno.land/std@0.205.0/semver/compare_build.d.ts +0 -13
- package/script/deps/deno.land/std@0.205.0/semver/compare_build.js +0 -27
- package/script/deps/deno.land/std@0.205.0/semver/constants.d.ts +0 -42
- package/script/deps/deno.land/std@0.205.0/semver/constants.js +0 -78
- package/script/deps/deno.land/std@0.205.0/semver/difference.d.ts +0 -4
- package/script/deps/deno.land/std@0.205.0/semver/difference.js +0 -30
- package/script/deps/deno.land/std@0.205.0/semver/eq.d.ts +0 -4
- package/script/deps/deno.land/std@0.205.0/semver/eq.js +0 -11
- package/script/deps/deno.land/std@0.205.0/semver/format.d.ts +0 -12
- package/script/deps/deno.land/std@0.205.0/semver/format.js +0 -58
- package/script/deps/deno.land/std@0.205.0/semver/gt.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/gt.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/gte.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/gte.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/gtr.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/gtr.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/increment.js +0 -211
- package/script/deps/deno.land/std@0.205.0/semver/is_semver_comparator.d.ts +0 -12
- package/script/deps/deno.land/std@0.205.0/semver/is_semver_comparator.js +0 -35
- package/script/deps/deno.land/std@0.205.0/semver/is_semver_range.d.ts +0 -12
- package/script/deps/deno.land/std@0.205.0/semver/is_semver_range.js +0 -26
- package/script/deps/deno.land/std@0.205.0/semver/lt.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/lt.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/lte.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/lte.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/ltr.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/ltr.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/max_satisfying.d.ts +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/max_satisfying.js +0 -18
- package/script/deps/deno.land/std@0.205.0/semver/min_satisfying.d.ts +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/min_satisfying.js +0 -18
- package/script/deps/deno.land/std@0.205.0/semver/neq.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/neq.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/outside.d.ts +0 -11
- package/script/deps/deno.land/std@0.205.0/semver/outside.js +0 -71
- package/script/deps/deno.land/std@0.205.0/semver/parse.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/parse.js +0 -70
- package/script/deps/deno.land/std@0.205.0/semver/parse_comparator.d.ts +0 -7
- package/script/deps/deno.land/std@0.205.0/semver/parse_comparator.js +0 -32
- package/script/deps/deno.land/std@0.205.0/semver/parse_range.d.ts +0 -7
- package/script/deps/deno.land/std@0.205.0/semver/parse_range.js +0 -296
- package/script/deps/deno.land/std@0.205.0/semver/range_format.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/range_format.js +0 -15
- package/script/deps/deno.land/std@0.205.0/semver/range_intersects.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/range_intersects.js +0 -39
- package/script/deps/deno.land/std@0.205.0/semver/range_max.d.ts +0 -7
- package/script/deps/deno.land/std@0.205.0/semver/range_max.js +0 -19
- package/script/deps/deno.land/std@0.205.0/semver/range_min.d.ts +0 -7
- package/script/deps/deno.land/std@0.205.0/semver/range_min.js +0 -18
- package/script/deps/deno.land/std@0.205.0/semver/rcompare.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/rcompare.js +0 -14
- package/script/deps/deno.land/std@0.205.0/semver/rsort.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/rsort.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/sort.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/sort.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/test_comparator.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/test_comparator.js +0 -14
- package/script/deps/deno.land/std@0.205.0/semver/test_range.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/test_range.js +0 -20
- package/script/deps/deno.land/std@0.205.0/semver/types.d.ts +0 -44
- package/script/deps/deno.land/std@0.205.0/semver/types.js +0 -3
- package/script/deps/deno.land/std@0.51.0/fs/eol.d.ts +0 -12
- package/script/deps/deno.land/std@0.51.0/fs/eol.js +0 -34
- package/script/deps/deno.land/x/ini@v2.1.0/ini.d.ts +0 -53
- package/script/deps/deno.land/x/ini@v2.1.0/ini.js +0 -256
- package/script/deps/deno.land/x/ini@v2.1.0/mod.d.ts +0 -1
- package/script/deps/deno.land/x/ini@v2.1.0/mod.js +0 -17
- package/script/src/Change.d.ts +0 -8
- package/script/src/Change.js +0 -51
- package/script/src/Changelog.d.ts +0 -23
- package/script/src/Changelog.js +0 -186
- package/script/src/Release.d.ts +0 -28
- package/script/src/Release.js +0 -226
- package/script/src/deps.d.ts +0 -2
- package/script/src/deps.js +0 -8
- package/script/src/parser.d.ts +0 -11
- package/script/src/parser.js +0 -184
- package/script/src/settings.d.ts +0 -17
- package/script/src/settings.js +0 -51
- /package/esm/{test → keep-a-changelog/test}/changelog.custom.type.md +0 -0
- /package/esm/{test → keep-a-changelog/test}/changelog.expected.linted.md +0 -0
- /package/esm/{test → keep-a-changelog/test}/changelog.expected.md +0 -0
- /package/esm/{test → keep-a-changelog/test}/changelog.gitlab.md +0 -0
- /package/esm/{test → keep-a-changelog/test}/changelog.md +0 -0
- /package/esm/{test → keep-a-changelog/test}/empty.expected.md +0 -0
- /package/esm/{deps/deno.land/std@0.189.0/path/_constants.d.ts → std/path/_common/constants.d.ts} +0 -0
- /package/script/{test → keep-a-changelog/test}/changelog.custom.type.md +0 -0
- /package/script/{test → keep-a-changelog/test}/changelog.expected.linted.md +0 -0
- /package/script/{test → keep-a-changelog/test}/changelog.expected.md +0 -0
- /package/script/{test → keep-a-changelog/test}/changelog.gitlab.md +0 -0
- /package/script/{test → keep-a-changelog/test}/changelog.md +0 -0
- /package/script/{test → keep-a-changelog/test}/empty.expected.md +0 -0
- /package/script/{deps/deno.land/std@0.189.0/path/_constants.d.ts → std/path/_common/constants.d.ts} +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { CHAR_BACKWARD_SLASH } from "../_common/constants.js";
|
|
4
|
+
import { resolve } from "./resolve.js";
|
|
5
|
+
import { assertArgs } from "../_common/relative.js";
|
|
6
|
+
/**
|
|
7
|
+
* Return the relative path from `from` to `to` based on current working directory.
|
|
8
|
+
*
|
|
9
|
+
* An example in windws, for instance:
|
|
10
|
+
* from = 'C:\\orandea\\test\\aaa'
|
|
11
|
+
* to = 'C:\\orandea\\impl\\bbb'
|
|
12
|
+
* The output of the function should be: '..\\..\\impl\\bbb'
|
|
13
|
+
*
|
|
14
|
+
* @example Usage
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { relative } from "relative.ts";
|
|
17
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
18
|
+
*
|
|
19
|
+
* const relativePath = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb");
|
|
20
|
+
* assertEquals(relativePath, "..\\..\\impl\\bbb");
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param from The path from which to calculate the relative path
|
|
24
|
+
* @param to The path to which to calculate the relative path
|
|
25
|
+
* @returns The relative path from `from` to `to`
|
|
26
|
+
*/
|
|
27
|
+
export function relative(from, to) {
|
|
28
|
+
assertArgs(from, to);
|
|
29
|
+
const fromOrig = resolve(from);
|
|
30
|
+
const toOrig = resolve(to);
|
|
31
|
+
if (fromOrig === toOrig)
|
|
32
|
+
return "";
|
|
33
|
+
from = fromOrig.toLowerCase();
|
|
34
|
+
to = toOrig.toLowerCase();
|
|
35
|
+
if (from === to)
|
|
36
|
+
return "";
|
|
37
|
+
// Trim any leading backslashes
|
|
38
|
+
let fromStart = 0;
|
|
39
|
+
let fromEnd = from.length;
|
|
40
|
+
for (; fromStart < fromEnd; ++fromStart) {
|
|
41
|
+
if (from.charCodeAt(fromStart) !== CHAR_BACKWARD_SLASH)
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
// Trim trailing backslashes (applicable to UNC paths only)
|
|
45
|
+
for (; fromEnd - 1 > fromStart; --fromEnd) {
|
|
46
|
+
if (from.charCodeAt(fromEnd - 1) !== CHAR_BACKWARD_SLASH)
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
const fromLen = fromEnd - fromStart;
|
|
50
|
+
// Trim any leading backslashes
|
|
51
|
+
let toStart = 0;
|
|
52
|
+
let toEnd = to.length;
|
|
53
|
+
for (; toStart < toEnd; ++toStart) {
|
|
54
|
+
if (to.charCodeAt(toStart) !== CHAR_BACKWARD_SLASH)
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
// Trim trailing backslashes (applicable to UNC paths only)
|
|
58
|
+
for (; toEnd - 1 > toStart; --toEnd) {
|
|
59
|
+
if (to.charCodeAt(toEnd - 1) !== CHAR_BACKWARD_SLASH)
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
const toLen = toEnd - toStart;
|
|
63
|
+
// Compare paths to find the longest common path from root
|
|
64
|
+
const length = fromLen < toLen ? fromLen : toLen;
|
|
65
|
+
let lastCommonSep = -1;
|
|
66
|
+
let i = 0;
|
|
67
|
+
for (; i <= length; ++i) {
|
|
68
|
+
if (i === length) {
|
|
69
|
+
if (toLen > length) {
|
|
70
|
+
if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {
|
|
71
|
+
// We get here if `from` is the exact base path for `to`.
|
|
72
|
+
// For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz'
|
|
73
|
+
return toOrig.slice(toStart + i + 1);
|
|
74
|
+
}
|
|
75
|
+
else if (i === 2) {
|
|
76
|
+
// We get here if `from` is the device root.
|
|
77
|
+
// For example: from='C:\\'; to='C:\\foo'
|
|
78
|
+
return toOrig.slice(toStart + i);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (fromLen > length) {
|
|
82
|
+
if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {
|
|
83
|
+
// We get here if `to` is the exact base path for `from`.
|
|
84
|
+
// For example: from='C:\\foo\\bar'; to='C:\\foo'
|
|
85
|
+
lastCommonSep = i;
|
|
86
|
+
}
|
|
87
|
+
else if (i === 2) {
|
|
88
|
+
// We get here if `to` is the device root.
|
|
89
|
+
// For example: from='C:\\foo\\bar'; to='C:\\'
|
|
90
|
+
lastCommonSep = 3;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
const fromCode = from.charCodeAt(fromStart + i);
|
|
96
|
+
const toCode = to.charCodeAt(toStart + i);
|
|
97
|
+
if (fromCode !== toCode)
|
|
98
|
+
break;
|
|
99
|
+
else if (fromCode === CHAR_BACKWARD_SLASH)
|
|
100
|
+
lastCommonSep = i;
|
|
101
|
+
}
|
|
102
|
+
// We found a mismatch before the first common path separator was seen, so
|
|
103
|
+
// return the original `to`.
|
|
104
|
+
if (i !== length && lastCommonSep === -1) {
|
|
105
|
+
return toOrig;
|
|
106
|
+
}
|
|
107
|
+
let out = "";
|
|
108
|
+
if (lastCommonSep === -1)
|
|
109
|
+
lastCommonSep = 0;
|
|
110
|
+
// Generate the relative path based on the path difference between `to` and
|
|
111
|
+
// `from`
|
|
112
|
+
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
113
|
+
if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {
|
|
114
|
+
if (out.length === 0)
|
|
115
|
+
out += "..";
|
|
116
|
+
else
|
|
117
|
+
out += "\\..";
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Lastly, append the rest of the destination (`to`) path that comes after
|
|
121
|
+
// the common path parts
|
|
122
|
+
if (out.length > 0) {
|
|
123
|
+
return out + toOrig.slice(toStart + lastCommonSep, toEnd);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
toStart += lastCommonSep;
|
|
127
|
+
if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH)
|
|
128
|
+
++toStart;
|
|
129
|
+
return toOrig.slice(toStart, toEnd);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves path segments into a `path`.
|
|
3
|
+
*
|
|
4
|
+
* @example Usage
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { resolve } from "resolve.ts";
|
|
7
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
8
|
+
*
|
|
9
|
+
* const resolved = resolve("C:\\foo\\bar", "..\\baz");
|
|
10
|
+
* assertEquals(resolved, "C:\\foo\\baz");
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param pathSegments The path segments to process to path
|
|
14
|
+
* @returns The resolved path
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolve(...pathSegments: string[]): string;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import * as dntShim from "../../../_dnt.shims.js";
|
|
4
|
+
import { CHAR_COLON } from "../_common/constants.js";
|
|
5
|
+
import { normalizeString } from "../_common/normalize_string.js";
|
|
6
|
+
import { assertPath } from "../_common/assert_path.js";
|
|
7
|
+
import { isPathSeparator, isWindowsDeviceRoot } from "./_util.js";
|
|
8
|
+
/**
|
|
9
|
+
* Resolves path segments into a `path`.
|
|
10
|
+
*
|
|
11
|
+
* @example Usage
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { resolve } from "resolve.ts";
|
|
14
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
15
|
+
*
|
|
16
|
+
* const resolved = resolve("C:\\foo\\bar", "..\\baz");
|
|
17
|
+
* assertEquals(resolved, "C:\\foo\\baz");
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param pathSegments The path segments to process to path
|
|
21
|
+
* @returns The resolved path
|
|
22
|
+
*/
|
|
23
|
+
export function resolve(...pathSegments) {
|
|
24
|
+
let resolvedDevice = "";
|
|
25
|
+
let resolvedTail = "";
|
|
26
|
+
let resolvedAbsolute = false;
|
|
27
|
+
for (let i = pathSegments.length - 1; i >= -1; i--) {
|
|
28
|
+
let path;
|
|
29
|
+
// deno-lint-ignore no-explicit-any
|
|
30
|
+
const { Deno } = dntShim.dntGlobalThis;
|
|
31
|
+
if (i >= 0) {
|
|
32
|
+
path = pathSegments[i];
|
|
33
|
+
}
|
|
34
|
+
else if (!resolvedDevice) {
|
|
35
|
+
if (typeof Deno?.cwd !== "function") {
|
|
36
|
+
throw new TypeError("Resolved a drive-letter-less path without a current working directory (CWD)");
|
|
37
|
+
}
|
|
38
|
+
path = Deno.cwd();
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
if (typeof Deno?.env?.get !== "function" || typeof Deno?.cwd !== "function") {
|
|
42
|
+
throw new TypeError("Resolved a relative path without a current working directory (CWD)");
|
|
43
|
+
}
|
|
44
|
+
path = Deno.cwd();
|
|
45
|
+
// Verify that a cwd was found and that it actually points
|
|
46
|
+
// to our drive. If not, default to the drive's root.
|
|
47
|
+
if (path === undefined ||
|
|
48
|
+
path.slice(0, 3).toLowerCase() !== `${resolvedDevice.toLowerCase()}\\`) {
|
|
49
|
+
path = `${resolvedDevice}\\`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
assertPath(path);
|
|
53
|
+
const len = path.length;
|
|
54
|
+
// Skip empty entries
|
|
55
|
+
if (len === 0)
|
|
56
|
+
continue;
|
|
57
|
+
let rootEnd = 0;
|
|
58
|
+
let device = "";
|
|
59
|
+
let isAbsolute = false;
|
|
60
|
+
const code = path.charCodeAt(0);
|
|
61
|
+
// Try to match a root
|
|
62
|
+
if (len > 1) {
|
|
63
|
+
if (isPathSeparator(code)) {
|
|
64
|
+
// Possible UNC root
|
|
65
|
+
// If we started with a separator, we know we at least have an
|
|
66
|
+
// absolute path of some kind (UNC or otherwise)
|
|
67
|
+
isAbsolute = true;
|
|
68
|
+
if (isPathSeparator(path.charCodeAt(1))) {
|
|
69
|
+
// Matched double path separator at beginning
|
|
70
|
+
let j = 2;
|
|
71
|
+
let last = j;
|
|
72
|
+
// Match 1 or more non-path separators
|
|
73
|
+
for (; j < len; ++j) {
|
|
74
|
+
if (isPathSeparator(path.charCodeAt(j)))
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
if (j < len && j !== last) {
|
|
78
|
+
const firstPart = path.slice(last, j);
|
|
79
|
+
// Matched!
|
|
80
|
+
last = j;
|
|
81
|
+
// Match 1 or more path separators
|
|
82
|
+
for (; j < len; ++j) {
|
|
83
|
+
if (!isPathSeparator(path.charCodeAt(j)))
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
if (j < len && j !== last) {
|
|
87
|
+
// Matched!
|
|
88
|
+
last = j;
|
|
89
|
+
// Match 1 or more non-path separators
|
|
90
|
+
for (; j < len; ++j) {
|
|
91
|
+
if (isPathSeparator(path.charCodeAt(j)))
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (j === len) {
|
|
95
|
+
// We matched a UNC root only
|
|
96
|
+
device = `\\\\${firstPart}\\${path.slice(last)}`;
|
|
97
|
+
rootEnd = j;
|
|
98
|
+
}
|
|
99
|
+
else if (j !== last) {
|
|
100
|
+
// We matched a UNC root with leftovers
|
|
101
|
+
device = `\\\\${firstPart}\\${path.slice(last, j)}`;
|
|
102
|
+
rootEnd = j;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
rootEnd = 1;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else if (isWindowsDeviceRoot(code)) {
|
|
112
|
+
// Possible device root
|
|
113
|
+
if (path.charCodeAt(1) === CHAR_COLON) {
|
|
114
|
+
device = path.slice(0, 2);
|
|
115
|
+
rootEnd = 2;
|
|
116
|
+
if (len > 2) {
|
|
117
|
+
if (isPathSeparator(path.charCodeAt(2))) {
|
|
118
|
+
// Treat separator following drive name as an absolute path
|
|
119
|
+
// indicator
|
|
120
|
+
isAbsolute = true;
|
|
121
|
+
rootEnd = 3;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else if (isPathSeparator(code)) {
|
|
128
|
+
// `path` contains just a path separator
|
|
129
|
+
rootEnd = 1;
|
|
130
|
+
isAbsolute = true;
|
|
131
|
+
}
|
|
132
|
+
if (device.length > 0 &&
|
|
133
|
+
resolvedDevice.length > 0 &&
|
|
134
|
+
device.toLowerCase() !== resolvedDevice.toLowerCase()) {
|
|
135
|
+
// This path points to another device so it is not applicable
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (resolvedDevice.length === 0 && device.length > 0) {
|
|
139
|
+
resolvedDevice = device;
|
|
140
|
+
}
|
|
141
|
+
if (!resolvedAbsolute) {
|
|
142
|
+
resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`;
|
|
143
|
+
resolvedAbsolute = isAbsolute;
|
|
144
|
+
}
|
|
145
|
+
if (resolvedAbsolute && resolvedDevice.length > 0)
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
// At this point the path should be resolved to a full absolute path,
|
|
149
|
+
// but handle relative paths to be safe (might happen when Deno.cwd()
|
|
150
|
+
// fails)
|
|
151
|
+
// Normalize the tail path
|
|
152
|
+
resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, "\\", isPathSeparator);
|
|
153
|
+
return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || ".";
|
|
154
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Converts a path string to a file URL.
|
|
4
|
+
*
|
|
5
|
+
* @example Usage
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { toFileUrl } from "to_file_url.ts";
|
|
8
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
9
|
+
*
|
|
10
|
+
* assertEquals(toFileUrl("\\home\\foo"), new URL("file:///home/foo"));
|
|
11
|
+
* assertEquals(toFileUrl("C:\\Users\\foo"), new URL("file:///C:/Users/foo"));
|
|
12
|
+
* assertEquals(toFileUrl("\\\\127.0.0.1\\home\\foo"), new URL("file://127.0.0.1/home/foo"));
|
|
13
|
+
* ```
|
|
14
|
+
* @param path The path to convert.
|
|
15
|
+
* @returns The file URL.
|
|
16
|
+
*/
|
|
17
|
+
export declare function toFileUrl(path: string): URL;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { encodeWhitespace } from "../_common/to_file_url.js";
|
|
4
|
+
import { isAbsolute } from "./is_absolute.js";
|
|
5
|
+
/**
|
|
6
|
+
* Converts a path string to a file URL.
|
|
7
|
+
*
|
|
8
|
+
* @example Usage
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { toFileUrl } from "to_file_url.ts";
|
|
11
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
12
|
+
*
|
|
13
|
+
* assertEquals(toFileUrl("\\home\\foo"), new URL("file:///home/foo"));
|
|
14
|
+
* assertEquals(toFileUrl("C:\\Users\\foo"), new URL("file:///C:/Users/foo"));
|
|
15
|
+
* assertEquals(toFileUrl("\\\\127.0.0.1\\home\\foo"), new URL("file://127.0.0.1/home/foo"));
|
|
16
|
+
* ```
|
|
17
|
+
* @param path The path to convert.
|
|
18
|
+
* @returns The file URL.
|
|
19
|
+
*/
|
|
20
|
+
export function toFileUrl(path) {
|
|
21
|
+
if (!isAbsolute(path)) {
|
|
22
|
+
throw new TypeError(`Path must be absolute: received "${path}"`);
|
|
23
|
+
}
|
|
24
|
+
const [, hostname, pathname] = path.match(/^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/);
|
|
25
|
+
const url = new URL("file:///");
|
|
26
|
+
url.pathname = encodeWhitespace(pathname.replace(/%/g, "%25"));
|
|
27
|
+
if (hostname !== undefined && hostname !== "localhost") {
|
|
28
|
+
url.hostname = hostname;
|
|
29
|
+
if (!url.hostname) {
|
|
30
|
+
throw new TypeError(`Invalid hostname: "${url.hostname}"`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return url;
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves path to a namespace path
|
|
3
|
+
*
|
|
4
|
+
* @example Usage
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { toNamespacedPath } from "to_namespaced_path.ts";
|
|
7
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
8
|
+
*
|
|
9
|
+
* const namespaced = toNamespacedPath("C:\\foo\\bar");
|
|
10
|
+
* assertEquals(namespaced, "\\\\?\\C:\\foo\\bar");
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param path The path to resolve to namespaced path
|
|
14
|
+
* @returns The resolved namespaced path
|
|
15
|
+
*/
|
|
16
|
+
export declare function toNamespacedPath(path: string): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { CHAR_BACKWARD_SLASH, CHAR_COLON, CHAR_DOT, CHAR_QUESTION_MARK, } from "../_common/constants.js";
|
|
4
|
+
import { isWindowsDeviceRoot } from "./_util.js";
|
|
5
|
+
import { resolve } from "./resolve.js";
|
|
6
|
+
/**
|
|
7
|
+
* Resolves path to a namespace path
|
|
8
|
+
*
|
|
9
|
+
* @example Usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { toNamespacedPath } from "to_namespaced_path.ts";
|
|
12
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
13
|
+
*
|
|
14
|
+
* const namespaced = toNamespacedPath("C:\\foo\\bar");
|
|
15
|
+
* assertEquals(namespaced, "\\\\?\\C:\\foo\\bar");
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param path The path to resolve to namespaced path
|
|
19
|
+
* @returns The resolved namespaced path
|
|
20
|
+
*/
|
|
21
|
+
export function toNamespacedPath(path) {
|
|
22
|
+
// Note: this will *probably* throw somewhere.
|
|
23
|
+
if (typeof path !== "string")
|
|
24
|
+
return path;
|
|
25
|
+
if (path.length === 0)
|
|
26
|
+
return "";
|
|
27
|
+
const resolvedPath = resolve(path);
|
|
28
|
+
if (resolvedPath.length >= 3) {
|
|
29
|
+
if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {
|
|
30
|
+
// Possible UNC root
|
|
31
|
+
if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {
|
|
32
|
+
const code = resolvedPath.charCodeAt(2);
|
|
33
|
+
if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {
|
|
34
|
+
// Matched non-long UNC root, convert the path to a long UNC path
|
|
35
|
+
return `\\\\?\\UNC\\${resolvedPath.slice(2)}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) {
|
|
40
|
+
// Possible device root
|
|
41
|
+
if (resolvedPath.charCodeAt(1) === CHAR_COLON &&
|
|
42
|
+
resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {
|
|
43
|
+
// Matched device root, convert the path to a long UNC path
|
|
44
|
+
return `\\\\?\\${resolvedPath}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return path;
|
|
49
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Comparator, SemVer } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The minimum valid SemVer object. Equivalent to `0.0.0`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MIN: SemVer;
|
|
6
|
+
/**
|
|
7
|
+
* ANY is a sentinel value used by some range calculations. It is not a valid
|
|
8
|
+
* SemVer object and should not be used directly.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ANY: SemVer;
|
|
11
|
+
/**
|
|
12
|
+
* A comparator which will span all valid semantic versions
|
|
13
|
+
*/
|
|
14
|
+
export declare const ALL: Comparator;
|
|
15
|
+
export declare const OPERATORS: readonly [undefined, "=", "!=", ">", ">=", "<", "<="];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
/**
|
|
3
|
+
* The minimum valid SemVer object. Equivalent to `0.0.0`.
|
|
4
|
+
*/
|
|
5
|
+
export const MIN = {
|
|
6
|
+
major: 0,
|
|
7
|
+
minor: 0,
|
|
8
|
+
patch: 0,
|
|
9
|
+
prerelease: [],
|
|
10
|
+
build: [],
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* ANY is a sentinel value used by some range calculations. It is not a valid
|
|
14
|
+
* SemVer object and should not be used directly.
|
|
15
|
+
*/
|
|
16
|
+
export const ANY = {
|
|
17
|
+
major: Number.NaN,
|
|
18
|
+
minor: Number.NaN,
|
|
19
|
+
patch: Number.NaN,
|
|
20
|
+
prerelease: [],
|
|
21
|
+
build: [],
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A comparator which will span all valid semantic versions
|
|
25
|
+
*/
|
|
26
|
+
export const ALL = {
|
|
27
|
+
operator: undefined,
|
|
28
|
+
...ANY,
|
|
29
|
+
};
|
|
30
|
+
export const OPERATORS = [
|
|
31
|
+
undefined,
|
|
32
|
+
"=",
|
|
33
|
+
"!=",
|
|
34
|
+
">",
|
|
35
|
+
">=",
|
|
36
|
+
"<",
|
|
37
|
+
"<=",
|
|
38
|
+
];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Comparator } from "./types.js";
|
|
2
|
+
export declare function compareNumber(a: number, b: number): 1 | 0 | -1;
|
|
3
|
+
export declare function checkIdentifier(v1?: ReadonlyArray<string | number>, v2?: ReadonlyArray<string | number>): 1 | 0 | -1;
|
|
4
|
+
export declare function compareIdentifier(v1?: ReadonlyArray<string | number>, v2?: ReadonlyArray<string | number>): 1 | 0 | -1;
|
|
5
|
+
export declare const FULL_REGEXP: RegExp;
|
|
6
|
+
/**
|
|
7
|
+
* A version that can contain wildcards.
|
|
8
|
+
* @example "x", "1.x", "1.x.x", "1.2.x", "*", "1.*", "1.*.*", "1.2.*"
|
|
9
|
+
*/
|
|
10
|
+
export declare const XRANGE = "[v=\\s]*(?<major>0|[1-9]\\d*|x|X|\\*)(?:\\.(?<minor>0|[1-9]\\d*|x|X|\\*)(?:\\.(?<patch>0|[1-9]\\d*|x|X|\\*)(?:-(?<prerelease>(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\+(?<buildmetadata>[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?)?)?";
|
|
11
|
+
/**
|
|
12
|
+
* An operator (`~`, `~>`, `^`, `=`, `<`, `<=`, `>`, or `>=`), followed by an x-range.
|
|
13
|
+
* @example "~1.x.x", "^1.2.*", ">=1.2.3"
|
|
14
|
+
*/
|
|
15
|
+
export declare const OPERATOR_XRANGE_REGEXP: RegExp;
|
|
16
|
+
/**
|
|
17
|
+
* An empty string or a comparator (`=`, `<`, `<=`, `>`, or `>=`), followed by a version.
|
|
18
|
+
* @example ">1.2.3"
|
|
19
|
+
*/
|
|
20
|
+
export declare const COMPARATOR_REGEXP: RegExp;
|
|
21
|
+
/**
|
|
22
|
+
* Returns true if the value is a valid SemVer number.
|
|
23
|
+
*
|
|
24
|
+
* Must be a number. Must not be NaN. Can be positive or negative infinity.
|
|
25
|
+
* Can be between 0 and MAX_SAFE_INTEGER.
|
|
26
|
+
* @param value The value to check
|
|
27
|
+
* @returns True if its a valid semver number
|
|
28
|
+
*/
|
|
29
|
+
export declare function isValidNumber(value: unknown): value is number;
|
|
30
|
+
export declare const MAX_LENGTH = 256;
|
|
31
|
+
/**
|
|
32
|
+
* Returns true if the value is a valid semver pre-release or build identifier.
|
|
33
|
+
*
|
|
34
|
+
* Must be a string. Must be between 1 and 256 characters long. Must match
|
|
35
|
+
* the regular expression /[0-9A-Za-z-]+/.
|
|
36
|
+
* @param value The value to check
|
|
37
|
+
* @returns True if the value is a valid semver string.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isValidString(value: unknown): value is string;
|
|
40
|
+
export declare function parsePrerelease(prerelease: string): (string | number)[];
|
|
41
|
+
export declare function parseBuild(buildmetadata: string): string[];
|
|
42
|
+
export declare function parseNumber(input: string, errorMessage: string): number;
|
|
43
|
+
export declare function isWildcardComparator(c: Comparator): boolean;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
export function compareNumber(a, b) {
|
|
3
|
+
if (isNaN(a) || isNaN(b)) {
|
|
4
|
+
throw new Error("Cannot compare against non-numbers");
|
|
5
|
+
}
|
|
6
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
7
|
+
}
|
|
8
|
+
export function checkIdentifier(v1 = [], v2 = []) {
|
|
9
|
+
// NOT having a prerelease is > having one
|
|
10
|
+
// But NOT having a build is < having one
|
|
11
|
+
if (v1.length && !v2.length)
|
|
12
|
+
return -1;
|
|
13
|
+
if (!v1.length && v2.length)
|
|
14
|
+
return 1;
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
export function compareIdentifier(v1 = [], v2 = []) {
|
|
18
|
+
const length = Math.max(v1.length, v2.length);
|
|
19
|
+
for (let i = 0; i < length; i++) {
|
|
20
|
+
const a = v1[i];
|
|
21
|
+
const b = v2[i];
|
|
22
|
+
// same length is equal
|
|
23
|
+
if (a === undefined && b === undefined)
|
|
24
|
+
return 0;
|
|
25
|
+
// longer > shorter
|
|
26
|
+
if (b === undefined)
|
|
27
|
+
return 1;
|
|
28
|
+
// shorter < longer
|
|
29
|
+
if (a === undefined)
|
|
30
|
+
return -1;
|
|
31
|
+
// string > number
|
|
32
|
+
if (typeof a === "string" && typeof b === "number")
|
|
33
|
+
return 1;
|
|
34
|
+
// number < string
|
|
35
|
+
if (typeof a === "number" && typeof b === "string")
|
|
36
|
+
return -1;
|
|
37
|
+
if (a < b)
|
|
38
|
+
return -1;
|
|
39
|
+
if (a > b)
|
|
40
|
+
return 1;
|
|
41
|
+
// If they're equal, continue comparing segments.
|
|
42
|
+
}
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A single `0`, or a non-zero digit followed by zero or more digits.
|
|
47
|
+
*/
|
|
48
|
+
const NUMERIC_IDENTIFIER = "0|[1-9]\\d*";
|
|
49
|
+
/**
|
|
50
|
+
* Zero or more digits, followed by a letter or hyphen, and then zero or more letters, digits, or hyphens.
|
|
51
|
+
*/
|
|
52
|
+
const NON_NUMERIC_IDENTIFIER = "\\d*[a-zA-Z-][a-zA-Z0-9-]*";
|
|
53
|
+
/**
|
|
54
|
+
* Three dot-separated numeric identifiers.
|
|
55
|
+
*/
|
|
56
|
+
const VERSION_CORE = `(?<major>${NUMERIC_IDENTIFIER})\\.(?<minor>${NUMERIC_IDENTIFIER})\\.(?<patch>${NUMERIC_IDENTIFIER})`;
|
|
57
|
+
/**
|
|
58
|
+
* A numeric identifier, or a non-numeric identifier.
|
|
59
|
+
*/
|
|
60
|
+
const PRERELEASE_IDENTIFIER = `(?:${NUMERIC_IDENTIFIER}|${NON_NUMERIC_IDENTIFIER})`;
|
|
61
|
+
/**
|
|
62
|
+
* A hyphen, followed by one or more dot-separated pre-release version identifiers.
|
|
63
|
+
* @example "-pre.release"
|
|
64
|
+
*/
|
|
65
|
+
const PRERELEASE = `(?:-(?<prerelease>${PRERELEASE_IDENTIFIER}(?:\\.${PRERELEASE_IDENTIFIER})*))`;
|
|
66
|
+
/**
|
|
67
|
+
* Any combination of digits, letters, or hyphens.
|
|
68
|
+
*/
|
|
69
|
+
const BUILD_IDENTIFIER = "[0-9A-Za-z-]+";
|
|
70
|
+
/**
|
|
71
|
+
* A plus sign, followed by one or more period-separated build metadata identifiers.
|
|
72
|
+
* @example "+build.meta"
|
|
73
|
+
*/
|
|
74
|
+
const BUILD = `(?:\\+(?<buildmetadata>${BUILD_IDENTIFIER}(?:\\.${BUILD_IDENTIFIER})*))`;
|
|
75
|
+
/**
|
|
76
|
+
* A version, followed optionally by a pre-release version and build metadata.
|
|
77
|
+
*/
|
|
78
|
+
const FULL_VERSION = `v?${VERSION_CORE}${PRERELEASE}?${BUILD}?`;
|
|
79
|
+
export const FULL_REGEXP = new RegExp(`^${FULL_VERSION}$`);
|
|
80
|
+
/**
|
|
81
|
+
* A comparator.
|
|
82
|
+
* @example `=`, `<`, `<=`, `>`, `>=`
|
|
83
|
+
*/
|
|
84
|
+
const COMPARATOR = "(?:<|>)?=?";
|
|
85
|
+
/**
|
|
86
|
+
* A wildcard identifier.
|
|
87
|
+
* @example "x", "X", "*"
|
|
88
|
+
*/
|
|
89
|
+
const WILDCARD_IDENTIFIER = `x|X|\\*`;
|
|
90
|
+
const XRANGE_IDENTIFIER = `${NUMERIC_IDENTIFIER}|${WILDCARD_IDENTIFIER}`;
|
|
91
|
+
/**
|
|
92
|
+
* A version that can contain wildcards.
|
|
93
|
+
* @example "x", "1.x", "1.x.x", "1.2.x", "*", "1.*", "1.*.*", "1.2.*"
|
|
94
|
+
*/
|
|
95
|
+
export const XRANGE = `[v=\\s]*(?<major>${XRANGE_IDENTIFIER})(?:\\.(?<minor>${XRANGE_IDENTIFIER})(?:\\.(?<patch>${XRANGE_IDENTIFIER})${PRERELEASE}?${BUILD}?)?)?`;
|
|
96
|
+
/**
|
|
97
|
+
* An operator (`~`, `~>`, `^`, `=`, `<`, `<=`, `>`, or `>=`), followed by an x-range.
|
|
98
|
+
* @example "~1.x.x", "^1.2.*", ">=1.2.3"
|
|
99
|
+
*/
|
|
100
|
+
export const OPERATOR_XRANGE_REGEXP = new RegExp(`^(?<operator>~>?|\\^|${COMPARATOR})\\s*${XRANGE}$`);
|
|
101
|
+
/**
|
|
102
|
+
* An empty string or a comparator (`=`, `<`, `<=`, `>`, or `>=`), followed by a version.
|
|
103
|
+
* @example ">1.2.3"
|
|
104
|
+
*/
|
|
105
|
+
export const COMPARATOR_REGEXP = new RegExp(`^(?<operator>${COMPARATOR})\\s*(${FULL_VERSION})$|^$`);
|
|
106
|
+
/**
|
|
107
|
+
* Returns true if the value is a valid SemVer number.
|
|
108
|
+
*
|
|
109
|
+
* Must be a number. Must not be NaN. Can be positive or negative infinity.
|
|
110
|
+
* Can be between 0 and MAX_SAFE_INTEGER.
|
|
111
|
+
* @param value The value to check
|
|
112
|
+
* @returns True if its a valid semver number
|
|
113
|
+
*/
|
|
114
|
+
export function isValidNumber(value) {
|
|
115
|
+
return (typeof value === "number" &&
|
|
116
|
+
!Number.isNaN(value) &&
|
|
117
|
+
(!Number.isFinite(value) ||
|
|
118
|
+
(0 <= value && value <= Number.MAX_SAFE_INTEGER)));
|
|
119
|
+
}
|
|
120
|
+
export const MAX_LENGTH = 256;
|
|
121
|
+
/**
|
|
122
|
+
* Returns true if the value is a valid semver pre-release or build identifier.
|
|
123
|
+
*
|
|
124
|
+
* Must be a string. Must be between 1 and 256 characters long. Must match
|
|
125
|
+
* the regular expression /[0-9A-Za-z-]+/.
|
|
126
|
+
* @param value The value to check
|
|
127
|
+
* @returns True if the value is a valid semver string.
|
|
128
|
+
*/
|
|
129
|
+
export function isValidString(value) {
|
|
130
|
+
return (typeof value === "string" &&
|
|
131
|
+
value.length > 0 &&
|
|
132
|
+
value.length <= MAX_LENGTH &&
|
|
133
|
+
/[0-9A-Za-z-]+/.test(value));
|
|
134
|
+
}
|
|
135
|
+
const NUMERIC_IDENTIFIER_REGEXP = new RegExp(`^${NUMERIC_IDENTIFIER}$`);
|
|
136
|
+
export function parsePrerelease(prerelease) {
|
|
137
|
+
return prerelease
|
|
138
|
+
.split(".")
|
|
139
|
+
.filter(Boolean)
|
|
140
|
+
.map((id) => {
|
|
141
|
+
if (NUMERIC_IDENTIFIER_REGEXP.test(id)) {
|
|
142
|
+
const number = Number(id);
|
|
143
|
+
if (isValidNumber(number))
|
|
144
|
+
return number;
|
|
145
|
+
}
|
|
146
|
+
return id;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
export function parseBuild(buildmetadata) {
|
|
150
|
+
return buildmetadata.split(".").filter(Boolean);
|
|
151
|
+
}
|
|
152
|
+
export function parseNumber(input, errorMessage) {
|
|
153
|
+
const number = Number(input);
|
|
154
|
+
if (!isValidNumber(number))
|
|
155
|
+
throw new TypeError(errorMessage);
|
|
156
|
+
return number;
|
|
157
|
+
}
|
|
158
|
+
export function isWildcardComparator(c) {
|
|
159
|
+
return (Number.isNaN(c.major) && Number.isNaN(c.minor) && Number.isNaN(c.patch) &&
|
|
160
|
+
(c.prerelease === undefined || c.prerelease.length === 0) &&
|
|
161
|
+
(c.build === undefined || c.build.length === 0));
|
|
162
|
+
}
|