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
|
@@ -1,909 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
-
// Copyright the Browserify authors. MIT License.
|
|
3
|
-
// Ported from https://github.com/browserify/path-browserify/
|
|
4
|
-
// This module is browser compatible.
|
|
5
|
-
import * as dntShim from "../../../../_dnt.shims.js";
|
|
6
|
-
import { CHAR_BACKWARD_SLASH, CHAR_COLON, CHAR_DOT, CHAR_QUESTION_MARK, } from "./_constants.js";
|
|
7
|
-
import { _format, assertPath, encodeWhitespace, isPathSeparator, isPosixPathSeparator, isWindowsDeviceRoot, lastPathSegment, normalizeString, stripSuffix, stripTrailingSeparators, } from "./_util.js";
|
|
8
|
-
import { assert } from "../_util/asserts.js";
|
|
9
|
-
export const sep = "\\";
|
|
10
|
-
export const delimiter = ";";
|
|
11
|
-
/**
|
|
12
|
-
* Resolves path segments into a `path`
|
|
13
|
-
* @param pathSegments to process to path
|
|
14
|
-
*/
|
|
15
|
-
export function resolve(...pathSegments) {
|
|
16
|
-
let resolvedDevice = "";
|
|
17
|
-
let resolvedTail = "";
|
|
18
|
-
let resolvedAbsolute = false;
|
|
19
|
-
for (let i = pathSegments.length - 1; i >= -1; i--) {
|
|
20
|
-
let path;
|
|
21
|
-
// deno-lint-ignore no-explicit-any
|
|
22
|
-
const { Deno } = dntShim.dntGlobalThis;
|
|
23
|
-
if (i >= 0) {
|
|
24
|
-
path = pathSegments[i];
|
|
25
|
-
}
|
|
26
|
-
else if (!resolvedDevice) {
|
|
27
|
-
if (typeof Deno?.cwd !== "function") {
|
|
28
|
-
throw new TypeError("Resolved a drive-letter-less path without a CWD.");
|
|
29
|
-
}
|
|
30
|
-
path = Deno.cwd();
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
if (typeof Deno?.env?.get !== "function" || typeof Deno?.cwd !== "function") {
|
|
34
|
-
throw new TypeError("Resolved a relative path without a CWD.");
|
|
35
|
-
}
|
|
36
|
-
path = Deno.cwd();
|
|
37
|
-
// Verify that a cwd was found and that it actually points
|
|
38
|
-
// to our drive. If not, default to the drive's root.
|
|
39
|
-
if (path === undefined ||
|
|
40
|
-
path.slice(0, 3).toLowerCase() !== `${resolvedDevice.toLowerCase()}\\`) {
|
|
41
|
-
path = `${resolvedDevice}\\`;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
assertPath(path);
|
|
45
|
-
const len = path.length;
|
|
46
|
-
// Skip empty entries
|
|
47
|
-
if (len === 0)
|
|
48
|
-
continue;
|
|
49
|
-
let rootEnd = 0;
|
|
50
|
-
let device = "";
|
|
51
|
-
let isAbsolute = false;
|
|
52
|
-
const code = path.charCodeAt(0);
|
|
53
|
-
// Try to match a root
|
|
54
|
-
if (len > 1) {
|
|
55
|
-
if (isPathSeparator(code)) {
|
|
56
|
-
// Possible UNC root
|
|
57
|
-
// If we started with a separator, we know we at least have an
|
|
58
|
-
// absolute path of some kind (UNC or otherwise)
|
|
59
|
-
isAbsolute = true;
|
|
60
|
-
if (isPathSeparator(path.charCodeAt(1))) {
|
|
61
|
-
// Matched double path separator at beginning
|
|
62
|
-
let j = 2;
|
|
63
|
-
let last = j;
|
|
64
|
-
// Match 1 or more non-path separators
|
|
65
|
-
for (; j < len; ++j) {
|
|
66
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
if (j < len && j !== last) {
|
|
70
|
-
const firstPart = path.slice(last, j);
|
|
71
|
-
// Matched!
|
|
72
|
-
last = j;
|
|
73
|
-
// Match 1 or more path separators
|
|
74
|
-
for (; j < len; ++j) {
|
|
75
|
-
if (!isPathSeparator(path.charCodeAt(j)))
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
if (j < len && j !== last) {
|
|
79
|
-
// Matched!
|
|
80
|
-
last = j;
|
|
81
|
-
// Match 1 or more non-path separators
|
|
82
|
-
for (; j < len; ++j) {
|
|
83
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
if (j === len) {
|
|
87
|
-
// We matched a UNC root only
|
|
88
|
-
device = `\\\\${firstPart}\\${path.slice(last)}`;
|
|
89
|
-
rootEnd = j;
|
|
90
|
-
}
|
|
91
|
-
else if (j !== last) {
|
|
92
|
-
// We matched a UNC root with leftovers
|
|
93
|
-
device = `\\\\${firstPart}\\${path.slice(last, j)}`;
|
|
94
|
-
rootEnd = j;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
rootEnd = 1;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else if (isWindowsDeviceRoot(code)) {
|
|
104
|
-
// Possible device root
|
|
105
|
-
if (path.charCodeAt(1) === CHAR_COLON) {
|
|
106
|
-
device = path.slice(0, 2);
|
|
107
|
-
rootEnd = 2;
|
|
108
|
-
if (len > 2) {
|
|
109
|
-
if (isPathSeparator(path.charCodeAt(2))) {
|
|
110
|
-
// Treat separator following drive name as an absolute path
|
|
111
|
-
// indicator
|
|
112
|
-
isAbsolute = true;
|
|
113
|
-
rootEnd = 3;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else if (isPathSeparator(code)) {
|
|
120
|
-
// `path` contains just a path separator
|
|
121
|
-
rootEnd = 1;
|
|
122
|
-
isAbsolute = true;
|
|
123
|
-
}
|
|
124
|
-
if (device.length > 0 &&
|
|
125
|
-
resolvedDevice.length > 0 &&
|
|
126
|
-
device.toLowerCase() !== resolvedDevice.toLowerCase()) {
|
|
127
|
-
// This path points to another device so it is not applicable
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
if (resolvedDevice.length === 0 && device.length > 0) {
|
|
131
|
-
resolvedDevice = device;
|
|
132
|
-
}
|
|
133
|
-
if (!resolvedAbsolute) {
|
|
134
|
-
resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`;
|
|
135
|
-
resolvedAbsolute = isAbsolute;
|
|
136
|
-
}
|
|
137
|
-
if (resolvedAbsolute && resolvedDevice.length > 0)
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
// At this point the path should be resolved to a full absolute path,
|
|
141
|
-
// but handle relative paths to be safe (might happen when process.cwd()
|
|
142
|
-
// fails)
|
|
143
|
-
// Normalize the tail path
|
|
144
|
-
resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, "\\", isPathSeparator);
|
|
145
|
-
return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || ".";
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Normalizes a `path`
|
|
149
|
-
* @param path to normalize
|
|
150
|
-
*/
|
|
151
|
-
export function normalize(path) {
|
|
152
|
-
assertPath(path);
|
|
153
|
-
const len = path.length;
|
|
154
|
-
if (len === 0)
|
|
155
|
-
return ".";
|
|
156
|
-
let rootEnd = 0;
|
|
157
|
-
let device;
|
|
158
|
-
let isAbsolute = false;
|
|
159
|
-
const code = path.charCodeAt(0);
|
|
160
|
-
// Try to match a root
|
|
161
|
-
if (len > 1) {
|
|
162
|
-
if (isPathSeparator(code)) {
|
|
163
|
-
// Possible UNC root
|
|
164
|
-
// If we started with a separator, we know we at least have an absolute
|
|
165
|
-
// path of some kind (UNC or otherwise)
|
|
166
|
-
isAbsolute = true;
|
|
167
|
-
if (isPathSeparator(path.charCodeAt(1))) {
|
|
168
|
-
// Matched double path separator at beginning
|
|
169
|
-
let j = 2;
|
|
170
|
-
let last = j;
|
|
171
|
-
// Match 1 or more non-path separators
|
|
172
|
-
for (; j < len; ++j) {
|
|
173
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
if (j < len && j !== last) {
|
|
177
|
-
const firstPart = path.slice(last, j);
|
|
178
|
-
// Matched!
|
|
179
|
-
last = j;
|
|
180
|
-
// Match 1 or more path separators
|
|
181
|
-
for (; j < len; ++j) {
|
|
182
|
-
if (!isPathSeparator(path.charCodeAt(j)))
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
if (j < len && j !== last) {
|
|
186
|
-
// Matched!
|
|
187
|
-
last = j;
|
|
188
|
-
// Match 1 or more non-path separators
|
|
189
|
-
for (; j < len; ++j) {
|
|
190
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
if (j === len) {
|
|
194
|
-
// We matched a UNC root only
|
|
195
|
-
// Return the normalized version of the UNC root since there
|
|
196
|
-
// is nothing left to process
|
|
197
|
-
return `\\\\${firstPart}\\${path.slice(last)}\\`;
|
|
198
|
-
}
|
|
199
|
-
else if (j !== last) {
|
|
200
|
-
// We matched a UNC root with leftovers
|
|
201
|
-
device = `\\\\${firstPart}\\${path.slice(last, j)}`;
|
|
202
|
-
rootEnd = j;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
rootEnd = 1;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
else if (isWindowsDeviceRoot(code)) {
|
|
212
|
-
// Possible device root
|
|
213
|
-
if (path.charCodeAt(1) === CHAR_COLON) {
|
|
214
|
-
device = path.slice(0, 2);
|
|
215
|
-
rootEnd = 2;
|
|
216
|
-
if (len > 2) {
|
|
217
|
-
if (isPathSeparator(path.charCodeAt(2))) {
|
|
218
|
-
// Treat separator following drive name as an absolute path
|
|
219
|
-
// indicator
|
|
220
|
-
isAbsolute = true;
|
|
221
|
-
rootEnd = 3;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
else if (isPathSeparator(code)) {
|
|
228
|
-
// `path` contains just a path separator, exit early to avoid unnecessary
|
|
229
|
-
// work
|
|
230
|
-
return "\\";
|
|
231
|
-
}
|
|
232
|
-
let tail;
|
|
233
|
-
if (rootEnd < len) {
|
|
234
|
-
tail = normalizeString(path.slice(rootEnd), !isAbsolute, "\\", isPathSeparator);
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
tail = "";
|
|
238
|
-
}
|
|
239
|
-
if (tail.length === 0 && !isAbsolute)
|
|
240
|
-
tail = ".";
|
|
241
|
-
if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {
|
|
242
|
-
tail += "\\";
|
|
243
|
-
}
|
|
244
|
-
if (device === undefined) {
|
|
245
|
-
if (isAbsolute) {
|
|
246
|
-
if (tail.length > 0)
|
|
247
|
-
return `\\${tail}`;
|
|
248
|
-
else
|
|
249
|
-
return "\\";
|
|
250
|
-
}
|
|
251
|
-
else if (tail.length > 0) {
|
|
252
|
-
return tail;
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
return "";
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
else if (isAbsolute) {
|
|
259
|
-
if (tail.length > 0)
|
|
260
|
-
return `${device}\\${tail}`;
|
|
261
|
-
else
|
|
262
|
-
return `${device}\\`;
|
|
263
|
-
}
|
|
264
|
-
else if (tail.length > 0) {
|
|
265
|
-
return device + tail;
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
return device;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Verifies whether path is absolute
|
|
273
|
-
* @param path to verify
|
|
274
|
-
*/
|
|
275
|
-
export function isAbsolute(path) {
|
|
276
|
-
assertPath(path);
|
|
277
|
-
const len = path.length;
|
|
278
|
-
if (len === 0)
|
|
279
|
-
return false;
|
|
280
|
-
const code = path.charCodeAt(0);
|
|
281
|
-
if (isPathSeparator(code)) {
|
|
282
|
-
return true;
|
|
283
|
-
}
|
|
284
|
-
else if (isWindowsDeviceRoot(code)) {
|
|
285
|
-
// Possible device root
|
|
286
|
-
if (len > 2 && path.charCodeAt(1) === CHAR_COLON) {
|
|
287
|
-
if (isPathSeparator(path.charCodeAt(2)))
|
|
288
|
-
return true;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
return false;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Join all given a sequence of `paths`,then normalizes the resulting path.
|
|
295
|
-
* @param paths to be joined and normalized
|
|
296
|
-
*/
|
|
297
|
-
export function join(...paths) {
|
|
298
|
-
const pathsCount = paths.length;
|
|
299
|
-
if (pathsCount === 0)
|
|
300
|
-
return ".";
|
|
301
|
-
let joined;
|
|
302
|
-
let firstPart = null;
|
|
303
|
-
for (let i = 0; i < pathsCount; ++i) {
|
|
304
|
-
const path = paths[i];
|
|
305
|
-
assertPath(path);
|
|
306
|
-
if (path.length > 0) {
|
|
307
|
-
if (joined === undefined)
|
|
308
|
-
joined = firstPart = path;
|
|
309
|
-
else
|
|
310
|
-
joined += `\\${path}`;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
if (joined === undefined)
|
|
314
|
-
return ".";
|
|
315
|
-
// Make sure that the joined path doesn't start with two slashes, because
|
|
316
|
-
// normalize() will mistake it for an UNC path then.
|
|
317
|
-
//
|
|
318
|
-
// This step is skipped when it is very clear that the user actually
|
|
319
|
-
// intended to point at an UNC path. This is assumed when the first
|
|
320
|
-
// non-empty string arguments starts with exactly two slashes followed by
|
|
321
|
-
// at least one more non-slash character.
|
|
322
|
-
//
|
|
323
|
-
// Note that for normalize() to treat a path as an UNC path it needs to
|
|
324
|
-
// have at least 2 components, so we don't filter for that here.
|
|
325
|
-
// This means that the user can use join to construct UNC paths from
|
|
326
|
-
// a server name and a share name; for example:
|
|
327
|
-
// path.join('//server', 'share') -> '\\\\server\\share\\')
|
|
328
|
-
let needsReplace = true;
|
|
329
|
-
let slashCount = 0;
|
|
330
|
-
assert(firstPart != null);
|
|
331
|
-
if (isPathSeparator(firstPart.charCodeAt(0))) {
|
|
332
|
-
++slashCount;
|
|
333
|
-
const firstLen = firstPart.length;
|
|
334
|
-
if (firstLen > 1) {
|
|
335
|
-
if (isPathSeparator(firstPart.charCodeAt(1))) {
|
|
336
|
-
++slashCount;
|
|
337
|
-
if (firstLen > 2) {
|
|
338
|
-
if (isPathSeparator(firstPart.charCodeAt(2)))
|
|
339
|
-
++slashCount;
|
|
340
|
-
else {
|
|
341
|
-
// We matched a UNC path in the first part
|
|
342
|
-
needsReplace = false;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (needsReplace) {
|
|
349
|
-
// Find any more consecutive slashes we need to replace
|
|
350
|
-
for (; slashCount < joined.length; ++slashCount) {
|
|
351
|
-
if (!isPathSeparator(joined.charCodeAt(slashCount)))
|
|
352
|
-
break;
|
|
353
|
-
}
|
|
354
|
-
// Replace the slashes if needed
|
|
355
|
-
if (slashCount >= 2)
|
|
356
|
-
joined = `\\${joined.slice(slashCount)}`;
|
|
357
|
-
}
|
|
358
|
-
return normalize(joined);
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* It will solve the relative path from `from` to `to`, for instance:
|
|
362
|
-
* from = 'C:\\orandea\\test\\aaa'
|
|
363
|
-
* to = 'C:\\orandea\\impl\\bbb'
|
|
364
|
-
* The output of the function should be: '..\\..\\impl\\bbb'
|
|
365
|
-
* @param from relative path
|
|
366
|
-
* @param to relative path
|
|
367
|
-
*/
|
|
368
|
-
export function relative(from, to) {
|
|
369
|
-
assertPath(from);
|
|
370
|
-
assertPath(to);
|
|
371
|
-
if (from === to)
|
|
372
|
-
return "";
|
|
373
|
-
const fromOrig = resolve(from);
|
|
374
|
-
const toOrig = resolve(to);
|
|
375
|
-
if (fromOrig === toOrig)
|
|
376
|
-
return "";
|
|
377
|
-
from = fromOrig.toLowerCase();
|
|
378
|
-
to = toOrig.toLowerCase();
|
|
379
|
-
if (from === to)
|
|
380
|
-
return "";
|
|
381
|
-
// Trim any leading backslashes
|
|
382
|
-
let fromStart = 0;
|
|
383
|
-
let fromEnd = from.length;
|
|
384
|
-
for (; fromStart < fromEnd; ++fromStart) {
|
|
385
|
-
if (from.charCodeAt(fromStart) !== CHAR_BACKWARD_SLASH)
|
|
386
|
-
break;
|
|
387
|
-
}
|
|
388
|
-
// Trim trailing backslashes (applicable to UNC paths only)
|
|
389
|
-
for (; fromEnd - 1 > fromStart; --fromEnd) {
|
|
390
|
-
if (from.charCodeAt(fromEnd - 1) !== CHAR_BACKWARD_SLASH)
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
const fromLen = fromEnd - fromStart;
|
|
394
|
-
// Trim any leading backslashes
|
|
395
|
-
let toStart = 0;
|
|
396
|
-
let toEnd = to.length;
|
|
397
|
-
for (; toStart < toEnd; ++toStart) {
|
|
398
|
-
if (to.charCodeAt(toStart) !== CHAR_BACKWARD_SLASH)
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
401
|
-
// Trim trailing backslashes (applicable to UNC paths only)
|
|
402
|
-
for (; toEnd - 1 > toStart; --toEnd) {
|
|
403
|
-
if (to.charCodeAt(toEnd - 1) !== CHAR_BACKWARD_SLASH)
|
|
404
|
-
break;
|
|
405
|
-
}
|
|
406
|
-
const toLen = toEnd - toStart;
|
|
407
|
-
// Compare paths to find the longest common path from root
|
|
408
|
-
const length = fromLen < toLen ? fromLen : toLen;
|
|
409
|
-
let lastCommonSep = -1;
|
|
410
|
-
let i = 0;
|
|
411
|
-
for (; i <= length; ++i) {
|
|
412
|
-
if (i === length) {
|
|
413
|
-
if (toLen > length) {
|
|
414
|
-
if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {
|
|
415
|
-
// We get here if `from` is the exact base path for `to`.
|
|
416
|
-
// For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz'
|
|
417
|
-
return toOrig.slice(toStart + i + 1);
|
|
418
|
-
}
|
|
419
|
-
else if (i === 2) {
|
|
420
|
-
// We get here if `from` is the device root.
|
|
421
|
-
// For example: from='C:\\'; to='C:\\foo'
|
|
422
|
-
return toOrig.slice(toStart + i);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
if (fromLen > length) {
|
|
426
|
-
if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {
|
|
427
|
-
// We get here if `to` is the exact base path for `from`.
|
|
428
|
-
// For example: from='C:\\foo\\bar'; to='C:\\foo'
|
|
429
|
-
lastCommonSep = i;
|
|
430
|
-
}
|
|
431
|
-
else if (i === 2) {
|
|
432
|
-
// We get here if `to` is the device root.
|
|
433
|
-
// For example: from='C:\\foo\\bar'; to='C:\\'
|
|
434
|
-
lastCommonSep = 3;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
break;
|
|
438
|
-
}
|
|
439
|
-
const fromCode = from.charCodeAt(fromStart + i);
|
|
440
|
-
const toCode = to.charCodeAt(toStart + i);
|
|
441
|
-
if (fromCode !== toCode)
|
|
442
|
-
break;
|
|
443
|
-
else if (fromCode === CHAR_BACKWARD_SLASH)
|
|
444
|
-
lastCommonSep = i;
|
|
445
|
-
}
|
|
446
|
-
// We found a mismatch before the first common path separator was seen, so
|
|
447
|
-
// return the original `to`.
|
|
448
|
-
if (i !== length && lastCommonSep === -1) {
|
|
449
|
-
return toOrig;
|
|
450
|
-
}
|
|
451
|
-
let out = "";
|
|
452
|
-
if (lastCommonSep === -1)
|
|
453
|
-
lastCommonSep = 0;
|
|
454
|
-
// Generate the relative path based on the path difference between `to` and
|
|
455
|
-
// `from`
|
|
456
|
-
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
457
|
-
if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {
|
|
458
|
-
if (out.length === 0)
|
|
459
|
-
out += "..";
|
|
460
|
-
else
|
|
461
|
-
out += "\\..";
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
// Lastly, append the rest of the destination (`to`) path that comes after
|
|
465
|
-
// the common path parts
|
|
466
|
-
if (out.length > 0) {
|
|
467
|
-
return out + toOrig.slice(toStart + lastCommonSep, toEnd);
|
|
468
|
-
}
|
|
469
|
-
else {
|
|
470
|
-
toStart += lastCommonSep;
|
|
471
|
-
if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH)
|
|
472
|
-
++toStart;
|
|
473
|
-
return toOrig.slice(toStart, toEnd);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* Resolves path to a namespace path
|
|
478
|
-
* @param path to resolve to namespace
|
|
479
|
-
*/
|
|
480
|
-
export function toNamespacedPath(path) {
|
|
481
|
-
// Note: this will *probably* throw somewhere.
|
|
482
|
-
if (typeof path !== "string")
|
|
483
|
-
return path;
|
|
484
|
-
if (path.length === 0)
|
|
485
|
-
return "";
|
|
486
|
-
const resolvedPath = resolve(path);
|
|
487
|
-
if (resolvedPath.length >= 3) {
|
|
488
|
-
if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {
|
|
489
|
-
// Possible UNC root
|
|
490
|
-
if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {
|
|
491
|
-
const code = resolvedPath.charCodeAt(2);
|
|
492
|
-
if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {
|
|
493
|
-
// Matched non-long UNC root, convert the path to a long UNC path
|
|
494
|
-
return `\\\\?\\UNC\\${resolvedPath.slice(2)}`;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) {
|
|
499
|
-
// Possible device root
|
|
500
|
-
if (resolvedPath.charCodeAt(1) === CHAR_COLON &&
|
|
501
|
-
resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {
|
|
502
|
-
// Matched device root, convert the path to a long UNC path
|
|
503
|
-
return `\\\\?\\${resolvedPath}`;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
return path;
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Return the directory path of a `path`.
|
|
511
|
-
* @param path - path to extract the directory from.
|
|
512
|
-
*/
|
|
513
|
-
export function dirname(path) {
|
|
514
|
-
assertPath(path);
|
|
515
|
-
const len = path.length;
|
|
516
|
-
if (len === 0)
|
|
517
|
-
return ".";
|
|
518
|
-
let rootEnd = -1;
|
|
519
|
-
let end = -1;
|
|
520
|
-
let matchedSlash = true;
|
|
521
|
-
let offset = 0;
|
|
522
|
-
const code = path.charCodeAt(0);
|
|
523
|
-
// Try to match a root
|
|
524
|
-
if (len > 1) {
|
|
525
|
-
if (isPathSeparator(code)) {
|
|
526
|
-
// Possible UNC root
|
|
527
|
-
rootEnd = offset = 1;
|
|
528
|
-
if (isPathSeparator(path.charCodeAt(1))) {
|
|
529
|
-
// Matched double path separator at beginning
|
|
530
|
-
let j = 2;
|
|
531
|
-
let last = j;
|
|
532
|
-
// Match 1 or more non-path separators
|
|
533
|
-
for (; j < len; ++j) {
|
|
534
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
|
535
|
-
break;
|
|
536
|
-
}
|
|
537
|
-
if (j < len && j !== last) {
|
|
538
|
-
// Matched!
|
|
539
|
-
last = j;
|
|
540
|
-
// Match 1 or more path separators
|
|
541
|
-
for (; j < len; ++j) {
|
|
542
|
-
if (!isPathSeparator(path.charCodeAt(j)))
|
|
543
|
-
break;
|
|
544
|
-
}
|
|
545
|
-
if (j < len && j !== last) {
|
|
546
|
-
// Matched!
|
|
547
|
-
last = j;
|
|
548
|
-
// Match 1 or more non-path separators
|
|
549
|
-
for (; j < len; ++j) {
|
|
550
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
|
551
|
-
break;
|
|
552
|
-
}
|
|
553
|
-
if (j === len) {
|
|
554
|
-
// We matched a UNC root only
|
|
555
|
-
return path;
|
|
556
|
-
}
|
|
557
|
-
if (j !== last) {
|
|
558
|
-
// We matched a UNC root with leftovers
|
|
559
|
-
// Offset by 1 to include the separator after the UNC root to
|
|
560
|
-
// treat it as a "normal root" on top of a (UNC) root
|
|
561
|
-
rootEnd = offset = j + 1;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
else if (isWindowsDeviceRoot(code)) {
|
|
568
|
-
// Possible device root
|
|
569
|
-
if (path.charCodeAt(1) === CHAR_COLON) {
|
|
570
|
-
rootEnd = offset = 2;
|
|
571
|
-
if (len > 2) {
|
|
572
|
-
if (isPathSeparator(path.charCodeAt(2)))
|
|
573
|
-
rootEnd = offset = 3;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
else if (isPathSeparator(code)) {
|
|
579
|
-
// `path` contains just a path separator, exit early to avoid
|
|
580
|
-
// unnecessary work
|
|
581
|
-
return path;
|
|
582
|
-
}
|
|
583
|
-
for (let i = len - 1; i >= offset; --i) {
|
|
584
|
-
if (isPathSeparator(path.charCodeAt(i))) {
|
|
585
|
-
if (!matchedSlash) {
|
|
586
|
-
end = i;
|
|
587
|
-
break;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
// We saw the first non-path separator
|
|
592
|
-
matchedSlash = false;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
if (end === -1) {
|
|
596
|
-
if (rootEnd === -1)
|
|
597
|
-
return ".";
|
|
598
|
-
else
|
|
599
|
-
end = rootEnd;
|
|
600
|
-
}
|
|
601
|
-
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
602
|
-
}
|
|
603
|
-
/**
|
|
604
|
-
* Return the last portion of a `path`.
|
|
605
|
-
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
606
|
-
*
|
|
607
|
-
* @param path - path to extract name from.
|
|
608
|
-
* @param [suffix] - suffix to remove from extracted name.
|
|
609
|
-
*/
|
|
610
|
-
export function basename(path, suffix = "") {
|
|
611
|
-
assertPath(path);
|
|
612
|
-
if (path.length === 0)
|
|
613
|
-
return path;
|
|
614
|
-
if (typeof suffix !== "string") {
|
|
615
|
-
throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
|
|
616
|
-
}
|
|
617
|
-
// Check for a drive letter prefix so as not to mistake the following
|
|
618
|
-
// path separator as an extra separator at the end of the path that can be
|
|
619
|
-
// disregarded
|
|
620
|
-
let start = 0;
|
|
621
|
-
if (path.length >= 2) {
|
|
622
|
-
const drive = path.charCodeAt(0);
|
|
623
|
-
if (isWindowsDeviceRoot(drive)) {
|
|
624
|
-
if (path.charCodeAt(1) === CHAR_COLON)
|
|
625
|
-
start = 2;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
const lastSegment = lastPathSegment(path, isPathSeparator, start);
|
|
629
|
-
const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator);
|
|
630
|
-
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* Return the extension of the `path` with leading period.
|
|
634
|
-
* @param path with extension
|
|
635
|
-
* @returns extension (ex. for `file.ts` returns `.ts`)
|
|
636
|
-
*/
|
|
637
|
-
export function extname(path) {
|
|
638
|
-
assertPath(path);
|
|
639
|
-
let start = 0;
|
|
640
|
-
let startDot = -1;
|
|
641
|
-
let startPart = 0;
|
|
642
|
-
let end = -1;
|
|
643
|
-
let matchedSlash = true;
|
|
644
|
-
// Track the state of characters (if any) we see before our first dot and
|
|
645
|
-
// after any path separator we find
|
|
646
|
-
let preDotState = 0;
|
|
647
|
-
// Check for a drive letter prefix so as not to mistake the following
|
|
648
|
-
// path separator as an extra separator at the end of the path that can be
|
|
649
|
-
// disregarded
|
|
650
|
-
if (path.length >= 2 &&
|
|
651
|
-
path.charCodeAt(1) === CHAR_COLON &&
|
|
652
|
-
isWindowsDeviceRoot(path.charCodeAt(0))) {
|
|
653
|
-
start = startPart = 2;
|
|
654
|
-
}
|
|
655
|
-
for (let i = path.length - 1; i >= start; --i) {
|
|
656
|
-
const code = path.charCodeAt(i);
|
|
657
|
-
if (isPathSeparator(code)) {
|
|
658
|
-
// If we reached a path separator that was not part of a set of path
|
|
659
|
-
// separators at the end of the string, stop now
|
|
660
|
-
if (!matchedSlash) {
|
|
661
|
-
startPart = i + 1;
|
|
662
|
-
break;
|
|
663
|
-
}
|
|
664
|
-
continue;
|
|
665
|
-
}
|
|
666
|
-
if (end === -1) {
|
|
667
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
668
|
-
// extension
|
|
669
|
-
matchedSlash = false;
|
|
670
|
-
end = i + 1;
|
|
671
|
-
}
|
|
672
|
-
if (code === CHAR_DOT) {
|
|
673
|
-
// If this is our first dot, mark it as the start of our extension
|
|
674
|
-
if (startDot === -1)
|
|
675
|
-
startDot = i;
|
|
676
|
-
else if (preDotState !== 1)
|
|
677
|
-
preDotState = 1;
|
|
678
|
-
}
|
|
679
|
-
else if (startDot !== -1) {
|
|
680
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
|
681
|
-
// have a good chance at having a non-empty extension
|
|
682
|
-
preDotState = -1;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
if (startDot === -1 ||
|
|
686
|
-
end === -1 ||
|
|
687
|
-
// We saw a non-dot character immediately before the dot
|
|
688
|
-
preDotState === 0 ||
|
|
689
|
-
// The (right-most) trimmed path component is exactly '..'
|
|
690
|
-
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
|
|
691
|
-
return "";
|
|
692
|
-
}
|
|
693
|
-
return path.slice(startDot, end);
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
* Generate a path from `FormatInputPathObject` object.
|
|
697
|
-
* @param pathObject with path
|
|
698
|
-
*/
|
|
699
|
-
export function format(pathObject) {
|
|
700
|
-
if (pathObject === null || typeof pathObject !== "object") {
|
|
701
|
-
throw new TypeError(`The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`);
|
|
702
|
-
}
|
|
703
|
-
return _format("\\", pathObject);
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* Return a `ParsedPath` object of the `path`.
|
|
707
|
-
* @param path to process
|
|
708
|
-
*/
|
|
709
|
-
export function parse(path) {
|
|
710
|
-
assertPath(path);
|
|
711
|
-
const ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
712
|
-
const len = path.length;
|
|
713
|
-
if (len === 0)
|
|
714
|
-
return ret;
|
|
715
|
-
let rootEnd = 0;
|
|
716
|
-
let code = path.charCodeAt(0);
|
|
717
|
-
// Try to match a root
|
|
718
|
-
if (len > 1) {
|
|
719
|
-
if (isPathSeparator(code)) {
|
|
720
|
-
// Possible UNC root
|
|
721
|
-
rootEnd = 1;
|
|
722
|
-
if (isPathSeparator(path.charCodeAt(1))) {
|
|
723
|
-
// Matched double path separator at beginning
|
|
724
|
-
let j = 2;
|
|
725
|
-
let last = j;
|
|
726
|
-
// Match 1 or more non-path separators
|
|
727
|
-
for (; j < len; ++j) {
|
|
728
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
|
729
|
-
break;
|
|
730
|
-
}
|
|
731
|
-
if (j < len && j !== last) {
|
|
732
|
-
// Matched!
|
|
733
|
-
last = j;
|
|
734
|
-
// Match 1 or more path separators
|
|
735
|
-
for (; j < len; ++j) {
|
|
736
|
-
if (!isPathSeparator(path.charCodeAt(j)))
|
|
737
|
-
break;
|
|
738
|
-
}
|
|
739
|
-
if (j < len && j !== last) {
|
|
740
|
-
// Matched!
|
|
741
|
-
last = j;
|
|
742
|
-
// Match 1 or more non-path separators
|
|
743
|
-
for (; j < len; ++j) {
|
|
744
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
|
745
|
-
break;
|
|
746
|
-
}
|
|
747
|
-
if (j === len) {
|
|
748
|
-
// We matched a UNC root only
|
|
749
|
-
rootEnd = j;
|
|
750
|
-
}
|
|
751
|
-
else if (j !== last) {
|
|
752
|
-
// We matched a UNC root with leftovers
|
|
753
|
-
rootEnd = j + 1;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
else if (isWindowsDeviceRoot(code)) {
|
|
760
|
-
// Possible device root
|
|
761
|
-
if (path.charCodeAt(1) === CHAR_COLON) {
|
|
762
|
-
rootEnd = 2;
|
|
763
|
-
if (len > 2) {
|
|
764
|
-
if (isPathSeparator(path.charCodeAt(2))) {
|
|
765
|
-
if (len === 3) {
|
|
766
|
-
// `path` contains just a drive root, exit early to avoid
|
|
767
|
-
// unnecessary work
|
|
768
|
-
ret.root = ret.dir = path;
|
|
769
|
-
ret.base = "\\";
|
|
770
|
-
return ret;
|
|
771
|
-
}
|
|
772
|
-
rootEnd = 3;
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
else {
|
|
776
|
-
// `path` contains just a relative drive root, exit early to avoid
|
|
777
|
-
// unnecessary work
|
|
778
|
-
ret.root = ret.dir = path;
|
|
779
|
-
return ret;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
else if (isPathSeparator(code)) {
|
|
785
|
-
// `path` contains just a path separator, exit early to avoid
|
|
786
|
-
// unnecessary work
|
|
787
|
-
ret.root = ret.dir = path;
|
|
788
|
-
ret.base = "\\";
|
|
789
|
-
return ret;
|
|
790
|
-
}
|
|
791
|
-
if (rootEnd > 0)
|
|
792
|
-
ret.root = path.slice(0, rootEnd);
|
|
793
|
-
let startDot = -1;
|
|
794
|
-
let startPart = rootEnd;
|
|
795
|
-
let end = -1;
|
|
796
|
-
let matchedSlash = true;
|
|
797
|
-
let i = path.length - 1;
|
|
798
|
-
// Track the state of characters (if any) we see before our first dot and
|
|
799
|
-
// after any path separator we find
|
|
800
|
-
let preDotState = 0;
|
|
801
|
-
// Get non-dir info
|
|
802
|
-
for (; i >= rootEnd; --i) {
|
|
803
|
-
code = path.charCodeAt(i);
|
|
804
|
-
if (isPathSeparator(code)) {
|
|
805
|
-
// If we reached a path separator that was not part of a set of path
|
|
806
|
-
// separators at the end of the string, stop now
|
|
807
|
-
if (!matchedSlash) {
|
|
808
|
-
startPart = i + 1;
|
|
809
|
-
break;
|
|
810
|
-
}
|
|
811
|
-
continue;
|
|
812
|
-
}
|
|
813
|
-
if (end === -1) {
|
|
814
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
815
|
-
// extension
|
|
816
|
-
matchedSlash = false;
|
|
817
|
-
end = i + 1;
|
|
818
|
-
}
|
|
819
|
-
if (code === CHAR_DOT) {
|
|
820
|
-
// If this is our first dot, mark it as the start of our extension
|
|
821
|
-
if (startDot === -1)
|
|
822
|
-
startDot = i;
|
|
823
|
-
else if (preDotState !== 1)
|
|
824
|
-
preDotState = 1;
|
|
825
|
-
}
|
|
826
|
-
else if (startDot !== -1) {
|
|
827
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
|
828
|
-
// have a good chance at having a non-empty extension
|
|
829
|
-
preDotState = -1;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
if (startDot === -1 ||
|
|
833
|
-
end === -1 ||
|
|
834
|
-
// We saw a non-dot character immediately before the dot
|
|
835
|
-
preDotState === 0 ||
|
|
836
|
-
// The (right-most) trimmed path component is exactly '..'
|
|
837
|
-
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
|
|
838
|
-
if (end !== -1) {
|
|
839
|
-
ret.base = ret.name = path.slice(startPart, end);
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
else {
|
|
843
|
-
ret.name = path.slice(startPart, startDot);
|
|
844
|
-
ret.base = path.slice(startPart, end);
|
|
845
|
-
ret.ext = path.slice(startDot, end);
|
|
846
|
-
}
|
|
847
|
-
// Fallback to '\' in case there is no basename
|
|
848
|
-
ret.base = ret.base || "\\";
|
|
849
|
-
// If the directory is the root, use the entire root as the `dir` including
|
|
850
|
-
// the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
|
|
851
|
-
// trailing slash (`C:\abc\def` -> `C:\abc`).
|
|
852
|
-
if (startPart > 0 && startPart !== rootEnd) {
|
|
853
|
-
ret.dir = path.slice(0, startPart - 1);
|
|
854
|
-
}
|
|
855
|
-
else
|
|
856
|
-
ret.dir = ret.root;
|
|
857
|
-
return ret;
|
|
858
|
-
}
|
|
859
|
-
/**
|
|
860
|
-
* Converts a file URL to a path string.
|
|
861
|
-
*
|
|
862
|
-
* ```ts
|
|
863
|
-
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
864
|
-
* fromFileUrl("file:///home/foo"); // "\\home\\foo"
|
|
865
|
-
* fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo"
|
|
866
|
-
* fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo"
|
|
867
|
-
* ```
|
|
868
|
-
* @param url of a file URL
|
|
869
|
-
*/
|
|
870
|
-
export function fromFileUrl(url) {
|
|
871
|
-
url = url instanceof URL ? url : new URL(url);
|
|
872
|
-
if (url.protocol != "file:") {
|
|
873
|
-
throw new TypeError("Must be a file URL.");
|
|
874
|
-
}
|
|
875
|
-
let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
|
|
876
|
-
if (url.hostname != "") {
|
|
877
|
-
// Note: The `URL` implementation guarantees that the drive letter and
|
|
878
|
-
// hostname are mutually exclusive. Otherwise it would not have been valid
|
|
879
|
-
// to append the hostname and path like this.
|
|
880
|
-
path = `\\\\${url.hostname}${path}`;
|
|
881
|
-
}
|
|
882
|
-
return path;
|
|
883
|
-
}
|
|
884
|
-
/**
|
|
885
|
-
* Converts a path string to a file URL.
|
|
886
|
-
*
|
|
887
|
-
* ```ts
|
|
888
|
-
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
889
|
-
* toFileUrl("\\home\\foo"); // new URL("file:///home/foo")
|
|
890
|
-
* toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo")
|
|
891
|
-
* toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file://127.0.0.1/home/foo")
|
|
892
|
-
* ```
|
|
893
|
-
* @param path to convert to file URL
|
|
894
|
-
*/
|
|
895
|
-
export function toFileUrl(path) {
|
|
896
|
-
if (!isAbsolute(path)) {
|
|
897
|
-
throw new TypeError("Must be an absolute path.");
|
|
898
|
-
}
|
|
899
|
-
const [, hostname, pathname] = path.match(/^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/);
|
|
900
|
-
const url = new URL("file:///");
|
|
901
|
-
url.pathname = encodeWhitespace(pathname.replace(/%/g, "%25"));
|
|
902
|
-
if (hostname != null && hostname != "localhost") {
|
|
903
|
-
url.hostname = hostname;
|
|
904
|
-
if (!url.hostname) {
|
|
905
|
-
throw new TypeError("Invalid hostname.");
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
return url;
|
|
909
|
-
}
|