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,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 path = normalizeGlob("foo/bar/../*", { globstar: true });
|
|
14
|
+
* assertEquals(path, "foo/*");
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param glob The glob to normalize.
|
|
18
|
+
* @param options The options to use.
|
|
19
|
+
* @returns The normalized path.
|
|
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 path = parse("/home/user/file.txt");
|
|
12
|
+
* assertEquals(path, {
|
|
13
|
+
* root: "/",
|
|
14
|
+
* dir: "/home/user",
|
|
15
|
+
* base: "file.txt",
|
|
16
|
+
* ext: ".txt",
|
|
17
|
+
* name: "file"
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param path The path to parse.
|
|
22
|
+
* @returns The parsed path object.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parse(path: string): ParsedPath;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { CHAR_DOT } from "../_common/constants.js";
|
|
4
|
+
import { stripTrailingSeparators } from "../_common/strip_trailing_separators.js";
|
|
5
|
+
import { assertPath } from "../_common/assert_path.js";
|
|
6
|
+
import { isPosixPathSeparator } from "./_util.js";
|
|
7
|
+
/**
|
|
8
|
+
* Return a `ParsedPath` object of the `path`.
|
|
9
|
+
*
|
|
10
|
+
* @example Usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { parse } from "parse.ts";
|
|
13
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
14
|
+
*
|
|
15
|
+
* const path = parse("/home/user/file.txt");
|
|
16
|
+
* assertEquals(path, {
|
|
17
|
+
* root: "/",
|
|
18
|
+
* dir: "/home/user",
|
|
19
|
+
* base: "file.txt",
|
|
20
|
+
* ext: ".txt",
|
|
21
|
+
* name: "file"
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param path The path to parse.
|
|
26
|
+
* @returns The parsed path object.
|
|
27
|
+
*/
|
|
28
|
+
export function parse(path) {
|
|
29
|
+
assertPath(path);
|
|
30
|
+
const ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
31
|
+
if (path.length === 0)
|
|
32
|
+
return ret;
|
|
33
|
+
const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
34
|
+
let start;
|
|
35
|
+
if (isAbsolute) {
|
|
36
|
+
ret.root = "/";
|
|
37
|
+
start = 1;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
start = 0;
|
|
41
|
+
}
|
|
42
|
+
let startDot = -1;
|
|
43
|
+
let startPart = 0;
|
|
44
|
+
let end = -1;
|
|
45
|
+
let matchedSlash = true;
|
|
46
|
+
let i = path.length - 1;
|
|
47
|
+
// Track the state of characters (if any) we see before our first dot and
|
|
48
|
+
// after any path separator we find
|
|
49
|
+
let preDotState = 0;
|
|
50
|
+
// Get non-dir info
|
|
51
|
+
for (; i >= start; --i) {
|
|
52
|
+
const code = path.charCodeAt(i);
|
|
53
|
+
if (isPosixPathSeparator(code)) {
|
|
54
|
+
// If we reached a path separator that was not part of a set of path
|
|
55
|
+
// separators at the end of the string, stop now
|
|
56
|
+
if (!matchedSlash) {
|
|
57
|
+
startPart = i + 1;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (end === -1) {
|
|
63
|
+
// We saw the first non-path separator, mark this as the end of our
|
|
64
|
+
// extension
|
|
65
|
+
matchedSlash = false;
|
|
66
|
+
end = i + 1;
|
|
67
|
+
}
|
|
68
|
+
if (code === CHAR_DOT) {
|
|
69
|
+
// If this is our first dot, mark it as the start of our extension
|
|
70
|
+
if (startDot === -1)
|
|
71
|
+
startDot = i;
|
|
72
|
+
else if (preDotState !== 1)
|
|
73
|
+
preDotState = 1;
|
|
74
|
+
}
|
|
75
|
+
else if (startDot !== -1) {
|
|
76
|
+
// We saw a non-dot and non-path separator before our dot, so we should
|
|
77
|
+
// have a good chance at having a non-empty extension
|
|
78
|
+
preDotState = -1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (startDot === -1 ||
|
|
82
|
+
end === -1 ||
|
|
83
|
+
// We saw a non-dot character immediately before the dot
|
|
84
|
+
preDotState === 0 ||
|
|
85
|
+
// The (right-most) trimmed path component is exactly '..'
|
|
86
|
+
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
|
|
87
|
+
if (end !== -1) {
|
|
88
|
+
if (startPart === 0 && isAbsolute) {
|
|
89
|
+
ret.base = ret.name = path.slice(1, end);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
ret.base = ret.name = path.slice(startPart, end);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Fallback to '/' in case there is no basename
|
|
96
|
+
ret.base = ret.base || "/";
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
if (startPart === 0 && isAbsolute) {
|
|
100
|
+
ret.name = path.slice(1, startDot);
|
|
101
|
+
ret.base = path.slice(1, end);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
ret.name = path.slice(startPart, startDot);
|
|
105
|
+
ret.base = path.slice(startPart, end);
|
|
106
|
+
}
|
|
107
|
+
ret.ext = path.slice(startDot, end);
|
|
108
|
+
}
|
|
109
|
+
if (startPart > 0) {
|
|
110
|
+
ret.dir = stripTrailingSeparators(path.slice(0, startPart - 1), isPosixPathSeparator);
|
|
111
|
+
}
|
|
112
|
+
else if (isAbsolute)
|
|
113
|
+
ret.dir = "/";
|
|
114
|
+
return ret;
|
|
115
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the relative path from `from` to `to` based on current working directory.
|
|
3
|
+
*
|
|
4
|
+
* If `from` and `to` are the same, return an empty string.
|
|
5
|
+
*
|
|
6
|
+
* @example Usage
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { relative } from "relative.ts";
|
|
9
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
10
|
+
*
|
|
11
|
+
* const path = relative("/data/orandea/test/aaa", "/data/orandea/impl/bbb");
|
|
12
|
+
* assertEquals(path, "../../impl/bbb");
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param from The path to start from.
|
|
16
|
+
* @param to The path to reach.
|
|
17
|
+
* @returns The relative path.
|
|
18
|
+
*/
|
|
19
|
+
export declare function relative(from: string, to: string): string;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { isPosixPathSeparator } from "./_util.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
|
+
* If `from` and `to` are the same, return an empty string.
|
|
10
|
+
*
|
|
11
|
+
* @example Usage
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { relative } from "relative.ts";
|
|
14
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
15
|
+
*
|
|
16
|
+
* const path = relative("/data/orandea/test/aaa", "/data/orandea/impl/bbb");
|
|
17
|
+
* assertEquals(path, "../../impl/bbb");
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param from The path to start from.
|
|
21
|
+
* @param to The path to reach.
|
|
22
|
+
* @returns The relative path.
|
|
23
|
+
*/
|
|
24
|
+
export function relative(from, to) {
|
|
25
|
+
assertArgs(from, to);
|
|
26
|
+
from = resolve(from);
|
|
27
|
+
to = resolve(to);
|
|
28
|
+
if (from === to)
|
|
29
|
+
return "";
|
|
30
|
+
// Trim any leading backslashes
|
|
31
|
+
let fromStart = 1;
|
|
32
|
+
const fromEnd = from.length;
|
|
33
|
+
for (; fromStart < fromEnd; ++fromStart) {
|
|
34
|
+
if (!isPosixPathSeparator(from.charCodeAt(fromStart)))
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
const fromLen = fromEnd - fromStart;
|
|
38
|
+
// Trim any leading backslashes
|
|
39
|
+
let toStart = 1;
|
|
40
|
+
const toEnd = to.length;
|
|
41
|
+
for (; toStart < toEnd; ++toStart) {
|
|
42
|
+
if (!isPosixPathSeparator(to.charCodeAt(toStart)))
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
const toLen = toEnd - toStart;
|
|
46
|
+
// Compare paths to find the longest common path from root
|
|
47
|
+
const length = fromLen < toLen ? fromLen : toLen;
|
|
48
|
+
let lastCommonSep = -1;
|
|
49
|
+
let i = 0;
|
|
50
|
+
for (; i <= length; ++i) {
|
|
51
|
+
if (i === length) {
|
|
52
|
+
if (toLen > length) {
|
|
53
|
+
if (isPosixPathSeparator(to.charCodeAt(toStart + i))) {
|
|
54
|
+
// We get here if `from` is the exact base path for `to`.
|
|
55
|
+
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
|
56
|
+
return to.slice(toStart + i + 1);
|
|
57
|
+
}
|
|
58
|
+
else if (i === 0) {
|
|
59
|
+
// We get here if `from` is the root
|
|
60
|
+
// For example: from='/'; to='/foo'
|
|
61
|
+
return to.slice(toStart + i);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (fromLen > length) {
|
|
65
|
+
if (isPosixPathSeparator(from.charCodeAt(fromStart + i))) {
|
|
66
|
+
// We get here if `to` is the exact base path for `from`.
|
|
67
|
+
// For example: from='/foo/bar/baz'; to='/foo/bar'
|
|
68
|
+
lastCommonSep = i;
|
|
69
|
+
}
|
|
70
|
+
else if (i === 0) {
|
|
71
|
+
// We get here if `to` is the root.
|
|
72
|
+
// For example: from='/foo'; to='/'
|
|
73
|
+
lastCommonSep = 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
const fromCode = from.charCodeAt(fromStart + i);
|
|
79
|
+
const toCode = to.charCodeAt(toStart + i);
|
|
80
|
+
if (fromCode !== toCode)
|
|
81
|
+
break;
|
|
82
|
+
else if (isPosixPathSeparator(fromCode))
|
|
83
|
+
lastCommonSep = i;
|
|
84
|
+
}
|
|
85
|
+
let out = "";
|
|
86
|
+
// Generate the relative path based on the path difference between `to`
|
|
87
|
+
// and `from`
|
|
88
|
+
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
89
|
+
if (i === fromEnd || isPosixPathSeparator(from.charCodeAt(i))) {
|
|
90
|
+
if (out.length === 0)
|
|
91
|
+
out += "..";
|
|
92
|
+
else
|
|
93
|
+
out += "/..";
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Lastly, append the rest of the destination (`to`) path that comes after
|
|
97
|
+
// the common path parts
|
|
98
|
+
if (out.length > 0)
|
|
99
|
+
return out + to.slice(toStart + lastCommonSep);
|
|
100
|
+
else {
|
|
101
|
+
toStart += lastCommonSep;
|
|
102
|
+
if (isPosixPathSeparator(to.charCodeAt(toStart)))
|
|
103
|
+
++toStart;
|
|
104
|
+
return to.slice(toStart);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -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 path = resolve("/foo", "bar", "baz/asdf", "quux", "..");
|
|
10
|
+
* assertEquals(path, "/foo/bar/baz/asdf");
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param pathSegments The path segments to resolve.
|
|
14
|
+
* @returns The resolved path.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolve(...pathSegments: string[]): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { normalizeString } from "../_common/normalize_string.js";
|
|
5
|
+
import { assertPath } from "../_common/assert_path.js";
|
|
6
|
+
import { isPosixPathSeparator } from "./_util.js";
|
|
7
|
+
/**
|
|
8
|
+
* Resolves path segments into a `path`.
|
|
9
|
+
*
|
|
10
|
+
* @example Usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { resolve } from "resolve.ts";
|
|
13
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
14
|
+
*
|
|
15
|
+
* const path = resolve("/foo", "bar", "baz/asdf", "quux", "..");
|
|
16
|
+
* assertEquals(path, "/foo/bar/baz/asdf");
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param pathSegments The path segments to resolve.
|
|
20
|
+
* @returns The resolved path.
|
|
21
|
+
*/
|
|
22
|
+
export function resolve(...pathSegments) {
|
|
23
|
+
let resolvedPath = "";
|
|
24
|
+
let resolvedAbsolute = false;
|
|
25
|
+
for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
26
|
+
let path;
|
|
27
|
+
if (i >= 0)
|
|
28
|
+
path = pathSegments[i];
|
|
29
|
+
else {
|
|
30
|
+
// deno-lint-ignore no-explicit-any
|
|
31
|
+
const { Deno } = dntShim.dntGlobalThis;
|
|
32
|
+
if (typeof Deno?.cwd !== "function") {
|
|
33
|
+
throw new TypeError("Resolved a relative path without a current working directory (CWD)");
|
|
34
|
+
}
|
|
35
|
+
path = Deno.cwd();
|
|
36
|
+
}
|
|
37
|
+
assertPath(path);
|
|
38
|
+
// Skip empty entries
|
|
39
|
+
if (path.length === 0) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
43
|
+
resolvedAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
44
|
+
}
|
|
45
|
+
// At this point the path should be resolved to a full absolute path, but
|
|
46
|
+
// handle relative paths to be safe (might happen when Deno.cwd() fails)
|
|
47
|
+
// Normalize the path
|
|
48
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator);
|
|
49
|
+
if (resolvedAbsolute) {
|
|
50
|
+
if (resolvedPath.length > 0)
|
|
51
|
+
return `/${resolvedPath}`;
|
|
52
|
+
else
|
|
53
|
+
return "/";
|
|
54
|
+
}
|
|
55
|
+
else if (resolvedPath.length > 0)
|
|
56
|
+
return resolvedPath;
|
|
57
|
+
else
|
|
58
|
+
return ".";
|
|
59
|
+
}
|
|
@@ -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("/home/foo bar"), new URL("file:///home/foo%20bar"));
|
|
12
|
+
* ```
|
|
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,27 @@
|
|
|
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("/home/foo bar"), new URL("file:///home/foo%20bar"));
|
|
15
|
+
* ```
|
|
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 url = new URL("file:///");
|
|
25
|
+
url.pathname = encodeWhitespace(path.replace(/%/g, "%25").replace(/\\/g, "%5C"));
|
|
26
|
+
return url;
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a path to a namespaced path. This function returns the path as is on posix.
|
|
3
|
+
*
|
|
4
|
+
* @example Usage
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { toNamespacedPath } from "to_namespaced_path.ts";
|
|
7
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
8
|
+
*
|
|
9
|
+
* assertEquals(toNamespacedPath("/home/foo"), "/home/foo");
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @param path The path.
|
|
13
|
+
* @returns The namespaced path.
|
|
14
|
+
*/
|
|
15
|
+
export declare function toNamespacedPath(path: string): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
/**
|
|
4
|
+
* Converts a path to a namespaced path. This function returns the path as is on posix.
|
|
5
|
+
*
|
|
6
|
+
* @example Usage
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { toNamespacedPath } from "to_namespaced_path.ts";
|
|
9
|
+
* import { assertEquals } from "../../assert/mod.ts";
|
|
10
|
+
*
|
|
11
|
+
* assertEquals(toNamespacedPath("/home/foo"), "/home/foo");
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param path The path.
|
|
15
|
+
* @returns The namespaced path.
|
|
16
|
+
*/
|
|
17
|
+
export function toNamespacedPath(path) {
|
|
18
|
+
// Non-op on posix systems
|
|
19
|
+
return path;
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the relative path from `from` to `to` based on current working
|
|
3
|
+
* directory.
|
|
4
|
+
*
|
|
5
|
+
* @example Usage
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { relative } from "relative.ts";
|
|
8
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
9
|
+
*
|
|
10
|
+
* if (Deno.build.os === "windows") {
|
|
11
|
+
* const path = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb");
|
|
12
|
+
* assertEquals(path, "..\\..\\impl\\bbb");
|
|
13
|
+
* } else {
|
|
14
|
+
* const path = relative("/data/foobar/test/aaa", "/data/foobar/impl/bbb");
|
|
15
|
+
* assertEquals(path, "../../impl/bbb");
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param from Path in current working directory.
|
|
20
|
+
* @param to Path in current working directory.
|
|
21
|
+
* @returns The relative path from `from` to `to`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function relative(from: string, to: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { isWindows } from "./_os.js";
|
|
4
|
+
import { relative as posixRelative } from "./posix/relative.js";
|
|
5
|
+
import { relative as windowsRelative } from "./windows/relative.js";
|
|
6
|
+
/**
|
|
7
|
+
* Return the relative path from `from` to `to` based on current working
|
|
8
|
+
* directory.
|
|
9
|
+
*
|
|
10
|
+
* @example Usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { relative } from "relative.ts";
|
|
13
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
14
|
+
*
|
|
15
|
+
* if (Deno.build.os === "windows") {
|
|
16
|
+
* const path = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb");
|
|
17
|
+
* assertEquals(path, "..\\..\\impl\\bbb");
|
|
18
|
+
* } else {
|
|
19
|
+
* const path = relative("/data/foobar/test/aaa", "/data/foobar/impl/bbb");
|
|
20
|
+
* assertEquals(path, "../../impl/bbb");
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param from Path in current working directory.
|
|
25
|
+
* @param to Path in current working directory.
|
|
26
|
+
* @returns The relative path from `from` to `to`.
|
|
27
|
+
*/
|
|
28
|
+
export function relative(from, to) {
|
|
29
|
+
return isWindows ? windowsRelative(from, to) : posixRelative(from, to);
|
|
30
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
* if (Deno.build.os === "windows") {
|
|
10
|
+
* assertEquals(resolve("C:\\foo", "bar", "baz"), "C:\\foo\\bar\\baz");
|
|
11
|
+
* assertEquals(resolve("C:\\foo", "C:\\bar", "baz"), "C:\\bar\\baz");
|
|
12
|
+
* } else {
|
|
13
|
+
* assertEquals(resolve("/foo", "bar", "baz"), "/foo/bar/baz");
|
|
14
|
+
* assertEquals(resolve("/foo", "/bar", "baz"), "/bar/baz");
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param pathSegments Path segments to process to path.
|
|
19
|
+
* @returns The resolved path.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolve(...pathSegments: string[]): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { isWindows } from "./_os.js";
|
|
4
|
+
import { resolve as posixResolve } from "./posix/resolve.js";
|
|
5
|
+
import { resolve as windowsResolve } from "./windows/resolve.js";
|
|
6
|
+
/**
|
|
7
|
+
* Resolves path segments into a path.
|
|
8
|
+
*
|
|
9
|
+
* @example Usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { resolve } from "resolve.ts";
|
|
12
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
13
|
+
*
|
|
14
|
+
* if (Deno.build.os === "windows") {
|
|
15
|
+
* assertEquals(resolve("C:\\foo", "bar", "baz"), "C:\\foo\\bar\\baz");
|
|
16
|
+
* assertEquals(resolve("C:\\foo", "C:\\bar", "baz"), "C:\\bar\\baz");
|
|
17
|
+
* } else {
|
|
18
|
+
* assertEquals(resolve("/foo", "bar", "baz"), "/foo/bar/baz");
|
|
19
|
+
* assertEquals(resolve("/foo", "/bar", "baz"), "/bar/baz");
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param pathSegments Path segments to process to path.
|
|
24
|
+
* @returns The resolved path.
|
|
25
|
+
*/
|
|
26
|
+
export function resolve(...pathSegments) {
|
|
27
|
+
return isWindows
|
|
28
|
+
? windowsResolve(...pathSegments)
|
|
29
|
+
: posixResolve(...pathSegments);
|
|
30
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
* if (Deno.build.os === "windows") {
|
|
11
|
+
* assertEquals(toFileUrl("\\home\\foo"), new URL("file:///home/foo"));
|
|
12
|
+
* assertEquals(toFileUrl("C:\\Users\\foo"), new URL("file:///C:/Users/foo"));
|
|
13
|
+
* assertEquals(toFileUrl("\\\\127.0.0.1\\home\\foo"), new URL("file://127.0.0.1/home/foo"));
|
|
14
|
+
* } else {
|
|
15
|
+
* assertEquals(toFileUrl("/home/foo"), new URL("file:///home/foo"));
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param path Path to convert to file URL.
|
|
20
|
+
* @returns The file URL equivalent to the path.
|
|
21
|
+
*/
|
|
22
|
+
export declare function toFileUrl(path: string): URL;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { isWindows } from "./_os.js";
|
|
4
|
+
import { toFileUrl as posixToFileUrl } from "./posix/to_file_url.js";
|
|
5
|
+
import { toFileUrl as windowsToFileUrl } from "./windows/to_file_url.js";
|
|
6
|
+
/**
|
|
7
|
+
* Converts a path string to a file URL.
|
|
8
|
+
*
|
|
9
|
+
* @example Usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { toFileUrl } from "to_file_url.ts";
|
|
12
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
13
|
+
*
|
|
14
|
+
* if (Deno.build.os === "windows") {
|
|
15
|
+
* assertEquals(toFileUrl("\\home\\foo"), new URL("file:///home/foo"));
|
|
16
|
+
* assertEquals(toFileUrl("C:\\Users\\foo"), new URL("file:///C:/Users/foo"));
|
|
17
|
+
* assertEquals(toFileUrl("\\\\127.0.0.1\\home\\foo"), new URL("file://127.0.0.1/home/foo"));
|
|
18
|
+
* } else {
|
|
19
|
+
* assertEquals(toFileUrl("/home/foo"), new URL("file:///home/foo"));
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param path Path to convert to file URL.
|
|
24
|
+
* @returns The file URL equivalent to the path.
|
|
25
|
+
*/
|
|
26
|
+
export function toFileUrl(path) {
|
|
27
|
+
return isWindows ? windowsToFileUrl(path) : posixToFileUrl(path);
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves path to a namespace path. This is a no-op on
|
|
3
|
+
* non-windows systems.
|
|
4
|
+
*
|
|
5
|
+
* @example Usage
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { toNamespacedPath } from "to_namespaced_path.ts";
|
|
8
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
9
|
+
*
|
|
10
|
+
* if (Deno.build.os === "windows") {
|
|
11
|
+
* assertEquals(toNamespacedPath("C:\\foo\\bar"), "\\\\?\\C:\\foo\\bar");
|
|
12
|
+
* } else {
|
|
13
|
+
* assertEquals(toNamespacedPath("/foo/bar"), "/foo/bar");
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param path Path to resolve to namespace.
|
|
18
|
+
* @returns The resolved namespace path.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toNamespacedPath(path: string): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { isWindows } from "./_os.js";
|
|
4
|
+
import { toNamespacedPath as posixToNamespacedPath } from "./posix/to_namespaced_path.js";
|
|
5
|
+
import { toNamespacedPath as windowsToNamespacedPath } from "./windows/to_namespaced_path.js";
|
|
6
|
+
/**
|
|
7
|
+
* Resolves path to a namespace path. This is a no-op on
|
|
8
|
+
* non-windows systems.
|
|
9
|
+
*
|
|
10
|
+
* @example Usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { toNamespacedPath } from "to_namespaced_path.ts";
|
|
13
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
14
|
+
*
|
|
15
|
+
* if (Deno.build.os === "windows") {
|
|
16
|
+
* assertEquals(toNamespacedPath("C:\\foo\\bar"), "\\\\?\\C:\\foo\\bar");
|
|
17
|
+
* } else {
|
|
18
|
+
* assertEquals(toNamespacedPath("/foo/bar"), "/foo/bar");
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @param path Path to resolve to namespace.
|
|
23
|
+
* @returns The resolved namespace path.
|
|
24
|
+
*/
|
|
25
|
+
export function toNamespacedPath(path) {
|
|
26
|
+
return isWindows
|
|
27
|
+
? windowsToNamespacedPath(path)
|
|
28
|
+
: posixToNamespacedPath(path);
|
|
29
|
+
}
|