keep-a-changelog 2.5.3 → 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 +22 -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} +85 -13
- 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} +86 -14
- 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,38 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { CHAR_COLON } from "../_common/constants.js";
|
|
4
|
+
import { assertPath } from "../_common/assert_path.js";
|
|
5
|
+
import { isPathSeparator, isWindowsDeviceRoot } from "./_util.js";
|
|
6
|
+
/**
|
|
7
|
+
* Verifies whether provided path is absolute.
|
|
8
|
+
*
|
|
9
|
+
* @example Usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { isAbsolute } from "is_absolute.ts";
|
|
12
|
+
* import { assert, assertFalse } from "../../assert/mod.ts";
|
|
13
|
+
*
|
|
14
|
+
* assert(isAbsolute("C:\\foo\\bar"));
|
|
15
|
+
* assertFalse(isAbsolute("..\\baz"));
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param path The path to verify.
|
|
19
|
+
* @returns `true` if the path is absolute, `false` otherwise.
|
|
20
|
+
*/
|
|
21
|
+
export function isAbsolute(path) {
|
|
22
|
+
assertPath(path);
|
|
23
|
+
const len = path.length;
|
|
24
|
+
if (len === 0)
|
|
25
|
+
return false;
|
|
26
|
+
const code = path.charCodeAt(0);
|
|
27
|
+
if (isPathSeparator(code)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
else if (isWindowsDeviceRoot(code)) {
|
|
31
|
+
// Possible device root
|
|
32
|
+
if (len > 2 && path.charCodeAt(1) === CHAR_COLON) {
|
|
33
|
+
if (isPathSeparator(path.charCodeAt(2)))
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Join all given a sequence of `paths`,then normalizes the resulting path.
|
|
3
|
+
*
|
|
4
|
+
* @example Usage
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { join } from "join.ts";
|
|
7
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
8
|
+
*
|
|
9
|
+
* const joined = join("C:\\foo", "bar", "baz\\..");
|
|
10
|
+
* assertEquals(joined, "C:\\foo\\bar");
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Note: If you are working with file URLs,
|
|
14
|
+
* use the new version of `join` from `@std/path/windows/unstable-join`.
|
|
15
|
+
*
|
|
16
|
+
* @param paths The paths to join.
|
|
17
|
+
* @returns The joined path.
|
|
18
|
+
*/
|
|
19
|
+
export declare function join(...paths: string[]): string;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { assertPath } from "../_common/assert_path.js";
|
|
4
|
+
import { isPathSeparator } from "./_util.js";
|
|
5
|
+
import { normalize } from "./normalize.js";
|
|
6
|
+
/**
|
|
7
|
+
* Join all given a sequence of `paths`,then normalizes the resulting path.
|
|
8
|
+
*
|
|
9
|
+
* @example Usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { join } from "join.ts";
|
|
12
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
13
|
+
*
|
|
14
|
+
* const joined = join("C:\\foo", "bar", "baz\\..");
|
|
15
|
+
* assertEquals(joined, "C:\\foo\\bar");
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Note: If you are working with file URLs,
|
|
19
|
+
* use the new version of `join` from `@std/path/windows/unstable-join`.
|
|
20
|
+
*
|
|
21
|
+
* @param paths The paths to join.
|
|
22
|
+
* @returns The joined path.
|
|
23
|
+
*/
|
|
24
|
+
export function join(...paths) {
|
|
25
|
+
paths.forEach((path) => assertPath(path));
|
|
26
|
+
paths = paths.filter((path) => path.length > 0);
|
|
27
|
+
if (paths.length === 0)
|
|
28
|
+
return ".";
|
|
29
|
+
// Make sure that the joined path doesn't start with two slashes, because
|
|
30
|
+
// normalize() will mistake it for an UNC path then.
|
|
31
|
+
//
|
|
32
|
+
// This step is skipped when it is very clear that the user actually
|
|
33
|
+
// intended to point at an UNC path. This is assumed when the first
|
|
34
|
+
// non-empty string arguments starts with exactly two slashes followed by
|
|
35
|
+
// at least one more non-slash character.
|
|
36
|
+
//
|
|
37
|
+
// Note that for normalize() to treat a path as an UNC path it needs to
|
|
38
|
+
// have at least 2 components, so we don't filter for that here.
|
|
39
|
+
// This means that the user can use join to construct UNC paths from
|
|
40
|
+
// a server name and a share name; for example:
|
|
41
|
+
// path.join('//server', 'share') -> '\\\\server\\share\\'
|
|
42
|
+
let needsReplace = true;
|
|
43
|
+
let slashCount = 0;
|
|
44
|
+
const firstPart = paths[0];
|
|
45
|
+
if (isPathSeparator(firstPart.charCodeAt(0))) {
|
|
46
|
+
++slashCount;
|
|
47
|
+
const firstLen = firstPart.length;
|
|
48
|
+
if (firstLen > 1) {
|
|
49
|
+
if (isPathSeparator(firstPart.charCodeAt(1))) {
|
|
50
|
+
++slashCount;
|
|
51
|
+
if (firstLen > 2) {
|
|
52
|
+
if (isPathSeparator(firstPart.charCodeAt(2)))
|
|
53
|
+
++slashCount;
|
|
54
|
+
else {
|
|
55
|
+
// We matched a UNC path in the first part
|
|
56
|
+
needsReplace = false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
let joined = paths.join("\\");
|
|
63
|
+
if (needsReplace) {
|
|
64
|
+
// Find any more consecutive slashes we need to replace
|
|
65
|
+
for (; slashCount < joined.length; ++slashCount) {
|
|
66
|
+
if (!isPathSeparator(joined.charCodeAt(slashCount)))
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
// Replace the slashes if needed
|
|
70
|
+
if (slashCount >= 2)
|
|
71
|
+
joined = `\\${joined.slice(slashCount)}`;
|
|
72
|
+
}
|
|
73
|
+
return normalize(joined);
|
|
74
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GlobOptions } from "../_common/glob_to_reg_exp.js";
|
|
2
|
+
export type { GlobOptions };
|
|
3
|
+
/**
|
|
4
|
+
* Like join(), but doesn't collapse "**\/.." when `globstar` is true.
|
|
5
|
+
*
|
|
6
|
+
* @example Usage
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { joinGlobs } from "join_globs.ts";
|
|
10
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
11
|
+
*
|
|
12
|
+
* const joined = joinGlobs(["foo", "**", "bar"], { globstar: true });
|
|
13
|
+
* assertEquals(joined, "foo\\**\\bar");
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param globs The globs to join.
|
|
17
|
+
* @param options The options for glob pattern.
|
|
18
|
+
* @returns The joined glob pattern.
|
|
19
|
+
*/
|
|
20
|
+
export declare function joinGlobs(globs: string[], options?: Pick<GlobOptions, "globstar">): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { join } from "./join.js";
|
|
4
|
+
import { SEPARATOR } from "./constants.js";
|
|
5
|
+
import { normalizeGlob } from "./normalize_glob.js";
|
|
6
|
+
/**
|
|
7
|
+
* Like join(), but doesn't collapse "**\/.." when `globstar` is true.
|
|
8
|
+
*
|
|
9
|
+
* @example Usage
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { joinGlobs } from "join_globs.ts";
|
|
13
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
14
|
+
*
|
|
15
|
+
* const joined = joinGlobs(["foo", "**", "bar"], { globstar: true });
|
|
16
|
+
* assertEquals(joined, "foo\\**\\bar");
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param globs The globs to join.
|
|
20
|
+
* @param options The options for glob pattern.
|
|
21
|
+
* @returns The joined glob pattern.
|
|
22
|
+
*/
|
|
23
|
+
export function joinGlobs(globs, options = {}) {
|
|
24
|
+
const { globstar = false } = options;
|
|
25
|
+
if (!globstar || globs.length === 0) {
|
|
26
|
+
return join(...globs);
|
|
27
|
+
}
|
|
28
|
+
let joined;
|
|
29
|
+
for (const glob of globs) {
|
|
30
|
+
const path = glob;
|
|
31
|
+
if (path.length > 0) {
|
|
32
|
+
if (!joined)
|
|
33
|
+
joined = path;
|
|
34
|
+
else
|
|
35
|
+
joined += `${SEPARATOR}${path}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (!joined)
|
|
39
|
+
return ".";
|
|
40
|
+
return normalizeGlob(joined, { globstar });
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize the `path`, resolving `'..'` and `'.'` segments.
|
|
3
|
+
* Note that resolving these segments does not necessarily mean that all will be eliminated.
|
|
4
|
+
* A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
|
|
5
|
+
*
|
|
6
|
+
* @example Usage
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { normalize } from "normalize.ts";
|
|
9
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
10
|
+
*
|
|
11
|
+
* const normalized = normalize("C:\\foo\\..\\bar");
|
|
12
|
+
* assertEquals(normalized, "C:\\bar");
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Note: If you are working with file URLs,
|
|
16
|
+
* use the new version of `normalize` from `@std/path/windows/unstable-normalize`.
|
|
17
|
+
*
|
|
18
|
+
* @param path The path to normalize
|
|
19
|
+
* @returns The normalized path
|
|
20
|
+
*/
|
|
21
|
+
export declare function normalize(path: string): string;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { assertArg } from "../_common/normalize.js";
|
|
4
|
+
import { CHAR_COLON } from "../_common/constants.js";
|
|
5
|
+
import { normalizeString } from "../_common/normalize_string.js";
|
|
6
|
+
import { isPathSeparator, isWindowsDeviceRoot } from "./_util.js";
|
|
7
|
+
/**
|
|
8
|
+
* Normalize the `path`, resolving `'..'` and `'.'` segments.
|
|
9
|
+
* Note that resolving these segments does not necessarily mean that all will be eliminated.
|
|
10
|
+
* A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
|
|
11
|
+
*
|
|
12
|
+
* @example Usage
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { normalize } from "normalize.ts";
|
|
15
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
16
|
+
*
|
|
17
|
+
* const normalized = normalize("C:\\foo\\..\\bar");
|
|
18
|
+
* assertEquals(normalized, "C:\\bar");
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Note: If you are working with file URLs,
|
|
22
|
+
* use the new version of `normalize` from `@std/path/windows/unstable-normalize`.
|
|
23
|
+
*
|
|
24
|
+
* @param path The path to normalize
|
|
25
|
+
* @returns The normalized path
|
|
26
|
+
*/
|
|
27
|
+
export function normalize(path) {
|
|
28
|
+
assertArg(path);
|
|
29
|
+
const len = path.length;
|
|
30
|
+
let rootEnd = 0;
|
|
31
|
+
let device;
|
|
32
|
+
let isAbsolute = false;
|
|
33
|
+
const code = path.charCodeAt(0);
|
|
34
|
+
// Try to match a root
|
|
35
|
+
if (len > 1) {
|
|
36
|
+
if (isPathSeparator(code)) {
|
|
37
|
+
// Possible UNC root
|
|
38
|
+
// If we started with a separator, we know we at least have an absolute
|
|
39
|
+
// path of some kind (UNC or otherwise)
|
|
40
|
+
isAbsolute = true;
|
|
41
|
+
if (isPathSeparator(path.charCodeAt(1))) {
|
|
42
|
+
// Matched double path separator at beginning
|
|
43
|
+
let j = 2;
|
|
44
|
+
let last = j;
|
|
45
|
+
// Match 1 or more non-path separators
|
|
46
|
+
for (; j < len; ++j) {
|
|
47
|
+
if (isPathSeparator(path.charCodeAt(j)))
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
if (j < len && j !== last) {
|
|
51
|
+
const firstPart = path.slice(last, j);
|
|
52
|
+
// Matched!
|
|
53
|
+
last = j;
|
|
54
|
+
// Match 1 or more path separators
|
|
55
|
+
for (; j < len; ++j) {
|
|
56
|
+
if (!isPathSeparator(path.charCodeAt(j)))
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
if (j < len && j !== last) {
|
|
60
|
+
// Matched!
|
|
61
|
+
last = j;
|
|
62
|
+
// Match 1 or more non-path separators
|
|
63
|
+
for (; j < len; ++j) {
|
|
64
|
+
if (isPathSeparator(path.charCodeAt(j)))
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
if (j === len) {
|
|
68
|
+
// We matched a UNC root only
|
|
69
|
+
// Return the normalized version of the UNC root since there
|
|
70
|
+
// is nothing left to process
|
|
71
|
+
return `\\\\${firstPart}\\${path.slice(last)}\\`;
|
|
72
|
+
}
|
|
73
|
+
else if (j !== last) {
|
|
74
|
+
// We matched a UNC root with leftovers
|
|
75
|
+
device = `\\\\${firstPart}\\${path.slice(last, j)}`;
|
|
76
|
+
rootEnd = j;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
rootEnd = 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (isWindowsDeviceRoot(code)) {
|
|
86
|
+
// Possible device root
|
|
87
|
+
if (path.charCodeAt(1) === CHAR_COLON) {
|
|
88
|
+
device = path.slice(0, 2);
|
|
89
|
+
rootEnd = 2;
|
|
90
|
+
if (len > 2) {
|
|
91
|
+
if (isPathSeparator(path.charCodeAt(2))) {
|
|
92
|
+
// Treat separator following drive name as an absolute path
|
|
93
|
+
// indicator
|
|
94
|
+
isAbsolute = true;
|
|
95
|
+
rootEnd = 3;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else if (isPathSeparator(code)) {
|
|
102
|
+
// `path` contains just a path separator, exit early to avoid unnecessary
|
|
103
|
+
// work
|
|
104
|
+
return "\\";
|
|
105
|
+
}
|
|
106
|
+
let tail;
|
|
107
|
+
if (rootEnd < len) {
|
|
108
|
+
tail = normalizeString(path.slice(rootEnd), !isAbsolute, "\\", isPathSeparator);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
tail = "";
|
|
112
|
+
}
|
|
113
|
+
if (tail.length === 0 && !isAbsolute)
|
|
114
|
+
tail = ".";
|
|
115
|
+
if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {
|
|
116
|
+
tail += "\\";
|
|
117
|
+
}
|
|
118
|
+
if (device === undefined) {
|
|
119
|
+
if (isAbsolute) {
|
|
120
|
+
if (tail.length > 0)
|
|
121
|
+
return `\\${tail}`;
|
|
122
|
+
else
|
|
123
|
+
return "\\";
|
|
124
|
+
}
|
|
125
|
+
return tail;
|
|
126
|
+
}
|
|
127
|
+
else if (isAbsolute) {
|
|
128
|
+
if (tail.length > 0)
|
|
129
|
+
return `${device}\\${tail}`;
|
|
130
|
+
else
|
|
131
|
+
return `${device}\\`;
|
|
132
|
+
}
|
|
133
|
+
return device + tail;
|
|
134
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GlobOptions } from "../_common/glob_to_reg_exp.js";
|
|
2
|
+
export type { GlobOptions };
|
|
3
|
+
/**
|
|
4
|
+
* Like normalize(), but doesn't collapse "**\/.." when `globstar` is true.
|
|
5
|
+
*
|
|
6
|
+
* @example Usage
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { normalizeGlob } from "normalize_glob.ts";
|
|
9
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
10
|
+
*
|
|
11
|
+
* const normalized = normalizeGlob("**\\foo\\..\\bar", { globstar: true });
|
|
12
|
+
* assertEquals(normalized, "**\\bar");
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param glob The glob pattern to normalize.
|
|
16
|
+
* @param options The options for glob pattern.
|
|
17
|
+
* @returns The normalized glob pattern.
|
|
18
|
+
*/
|
|
19
|
+
export declare function normalizeGlob(glob: string, options?: Pick<GlobOptions, "globstar">): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { normalize } from "./normalize.js";
|
|
4
|
+
import { SEPARATOR_PATTERN } from "./constants.js";
|
|
5
|
+
/**
|
|
6
|
+
* Like normalize(), but doesn't collapse "**\/.." when `globstar` is true.
|
|
7
|
+
*
|
|
8
|
+
* @example Usage
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { normalizeGlob } from "normalize_glob.ts";
|
|
11
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
12
|
+
*
|
|
13
|
+
* const normalized = normalizeGlob("**\\foo\\..\\bar", { globstar: true });
|
|
14
|
+
* assertEquals(normalized, "**\\bar");
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param glob The glob pattern to normalize.
|
|
18
|
+
* @param options The options for glob pattern.
|
|
19
|
+
* @returns The normalized glob pattern.
|
|
20
|
+
*/
|
|
21
|
+
export function normalizeGlob(glob, options = {}) {
|
|
22
|
+
const { globstar = false } = options;
|
|
23
|
+
if (glob.match(/\0/g)) {
|
|
24
|
+
throw new Error(`Glob contains invalid characters: "${glob}"`);
|
|
25
|
+
}
|
|
26
|
+
if (!globstar) {
|
|
27
|
+
return normalize(glob);
|
|
28
|
+
}
|
|
29
|
+
const s = SEPARATOR_PATTERN.source;
|
|
30
|
+
const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g");
|
|
31
|
+
return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
|
|
32
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ParsedPath } from "../types.js";
|
|
2
|
+
export type { ParsedPath } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Return a `ParsedPath` object of the `path`.
|
|
5
|
+
*
|
|
6
|
+
* @example Usage
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { parse } from "parse.ts";
|
|
9
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
10
|
+
*
|
|
11
|
+
* const parsed = parse("C:\\foo\\bar\\baz.ext");
|
|
12
|
+
* assertEquals(parsed, {
|
|
13
|
+
* root: "C:\\",
|
|
14
|
+
* dir: "C:\\foo\\bar",
|
|
15
|
+
* base: "baz.ext",
|
|
16
|
+
* ext: ".ext",
|
|
17
|
+
* name: "baz",
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param path The path to parse.
|
|
22
|
+
* @returns The `ParsedPath` object.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parse(path: string): ParsedPath;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { CHAR_COLON, CHAR_DOT } from "../_common/constants.js";
|
|
4
|
+
import { assertPath } from "../_common/assert_path.js";
|
|
5
|
+
import { isPathSeparator, isWindowsDeviceRoot } from "./_util.js";
|
|
6
|
+
/**
|
|
7
|
+
* Return a `ParsedPath` object of the `path`.
|
|
8
|
+
*
|
|
9
|
+
* @example Usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { parse } from "parse.ts";
|
|
12
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
13
|
+
*
|
|
14
|
+
* const parsed = parse("C:\\foo\\bar\\baz.ext");
|
|
15
|
+
* assertEquals(parsed, {
|
|
16
|
+
* root: "C:\\",
|
|
17
|
+
* dir: "C:\\foo\\bar",
|
|
18
|
+
* base: "baz.ext",
|
|
19
|
+
* ext: ".ext",
|
|
20
|
+
* name: "baz",
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param path The path to parse.
|
|
25
|
+
* @returns The `ParsedPath` object.
|
|
26
|
+
*/
|
|
27
|
+
export function parse(path) {
|
|
28
|
+
assertPath(path);
|
|
29
|
+
const ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
30
|
+
const len = path.length;
|
|
31
|
+
if (len === 0)
|
|
32
|
+
return ret;
|
|
33
|
+
let rootEnd = 0;
|
|
34
|
+
let code = path.charCodeAt(0);
|
|
35
|
+
// Try to match a root
|
|
36
|
+
if (len > 1) {
|
|
37
|
+
if (isPathSeparator(code)) {
|
|
38
|
+
// Possible UNC root
|
|
39
|
+
rootEnd = 1;
|
|
40
|
+
if (isPathSeparator(path.charCodeAt(1))) {
|
|
41
|
+
// Matched double path separator at beginning
|
|
42
|
+
let j = 2;
|
|
43
|
+
let last = j;
|
|
44
|
+
// Match 1 or more non-path separators
|
|
45
|
+
for (; j < len; ++j) {
|
|
46
|
+
if (isPathSeparator(path.charCodeAt(j)))
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
if (j < len && j !== last) {
|
|
50
|
+
// Matched!
|
|
51
|
+
last = j;
|
|
52
|
+
// Match 1 or more path separators
|
|
53
|
+
for (; j < len; ++j) {
|
|
54
|
+
if (!isPathSeparator(path.charCodeAt(j)))
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
if (j < len && j !== last) {
|
|
58
|
+
// Matched!
|
|
59
|
+
last = j;
|
|
60
|
+
// Match 1 or more non-path separators
|
|
61
|
+
for (; j < len; ++j) {
|
|
62
|
+
if (isPathSeparator(path.charCodeAt(j)))
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
if (j === len) {
|
|
66
|
+
// We matched a UNC root only
|
|
67
|
+
rootEnd = j;
|
|
68
|
+
}
|
|
69
|
+
else if (j !== last) {
|
|
70
|
+
// We matched a UNC root with leftovers
|
|
71
|
+
rootEnd = j + 1;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else if (isWindowsDeviceRoot(code)) {
|
|
78
|
+
// Possible device root
|
|
79
|
+
if (path.charCodeAt(1) === CHAR_COLON) {
|
|
80
|
+
rootEnd = 2;
|
|
81
|
+
if (len > 2) {
|
|
82
|
+
if (isPathSeparator(path.charCodeAt(2))) {
|
|
83
|
+
if (len === 3) {
|
|
84
|
+
// `path` contains just a drive root, exit early to avoid
|
|
85
|
+
// unnecessary work
|
|
86
|
+
ret.root = ret.dir = path;
|
|
87
|
+
ret.base = "\\";
|
|
88
|
+
return ret;
|
|
89
|
+
}
|
|
90
|
+
rootEnd = 3;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// `path` contains just a relative drive root, exit early to avoid
|
|
95
|
+
// unnecessary work
|
|
96
|
+
ret.root = ret.dir = path;
|
|
97
|
+
return ret;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else if (isPathSeparator(code)) {
|
|
103
|
+
// `path` contains just a path separator, exit early to avoid
|
|
104
|
+
// unnecessary work
|
|
105
|
+
ret.root = ret.dir = path;
|
|
106
|
+
ret.base = "\\";
|
|
107
|
+
return ret;
|
|
108
|
+
}
|
|
109
|
+
if (rootEnd > 0)
|
|
110
|
+
ret.root = path.slice(0, rootEnd);
|
|
111
|
+
let startDot = -1;
|
|
112
|
+
let startPart = rootEnd;
|
|
113
|
+
let end = -1;
|
|
114
|
+
let matchedSlash = true;
|
|
115
|
+
let i = path.length - 1;
|
|
116
|
+
// Track the state of characters (if any) we see before our first dot and
|
|
117
|
+
// after any path separator we find
|
|
118
|
+
let preDotState = 0;
|
|
119
|
+
// Get non-dir info
|
|
120
|
+
for (; i >= rootEnd; --i) {
|
|
121
|
+
code = path.charCodeAt(i);
|
|
122
|
+
if (isPathSeparator(code)) {
|
|
123
|
+
// If we reached a path separator that was not part of a set of path
|
|
124
|
+
// separators at the end of the string, stop now
|
|
125
|
+
if (!matchedSlash) {
|
|
126
|
+
startPart = i + 1;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (end === -1) {
|
|
132
|
+
// We saw the first non-path separator, mark this as the end of our
|
|
133
|
+
// extension
|
|
134
|
+
matchedSlash = false;
|
|
135
|
+
end = i + 1;
|
|
136
|
+
}
|
|
137
|
+
if (code === CHAR_DOT) {
|
|
138
|
+
// If this is our first dot, mark it as the start of our extension
|
|
139
|
+
if (startDot === -1)
|
|
140
|
+
startDot = i;
|
|
141
|
+
else if (preDotState !== 1)
|
|
142
|
+
preDotState = 1;
|
|
143
|
+
}
|
|
144
|
+
else if (startDot !== -1) {
|
|
145
|
+
// We saw a non-dot and non-path separator before our dot, so we should
|
|
146
|
+
// have a good chance at having a non-empty extension
|
|
147
|
+
preDotState = -1;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (startDot === -1 ||
|
|
151
|
+
end === -1 ||
|
|
152
|
+
// We saw a non-dot character immediately before the dot
|
|
153
|
+
preDotState === 0 ||
|
|
154
|
+
// The (right-most) trimmed path component is exactly '..'
|
|
155
|
+
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
|
|
156
|
+
if (end !== -1) {
|
|
157
|
+
ret.base = ret.name = path.slice(startPart, end);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
ret.name = path.slice(startPart, startDot);
|
|
162
|
+
ret.base = path.slice(startPart, end);
|
|
163
|
+
ret.ext = path.slice(startDot, end);
|
|
164
|
+
}
|
|
165
|
+
// Fallback to '\' in case there is no basename
|
|
166
|
+
ret.base = ret.base || "\\";
|
|
167
|
+
// If the directory is the root, use the entire root as the `dir` including
|
|
168
|
+
// the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
|
|
169
|
+
// trailing slash (`C:\abc\def` -> `C:\abc`).
|
|
170
|
+
if (startPart > 0 && startPart !== rootEnd) {
|
|
171
|
+
ret.dir = path.slice(0, startPart - 1);
|
|
172
|
+
}
|
|
173
|
+
else
|
|
174
|
+
ret.dir = ret.root;
|
|
175
|
+
return ret;
|
|
176
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the relative path from `from` to `to` based on current working directory.
|
|
3
|
+
*
|
|
4
|
+
* An example in windws, for instance:
|
|
5
|
+
* from = 'C:\\orandea\\test\\aaa'
|
|
6
|
+
* to = 'C:\\orandea\\impl\\bbb'
|
|
7
|
+
* The output of the function should be: '..\\..\\impl\\bbb'
|
|
8
|
+
*
|
|
9
|
+
* @example Usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { relative } from "relative.ts";
|
|
12
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
13
|
+
*
|
|
14
|
+
* const relativePath = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb");
|
|
15
|
+
* assertEquals(relativePath, "..\\..\\impl\\bbb");
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param from The path from which to calculate the relative path
|
|
19
|
+
* @param to The path to which to calculate the relative path
|
|
20
|
+
* @returns The relative path from `from` to `to`
|
|
21
|
+
*/
|
|
22
|
+
export declare function relative(from: string, to: string): string;
|