keep-a-changelog 2.5.3 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -1
- package/README.md +15 -14
- package/esm/keep-a-changelog/bin.d.ts +2 -0
- package/esm/{bin.js → keep-a-changelog/bin.js} +85 -13
- package/esm/{mod.d.ts → keep-a-changelog/mod.d.ts} +1 -1
- package/esm/{mod.js → keep-a-changelog/mod.js} +1 -1
- package/esm/keep-a-changelog/test/changelog.azdo.md +24 -0
- package/esm/keep-a-changelog/test/changelog.sort.md +17 -0
- package/esm/std/cli/parse_args.d.ts +193 -0
- package/esm/std/cli/parse_args.js +357 -0
- package/esm/std/ini/_ini_map.d.ts +90 -0
- package/esm/std/ini/_ini_map.js +371 -0
- package/esm/std/ini/mod.d.ts +31 -0
- package/esm/std/ini/mod.js +33 -0
- package/esm/std/ini/parse.d.ts +77 -0
- package/esm/std/ini/parse.js +72 -0
- package/esm/std/ini/stringify.d.ts +83 -0
- package/esm/std/ini/stringify.js +66 -0
- package/esm/std/path/_common/assert_path.d.ts +1 -0
- package/esm/std/path/_common/assert_path.js +7 -0
- package/esm/std/path/_common/basename.d.ts +3 -0
- package/esm/std/path/_common/basename.js +40 -0
- package/esm/std/path/_common/common.d.ts +1 -0
- package/esm/std/path/_common/common.js +23 -0
- package/esm/{deps/deno.land/std@0.189.0/path/_constants.js → std/path/_common/constants.js} +1 -1
- package/esm/std/path/_common/dirname.d.ts +1 -0
- package/esm/std/path/_common/dirname.js +8 -0
- package/esm/std/path/_common/format.d.ts +3 -0
- package/esm/std/path/_common/format.js +19 -0
- package/esm/std/path/_common/from_file_url.d.ts +2 -0
- package/esm/std/path/_common/from_file_url.js +9 -0
- package/esm/std/path/_common/glob_to_reg_exp.d.ts +34 -0
- package/esm/std/path/_common/glob_to_reg_exp.js +234 -0
- package/esm/std/path/_common/normalize.d.ts +1 -0
- package/esm/std/path/_common/normalize.js +8 -0
- package/esm/std/path/_common/normalize_string.d.ts +1 -0
- package/esm/std/path/_common/normalize_string.js +77 -0
- package/esm/std/path/_common/relative.d.ts +1 -0
- package/esm/std/path/_common/relative.js +9 -0
- package/esm/std/path/_common/strip_trailing_separators.d.ts +1 -0
- package/esm/std/path/_common/strip_trailing_separators.js +19 -0
- package/esm/std/path/_common/to_file_url.d.ts +1 -0
- package/esm/std/path/_common/to_file_url.js +15 -0
- package/esm/std/path/_os.d.ts +1 -0
- package/esm/std/path/_os.js +9 -0
- package/esm/std/path/basename.d.ts +27 -0
- package/esm/std/path/basename.js +36 -0
- package/esm/std/path/common.d.ts +27 -0
- package/esm/std/path/common.js +33 -0
- package/esm/std/path/constants.d.ts +14 -0
- package/esm/std/path/constants.js +17 -0
- package/esm/std/path/dirname.d.ts +22 -0
- package/esm/std/path/dirname.js +29 -0
- package/esm/std/path/extname.d.ts +22 -0
- package/esm/std/path/extname.js +29 -0
- package/esm/std/path/format.d.ts +21 -0
- package/esm/std/path/format.js +27 -0
- package/esm/std/path/from_file_url.d.ts +22 -0
- package/esm/std/path/from_file_url.js +28 -0
- package/esm/std/path/glob_to_regexp.d.ts +76 -0
- package/esm/std/path/glob_to_regexp.js +83 -0
- package/esm/std/path/is_absolute.d.ts +21 -0
- package/esm/std/path/is_absolute.js +28 -0
- package/esm/std/path/is_glob.d.ts +16 -0
- package/esm/std/path/is_glob.js +42 -0
- package/esm/std/path/join.d.ts +22 -0
- package/esm/std/path/join.js +29 -0
- package/esm/std/path/join_globs.d.ts +27 -0
- package/esm/std/path/join_globs.js +34 -0
- package/esm/std/path/mod.d.ts +53 -0
- package/esm/std/path/mod.js +57 -0
- package/esm/std/path/normalize.d.ts +26 -0
- package/esm/std/path/normalize.js +33 -0
- package/esm/std/path/normalize_glob.d.ts +28 -0
- package/esm/std/path/normalize_glob.js +35 -0
- package/esm/std/path/parse.d.ts +34 -0
- package/esm/std/path/parse.js +39 -0
- package/esm/std/path/posix/_util.d.ts +1 -0
- package/esm/std/path/posix/_util.js +8 -0
- package/esm/std/path/posix/basename.d.ts +39 -0
- package/esm/std/path/posix/basename.js +49 -0
- package/esm/std/path/posix/constants.d.ts +12 -0
- package/esm/std/path/posix/constants.js +14 -0
- package/esm/std/path/posix/dirname.d.ts +31 -0
- package/esm/std/path/posix/dirname.js +62 -0
- package/esm/std/path/posix/extname.d.ts +36 -0
- package/esm/std/path/posix/extname.js +89 -0
- package/esm/std/path/posix/format.d.ts +23 -0
- package/esm/std/path/posix/format.js +28 -0
- package/esm/std/path/posix/from_file_url.d.ts +16 -0
- package/esm/std/path/posix/from_file_url.js +21 -0
- package/esm/std/path/posix/glob_to_regexp.d.ts +71 -0
- package/{script/deps/deno.land/std@0.189.0/path/glob.d.ts → esm/std/path/posix/glob_to_regexp.js} +28 -29
- package/esm/std/path/posix/is_absolute.d.ts +16 -0
- package/esm/std/path/posix/is_absolute.js +23 -0
- package/esm/std/path/posix/join.d.ts +32 -0
- package/esm/std/path/posix/join.js +42 -0
- package/esm/std/path/posix/join_globs.d.ts +19 -0
- package/esm/std/path/posix/join_globs.js +40 -0
- package/esm/std/path/posix/normalize.d.ts +39 -0
- package/esm/std/path/posix/normalize.js +57 -0
- package/esm/std/path/posix/normalize_glob.d.ts +19 -0
- package/esm/std/path/posix/normalize_glob.js +32 -0
- package/esm/std/path/posix/parse.d.ts +24 -0
- package/esm/std/path/posix/parse.js +115 -0
- package/esm/std/path/posix/relative.d.ts +19 -0
- package/esm/std/path/posix/relative.js +106 -0
- package/esm/std/path/posix/resolve.d.ts +16 -0
- package/esm/std/path/posix/resolve.js +59 -0
- package/esm/std/path/posix/to_file_url.d.ts +17 -0
- package/esm/std/path/posix/to_file_url.js +27 -0
- package/esm/std/path/posix/to_namespaced_path.d.ts +15 -0
- package/esm/std/path/posix/to_namespaced_path.js +20 -0
- package/esm/std/path/relative.d.ts +23 -0
- package/esm/std/path/relative.js +30 -0
- package/esm/std/path/resolve.d.ts +21 -0
- package/esm/std/path/resolve.js +30 -0
- package/esm/std/path/to_file_url.d.ts +22 -0
- package/esm/std/path/to_file_url.js +28 -0
- package/esm/std/path/to_namespaced_path.d.ts +20 -0
- package/esm/std/path/to_namespaced_path.js +29 -0
- package/esm/{deps/deno.land/std@0.189.0/path/_interface.d.ts → std/path/types.d.ts} +13 -2
- package/esm/std/path/types.js +3 -0
- package/esm/std/path/windows/_util.d.ts +3 -0
- package/esm/std/path/windows/_util.js +15 -0
- package/esm/std/path/windows/basename.d.ts +22 -0
- package/esm/std/path/windows/basename.js +44 -0
- package/esm/std/path/windows/constants.d.ts +12 -0
- package/esm/std/path/windows/constants.js +14 -0
- package/esm/std/path/windows/dirname.d.ts +19 -0
- package/esm/std/path/windows/dirname.js +112 -0
- package/esm/std/path/windows/extname.d.ts +19 -0
- package/esm/std/path/windows/extname.js +81 -0
- package/esm/std/path/windows/format.d.ts +23 -0
- package/esm/std/path/windows/format.js +28 -0
- package/esm/std/path/windows/from_file_url.d.ts +18 -0
- package/esm/std/path/windows/from_file_url.js +30 -0
- package/esm/std/path/windows/glob_to_regexp.d.ts +70 -0
- package/esm/{deps/deno.land/std@0.189.0/path/glob.d.ts → std/path/windows/glob_to_regexp.js} +28 -29
- package/esm/std/path/windows/is_absolute.d.ts +16 -0
- package/esm/std/path/windows/is_absolute.js +38 -0
- package/esm/std/path/windows/join.d.ts +19 -0
- package/esm/std/path/windows/join.js +74 -0
- package/esm/std/path/windows/join_globs.d.ts +20 -0
- package/esm/std/path/windows/join_globs.js +41 -0
- package/esm/std/path/windows/normalize.d.ts +21 -0
- package/esm/std/path/windows/normalize.js +134 -0
- package/esm/std/path/windows/normalize_glob.d.ts +19 -0
- package/esm/std/path/windows/normalize_glob.js +32 -0
- package/esm/std/path/windows/parse.d.ts +24 -0
- package/esm/std/path/windows/parse.js +176 -0
- package/esm/std/path/windows/relative.d.ts +22 -0
- package/esm/std/path/windows/relative.js +131 -0
- package/esm/std/path/windows/resolve.d.ts +16 -0
- package/esm/std/path/windows/resolve.js +154 -0
- package/esm/std/path/windows/to_file_url.d.ts +17 -0
- package/esm/std/path/windows/to_file_url.js +34 -0
- package/esm/std/path/windows/to_namespaced_path.d.ts +16 -0
- package/esm/std/path/windows/to_namespaced_path.js +49 -0
- package/esm/std/semver/_constants.d.ts +15 -0
- package/esm/std/semver/_constants.js +38 -0
- package/esm/std/semver/_shared.d.ts +43 -0
- package/esm/std/semver/_shared.js +162 -0
- package/esm/std/semver/_test_comparator_set.d.ts +2 -0
- package/esm/std/semver/_test_comparator_set.js +58 -0
- package/esm/std/semver/can_parse.d.ts +16 -0
- package/esm/std/semver/can_parse.js +27 -0
- package/esm/std/semver/compare.d.ts +27 -0
- package/esm/std/semver/compare.js +35 -0
- package/esm/std/semver/difference.d.ts +26 -0
- package/esm/std/semver/difference.js +41 -0
- package/esm/std/semver/equals.d.ts +23 -0
- package/esm/std/semver/equals.js +27 -0
- package/esm/std/semver/format.d.ts +21 -0
- package/esm/std/semver/format.js +32 -0
- package/esm/std/semver/format_range.d.ts +17 -0
- package/esm/std/semver/format_range.js +27 -0
- package/esm/std/semver/greater_or_equal.d.ts +24 -0
- package/esm/std/semver/greater_or_equal.js +26 -0
- package/esm/std/semver/greater_than.d.ts +24 -0
- package/esm/std/semver/greater_than.js +28 -0
- package/esm/std/semver/greater_than_range.d.ts +22 -0
- package/esm/std/semver/greater_than_range.js +58 -0
- package/{script/deps/deno.land/std@0.205.0 → esm/std}/semver/increment.d.ts +27 -5
- package/esm/std/semver/increment.js +176 -0
- package/esm/std/semver/is_range.d.ts +22 -0
- package/esm/std/semver/is_range.js +38 -0
- package/{script/deps/deno.land/std@0.205.0 → esm/std}/semver/is_semver.d.ts +16 -0
- package/esm/{deps/deno.land/std@0.205.0 → std}/semver/is_semver.js +25 -13
- package/esm/std/semver/less_or_equal.d.ts +24 -0
- package/esm/std/semver/less_or_equal.js +26 -0
- package/esm/std/semver/less_than.d.ts +24 -0
- package/esm/std/semver/less_than.js +26 -0
- package/esm/std/semver/less_than_range.d.ts +22 -0
- package/esm/std/semver/less_than_range.js +58 -0
- package/esm/std/semver/max_satisfying.d.ts +21 -0
- package/esm/std/semver/max_satisfying.js +30 -0
- package/esm/std/semver/min_satisfying.d.ts +21 -0
- package/esm/std/semver/min_satisfying.js +30 -0
- package/{script/deps/deno.land/std@0.205.0 → esm/std}/semver/mod.d.ts +72 -85
- package/esm/{deps/deno.land/std@0.205.0 → std}/semver/mod.js +73 -86
- package/esm/std/semver/not_equals.d.ts +23 -0
- package/esm/std/semver/not_equals.js +25 -0
- package/esm/std/semver/parse.d.ts +24 -0
- package/esm/std/semver/parse.js +44 -0
- package/esm/std/semver/parse_range.d.ts +26 -0
- package/esm/std/semver/parse_range.js +358 -0
- package/esm/std/semver/range_intersects.d.ts +24 -0
- package/esm/std/semver/range_intersects.js +89 -0
- package/esm/std/semver/satisfies.d.ts +23 -0
- package/esm/std/semver/satisfies.js +26 -0
- package/esm/std/semver/try_parse.d.ts +20 -0
- package/esm/std/semver/try_parse.js +27 -0
- package/esm/std/semver/try_parse_range.d.ts +22 -0
- package/esm/std/semver/try_parse_range.js +33 -0
- package/esm/std/semver/types.d.ts +57 -0
- package/esm/std/semver/types.js +3 -0
- package/package.json +14 -13
- package/script/keep-a-changelog/bin.d.ts +2 -0
- package/script/{bin.js → keep-a-changelog/bin.js} +86 -14
- package/script/{mod.d.ts → keep-a-changelog/mod.d.ts} +1 -1
- package/script/{mod.js → keep-a-changelog/mod.js} +1 -1
- package/script/keep-a-changelog/test/changelog.azdo.md +24 -0
- package/script/keep-a-changelog/test/changelog.sort.md +17 -0
- package/script/std/cli/parse_args.d.ts +193 -0
- package/script/std/cli/parse_args.js +361 -0
- package/script/std/ini/_ini_map.d.ts +90 -0
- package/script/std/ini/_ini_map.js +375 -0
- package/script/std/ini/mod.d.ts +31 -0
- package/script/std/ini/mod.js +49 -0
- package/script/std/ini/parse.d.ts +77 -0
- package/script/std/ini/parse.js +76 -0
- package/script/std/ini/stringify.d.ts +83 -0
- package/script/std/ini/stringify.js +70 -0
- package/script/std/path/_common/assert_path.d.ts +1 -0
- package/script/std/path/_common/assert_path.js +11 -0
- package/script/std/path/_common/basename.d.ts +3 -0
- package/script/std/path/_common/basename.js +46 -0
- package/script/std/path/_common/common.d.ts +1 -0
- package/script/std/path/_common/common.js +27 -0
- package/script/{deps/deno.land/std@0.189.0/path/_constants.js → std/path/_common/constants.js} +1 -1
- package/script/std/path/_common/dirname.d.ts +1 -0
- package/script/std/path/_common/dirname.js +12 -0
- package/script/std/path/_common/format.d.ts +3 -0
- package/script/std/path/_common/format.js +24 -0
- package/script/std/path/_common/from_file_url.d.ts +2 -0
- package/script/std/path/_common/from_file_url.js +13 -0
- package/script/std/path/_common/glob_to_reg_exp.d.ts +34 -0
- package/script/std/path/_common/glob_to_reg_exp.js +238 -0
- package/script/std/path/_common/normalize.d.ts +1 -0
- package/script/std/path/_common/normalize.js +12 -0
- package/script/std/path/_common/normalize_string.d.ts +1 -0
- package/script/std/path/_common/normalize_string.js +81 -0
- package/script/std/path/_common/relative.d.ts +1 -0
- package/script/std/path/_common/relative.js +13 -0
- package/script/std/path/_common/strip_trailing_separators.d.ts +1 -0
- package/script/std/path/_common/strip_trailing_separators.js +23 -0
- package/script/std/path/_common/to_file_url.d.ts +1 -0
- package/script/std/path/_common/to_file_url.js +19 -0
- package/script/std/path/_os.d.ts +1 -0
- package/script/{deps/deno.land/std@0.189.0/_util/os.js → std/path/_os.js} +10 -19
- package/script/std/path/basename.d.ts +27 -0
- package/script/std/path/basename.js +40 -0
- package/script/std/path/common.d.ts +27 -0
- package/script/std/path/common.js +37 -0
- package/script/std/path/constants.d.ts +14 -0
- package/script/std/path/constants.js +20 -0
- package/script/std/path/dirname.d.ts +22 -0
- package/script/std/path/dirname.js +33 -0
- package/script/std/path/extname.d.ts +22 -0
- package/script/std/path/extname.js +33 -0
- package/script/std/path/format.d.ts +21 -0
- package/script/std/path/format.js +31 -0
- package/script/std/path/from_file_url.d.ts +22 -0
- package/script/std/path/from_file_url.js +32 -0
- package/script/std/path/glob_to_regexp.d.ts +76 -0
- package/script/std/path/glob_to_regexp.js +87 -0
- package/script/std/path/is_absolute.d.ts +21 -0
- package/script/std/path/is_absolute.js +32 -0
- package/script/std/path/is_glob.d.ts +16 -0
- package/script/std/path/is_glob.js +46 -0
- package/script/std/path/join.d.ts +22 -0
- package/script/std/path/join.js +33 -0
- package/script/std/path/join_globs.d.ts +27 -0
- package/script/std/path/join_globs.js +38 -0
- package/script/std/path/mod.d.ts +53 -0
- package/script/std/path/mod.js +73 -0
- package/script/std/path/normalize.d.ts +26 -0
- package/script/std/path/normalize.js +37 -0
- package/script/std/path/normalize_glob.d.ts +28 -0
- package/script/std/path/normalize_glob.js +39 -0
- package/script/std/path/parse.d.ts +34 -0
- package/script/std/path/parse.js +43 -0
- package/script/std/path/posix/_util.d.ts +1 -0
- package/script/std/path/posix/_util.js +12 -0
- package/script/std/path/posix/basename.d.ts +39 -0
- package/script/std/path/posix/basename.js +53 -0
- package/script/std/path/posix/constants.d.ts +12 -0
- package/script/std/path/posix/constants.js +17 -0
- package/script/std/path/posix/dirname.d.ts +31 -0
- package/script/std/path/posix/dirname.js +66 -0
- package/script/std/path/posix/extname.d.ts +36 -0
- package/script/std/path/posix/extname.js +93 -0
- package/script/std/path/posix/format.d.ts +23 -0
- package/script/std/path/posix/format.js +32 -0
- package/script/std/path/posix/from_file_url.d.ts +16 -0
- package/script/std/path/posix/from_file_url.js +25 -0
- package/script/std/path/posix/glob_to_regexp.d.ts +71 -0
- package/script/std/path/posix/glob_to_regexp.js +86 -0
- package/script/std/path/posix/is_absolute.d.ts +16 -0
- package/script/std/path/posix/is_absolute.js +27 -0
- package/script/std/path/posix/join.d.ts +32 -0
- package/script/std/path/posix/join.js +46 -0
- package/script/std/path/posix/join_globs.d.ts +19 -0
- package/script/std/path/posix/join_globs.js +44 -0
- package/script/std/path/posix/normalize.d.ts +39 -0
- package/script/std/path/posix/normalize.js +61 -0
- package/script/std/path/posix/normalize_glob.d.ts +19 -0
- package/script/std/path/posix/normalize_glob.js +36 -0
- package/script/std/path/posix/parse.d.ts +24 -0
- package/script/std/path/posix/parse.js +119 -0
- package/script/std/path/posix/relative.d.ts +19 -0
- package/script/std/path/posix/relative.js +110 -0
- package/script/std/path/posix/resolve.d.ts +16 -0
- package/script/std/path/posix/resolve.js +86 -0
- package/script/std/path/posix/to_file_url.d.ts +17 -0
- package/script/std/path/posix/to_file_url.js +31 -0
- package/script/std/path/posix/to_namespaced_path.d.ts +15 -0
- package/script/std/path/posix/to_namespaced_path.js +24 -0
- package/script/std/path/relative.d.ts +23 -0
- package/script/std/path/relative.js +34 -0
- package/script/std/path/resolve.d.ts +21 -0
- package/script/std/path/resolve.js +34 -0
- package/script/std/path/to_file_url.d.ts +22 -0
- package/script/std/path/to_file_url.js +32 -0
- package/script/std/path/to_namespaced_path.d.ts +20 -0
- package/script/std/path/to_namespaced_path.js +33 -0
- package/script/{deps/deno.land/std@0.189.0/path/_interface.d.ts → std/path/types.d.ts} +13 -2
- package/script/{deps/deno.land/std@0.189.0/path/_interface.js → std/path/types.js} +1 -1
- package/script/std/path/windows/_util.d.ts +3 -0
- package/script/std/path/windows/_util.js +21 -0
- package/script/std/path/windows/basename.d.ts +22 -0
- package/script/std/path/windows/basename.js +48 -0
- package/script/std/path/windows/constants.d.ts +12 -0
- package/script/std/path/windows/constants.js +17 -0
- package/script/std/path/windows/dirname.d.ts +19 -0
- package/script/std/path/windows/dirname.js +116 -0
- package/script/std/path/windows/extname.d.ts +19 -0
- package/script/std/path/windows/extname.js +85 -0
- package/script/std/path/windows/format.d.ts +23 -0
- package/script/std/path/windows/format.js +32 -0
- package/script/std/path/windows/from_file_url.d.ts +18 -0
- package/script/std/path/windows/from_file_url.js +34 -0
- package/script/std/path/windows/glob_to_regexp.d.ts +70 -0
- package/script/std/path/windows/glob_to_regexp.js +86 -0
- package/script/std/path/windows/is_absolute.d.ts +16 -0
- package/script/std/path/windows/is_absolute.js +42 -0
- package/script/std/path/windows/join.d.ts +19 -0
- package/script/std/path/windows/join.js +78 -0
- package/script/std/path/windows/join_globs.d.ts +20 -0
- package/script/std/path/windows/join_globs.js +45 -0
- package/script/std/path/windows/normalize.d.ts +21 -0
- package/script/std/path/windows/normalize.js +138 -0
- package/script/std/path/windows/normalize_glob.d.ts +19 -0
- package/script/std/path/windows/normalize_glob.js +36 -0
- package/script/std/path/windows/parse.d.ts +24 -0
- package/script/std/path/windows/parse.js +180 -0
- package/script/std/path/windows/relative.d.ts +22 -0
- package/script/std/path/windows/relative.js +135 -0
- package/script/std/path/windows/resolve.d.ts +16 -0
- package/script/std/path/windows/resolve.js +181 -0
- package/script/std/path/windows/to_file_url.d.ts +17 -0
- package/script/std/path/windows/to_file_url.js +38 -0
- package/script/std/path/windows/to_namespaced_path.d.ts +16 -0
- package/script/std/path/windows/to_namespaced_path.js +53 -0
- package/script/std/semver/_constants.d.ts +15 -0
- package/script/std/semver/_constants.js +41 -0
- package/script/std/semver/_shared.d.ts +43 -0
- package/script/std/semver/_shared.js +174 -0
- package/script/std/semver/_test_comparator_set.d.ts +2 -0
- package/script/std/semver/_test_comparator_set.js +62 -0
- package/script/std/semver/can_parse.d.ts +16 -0
- package/script/std/semver/can_parse.js +31 -0
- package/script/std/semver/compare.d.ts +27 -0
- package/script/std/semver/compare.js +39 -0
- package/script/std/semver/difference.d.ts +26 -0
- package/script/std/semver/difference.js +45 -0
- package/script/std/semver/equals.d.ts +23 -0
- package/script/std/semver/equals.js +31 -0
- package/script/std/semver/format.d.ts +21 -0
- package/script/std/semver/format.js +36 -0
- package/script/std/semver/format_range.d.ts +17 -0
- package/script/std/semver/format_range.js +31 -0
- package/script/std/semver/greater_or_equal.d.ts +24 -0
- package/script/std/semver/greater_or_equal.js +30 -0
- package/script/std/semver/greater_than.d.ts +24 -0
- package/script/std/semver/greater_than.js +32 -0
- package/script/std/semver/greater_than_range.d.ts +22 -0
- package/script/std/semver/greater_than_range.js +62 -0
- package/{esm/deps/deno.land/std@0.205.0 → script/std}/semver/increment.d.ts +27 -5
- package/script/std/semver/increment.js +180 -0
- package/script/std/semver/is_range.d.ts +22 -0
- package/script/std/semver/is_range.js +42 -0
- package/{esm/deps/deno.land/std@0.205.0 → script/std}/semver/is_semver.d.ts +16 -0
- package/script/{deps/deno.land/std@0.205.0 → std}/semver/is_semver.js +26 -14
- package/script/std/semver/less_or_equal.d.ts +24 -0
- package/script/std/semver/less_or_equal.js +30 -0
- package/script/std/semver/less_than.d.ts +24 -0
- package/script/std/semver/less_than.js +30 -0
- package/script/std/semver/less_than_range.d.ts +22 -0
- package/script/std/semver/less_than_range.js +62 -0
- package/script/std/semver/max_satisfying.d.ts +21 -0
- package/script/std/semver/max_satisfying.js +34 -0
- package/script/std/semver/min_satisfying.d.ts +21 -0
- package/script/std/semver/min_satisfying.js +34 -0
- package/{esm/deps/deno.land/std@0.205.0 → script/std}/semver/mod.d.ts +72 -85
- package/script/{deps/deno.land/std@0.205.0 → std}/semver/mod.js +73 -87
- package/script/std/semver/not_equals.d.ts +23 -0
- package/script/std/semver/not_equals.js +29 -0
- package/script/std/semver/parse.d.ts +24 -0
- package/script/std/semver/parse.js +48 -0
- package/script/std/semver/parse_range.d.ts +26 -0
- package/script/std/semver/parse_range.js +362 -0
- package/script/std/semver/range_intersects.d.ts +24 -0
- package/script/std/semver/range_intersects.js +93 -0
- package/script/std/semver/satisfies.d.ts +23 -0
- package/script/std/semver/satisfies.js +30 -0
- package/script/std/semver/try_parse.d.ts +20 -0
- package/script/std/semver/try_parse.js +31 -0
- package/script/std/semver/try_parse_range.d.ts +22 -0
- package/script/std/semver/try_parse_range.js +37 -0
- package/script/std/semver/types.d.ts +57 -0
- package/script/std/semver/types.js +4 -0
- package/esm/bin.d.ts +0 -2
- package/esm/deps/deno.land/std@0.189.0/_util/asserts.d.ts +0 -10
- package/esm/deps/deno.land/std@0.189.0/_util/asserts.js +0 -21
- package/esm/deps/deno.land/std@0.189.0/_util/os.d.ts +0 -4
- package/esm/deps/deno.land/std@0.189.0/_util/os.js +0 -18
- package/esm/deps/deno.land/std@0.189.0/flags/mod.d.ts +0 -166
- package/esm/deps/deno.land/std@0.189.0/flags/mod.js +0 -365
- package/esm/deps/deno.land/std@0.189.0/path/_interface.js +0 -3
- package/esm/deps/deno.land/std@0.189.0/path/_util.d.ts +0 -11
- package/esm/deps/deno.land/std@0.189.0/path/_util.js +0 -161
- package/esm/deps/deno.land/std@0.189.0/path/common.d.ts +0 -13
- package/esm/deps/deno.land/std@0.189.0/path/common.js +0 -36
- package/esm/deps/deno.land/std@0.189.0/path/glob.js +0 -361
- package/esm/deps/deno.land/std@0.189.0/path/mod.d.ts +0 -11
- package/esm/deps/deno.land/std@0.189.0/path/mod.js +0 -35
- package/esm/deps/deno.land/std@0.189.0/path/posix.d.ts +0 -86
- package/esm/deps/deno.land/std@0.189.0/path/posix.js +0 -442
- package/esm/deps/deno.land/std@0.189.0/path/separator.d.ts +0 -2
- package/esm/deps/deno.land/std@0.189.0/path/separator.js +0 -5
- package/esm/deps/deno.land/std@0.189.0/path/win32.d.ts +0 -91
- package/esm/deps/deno.land/std@0.189.0/path/win32.js +0 -909
- package/esm/deps/deno.land/std@0.205.0/semver/_shared.d.ts +0 -42
- package/esm/deps/deno.land/std@0.205.0/semver/_shared.js +0 -230
- package/esm/deps/deno.land/std@0.205.0/semver/cmp.d.ts +0 -9
- package/esm/deps/deno.land/std@0.205.0/semver/cmp.js +0 -35
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_format.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_format.js +0 -11
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_intersects.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_intersects.js +0 -45
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_max.d.ts +0 -9
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_max.js +0 -45
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_min.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/comparator_min.js +0 -32
- package/esm/deps/deno.land/std@0.205.0/semver/compare.d.ts +0 -10
- package/esm/deps/deno.land/std@0.205.0/semver/compare.js +0 -18
- package/esm/deps/deno.land/std@0.205.0/semver/compare_build.d.ts +0 -13
- package/esm/deps/deno.land/std@0.205.0/semver/compare_build.js +0 -23
- package/esm/deps/deno.land/std@0.205.0/semver/constants.d.ts +0 -42
- package/esm/deps/deno.land/std@0.205.0/semver/constants.js +0 -75
- package/esm/deps/deno.land/std@0.205.0/semver/difference.d.ts +0 -4
- package/esm/deps/deno.land/std@0.205.0/semver/difference.js +0 -26
- package/esm/deps/deno.land/std@0.205.0/semver/eq.d.ts +0 -4
- package/esm/deps/deno.land/std@0.205.0/semver/eq.js +0 -7
- package/esm/deps/deno.land/std@0.205.0/semver/format.d.ts +0 -12
- package/esm/deps/deno.land/std@0.205.0/semver/format.js +0 -54
- package/esm/deps/deno.land/std@0.205.0/semver/gt.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/gt.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/gte.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/gte.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/gtr.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/gtr.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/increment.js +0 -207
- package/esm/deps/deno.land/std@0.205.0/semver/is_semver_comparator.d.ts +0 -12
- package/esm/deps/deno.land/std@0.205.0/semver/is_semver_comparator.js +0 -31
- package/esm/deps/deno.land/std@0.205.0/semver/is_semver_range.d.ts +0 -12
- package/esm/deps/deno.land/std@0.205.0/semver/is_semver_range.js +0 -22
- package/esm/deps/deno.land/std@0.205.0/semver/lt.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/lt.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/lte.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/lte.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/ltr.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/ltr.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/max_satisfying.d.ts +0 -9
- package/esm/deps/deno.land/std@0.205.0/semver/max_satisfying.js +0 -14
- package/esm/deps/deno.land/std@0.205.0/semver/min_satisfying.d.ts +0 -9
- package/esm/deps/deno.land/std@0.205.0/semver/min_satisfying.js +0 -14
- package/esm/deps/deno.land/std@0.205.0/semver/neq.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/neq.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/outside.d.ts +0 -11
- package/esm/deps/deno.land/std@0.205.0/semver/outside.js +0 -67
- package/esm/deps/deno.land/std@0.205.0/semver/parse.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/parse.js +0 -66
- package/esm/deps/deno.land/std@0.205.0/semver/parse_comparator.d.ts +0 -7
- package/esm/deps/deno.land/std@0.205.0/semver/parse_comparator.js +0 -28
- package/esm/deps/deno.land/std@0.205.0/semver/parse_range.d.ts +0 -7
- package/esm/deps/deno.land/std@0.205.0/semver/parse_range.js +0 -292
- package/esm/deps/deno.land/std@0.205.0/semver/range_format.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/range_format.js +0 -11
- package/esm/deps/deno.land/std@0.205.0/semver/range_intersects.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/range_intersects.js +0 -35
- package/esm/deps/deno.land/std@0.205.0/semver/range_max.d.ts +0 -7
- package/esm/deps/deno.land/std@0.205.0/semver/range_max.js +0 -15
- package/esm/deps/deno.land/std@0.205.0/semver/range_min.d.ts +0 -7
- package/esm/deps/deno.land/std@0.205.0/semver/range_min.js +0 -14
- package/esm/deps/deno.land/std@0.205.0/semver/rcompare.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/rcompare.js +0 -10
- package/esm/deps/deno.land/std@0.205.0/semver/rsort.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/rsort.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/sort.d.ts +0 -3
- package/esm/deps/deno.land/std@0.205.0/semver/sort.js +0 -5
- package/esm/deps/deno.land/std@0.205.0/semver/test_comparator.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/test_comparator.js +0 -10
- package/esm/deps/deno.land/std@0.205.0/semver/test_range.d.ts +0 -8
- package/esm/deps/deno.land/std@0.205.0/semver/test_range.js +0 -16
- package/esm/deps/deno.land/std@0.205.0/semver/types.d.ts +0 -44
- package/esm/deps/deno.land/std@0.205.0/semver/types.js +0 -2
- package/esm/deps/deno.land/std@0.51.0/fs/eol.d.ts +0 -12
- package/esm/deps/deno.land/std@0.51.0/fs/eol.js +0 -29
- package/esm/deps/deno.land/x/ini@v2.1.0/ini.d.ts +0 -53
- package/esm/deps/deno.land/x/ini@v2.1.0/ini.js +0 -226
- package/esm/deps/deno.land/x/ini@v2.1.0/mod.d.ts +0 -1
- package/esm/deps/deno.land/x/ini@v2.1.0/mod.js +0 -1
- package/esm/src/Change.d.ts +0 -8
- package/esm/src/Change.js +0 -48
- package/esm/src/Changelog.d.ts +0 -23
- package/esm/src/Changelog.js +0 -183
- package/esm/src/Release.d.ts +0 -28
- package/esm/src/Release.js +0 -220
- package/esm/src/deps.d.ts +0 -2
- package/esm/src/deps.js +0 -1
- package/esm/src/parser.d.ts +0 -11
- package/esm/src/parser.js +0 -178
- package/esm/src/settings.d.ts +0 -17
- package/esm/src/settings.js +0 -47
- package/script/bin.d.ts +0 -2
- package/script/deps/deno.land/std@0.189.0/_util/asserts.d.ts +0 -10
- package/script/deps/deno.land/std@0.189.0/_util/asserts.js +0 -27
- package/script/deps/deno.land/std@0.189.0/_util/os.d.ts +0 -4
- package/script/deps/deno.land/std@0.189.0/flags/mod.d.ts +0 -166
- package/script/deps/deno.land/std@0.189.0/flags/mod.js +0 -369
- package/script/deps/deno.land/std@0.189.0/path/_util.d.ts +0 -11
- package/script/deps/deno.land/std@0.189.0/path/_util.js +0 -174
- package/script/deps/deno.land/std@0.189.0/path/common.d.ts +0 -13
- package/script/deps/deno.land/std@0.189.0/path/common.js +0 -40
- package/script/deps/deno.land/std@0.189.0/path/glob.js +0 -391
- package/script/deps/deno.land/std@0.189.0/path/mod.d.ts +0 -11
- package/script/deps/deno.land/std@0.189.0/path/mod.js +0 -66
- package/script/deps/deno.land/std@0.189.0/path/posix.d.ts +0 -86
- package/script/deps/deno.land/std@0.189.0/path/posix.js +0 -481
- package/script/deps/deno.land/std@0.189.0/path/separator.d.ts +0 -2
- package/script/deps/deno.land/std@0.189.0/path/separator.js +0 -8
- package/script/deps/deno.land/std@0.189.0/path/win32.d.ts +0 -91
- package/script/deps/deno.land/std@0.189.0/path/win32.js +0 -948
- package/script/deps/deno.land/std@0.205.0/semver/_shared.d.ts +0 -42
- package/script/deps/deno.land/std@0.205.0/semver/_shared.js +0 -248
- package/script/deps/deno.land/std@0.205.0/semver/cmp.d.ts +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/cmp.js +0 -39
- package/script/deps/deno.land/std@0.205.0/semver/comparator_format.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/comparator_format.js +0 -15
- package/script/deps/deno.land/std@0.205.0/semver/comparator_intersects.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/comparator_intersects.js +0 -49
- package/script/deps/deno.land/std@0.205.0/semver/comparator_max.d.ts +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/comparator_max.js +0 -49
- package/script/deps/deno.land/std@0.205.0/semver/comparator_min.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/comparator_min.js +0 -36
- package/script/deps/deno.land/std@0.205.0/semver/compare.d.ts +0 -10
- package/script/deps/deno.land/std@0.205.0/semver/compare.js +0 -22
- package/script/deps/deno.land/std@0.205.0/semver/compare_build.d.ts +0 -13
- package/script/deps/deno.land/std@0.205.0/semver/compare_build.js +0 -27
- package/script/deps/deno.land/std@0.205.0/semver/constants.d.ts +0 -42
- package/script/deps/deno.land/std@0.205.0/semver/constants.js +0 -78
- package/script/deps/deno.land/std@0.205.0/semver/difference.d.ts +0 -4
- package/script/deps/deno.land/std@0.205.0/semver/difference.js +0 -30
- package/script/deps/deno.land/std@0.205.0/semver/eq.d.ts +0 -4
- package/script/deps/deno.land/std@0.205.0/semver/eq.js +0 -11
- package/script/deps/deno.land/std@0.205.0/semver/format.d.ts +0 -12
- package/script/deps/deno.land/std@0.205.0/semver/format.js +0 -58
- package/script/deps/deno.land/std@0.205.0/semver/gt.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/gt.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/gte.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/gte.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/gtr.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/gtr.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/increment.js +0 -211
- package/script/deps/deno.land/std@0.205.0/semver/is_semver_comparator.d.ts +0 -12
- package/script/deps/deno.land/std@0.205.0/semver/is_semver_comparator.js +0 -35
- package/script/deps/deno.land/std@0.205.0/semver/is_semver_range.d.ts +0 -12
- package/script/deps/deno.land/std@0.205.0/semver/is_semver_range.js +0 -26
- package/script/deps/deno.land/std@0.205.0/semver/lt.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/lt.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/lte.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/lte.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/ltr.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/ltr.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/max_satisfying.d.ts +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/max_satisfying.js +0 -18
- package/script/deps/deno.land/std@0.205.0/semver/min_satisfying.d.ts +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/min_satisfying.js +0 -18
- package/script/deps/deno.land/std@0.205.0/semver/neq.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/neq.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/outside.d.ts +0 -11
- package/script/deps/deno.land/std@0.205.0/semver/outside.js +0 -71
- package/script/deps/deno.land/std@0.205.0/semver/parse.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/parse.js +0 -70
- package/script/deps/deno.land/std@0.205.0/semver/parse_comparator.d.ts +0 -7
- package/script/deps/deno.land/std@0.205.0/semver/parse_comparator.js +0 -32
- package/script/deps/deno.land/std@0.205.0/semver/parse_range.d.ts +0 -7
- package/script/deps/deno.land/std@0.205.0/semver/parse_range.js +0 -296
- package/script/deps/deno.land/std@0.205.0/semver/range_format.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/range_format.js +0 -15
- package/script/deps/deno.land/std@0.205.0/semver/range_intersects.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/range_intersects.js +0 -39
- package/script/deps/deno.land/std@0.205.0/semver/range_max.d.ts +0 -7
- package/script/deps/deno.land/std@0.205.0/semver/range_max.js +0 -19
- package/script/deps/deno.land/std@0.205.0/semver/range_min.d.ts +0 -7
- package/script/deps/deno.land/std@0.205.0/semver/range_min.js +0 -18
- package/script/deps/deno.land/std@0.205.0/semver/rcompare.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/rcompare.js +0 -14
- package/script/deps/deno.land/std@0.205.0/semver/rsort.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/rsort.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/sort.d.ts +0 -3
- package/script/deps/deno.land/std@0.205.0/semver/sort.js +0 -9
- package/script/deps/deno.land/std@0.205.0/semver/test_comparator.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/test_comparator.js +0 -14
- package/script/deps/deno.land/std@0.205.0/semver/test_range.d.ts +0 -8
- package/script/deps/deno.land/std@0.205.0/semver/test_range.js +0 -20
- package/script/deps/deno.land/std@0.205.0/semver/types.d.ts +0 -44
- package/script/deps/deno.land/std@0.205.0/semver/types.js +0 -3
- package/script/deps/deno.land/std@0.51.0/fs/eol.d.ts +0 -12
- package/script/deps/deno.land/std@0.51.0/fs/eol.js +0 -34
- package/script/deps/deno.land/x/ini@v2.1.0/ini.d.ts +0 -53
- package/script/deps/deno.land/x/ini@v2.1.0/ini.js +0 -256
- package/script/deps/deno.land/x/ini@v2.1.0/mod.d.ts +0 -1
- package/script/deps/deno.land/x/ini@v2.1.0/mod.js +0 -17
- package/script/src/Change.d.ts +0 -8
- package/script/src/Change.js +0 -51
- package/script/src/Changelog.d.ts +0 -23
- package/script/src/Changelog.js +0 -186
- package/script/src/Release.d.ts +0 -28
- package/script/src/Release.js +0 -226
- package/script/src/deps.d.ts +0 -2
- package/script/src/deps.js +0 -8
- package/script/src/parser.d.ts +0 -11
- package/script/src/parser.js +0 -184
- package/script/src/settings.d.ts +0 -17
- package/script/src/settings.js +0 -51
- /package/esm/{test → keep-a-changelog/test}/changelog.custom.type.md +0 -0
- /package/esm/{test → keep-a-changelog/test}/changelog.expected.linted.md +0 -0
- /package/esm/{test → keep-a-changelog/test}/changelog.expected.md +0 -0
- /package/esm/{test → keep-a-changelog/test}/changelog.gitlab.md +0 -0
- /package/esm/{test → keep-a-changelog/test}/changelog.md +0 -0
- /package/esm/{test → keep-a-changelog/test}/empty.expected.md +0 -0
- /package/esm/{deps/deno.land/std@0.189.0/path/_constants.d.ts → std/path/_common/constants.d.ts} +0 -0
- /package/script/{test → keep-a-changelog/test}/changelog.custom.type.md +0 -0
- /package/script/{test → keep-a-changelog/test}/changelog.expected.linted.md +0 -0
- /package/script/{test → keep-a-changelog/test}/changelog.expected.md +0 -0
- /package/script/{test → keep-a-changelog/test}/changelog.gitlab.md +0 -0
- /package/script/{test → keep-a-changelog/test}/changelog.md +0 -0
- /package/script/{test → keep-a-changelog/test}/empty.expected.md +0 -0
- /package/script/{deps/deno.land/std@0.189.0/path/_constants.d.ts → std/path/_common/constants.d.ts} +0 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
6
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
9
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
10
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
11
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
12
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
13
|
+
};
|
|
14
|
+
var _IniMap_instances, _IniMap_global, _IniMap_sections, _IniMap_lines, _IniMap_formatting, _IniMap_getOrCreateSection, _IniMap_appendValue, _IniMap_appendOrDeleteLine, _IniMap_readTextLines, _IniMap_cleanFormatting;
|
|
15
|
+
const ASSIGNMENT_MARK = "=";
|
|
16
|
+
function trimQuotes(value) {
|
|
17
|
+
if (value.startsWith('"') && value.endsWith('"')) {
|
|
18
|
+
return value.slice(1, -1);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
const NON_WHITESPACE_REGEXP = /\S/;
|
|
23
|
+
/**
|
|
24
|
+
* Class implementation for fine control of INI data structures.
|
|
25
|
+
*/
|
|
26
|
+
// deno-lint-ignore no-explicit-any
|
|
27
|
+
export class IniMap {
|
|
28
|
+
/** Constructs a new `IniMap`.
|
|
29
|
+
*
|
|
30
|
+
* @param formatting Optional formatting options when printing an INI file.
|
|
31
|
+
*/
|
|
32
|
+
constructor(formatting) {
|
|
33
|
+
_IniMap_instances.add(this);
|
|
34
|
+
_IniMap_global.set(this, new Map());
|
|
35
|
+
_IniMap_sections.set(this, new Map());
|
|
36
|
+
_IniMap_lines.set(this, []);
|
|
37
|
+
_IniMap_formatting.set(this, void 0);
|
|
38
|
+
__classPrivateFieldSet(this, _IniMap_formatting, __classPrivateFieldGet(this, _IniMap_instances, "m", _IniMap_cleanFormatting).call(this, formatting), "f");
|
|
39
|
+
}
|
|
40
|
+
// deno-lint-ignore no-explicit-any
|
|
41
|
+
set(keyOrSection, valueOrKey, value) {
|
|
42
|
+
if (typeof valueOrKey === "string" && value !== undefined) {
|
|
43
|
+
const section = __classPrivateFieldGet(this, _IniMap_instances, "m", _IniMap_getOrCreateSection).call(this, keyOrSection);
|
|
44
|
+
const exists = section.map.get(valueOrKey);
|
|
45
|
+
if (exists) {
|
|
46
|
+
exists.val = value;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
section.end += 1;
|
|
50
|
+
const lineValue = {
|
|
51
|
+
type: "value",
|
|
52
|
+
num: section.end,
|
|
53
|
+
sec: section.sec,
|
|
54
|
+
key: valueOrKey,
|
|
55
|
+
val: value,
|
|
56
|
+
};
|
|
57
|
+
__classPrivateFieldGet(this, _IniMap_instances, "m", _IniMap_appendValue).call(this, lineValue);
|
|
58
|
+
section.map.set(valueOrKey, lineValue);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const lineValue = {
|
|
63
|
+
type: "value",
|
|
64
|
+
num: 0,
|
|
65
|
+
key: keyOrSection,
|
|
66
|
+
val: valueOrKey,
|
|
67
|
+
};
|
|
68
|
+
__classPrivateFieldGet(this, _IniMap_instances, "m", _IniMap_appendValue).call(this, lineValue);
|
|
69
|
+
__classPrivateFieldGet(this, _IniMap_global, "f").set(keyOrSection, lineValue);
|
|
70
|
+
}
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Convert this `IniMap` to a plain object.
|
|
75
|
+
*
|
|
76
|
+
* @returns The object equivalent to this {@code IniMap}
|
|
77
|
+
*/
|
|
78
|
+
toObject() {
|
|
79
|
+
const obj = {};
|
|
80
|
+
for (const { key, val } of __classPrivateFieldGet(this, _IniMap_global, "f").values()) {
|
|
81
|
+
Object.defineProperty(obj, key, {
|
|
82
|
+
value: val,
|
|
83
|
+
writable: true,
|
|
84
|
+
enumerable: true,
|
|
85
|
+
configurable: true,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
for (const { sec, map } of __classPrivateFieldGet(this, _IniMap_sections, "f").values()) {
|
|
89
|
+
const section = {};
|
|
90
|
+
Object.defineProperty(obj, sec, {
|
|
91
|
+
value: section,
|
|
92
|
+
writable: true,
|
|
93
|
+
enumerable: true,
|
|
94
|
+
configurable: true,
|
|
95
|
+
});
|
|
96
|
+
for (const { key, val } of map.values()) {
|
|
97
|
+
Object.defineProperty(section, key, {
|
|
98
|
+
value: val,
|
|
99
|
+
writable: true,
|
|
100
|
+
enumerable: true,
|
|
101
|
+
configurable: true,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return obj;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Convert this `IniMap` to an INI string.
|
|
109
|
+
*
|
|
110
|
+
* @param replacer The replacer
|
|
111
|
+
* @returns Ini string
|
|
112
|
+
*/
|
|
113
|
+
toString(replacer) {
|
|
114
|
+
const replacerFunc = typeof replacer === "function"
|
|
115
|
+
? replacer
|
|
116
|
+
: (_key, value, _section) => `${value}`;
|
|
117
|
+
const pretty = __classPrivateFieldGet(this, _IniMap_formatting, "f")?.pretty ?? false;
|
|
118
|
+
const assignment = pretty ? ` ${ASSIGNMENT_MARK} ` : ASSIGNMENT_MARK;
|
|
119
|
+
const lines = __classPrivateFieldGet(this, _IniMap_lines, "f");
|
|
120
|
+
return lines.map((line) => {
|
|
121
|
+
switch (line.type) {
|
|
122
|
+
case "comment":
|
|
123
|
+
return line.val;
|
|
124
|
+
case "section":
|
|
125
|
+
return `[${line.sec}]`;
|
|
126
|
+
case "value":
|
|
127
|
+
return line.key + assignment +
|
|
128
|
+
replacerFunc(line.key, line.val, line.sec);
|
|
129
|
+
}
|
|
130
|
+
}).join(__classPrivateFieldGet(this, _IniMap_formatting, "f")?.lineBreak ?? "\n");
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Parse an INI string in this `IniMap`.
|
|
134
|
+
*
|
|
135
|
+
* @param text The text to parse
|
|
136
|
+
* @param reviver The reviver function
|
|
137
|
+
* @returns This {@code IniMap} object
|
|
138
|
+
*/
|
|
139
|
+
parse(text, reviver) {
|
|
140
|
+
if (typeof text !== "string") {
|
|
141
|
+
throw new SyntaxError(`Unexpected token ${text} in INI at line 0`);
|
|
142
|
+
}
|
|
143
|
+
const reviverFunc = typeof reviver === "function"
|
|
144
|
+
? reviver
|
|
145
|
+
: (_key, value, _section) => {
|
|
146
|
+
if (!isNaN(+value) && !value.includes('"'))
|
|
147
|
+
return +value;
|
|
148
|
+
if (value === "null")
|
|
149
|
+
return null;
|
|
150
|
+
if (value === "true" || value === "false")
|
|
151
|
+
return value === "true";
|
|
152
|
+
return trimQuotes(value);
|
|
153
|
+
};
|
|
154
|
+
let lineNumber = 1;
|
|
155
|
+
let currentSection;
|
|
156
|
+
for (const line of __classPrivateFieldGet(this, _IniMap_instances, "m", _IniMap_readTextLines).call(this, text)) {
|
|
157
|
+
const trimmed = line.trim();
|
|
158
|
+
if (isComment(trimmed)) {
|
|
159
|
+
__classPrivateFieldGet(this, _IniMap_lines, "f").push({
|
|
160
|
+
type: "comment",
|
|
161
|
+
num: lineNumber,
|
|
162
|
+
val: trimmed,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
else if (isSection(trimmed, lineNumber)) {
|
|
166
|
+
const sec = trimmed.substring(1, trimmed.length - 1);
|
|
167
|
+
if (!NON_WHITESPACE_REGEXP.test(sec)) {
|
|
168
|
+
throw new SyntaxError(`Unexpected empty section name at line ${lineNumber}`);
|
|
169
|
+
}
|
|
170
|
+
currentSection = {
|
|
171
|
+
type: "section",
|
|
172
|
+
num: lineNumber,
|
|
173
|
+
sec,
|
|
174
|
+
map: new Map(),
|
|
175
|
+
end: lineNumber,
|
|
176
|
+
};
|
|
177
|
+
__classPrivateFieldGet(this, _IniMap_lines, "f").push(currentSection);
|
|
178
|
+
__classPrivateFieldGet(this, _IniMap_sections, "f").set(currentSection.sec, currentSection);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
const assignmentPos = trimmed.indexOf(ASSIGNMENT_MARK);
|
|
182
|
+
if (assignmentPos === -1) {
|
|
183
|
+
throw new SyntaxError(`Unexpected token ${trimmed[0]} in INI at line ${lineNumber}`);
|
|
184
|
+
}
|
|
185
|
+
if (assignmentPos === 0) {
|
|
186
|
+
throw new SyntaxError(`Unexpected empty key name at line ${lineNumber}`);
|
|
187
|
+
}
|
|
188
|
+
const leftHand = trimmed.substring(0, assignmentPos);
|
|
189
|
+
const rightHand = trimmed.substring(assignmentPos + 1);
|
|
190
|
+
if (__classPrivateFieldGet(this, _IniMap_formatting, "f").pretty === undefined) {
|
|
191
|
+
__classPrivateFieldGet(this, _IniMap_formatting, "f").pretty = leftHand.endsWith(" ") &&
|
|
192
|
+
rightHand.startsWith(" ");
|
|
193
|
+
}
|
|
194
|
+
const key = leftHand.trim();
|
|
195
|
+
const value = rightHand.trim();
|
|
196
|
+
if (currentSection) {
|
|
197
|
+
const lineValue = {
|
|
198
|
+
type: "value",
|
|
199
|
+
num: lineNumber,
|
|
200
|
+
sec: currentSection.sec,
|
|
201
|
+
key,
|
|
202
|
+
val: reviverFunc(key, value, currentSection.sec),
|
|
203
|
+
};
|
|
204
|
+
currentSection.map.set(key, lineValue);
|
|
205
|
+
__classPrivateFieldGet(this, _IniMap_lines, "f").push(lineValue);
|
|
206
|
+
currentSection.end = lineNumber;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
const lineValue = {
|
|
210
|
+
type: "value",
|
|
211
|
+
num: lineNumber,
|
|
212
|
+
key,
|
|
213
|
+
val: reviverFunc(key, value),
|
|
214
|
+
};
|
|
215
|
+
__classPrivateFieldGet(this, _IniMap_global, "f").set(key, lineValue);
|
|
216
|
+
__classPrivateFieldGet(this, _IniMap_lines, "f").push(lineValue);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
lineNumber += 1;
|
|
220
|
+
}
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
223
|
+
static from(
|
|
224
|
+
// deno-lint-ignore no-explicit-any
|
|
225
|
+
input, formatting) {
|
|
226
|
+
const ini = new IniMap(formatting);
|
|
227
|
+
if (typeof input === "object" && input !== null) {
|
|
228
|
+
// deno-lint-ignore no-explicit-any
|
|
229
|
+
const isRecord = (val) => typeof val === "object" && val !== null;
|
|
230
|
+
// deno-lint-ignore no-explicit-any
|
|
231
|
+
const sort = ([_a, valA], [_b, valB]) => {
|
|
232
|
+
if (isRecord(valA))
|
|
233
|
+
return 1;
|
|
234
|
+
if (isRecord(valB))
|
|
235
|
+
return -1;
|
|
236
|
+
return 0;
|
|
237
|
+
};
|
|
238
|
+
for (const [key, val] of Object.entries(input).sort(sort)) {
|
|
239
|
+
if (isRecord(val)) {
|
|
240
|
+
for (const [sectionKey, sectionValue] of Object.entries(val)) {
|
|
241
|
+
ini.set(key, sectionKey, sectionValue);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
ini.set(key, val);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
ini.parse(input, formatting?.reviver);
|
|
251
|
+
}
|
|
252
|
+
return ini;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
_IniMap_global = new WeakMap(), _IniMap_sections = new WeakMap(), _IniMap_lines = new WeakMap(), _IniMap_formatting = new WeakMap(), _IniMap_instances = new WeakSet(), _IniMap_getOrCreateSection = function _IniMap_getOrCreateSection(section) {
|
|
256
|
+
const existing = __classPrivateFieldGet(this, _IniMap_sections, "f").get(section);
|
|
257
|
+
if (existing) {
|
|
258
|
+
return existing;
|
|
259
|
+
}
|
|
260
|
+
const lineSection = {
|
|
261
|
+
type: "section",
|
|
262
|
+
num: __classPrivateFieldGet(this, _IniMap_lines, "f").length + 1,
|
|
263
|
+
sec: section,
|
|
264
|
+
map: new Map(),
|
|
265
|
+
end: __classPrivateFieldGet(this, _IniMap_lines, "f").length + 1,
|
|
266
|
+
};
|
|
267
|
+
__classPrivateFieldGet(this, _IniMap_lines, "f").push(lineSection);
|
|
268
|
+
__classPrivateFieldGet(this, _IniMap_sections, "f").set(section, lineSection);
|
|
269
|
+
return lineSection;
|
|
270
|
+
}, _IniMap_appendValue = function _IniMap_appendValue(lineValue) {
|
|
271
|
+
if (__classPrivateFieldGet(this, _IniMap_lines, "f").length === 0) {
|
|
272
|
+
// For an empty array, just insert the line value
|
|
273
|
+
lineValue.num = 1;
|
|
274
|
+
__classPrivateFieldGet(this, _IniMap_lines, "f").push(lineValue);
|
|
275
|
+
}
|
|
276
|
+
else if (lineValue.sec) {
|
|
277
|
+
// For line values in a section, the end of the section is known
|
|
278
|
+
__classPrivateFieldGet(this, _IniMap_instances, "m", _IniMap_appendOrDeleteLine).call(this, lineValue, LineOp.Add);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
// For global values, find the line preceding the first section
|
|
282
|
+
lineValue.num = __classPrivateFieldGet(this, _IniMap_lines, "f").length + 1;
|
|
283
|
+
for (const [i, line] of __classPrivateFieldGet(this, _IniMap_lines, "f").entries()) {
|
|
284
|
+
if (line.type === "section") {
|
|
285
|
+
lineValue.num = i + 1;
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
// Append the line value at the end of all global values
|
|
290
|
+
__classPrivateFieldGet(this, _IniMap_instances, "m", _IniMap_appendOrDeleteLine).call(this, lineValue, LineOp.Add);
|
|
291
|
+
}
|
|
292
|
+
}, _IniMap_appendOrDeleteLine = function _IniMap_appendOrDeleteLine(input, op) {
|
|
293
|
+
if (op === LineOp.Add) {
|
|
294
|
+
__classPrivateFieldGet(this, _IniMap_lines, "f").splice(input.num - 1, 0, input);
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
__classPrivateFieldGet(this, _IniMap_lines, "f").splice(input.num - 1, 1);
|
|
298
|
+
}
|
|
299
|
+
// If the input is a comment, find the next section if any to update.
|
|
300
|
+
let updateSection = input.type === "comment";
|
|
301
|
+
const start = op === LineOp.Add ? input.num : input.num - 1;
|
|
302
|
+
for (const line of __classPrivateFieldGet(this, _IniMap_lines, "f").slice(start)) {
|
|
303
|
+
line.num += op;
|
|
304
|
+
if (line.type === "section") {
|
|
305
|
+
line.end += op;
|
|
306
|
+
// If the comment is before the nearest section, don't update the section further.
|
|
307
|
+
updateSection = false;
|
|
308
|
+
}
|
|
309
|
+
if (updateSection) {
|
|
310
|
+
// if the comment precedes a value in a section, get and update the section end.
|
|
311
|
+
if (line.type === "value" && line.sec) {
|
|
312
|
+
const section = __classPrivateFieldGet(this, _IniMap_sections, "f").get(line.sec);
|
|
313
|
+
if (section) {
|
|
314
|
+
section.end += op;
|
|
315
|
+
updateSection = false;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}, _IniMap_readTextLines = function* _IniMap_readTextLines(text) {
|
|
321
|
+
const { length } = text;
|
|
322
|
+
let line = "";
|
|
323
|
+
for (let i = 0; i < length; i += 1) {
|
|
324
|
+
const char = text[i];
|
|
325
|
+
if (char === "\n" || char === "\r") {
|
|
326
|
+
yield line;
|
|
327
|
+
line = "";
|
|
328
|
+
if (char === "\r" && text[i + 1] === "\n") {
|
|
329
|
+
i++;
|
|
330
|
+
if (!__classPrivateFieldGet(this, _IniMap_formatting, "f").lineBreak) {
|
|
331
|
+
__classPrivateFieldGet(this, _IniMap_formatting, "f").lineBreak = "\r\n";
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
else if (!__classPrivateFieldGet(this, _IniMap_formatting, "f").lineBreak) {
|
|
335
|
+
__classPrivateFieldGet(this, _IniMap_formatting, "f").lineBreak = char;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
line += char;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
yield line;
|
|
343
|
+
}, _IniMap_cleanFormatting = function _IniMap_cleanFormatting(options) {
|
|
344
|
+
return Object.fromEntries(Object.entries(options ?? {}).filter(([key]) => FormattingKeys.includes(key)));
|
|
345
|
+
};
|
|
346
|
+
/** Detect supported comment styles. */
|
|
347
|
+
function isComment(input) {
|
|
348
|
+
return input === "" ||
|
|
349
|
+
input.startsWith("#") ||
|
|
350
|
+
input.startsWith(";") ||
|
|
351
|
+
input.startsWith("//");
|
|
352
|
+
}
|
|
353
|
+
/** Detect a section start. */
|
|
354
|
+
function isSection(input, lineNumber) {
|
|
355
|
+
if (input.startsWith("[")) {
|
|
356
|
+
if (input.endsWith("]")) {
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
throw new SyntaxError(`Unexpected end of INI section at line ${lineNumber}`);
|
|
360
|
+
}
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
const LineOp = {
|
|
364
|
+
Del: -1,
|
|
365
|
+
Add: 1,
|
|
366
|
+
};
|
|
367
|
+
const DummyFormatting = {
|
|
368
|
+
lineBreak: "\n",
|
|
369
|
+
pretty: false,
|
|
370
|
+
};
|
|
371
|
+
const FormattingKeys = Object.keys(DummyFormatting);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {@linkcode parse} and {@linkcode stringify} for handling
|
|
3
|
+
* {@link https://en.wikipedia.org/wiki/INI_file | INI} encoded data, such as the
|
|
4
|
+
* {@link https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s03.html | Desktop Entry specification}.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { parse, stringify } from "mod.ts";
|
|
8
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
9
|
+
*
|
|
10
|
+
* const text = `Global Key=Some data here
|
|
11
|
+
* [Section #1]
|
|
12
|
+
* Section Value=42
|
|
13
|
+
* Section Date=1977-05-25`;
|
|
14
|
+
*
|
|
15
|
+
* const parsed = parse(text);
|
|
16
|
+
*
|
|
17
|
+
* assertEquals(parse(text), {
|
|
18
|
+
* "Global Key": "Some data here",
|
|
19
|
+
* "Section #1": {
|
|
20
|
+
* "Section Value": 42,
|
|
21
|
+
* "Section Date": "1977-05-25",
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* assertEquals(stringify(parsed), text);
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @module
|
|
29
|
+
*/
|
|
30
|
+
export * from "./parse.js";
|
|
31
|
+
export * from "./stringify.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
/**
|
|
4
|
+
* {@linkcode parse} and {@linkcode stringify} for handling
|
|
5
|
+
* {@link https://en.wikipedia.org/wiki/INI_file | INI} encoded data, such as the
|
|
6
|
+
* {@link https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s03.html | Desktop Entry specification}.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { parse, stringify } from "mod.ts";
|
|
10
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
11
|
+
*
|
|
12
|
+
* const text = `Global Key=Some data here
|
|
13
|
+
* [Section #1]
|
|
14
|
+
* Section Value=42
|
|
15
|
+
* Section Date=1977-05-25`;
|
|
16
|
+
*
|
|
17
|
+
* const parsed = parse(text);
|
|
18
|
+
*
|
|
19
|
+
* assertEquals(parse(text), {
|
|
20
|
+
* "Global Key": "Some data here",
|
|
21
|
+
* "Section #1": {
|
|
22
|
+
* "Section Value": 42,
|
|
23
|
+
* "Section Date": "1977-05-25",
|
|
24
|
+
* },
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* assertEquals(stringify(parsed), text);
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @module
|
|
31
|
+
*/
|
|
32
|
+
export * from "./parse.js";
|
|
33
|
+
export * from "./stringify.js";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type ReviverFunction } from "./_ini_map.js";
|
|
2
|
+
export type { ReviverFunction };
|
|
3
|
+
/** Options for {@linkcode parse}. */
|
|
4
|
+
export interface ParseOptions<T = any> {
|
|
5
|
+
/**
|
|
6
|
+
* Provide custom parsing of the value in a key/value pair. Similar to the
|
|
7
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#reviver | reviver}
|
|
8
|
+
* function in {@linkcode JSON.parse}.
|
|
9
|
+
*/
|
|
10
|
+
reviver?: ReviverFunction<T>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse an INI config string into an object.
|
|
14
|
+
*
|
|
15
|
+
* Values are parsed as strings by default to preserve data parity from the
|
|
16
|
+
* original. To parse values as other types besides strings, use
|
|
17
|
+
* {@linkcode ParseOptions.reviver}.
|
|
18
|
+
*
|
|
19
|
+
* Nested sections, repeated key names within a section, and key/value arrays
|
|
20
|
+
* are not supported. White space padding and lines starting with `#`, `;`, or
|
|
21
|
+
* `//` will be treated as comments.
|
|
22
|
+
*
|
|
23
|
+
* @throws {SyntaxError} If the INI string is invalid or if it contains
|
|
24
|
+
* multi-line values.
|
|
25
|
+
*
|
|
26
|
+
* @example Usage
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { parse } from "parse.ts";
|
|
29
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
30
|
+
*
|
|
31
|
+
* const parsed = parse(`
|
|
32
|
+
* key = value
|
|
33
|
+
*
|
|
34
|
+
* [section 1]
|
|
35
|
+
* foo = Hello
|
|
36
|
+
* baz = World
|
|
37
|
+
* `);
|
|
38
|
+
*
|
|
39
|
+
* assertEquals(parsed, { key: "value", "section 1": { foo: "Hello", baz: "World" } })
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example Using custom reviver
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { parse } from "parse.ts";
|
|
45
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
46
|
+
*
|
|
47
|
+
* const parsed = parse(`
|
|
48
|
+
* [section Foo]
|
|
49
|
+
* date = 2012-10-10
|
|
50
|
+
* amount = 12345
|
|
51
|
+
* `, {
|
|
52
|
+
* reviver(key, value, section) {
|
|
53
|
+
* if (section === "section Foo") {
|
|
54
|
+
* if (key === "date") {
|
|
55
|
+
* return new Date(value);
|
|
56
|
+
* } else if (key === "amount") {
|
|
57
|
+
* return +value;
|
|
58
|
+
* }
|
|
59
|
+
* }
|
|
60
|
+
* return value;
|
|
61
|
+
* }
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* assertEquals(parsed, {
|
|
65
|
+
* "section Foo": {
|
|
66
|
+
* date: new Date("2012-10-10"),
|
|
67
|
+
* amount: 12345,
|
|
68
|
+
* }
|
|
69
|
+
* })
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @param text The text to parse
|
|
73
|
+
* @param options The options to use
|
|
74
|
+
* @typeParam T The type of the value
|
|
75
|
+
* @return The parsed object
|
|
76
|
+
*/
|
|
77
|
+
export declare function parse<T = any>(text: string, options?: ParseOptions<T>): Record<string, T | Record<string, T>>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { IniMap } from "./_ini_map.js";
|
|
4
|
+
/**
|
|
5
|
+
* Parse an INI config string into an object.
|
|
6
|
+
*
|
|
7
|
+
* Values are parsed as strings by default to preserve data parity from the
|
|
8
|
+
* original. To parse values as other types besides strings, use
|
|
9
|
+
* {@linkcode ParseOptions.reviver}.
|
|
10
|
+
*
|
|
11
|
+
* Nested sections, repeated key names within a section, and key/value arrays
|
|
12
|
+
* are not supported. White space padding and lines starting with `#`, `;`, or
|
|
13
|
+
* `//` will be treated as comments.
|
|
14
|
+
*
|
|
15
|
+
* @throws {SyntaxError} If the INI string is invalid or if it contains
|
|
16
|
+
* multi-line values.
|
|
17
|
+
*
|
|
18
|
+
* @example Usage
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { parse } from "parse.ts";
|
|
21
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
22
|
+
*
|
|
23
|
+
* const parsed = parse(`
|
|
24
|
+
* key = value
|
|
25
|
+
*
|
|
26
|
+
* [section 1]
|
|
27
|
+
* foo = Hello
|
|
28
|
+
* baz = World
|
|
29
|
+
* `);
|
|
30
|
+
*
|
|
31
|
+
* assertEquals(parsed, { key: "value", "section 1": { foo: "Hello", baz: "World" } })
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example Using custom reviver
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { parse } from "parse.ts";
|
|
37
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
38
|
+
*
|
|
39
|
+
* const parsed = parse(`
|
|
40
|
+
* [section Foo]
|
|
41
|
+
* date = 2012-10-10
|
|
42
|
+
* amount = 12345
|
|
43
|
+
* `, {
|
|
44
|
+
* reviver(key, value, section) {
|
|
45
|
+
* if (section === "section Foo") {
|
|
46
|
+
* if (key === "date") {
|
|
47
|
+
* return new Date(value);
|
|
48
|
+
* } else if (key === "amount") {
|
|
49
|
+
* return +value;
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
* return value;
|
|
53
|
+
* }
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* assertEquals(parsed, {
|
|
57
|
+
* "section Foo": {
|
|
58
|
+
* date: new Date("2012-10-10"),
|
|
59
|
+
* amount: 12345,
|
|
60
|
+
* }
|
|
61
|
+
* })
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @param text The text to parse
|
|
65
|
+
* @param options The options to use
|
|
66
|
+
* @typeParam T The type of the value
|
|
67
|
+
* @return The parsed object
|
|
68
|
+
*/
|
|
69
|
+
// deno-lint-ignore no-explicit-any
|
|
70
|
+
export function parse(text, options) {
|
|
71
|
+
return IniMap.from(text, options).toObject();
|
|
72
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type ReplacerFunction } from "./_ini_map.js";
|
|
2
|
+
/** Options for {@linkcode stringify}. */
|
|
3
|
+
export interface StringifyOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Character(s) used to break lines in the config file.
|
|
6
|
+
*
|
|
7
|
+
* @default {"\n"}
|
|
8
|
+
*/
|
|
9
|
+
lineBreak?: "\n" | "\r\n" | "\r";
|
|
10
|
+
/**
|
|
11
|
+
* Use a plain assignment char or pad with spaces.
|
|
12
|
+
*
|
|
13
|
+
* @default {false}
|
|
14
|
+
*/
|
|
15
|
+
pretty?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Provide custom string conversion for the value in a key/value pair.
|
|
18
|
+
* Similar to the
|
|
19
|
+
* {@linkcode https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#replacer | replacer}
|
|
20
|
+
* function in {@linkcode JSON.stringify}.
|
|
21
|
+
*/
|
|
22
|
+
replacer?: ReplacerFunction;
|
|
23
|
+
}
|
|
24
|
+
export type { ReplacerFunction };
|
|
25
|
+
/**
|
|
26
|
+
* Compile an object into an INI config string. Provide formatting options to modify the output.
|
|
27
|
+
*
|
|
28
|
+
* @example Usage
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { stringify } from "stringify.ts";
|
|
31
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
32
|
+
*
|
|
33
|
+
* const str = stringify({
|
|
34
|
+
* key1: "value1",
|
|
35
|
+
* key2: "value2",
|
|
36
|
+
* section1: {
|
|
37
|
+
* foo: "bar",
|
|
38
|
+
* },
|
|
39
|
+
* section2: {
|
|
40
|
+
* hello: "world",
|
|
41
|
+
* },
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* assertEquals(str, `key1=value1
|
|
45
|
+
* key2=value2
|
|
46
|
+
* [section1]
|
|
47
|
+
* foo=bar
|
|
48
|
+
* [section2]
|
|
49
|
+
* hello=world`);
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example Using replacer option
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { stringify } from "stringify.ts";
|
|
55
|
+
* import { assertEquals } from "../assert/mod.ts";
|
|
56
|
+
*
|
|
57
|
+
* const str = stringify({
|
|
58
|
+
* "section X": {
|
|
59
|
+
* date: new Date("2024-06-10"),
|
|
60
|
+
* },
|
|
61
|
+
* "section Y": {
|
|
62
|
+
* name: "John"
|
|
63
|
+
* }
|
|
64
|
+
* }, {
|
|
65
|
+
* replacer(key, value, section) {
|
|
66
|
+
* if (section === "section X" && key === "date") {
|
|
67
|
+
* return value.toISOString().slice(0, 10);
|
|
68
|
+
* }
|
|
69
|
+
* return value;
|
|
70
|
+
* },
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* assertEquals(str, `[section X]
|
|
74
|
+
* date=2024-06-10
|
|
75
|
+
* [section Y]
|
|
76
|
+
* name=John`);
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @param object The object to stringify
|
|
80
|
+
* @param options The option to use
|
|
81
|
+
* @returns The INI string
|
|
82
|
+
*/
|
|
83
|
+
export declare function stringify(object: any, options?: StringifyOptions): string;
|