keep-a-changelog 2.1.0 → 2.3.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 -2
- package/README.md +23 -6
- package/esm/_dnt.test_shims.d.ts +5 -0
- package/esm/bin.js +11 -2
- package/esm/deps/deno.land/std@0.133.0/fmt/colors.d.ts +270 -0
- package/esm/deps/deno.land/std@0.133.0/testing/_diff.d.ts +23 -0
- package/esm/deps/deno.land/std@0.133.0/testing/asserts.d.ts +167 -0
- package/esm/deps/deno.land/std@0.173.0/semver/mod.d.ts +398 -0
- package/esm/deps/deno.land/{x/semver@v1.4.0 → std@0.173.0/semver}/mod.js +227 -334
- package/esm/deps/deno.land/std@0.189.0/_util/asserts.d.ts +10 -0
- package/esm/deps/deno.land/std@0.189.0/_util/asserts.js +21 -0
- package/esm/deps/deno.land/std@0.189.0/_util/os.d.ts +4 -0
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/_util/os.js +3 -2
- package/esm/deps/deno.land/std@0.189.0/flags/mod.d.ts +166 -0
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/flags/mod.js +146 -36
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/_constants.js +1 -0
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/_interface.d.ts +1 -1
- package/esm/deps/deno.land/std@0.189.0/path/_interface.js +3 -0
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/_util.d.ts +3 -0
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/_util.js +47 -0
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/common.js +1 -1
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/glob.d.ts +10 -5
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/glob.js +1 -1
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/mod.d.ts +3 -1
- package/esm/deps/deno.land/std@0.189.0/path/mod.js +35 -0
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/posix.d.ts +15 -9
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/posix.js +58 -112
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/separator.js +1 -1
- package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/win32.d.ts +13 -9
- package/esm/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/win32.js +30 -87
- package/esm/src/Change.js +15 -15
- package/{types → esm}/src/Changelog.d.ts +1 -0
- package/esm/src/Changelog.js +9 -1
- package/{types → esm}/src/Release.d.ts +1 -0
- package/esm/src/Release.js +10 -0
- package/esm/src/deps.d.ts +1 -0
- package/esm/src/deps.js +1 -1
- package/esm/src/parser.js +19 -3
- package/esm/test/Change.test.d.ts +1 -0
- package/esm/test/changelog.custom.type.md +0 -1
- package/esm/test/changelog.expected.linted.md +208 -0
- package/esm/test/changelog.expected.md +3 -1
- package/esm/test/changelog.md +4 -0
- package/esm/test/deps.d.ts +1 -0
- package/esm/test/empty.expected.md +0 -1
- package/esm/test/fixture/CustomRelease.d.ts +8 -0
- package/esm/test/parser.test.d.ts +1 -0
- package/esm/test/test.d.ts +1 -0
- package/package.json +6 -8
- package/script/_dnt.polyfills.d.ts +11 -0
- package/script/_dnt.shims.d.ts +5 -0
- package/script/_dnt.test_shims.d.ts +5 -0
- package/script/bin.d.ts +2 -0
- package/script/bin.js +11 -2
- package/script/deps/deno.land/std@0.133.0/fmt/colors.d.ts +270 -0
- package/script/deps/deno.land/std@0.133.0/testing/_diff.d.ts +23 -0
- package/script/deps/deno.land/std@0.133.0/testing/asserts.d.ts +167 -0
- package/script/deps/deno.land/std@0.173.0/semver/mod.d.ts +398 -0
- package/script/deps/deno.land/{x/semver@v1.4.0 → std@0.173.0/semver}/mod.js +232 -342
- package/script/deps/deno.land/std@0.189.0/_util/asserts.d.ts +10 -0
- package/script/deps/deno.land/std@0.189.0/_util/asserts.js +27 -0
- package/script/deps/deno.land/std@0.189.0/_util/os.d.ts +4 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/_util/os.js +4 -3
- package/script/deps/deno.land/std@0.189.0/flags/mod.d.ts +166 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/flags/mod.js +150 -40
- package/script/deps/deno.land/std@0.189.0/path/_constants.d.ts +39 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/_constants.js +1 -0
- package/script/deps/deno.land/std@0.189.0/path/_interface.d.ts +26 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/_interface.js +1 -1
- package/script/deps/deno.land/std@0.189.0/path/_util.d.ts +11 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/_util.js +51 -1
- package/script/deps/deno.land/std@0.189.0/path/common.d.ts +13 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/common.js +1 -1
- package/script/deps/deno.land/std@0.189.0/path/glob.d.ts +83 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/glob.js +1 -1
- package/script/deps/deno.land/std@0.189.0/path/mod.d.ts +11 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/mod.js +23 -2
- package/script/deps/deno.land/std@0.189.0/path/posix.d.ts +86 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/posix.js +56 -110
- package/script/deps/deno.land/std@0.189.0/path/separator.d.ts +2 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/separator.js +1 -1
- package/script/deps/deno.land/std@0.189.0/path/win32.d.ts +91 -0
- package/script/deps/deno.land/{std@0.120.0 → std@0.189.0}/path/win32.js +30 -87
- package/script/deps/deno.land/std@0.51.0/fs/eol.d.ts +12 -0
- package/script/deps/deno.land/x/ini@v2.1.0/ini.d.ts +53 -0
- package/script/deps/deno.land/x/ini@v2.1.0/mod.d.ts +1 -0
- package/script/mod.d.ts +6 -0
- package/script/src/Change.d.ts +8 -0
- package/script/src/Change.js +15 -15
- package/script/src/Changelog.d.ts +19 -0
- package/script/src/Changelog.js +9 -1
- package/script/src/Release.d.ts +27 -0
- package/script/src/Release.js +10 -0
- package/script/src/deps.d.ts +1 -0
- package/script/src/deps.js +1 -1
- package/script/src/parser.d.ts +11 -0
- package/script/src/parser.js +19 -3
- package/script/test/Change.test.d.ts +1 -0
- package/script/test/changelog.custom.type.md +0 -1
- package/script/test/changelog.expected.linted.md +208 -0
- package/script/test/changelog.expected.md +3 -1
- package/script/test/changelog.md +4 -0
- package/script/test/deps.d.ts +1 -0
- package/script/test/empty.expected.md +0 -1
- package/script/test/fixture/CustomRelease.d.ts +8 -0
- package/script/test/parser.test.d.ts +1 -0
- package/script/test/test.d.ts +1 -0
- package/esm/deps/deno.land/std@0.120.0/_util/assert.js +0 -13
- package/esm/deps/deno.land/std@0.120.0/path/_interface.js +0 -3
- package/esm/deps/deno.land/std@0.120.0/path/mod.js +0 -14
- package/script/deps/deno.land/std@0.120.0/_util/assert.js +0 -18
- package/types/deps/deno.land/std@0.120.0/_util/assert.d.ts +0 -5
- package/types/deps/deno.land/std@0.120.0/_util/os.d.ts +0 -3
- package/types/deps/deno.land/std@0.120.0/flags/mod.d.ts +0 -50
- package/types/deps/deno.land/x/semver@v1.4.0/mod.d.ts +0 -116
- package/types/src/deps.d.ts +0 -1
- /package/{types → esm}/_dnt.polyfills.d.ts +0 -0
- /package/{types → esm}/_dnt.shims.d.ts +0 -0
- /package/{types → esm}/bin.d.ts +0 -0
- /package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/_constants.d.ts +0 -0
- /package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/common.d.ts +0 -0
- /package/{types/deps/deno.land/std@0.120.0 → esm/deps/deno.land/std@0.189.0}/path/separator.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/std@0.51.0/fs/eol.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/x/ini@v2.1.0/ini.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/x/ini@v2.1.0/mod.d.ts +0 -0
- /package/{types → esm}/mod.d.ts +0 -0
- /package/{types → esm}/src/Change.d.ts +0 -0
- /package/{types → esm}/src/parser.d.ts +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { FormatInputPathObject, ParsedPath } from "./_interface.js";
|
|
3
|
+
export declare const sep = "\\";
|
|
4
|
+
export declare const delimiter = ";";
|
|
5
|
+
/**
|
|
6
|
+
* Resolves path segments into a `path`
|
|
7
|
+
* @param pathSegments to process to path
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolve(...pathSegments: string[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes a `path`
|
|
12
|
+
* @param path to normalize
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalize(path: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Verifies whether path is absolute
|
|
17
|
+
* @param path to verify
|
|
18
|
+
*/
|
|
19
|
+
export declare function isAbsolute(path: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Join all given a sequence of `paths`,then normalizes the resulting path.
|
|
22
|
+
* @param paths to be joined and normalized
|
|
23
|
+
*/
|
|
24
|
+
export declare function join(...paths: string[]): string;
|
|
25
|
+
/**
|
|
26
|
+
* It will solve the relative path from `from` to `to`, for instance:
|
|
27
|
+
* from = 'C:\\orandea\\test\\aaa'
|
|
28
|
+
* to = 'C:\\orandea\\impl\\bbb'
|
|
29
|
+
* The output of the function should be: '..\\..\\impl\\bbb'
|
|
30
|
+
* @param from relative path
|
|
31
|
+
* @param to relative path
|
|
32
|
+
*/
|
|
33
|
+
export declare function relative(from: string, to: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves path to a namespace path
|
|
36
|
+
* @param path to resolve to namespace
|
|
37
|
+
*/
|
|
38
|
+
export declare function toNamespacedPath(path: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Return the directory path of a `path`.
|
|
41
|
+
* @param path - path to extract the directory from.
|
|
42
|
+
*/
|
|
43
|
+
export declare function dirname(path: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Return the last portion of a `path`.
|
|
46
|
+
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
47
|
+
*
|
|
48
|
+
* @param path - path to extract name from.
|
|
49
|
+
* @param [suffix] - suffix to remove from extracted name.
|
|
50
|
+
*/
|
|
51
|
+
export declare function basename(path: string, suffix?: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Return the extension of the `path` with leading period.
|
|
54
|
+
* @param path with extension
|
|
55
|
+
* @returns extension (ex. for `file.ts` returns `.ts`)
|
|
56
|
+
*/
|
|
57
|
+
export declare function extname(path: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Generate a path from `FormatInputPathObject` object.
|
|
60
|
+
* @param pathObject with path
|
|
61
|
+
*/
|
|
62
|
+
export declare function format(pathObject: FormatInputPathObject): string;
|
|
63
|
+
/**
|
|
64
|
+
* Return a `ParsedPath` object of the `path`.
|
|
65
|
+
* @param path to process
|
|
66
|
+
*/
|
|
67
|
+
export declare function parse(path: string): ParsedPath;
|
|
68
|
+
/**
|
|
69
|
+
* Converts a file URL to a path string.
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
73
|
+
* fromFileUrl("file:///home/foo"); // "\\home\\foo"
|
|
74
|
+
* fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo"
|
|
75
|
+
* fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo"
|
|
76
|
+
* ```
|
|
77
|
+
* @param url of a file URL
|
|
78
|
+
*/
|
|
79
|
+
export declare function fromFileUrl(url: string | URL): string;
|
|
80
|
+
/**
|
|
81
|
+
* Converts a path string to a file URL.
|
|
82
|
+
*
|
|
83
|
+
* ```ts
|
|
84
|
+
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
85
|
+
* toFileUrl("\\home\\foo"); // new URL("file:///home/foo")
|
|
86
|
+
* toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo")
|
|
87
|
+
* toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file://127.0.0.1/home/foo")
|
|
88
|
+
* ```
|
|
89
|
+
* @param path to convert to file URL
|
|
90
|
+
*/
|
|
91
|
+
export declare function toFileUrl(path: string): URL;
|
|
@@ -24,13 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.toFileUrl = exports.fromFileUrl = exports.parse = exports.format = exports.extname = exports.basename = exports.dirname = exports.toNamespacedPath = exports.relative = exports.join = exports.isAbsolute = exports.normalize = exports.resolve = exports.delimiter = exports.sep = void 0;
|
|
27
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
27
28
|
// Copyright the Browserify authors. MIT License.
|
|
28
29
|
// Ported from https://github.com/browserify/path-browserify/
|
|
29
30
|
// This module is browser compatible.
|
|
30
31
|
const dntShim = __importStar(require("../../../../_dnt.shims.js"));
|
|
31
32
|
const _constants_js_1 = require("./_constants.js");
|
|
32
33
|
const _util_js_1 = require("./_util.js");
|
|
33
|
-
const
|
|
34
|
+
const asserts_js_1 = require("../_util/asserts.js");
|
|
34
35
|
exports.sep = "\\";
|
|
35
36
|
exports.delimiter = ";";
|
|
36
37
|
/**
|
|
@@ -355,7 +356,7 @@ function join(...paths) {
|
|
|
355
356
|
// path.join('//server', 'share') -> '\\\\server\\share\\')
|
|
356
357
|
let needsReplace = true;
|
|
357
358
|
let slashCount = 0;
|
|
358
|
-
(0,
|
|
359
|
+
(0, asserts_js_1.assert)(firstPart != null);
|
|
359
360
|
if ((0, _util_js_1.isPathSeparator)(firstPart.charCodeAt(0))) {
|
|
360
361
|
++slashCount;
|
|
361
362
|
const firstLen = firstPart.length;
|
|
@@ -538,8 +539,8 @@ function toNamespacedPath(path) {
|
|
|
538
539
|
}
|
|
539
540
|
exports.toNamespacedPath = toNamespacedPath;
|
|
540
541
|
/**
|
|
541
|
-
* Return the directory
|
|
542
|
-
* @param path to
|
|
542
|
+
* Return the directory path of a `path`.
|
|
543
|
+
* @param path - path to extract the directory from.
|
|
543
544
|
*/
|
|
544
545
|
function dirname(path) {
|
|
545
546
|
(0, _util_js_1.assertPath)(path);
|
|
@@ -629,26 +630,27 @@ function dirname(path) {
|
|
|
629
630
|
else
|
|
630
631
|
end = rootEnd;
|
|
631
632
|
}
|
|
632
|
-
return path.slice(0, end);
|
|
633
|
+
return (0, _util_js_1.stripTrailingSeparators)(path.slice(0, end), _util_js_1.isPosixPathSeparator);
|
|
633
634
|
}
|
|
634
635
|
exports.dirname = dirname;
|
|
635
636
|
/**
|
|
636
|
-
* Return the last portion of a `path`.
|
|
637
|
-
*
|
|
638
|
-
*
|
|
637
|
+
* Return the last portion of a `path`.
|
|
638
|
+
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
639
|
+
*
|
|
640
|
+
* @param path - path to extract name from.
|
|
641
|
+
* @param [suffix] - suffix to remove from extracted name.
|
|
639
642
|
*/
|
|
640
|
-
function basename(path,
|
|
641
|
-
if (ext !== undefined && typeof ext !== "string") {
|
|
642
|
-
throw new TypeError('"ext" argument must be a string');
|
|
643
|
-
}
|
|
643
|
+
function basename(path, suffix = "") {
|
|
644
644
|
(0, _util_js_1.assertPath)(path);
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
645
|
+
if (path.length === 0)
|
|
646
|
+
return path;
|
|
647
|
+
if (typeof suffix !== "string") {
|
|
648
|
+
throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
|
|
649
|
+
}
|
|
649
650
|
// Check for a drive letter prefix so as not to mistake the following
|
|
650
651
|
// path separator as an extra separator at the end of the path that can be
|
|
651
652
|
// disregarded
|
|
653
|
+
let start = 0;
|
|
652
654
|
if (path.length >= 2) {
|
|
653
655
|
const drive = path.charCodeAt(0);
|
|
654
656
|
if ((0, _util_js_1.isWindowsDeviceRoot)(drive)) {
|
|
@@ -656,78 +658,15 @@ function basename(path, ext = "") {
|
|
|
656
658
|
start = 2;
|
|
657
659
|
}
|
|
658
660
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
let extIdx = ext.length - 1;
|
|
663
|
-
let firstNonSlashEnd = -1;
|
|
664
|
-
for (i = path.length - 1; i >= start; --i) {
|
|
665
|
-
const code = path.charCodeAt(i);
|
|
666
|
-
if ((0, _util_js_1.isPathSeparator)(code)) {
|
|
667
|
-
// If we reached a path separator that was not part of a set of path
|
|
668
|
-
// separators at the end of the string, stop now
|
|
669
|
-
if (!matchedSlash) {
|
|
670
|
-
start = i + 1;
|
|
671
|
-
break;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
else {
|
|
675
|
-
if (firstNonSlashEnd === -1) {
|
|
676
|
-
// We saw the first non-path separator, remember this index in case
|
|
677
|
-
// we need it if the extension ends up not matching
|
|
678
|
-
matchedSlash = false;
|
|
679
|
-
firstNonSlashEnd = i + 1;
|
|
680
|
-
}
|
|
681
|
-
if (extIdx >= 0) {
|
|
682
|
-
// Try to match the explicit extension
|
|
683
|
-
if (code === ext.charCodeAt(extIdx)) {
|
|
684
|
-
if (--extIdx === -1) {
|
|
685
|
-
// We matched the extension, so mark this as the end of our path
|
|
686
|
-
// component
|
|
687
|
-
end = i;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
else {
|
|
691
|
-
// Extension does not match, so our result is the entire path
|
|
692
|
-
// component
|
|
693
|
-
extIdx = -1;
|
|
694
|
-
end = firstNonSlashEnd;
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
if (start === end)
|
|
700
|
-
end = firstNonSlashEnd;
|
|
701
|
-
else if (end === -1)
|
|
702
|
-
end = path.length;
|
|
703
|
-
return path.slice(start, end);
|
|
704
|
-
}
|
|
705
|
-
else {
|
|
706
|
-
for (i = path.length - 1; i >= start; --i) {
|
|
707
|
-
if ((0, _util_js_1.isPathSeparator)(path.charCodeAt(i))) {
|
|
708
|
-
// If we reached a path separator that was not part of a set of path
|
|
709
|
-
// separators at the end of the string, stop now
|
|
710
|
-
if (!matchedSlash) {
|
|
711
|
-
start = i + 1;
|
|
712
|
-
break;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
else if (end === -1) {
|
|
716
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
717
|
-
// path component
|
|
718
|
-
matchedSlash = false;
|
|
719
|
-
end = i + 1;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
if (end === -1)
|
|
723
|
-
return "";
|
|
724
|
-
return path.slice(start, end);
|
|
725
|
-
}
|
|
661
|
+
const lastSegment = (0, _util_js_1.lastPathSegment)(path, _util_js_1.isPathSeparator, start);
|
|
662
|
+
const strippedSegment = (0, _util_js_1.stripTrailingSeparators)(lastSegment, _util_js_1.isPathSeparator);
|
|
663
|
+
return suffix ? (0, _util_js_1.stripSuffix)(strippedSegment, suffix) : strippedSegment;
|
|
726
664
|
}
|
|
727
665
|
exports.basename = basename;
|
|
728
666
|
/**
|
|
729
|
-
* Return the extension of the `path
|
|
667
|
+
* Return the extension of the `path` with leading period.
|
|
730
668
|
* @param path with extension
|
|
669
|
+
* @returns extension (ex. for `file.ts` returns `.ts`)
|
|
731
670
|
*/
|
|
732
671
|
function extname(path) {
|
|
733
672
|
(0, _util_js_1.assertPath)(path);
|
|
@@ -863,13 +802,14 @@ function parse(path) {
|
|
|
863
802
|
// `path` contains just a drive root, exit early to avoid
|
|
864
803
|
// unnecessary work
|
|
865
804
|
ret.root = ret.dir = path;
|
|
805
|
+
ret.base = "\\";
|
|
866
806
|
return ret;
|
|
867
807
|
}
|
|
868
808
|
rootEnd = 3;
|
|
869
809
|
}
|
|
870
810
|
}
|
|
871
811
|
else {
|
|
872
|
-
// `path` contains just a drive root, exit early to avoid
|
|
812
|
+
// `path` contains just a relative drive root, exit early to avoid
|
|
873
813
|
// unnecessary work
|
|
874
814
|
ret.root = ret.dir = path;
|
|
875
815
|
return ret;
|
|
@@ -881,6 +821,7 @@ function parse(path) {
|
|
|
881
821
|
// `path` contains just a path separator, exit early to avoid
|
|
882
822
|
// unnecessary work
|
|
883
823
|
ret.root = ret.dir = path;
|
|
824
|
+
ret.base = "\\";
|
|
884
825
|
return ret;
|
|
885
826
|
}
|
|
886
827
|
if (rootEnd > 0)
|
|
@@ -939,6 +880,8 @@ function parse(path) {
|
|
|
939
880
|
ret.base = path.slice(startPart, end);
|
|
940
881
|
ret.ext = path.slice(startDot, end);
|
|
941
882
|
}
|
|
883
|
+
// Fallback to '\' in case there is no basename
|
|
884
|
+
ret.base = ret.base || "\\";
|
|
942
885
|
// If the directory is the root, use the entire root as the `dir` including
|
|
943
886
|
// the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
|
|
944
887
|
// trailing slash (`C:\abc\def` -> `C:\abc`).
|
|
@@ -954,7 +897,7 @@ exports.parse = parse;
|
|
|
954
897
|
* Converts a file URL to a path string.
|
|
955
898
|
*
|
|
956
899
|
* ```ts
|
|
957
|
-
* import { fromFileUrl } from "
|
|
900
|
+
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
958
901
|
* fromFileUrl("file:///home/foo"); // "\\home\\foo"
|
|
959
902
|
* fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo"
|
|
960
903
|
* fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo"
|
|
@@ -980,7 +923,7 @@ exports.fromFileUrl = fromFileUrl;
|
|
|
980
923
|
* Converts a path string to a file URL.
|
|
981
924
|
*
|
|
982
925
|
* ```ts
|
|
983
|
-
* import { toFileUrl } from "
|
|
926
|
+
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
|
|
984
927
|
* toFileUrl("\\home\\foo"); // new URL("file:///home/foo")
|
|
985
928
|
* toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo")
|
|
986
929
|
* toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file://127.0.0.1/home/foo")
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** EndOfLine character enum */
|
|
2
|
+
export declare enum EOL {
|
|
3
|
+
LF = "\n",
|
|
4
|
+
CRLF = "\r\n"
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Detect the EOL character for string input.
|
|
8
|
+
* returns null if no newline
|
|
9
|
+
*/
|
|
10
|
+
export declare function detect(content: string): EOL | null;
|
|
11
|
+
/** Format the file to the targeted EOL */
|
|
12
|
+
export declare function format(content: string, eol: EOL): string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const parse: typeof decode;
|
|
2
|
+
export declare const stringify: typeof encode;
|
|
3
|
+
export interface EncodeOptions {
|
|
4
|
+
section?: string;
|
|
5
|
+
whitespace?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Encode the object `object` into an ini-style formatted string. If the
|
|
9
|
+
* optional parameter `section` is given, then all top-level properties
|
|
10
|
+
* of the object are put into this section and the `section`-string is
|
|
11
|
+
* prepended to all sub-sections, see the usage example above.
|
|
12
|
+
*
|
|
13
|
+
* The `options` object may contain the following:
|
|
14
|
+
* - `section` A string which will be the first `section` in the encoded
|
|
15
|
+
* ini data. Defaults to none.
|
|
16
|
+
* - `whitespace` Boolean to specify whether to put whitespace around the
|
|
17
|
+
* `=` character. By default, whitespace is omitted, to be friendly to
|
|
18
|
+
* some persnickety old parsers that don't tolerate it well. But some
|
|
19
|
+
* find that it's more human-readable and pretty with the whitespace.
|
|
20
|
+
*
|
|
21
|
+
* For backwards compatibility reasons, if a `string` options is passed,
|
|
22
|
+
* then it is assumed to be the `section` value.
|
|
23
|
+
*
|
|
24
|
+
* @param obj Object to encode
|
|
25
|
+
* @param opt Encoding options
|
|
26
|
+
*/
|
|
27
|
+
export declare function encode(obj: any, opt?: string | EncodeOptions): string;
|
|
28
|
+
/**
|
|
29
|
+
* Decode the given ini-style formatted document into a nested object.
|
|
30
|
+
* @param str ini-style document
|
|
31
|
+
*/
|
|
32
|
+
export declare function decode(str: string): any;
|
|
33
|
+
/**
|
|
34
|
+
* Escapes the string `val` such that it is safe to be used as a key or
|
|
35
|
+
* value in an ini-file. Basically escapes quotes. For example:
|
|
36
|
+
*
|
|
37
|
+
* ```javascript
|
|
38
|
+
* ini.safe('"unsafe string"')
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* would result in
|
|
42
|
+
*
|
|
43
|
+
* ```javascript
|
|
44
|
+
* "\"unsafe string\""
|
|
45
|
+
* ```
|
|
46
|
+
* @param val String to escape
|
|
47
|
+
*/
|
|
48
|
+
export declare function safe(val: string | any): string;
|
|
49
|
+
/**
|
|
50
|
+
* Unescapes the given string value.
|
|
51
|
+
* @param val String to unescape
|
|
52
|
+
*/
|
|
53
|
+
export declare function unsafe(val?: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ini.js';
|
package/script/mod.d.ts
ADDED
package/script/src/Change.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class Change {
|
|
4
|
+
static extractIssues(text, issues) {
|
|
5
|
+
return text
|
|
6
|
+
.replace(/(^|[^\\])\[#(\d+)\](?=[^\(]|$)/g, (_, start, index) => {
|
|
7
|
+
if (!issues.includes(index)) {
|
|
8
|
+
issues.push(index);
|
|
9
|
+
}
|
|
10
|
+
return `${start}[#${index}]`;
|
|
11
|
+
})
|
|
12
|
+
.replace(/(^|[\s,])#(\d+)(?=[\s,\.]|$)/g, (_, start, index) => {
|
|
13
|
+
if (!issues.includes(index)) {
|
|
14
|
+
issues.push(index);
|
|
15
|
+
}
|
|
16
|
+
return `${start}[#${index}]`;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
4
19
|
constructor(title, description = "") {
|
|
5
20
|
Object.defineProperty(this, "title", {
|
|
6
21
|
enumerable: true,
|
|
@@ -23,21 +38,6 @@ class Change {
|
|
|
23
38
|
this.title = Change.extractIssues(title, this.issues);
|
|
24
39
|
this.description = Change.extractIssues(description, this.issues);
|
|
25
40
|
}
|
|
26
|
-
static extractIssues(text, issues) {
|
|
27
|
-
return text
|
|
28
|
-
.replace(/(^|[^\\])\[#(\d+)\](?=[^\(]|$)/g, (_, start, index) => {
|
|
29
|
-
if (!issues.includes(index)) {
|
|
30
|
-
issues.push(index);
|
|
31
|
-
}
|
|
32
|
-
return `${start}[#${index}]`;
|
|
33
|
-
})
|
|
34
|
-
.replace(/(^|[\s,])#(\d+)(?=[\s,\.]|$)/g, (_, start, index) => {
|
|
35
|
-
if (!issues.includes(index)) {
|
|
36
|
-
issues.push(index);
|
|
37
|
-
}
|
|
38
|
-
return `${start}[#${index}]`;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
41
|
toString() {
|
|
42
42
|
let t = this.title.split("\n").map((line) => ` ${line}`.trimEnd());
|
|
43
43
|
t[0] = "-" + t[0].substr(1);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Release from "./Release.js";
|
|
2
|
+
import { Semver } from "./deps.js";
|
|
3
|
+
export default class Changelog {
|
|
4
|
+
flag?: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
head: string;
|
|
8
|
+
footer?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
releases: Release[];
|
|
11
|
+
tagNameBuilder?: (release: Release) => string;
|
|
12
|
+
format: "compact" | "markdownlint";
|
|
13
|
+
constructor(title: string, description?: string);
|
|
14
|
+
addRelease(release: Release): this;
|
|
15
|
+
findRelease(version?: Semver | string): Release | undefined;
|
|
16
|
+
sortReleases(): void;
|
|
17
|
+
tagName(release: Release): string;
|
|
18
|
+
toString(): string;
|
|
19
|
+
}
|
package/script/src/Changelog.js
CHANGED
|
@@ -51,6 +51,12 @@ class Changelog {
|
|
|
51
51
|
writable: true,
|
|
52
52
|
value: void 0
|
|
53
53
|
});
|
|
54
|
+
Object.defineProperty(this, "format", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: "compact"
|
|
59
|
+
});
|
|
54
60
|
this.title = title;
|
|
55
61
|
this.description = description;
|
|
56
62
|
}
|
|
@@ -82,6 +88,9 @@ class Changelog {
|
|
|
82
88
|
t.push("");
|
|
83
89
|
}
|
|
84
90
|
t.push(`# ${this.title}`);
|
|
91
|
+
if (this.format === "markdownlint") {
|
|
92
|
+
t.push("");
|
|
93
|
+
}
|
|
85
94
|
const links = [];
|
|
86
95
|
const compareLinks = [];
|
|
87
96
|
const description = this.description.trim() ||
|
|
@@ -90,7 +99,6 @@ class Changelog {
|
|
|
90
99
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
91
100
|
and this project adheres to [Semantic Versioning](http://semver.org/).`;
|
|
92
101
|
if (description) {
|
|
93
|
-
t.push("");
|
|
94
102
|
t.push(description);
|
|
95
103
|
}
|
|
96
104
|
this.releases.forEach((release) => {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Semver } from "./deps.js";
|
|
2
|
+
import Change from "./Change.js";
|
|
3
|
+
import Changelog from "./Changelog.js";
|
|
4
|
+
export default class Release {
|
|
5
|
+
changelog?: Changelog;
|
|
6
|
+
version?: Semver;
|
|
7
|
+
date?: Date;
|
|
8
|
+
yanked: boolean;
|
|
9
|
+
description: string;
|
|
10
|
+
changes: Map<string, Change[]>;
|
|
11
|
+
constructor(version?: string | Semver, date?: string | Date, description?: string);
|
|
12
|
+
compare(release: Release): number;
|
|
13
|
+
isEmpty(): boolean;
|
|
14
|
+
setVersion(version?: string | Semver): void;
|
|
15
|
+
setDate(date?: Date | string): void;
|
|
16
|
+
setYanked(yanked?: boolean): this;
|
|
17
|
+
addChange(type: string, change: Change | string): this;
|
|
18
|
+
added(change: Change | string): this;
|
|
19
|
+
changed(change: Change | string): this;
|
|
20
|
+
deprecated(change: Change | string): this;
|
|
21
|
+
removed(change: Change | string): this;
|
|
22
|
+
fixed(change: Change | string): this;
|
|
23
|
+
security(change: Change | string): this;
|
|
24
|
+
toString(changelog?: Changelog): string;
|
|
25
|
+
getCompareLink(changelog?: Changelog): string | undefined;
|
|
26
|
+
getLinks(changelog: Changelog): string[];
|
|
27
|
+
}
|
package/script/src/Release.js
CHANGED
|
@@ -95,6 +95,10 @@ class Release {
|
|
|
95
95
|
}
|
|
96
96
|
this.date = date;
|
|
97
97
|
}
|
|
98
|
+
setYanked(yanked = true) {
|
|
99
|
+
this.yanked = yanked;
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
98
102
|
addChange(type, change) {
|
|
99
103
|
if (!(change instanceof Change_js_1.default)) {
|
|
100
104
|
change = new Change_js_1.default(change);
|
|
@@ -143,6 +147,9 @@ class Release {
|
|
|
143
147
|
t.push(`## Unreleased${yanked}`);
|
|
144
148
|
}
|
|
145
149
|
}
|
|
150
|
+
if (changelog?.format === "markdownlint") {
|
|
151
|
+
t.push("");
|
|
152
|
+
}
|
|
146
153
|
if (this.description.trim()) {
|
|
147
154
|
t.push(this.description.trim());
|
|
148
155
|
t.push("");
|
|
@@ -150,6 +157,9 @@ class Release {
|
|
|
150
157
|
this.changes.forEach((changes, type) => {
|
|
151
158
|
if (changes.length) {
|
|
152
159
|
t.push(`### ${type[0].toUpperCase()}${type.substring(1)}`);
|
|
160
|
+
if (changelog?.format === "markdownlint") {
|
|
161
|
+
t.push("");
|
|
162
|
+
}
|
|
153
163
|
t = t.concat(changes.map((change) => change.toString()));
|
|
154
164
|
t.push("");
|
|
155
165
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Semver, eq, } from "../deps/deno.land/std@0.173.0/semver/mod.js";
|
package/script/src/deps.js
CHANGED
|
@@ -4,6 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.eq = exports.Semver = void 0;
|
|
7
|
-
var mod_js_1 = require("../deps/deno.land/
|
|
7
|
+
var mod_js_1 = require("../deps/deno.land/std@0.173.0/semver/mod.js");
|
|
8
8
|
Object.defineProperty(exports, "Semver", { enumerable: true, get: function () { return __importDefault(mod_js_1).default; } });
|
|
9
9
|
Object.defineProperty(exports, "eq", { enumerable: true, get: function () { return mod_js_1.eq; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Changelog from "./Changelog.js";
|
|
2
|
+
import Release from "./Release.js";
|
|
3
|
+
export interface Options {
|
|
4
|
+
/**
|
|
5
|
+
* Custom function to create Release instances.
|
|
6
|
+
* Needed if you want to use a custom Release class.
|
|
7
|
+
*/
|
|
8
|
+
releaseCreator: (version?: string, date?: string, description?: string) => Release;
|
|
9
|
+
}
|
|
10
|
+
/** Parse a markdown string */
|
|
11
|
+
export default function parser(markdown: string, options?: Options): Changelog;
|
package/script/src/parser.js
CHANGED
|
@@ -25,7 +25,7 @@ function processTokens(tokens, opts) {
|
|
|
25
25
|
const changelog = new Changelog_js_1.default("");
|
|
26
26
|
changelog.flag = getContent(tokens, "flag");
|
|
27
27
|
changelog.title = getContent(tokens, "h1", true);
|
|
28
|
-
changelog.description =
|
|
28
|
+
changelog.description = getTextContent(tokens);
|
|
29
29
|
//Releases
|
|
30
30
|
let release;
|
|
31
31
|
while ((release = getContent(tokens, "h2").toLowerCase())) {
|
|
@@ -46,7 +46,7 @@ function processTokens(tokens, opts) {
|
|
|
46
46
|
throw new Error(`Syntax error in the release title`);
|
|
47
47
|
}
|
|
48
48
|
changelog.addRelease(release);
|
|
49
|
-
release.description =
|
|
49
|
+
release.description = getTextContent(tokens);
|
|
50
50
|
let type;
|
|
51
51
|
while ((type = getContent(tokens, "h3").toLowerCase())) {
|
|
52
52
|
let change;
|
|
@@ -77,7 +77,8 @@ function processTokens(tokens, opts) {
|
|
|
77
77
|
}
|
|
78
78
|
/** Returns the content of a token */
|
|
79
79
|
function getContent(tokens, type, required = false) {
|
|
80
|
-
|
|
80
|
+
const types = Array.isArray(type) ? type : [type];
|
|
81
|
+
if (!tokens[0] || types.indexOf(tokens[0][1]) === -1) {
|
|
81
82
|
if (required) {
|
|
82
83
|
throw new Error(`Required token missing in: "${tokens[0][0]}"`);
|
|
83
84
|
}
|
|
@@ -85,6 +86,21 @@ function getContent(tokens, type, required = false) {
|
|
|
85
86
|
}
|
|
86
87
|
return tokens.shift()[2].join("\n");
|
|
87
88
|
}
|
|
89
|
+
/** Return the next text content */
|
|
90
|
+
function getTextContent(tokens) {
|
|
91
|
+
const lines = [];
|
|
92
|
+
const types = ["p", "li"];
|
|
93
|
+
while (tokens[0] && types.indexOf(tokens[0][1]) !== -1) {
|
|
94
|
+
const token = tokens.shift();
|
|
95
|
+
if (token[1] === "li") {
|
|
96
|
+
lines.push("- " + token[2].join("\n"));
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
lines.push(token[2].join("\n"));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return lines.join("\n");
|
|
103
|
+
}
|
|
88
104
|
/** Tokenize a markdown string */
|
|
89
105
|
function tokenize(markdown) {
|
|
90
106
|
const tokens = [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|