keep-a-changelog 2.2.1 → 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 +9 -0
- package/README.md +7 -2
- package/esm/_dnt.test_shims.d.ts +5 -0
- package/esm/bin.js +8 -3
- 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 → std@0.189.0}/flags/mod.js +3 -2
- package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/_util.d.ts +3 -0
- package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_util.js +46 -0
- package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/mod.d.ts +3 -1
- package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/mod.js +4 -1
- package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/posix.d.ts +7 -5
- package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/posix.js +50 -108
- package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/win32.d.ts +7 -5
- package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/win32.js +23 -82
- package/esm/test/Change.test.d.ts +1 -0
- package/esm/test/deps.d.ts +1 -0
- 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 +5 -12
- 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 +8 -3
- 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/std@0.189.0/_util/asserts.d.ts +10 -0
- package/script/deps/deno.land/std@0.189.0/_util/os.d.ts +4 -0
- package/script/deps/deno.land/std@0.189.0/flags/mod.d.ts +166 -0
- package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/flags/mod.js +4 -3
- package/script/deps/deno.land/std@0.189.0/path/_constants.d.ts +39 -0
- package/script/deps/deno.land/std@0.189.0/path/_interface.d.ts +26 -0
- package/script/deps/deno.land/std@0.189.0/path/_util.d.ts +11 -0
- package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_util.js +50 -1
- package/script/deps/deno.land/std@0.189.0/path/common.d.ts +13 -0
- package/script/deps/deno.land/std@0.189.0/path/glob.d.ts +83 -0
- package/script/deps/deno.land/std@0.189.0/path/mod.d.ts +11 -0
- package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/mod.js +5 -2
- package/script/deps/deno.land/std@0.189.0/path/posix.d.ts +86 -0
- package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/posix.js +48 -106
- package/script/deps/deno.land/std@0.189.0/path/separator.d.ts +2 -0
- package/script/deps/deno.land/std@0.189.0/path/win32.d.ts +91 -0
- package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/win32.js +22 -81
- 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/Changelog.d.ts +19 -0
- package/script/src/Release.d.ts +27 -0
- package/script/src/deps.d.ts +1 -0
- package/script/src/parser.d.ts +11 -0
- package/script/test/Change.test.d.ts +1 -0
- package/script/test/deps.d.ts +1 -0
- 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/{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 → esm}/deps/deno.land/std@0.173.0/semver/mod.d.ts +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/_util/asserts.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/asserts.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/_util/os.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/os.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/flags/mod.d.ts +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/_constants.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_constants.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/_interface.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_interface.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/common.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/common.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/glob.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/glob.js +0 -0
- /package/{types/deps/deno.land/std@0.173.0 → esm/deps/deno.land/std@0.189.0}/path/separator.d.ts +0 -0
- /package/esm/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/separator.js +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/Changelog.d.ts +0 -0
- /package/{types → esm}/src/Release.d.ts +0 -0
- /package/{types → esm}/src/deps.d.ts +0 -0
- /package/{types → esm}/src/parser.d.ts +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/asserts.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/_util/os.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_constants.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/_interface.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/common.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/glob.js +0 -0
- /package/script/deps/deno.land/{std@0.173.0 → std@0.189.0}/path/separator.js +0 -0
|
@@ -37,15 +37,17 @@ export declare function relative(from: string, to: string): string;
|
|
|
37
37
|
export declare function toNamespacedPath(path: string): string;
|
|
38
38
|
/**
|
|
39
39
|
* Return the directory path of a `path`.
|
|
40
|
-
* @param path to
|
|
40
|
+
* @param path - path to extract the directory from.
|
|
41
41
|
*/
|
|
42
42
|
export declare function dirname(path: string): string;
|
|
43
43
|
/**
|
|
44
|
-
* Return the last portion of a `path`.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* Return the last portion of a `path`.
|
|
45
|
+
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
46
|
+
*
|
|
47
|
+
* @param path - path to extract the name from.
|
|
48
|
+
* @param [suffix] - suffix to remove from extracted name.
|
|
47
49
|
*/
|
|
48
|
-
export declare function basename(path: string,
|
|
50
|
+
export declare function basename(path: string, suffix?: string): string;
|
|
49
51
|
/**
|
|
50
52
|
* Return the extension of the `path` with leading period.
|
|
51
53
|
* @param path with extension
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// Ported from https://github.com/browserify/path-browserify/
|
|
4
4
|
// This module is browser compatible.
|
|
5
5
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
6
|
-
import { CHAR_DOT
|
|
7
|
-
import { _format, assertPath, encodeWhitespace, isPosixPathSeparator, normalizeString, } from "./_util.js";
|
|
6
|
+
import { CHAR_DOT } from "./_constants.js";
|
|
7
|
+
import { _format, assertPath, encodeWhitespace, isPosixPathSeparator, lastPathSegment, normalizeString, stripSuffix, stripTrailingSeparators, } from "./_util.js";
|
|
8
8
|
export const sep = "/";
|
|
9
9
|
export const delimiter = ":";
|
|
10
10
|
// path.resolve([from ...], to)
|
|
@@ -33,7 +33,7 @@ export function resolve(...pathSegments) {
|
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
35
|
resolvedPath = `${path}/${resolvedPath}`;
|
|
36
|
-
resolvedAbsolute = path.charCodeAt(0)
|
|
36
|
+
resolvedAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
37
37
|
}
|
|
38
38
|
// At this point the path should be resolved to a full absolute path, but
|
|
39
39
|
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
@@ -60,8 +60,8 @@ export function normalize(path) {
|
|
|
60
60
|
assertPath(path);
|
|
61
61
|
if (path.length === 0)
|
|
62
62
|
return ".";
|
|
63
|
-
const isAbsolute = path.charCodeAt(0)
|
|
64
|
-
const trailingSeparator = path.charCodeAt(path.length - 1)
|
|
63
|
+
const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
64
|
+
const trailingSeparator = isPosixPathSeparator(path.charCodeAt(path.length - 1));
|
|
65
65
|
// Normalize the path
|
|
66
66
|
path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator);
|
|
67
67
|
if (path.length === 0 && !isAbsolute)
|
|
@@ -78,7 +78,7 @@ export function normalize(path) {
|
|
|
78
78
|
*/
|
|
79
79
|
export function isAbsolute(path) {
|
|
80
80
|
assertPath(path);
|
|
81
|
-
return path.length > 0 && path.charCodeAt(0)
|
|
81
|
+
return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0));
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Join all given a sequence of `paths`,then normalizes the resulting path.
|
|
@@ -120,7 +120,7 @@ export function relative(from, to) {
|
|
|
120
120
|
let fromStart = 1;
|
|
121
121
|
const fromEnd = from.length;
|
|
122
122
|
for (; fromStart < fromEnd; ++fromStart) {
|
|
123
|
-
if (from.charCodeAt(fromStart)
|
|
123
|
+
if (!isPosixPathSeparator(from.charCodeAt(fromStart)))
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
126
|
const fromLen = fromEnd - fromStart;
|
|
@@ -128,7 +128,7 @@ export function relative(from, to) {
|
|
|
128
128
|
let toStart = 1;
|
|
129
129
|
const toEnd = to.length;
|
|
130
130
|
for (; toStart < toEnd; ++toStart) {
|
|
131
|
-
if (to.charCodeAt(toStart)
|
|
131
|
+
if (!isPosixPathSeparator(to.charCodeAt(toStart)))
|
|
132
132
|
break;
|
|
133
133
|
}
|
|
134
134
|
const toLen = toEnd - toStart;
|
|
@@ -139,7 +139,7 @@ export function relative(from, to) {
|
|
|
139
139
|
for (; i <= length; ++i) {
|
|
140
140
|
if (i === length) {
|
|
141
141
|
if (toLen > length) {
|
|
142
|
-
if (to.charCodeAt(toStart + i)
|
|
142
|
+
if (isPosixPathSeparator(to.charCodeAt(toStart + i))) {
|
|
143
143
|
// We get here if `from` is the exact base path for `to`.
|
|
144
144
|
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
|
145
145
|
return to.slice(toStart + i + 1);
|
|
@@ -151,7 +151,7 @@ export function relative(from, to) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
else if (fromLen > length) {
|
|
154
|
-
if (from.charCodeAt(fromStart + i)
|
|
154
|
+
if (isPosixPathSeparator(from.charCodeAt(fromStart + i))) {
|
|
155
155
|
// We get here if `to` is the exact base path for `from`.
|
|
156
156
|
// For example: from='/foo/bar/baz'; to='/foo/bar'
|
|
157
157
|
lastCommonSep = i;
|
|
@@ -168,14 +168,14 @@ export function relative(from, to) {
|
|
|
168
168
|
const toCode = to.charCodeAt(toStart + i);
|
|
169
169
|
if (fromCode !== toCode)
|
|
170
170
|
break;
|
|
171
|
-
else if (fromCode
|
|
171
|
+
else if (isPosixPathSeparator(fromCode))
|
|
172
172
|
lastCommonSep = i;
|
|
173
173
|
}
|
|
174
174
|
let out = "";
|
|
175
175
|
// Generate the relative path based on the path difference between `to`
|
|
176
176
|
// and `from`
|
|
177
177
|
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
178
|
-
if (i === fromEnd || from.charCodeAt(i)
|
|
178
|
+
if (i === fromEnd || isPosixPathSeparator(from.charCodeAt(i))) {
|
|
179
179
|
if (out.length === 0)
|
|
180
180
|
out += "..";
|
|
181
181
|
else
|
|
@@ -188,7 +188,7 @@ export function relative(from, to) {
|
|
|
188
188
|
return out + to.slice(toStart + lastCommonSep);
|
|
189
189
|
else {
|
|
190
190
|
toStart += lastCommonSep;
|
|
191
|
-
if (to.charCodeAt(toStart)
|
|
191
|
+
if (isPosixPathSeparator(to.charCodeAt(toStart)))
|
|
192
192
|
++toStart;
|
|
193
193
|
return to.slice(toStart);
|
|
194
194
|
}
|
|
@@ -203,114 +203,53 @@ export function toNamespacedPath(path) {
|
|
|
203
203
|
}
|
|
204
204
|
/**
|
|
205
205
|
* Return the directory path of a `path`.
|
|
206
|
-
* @param path to
|
|
206
|
+
* @param path - path to extract the directory from.
|
|
207
207
|
*/
|
|
208
208
|
export function dirname(path) {
|
|
209
|
-
assertPath(path);
|
|
210
209
|
if (path.length === 0)
|
|
211
210
|
return ".";
|
|
212
|
-
const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
|
|
213
211
|
let end = -1;
|
|
214
|
-
let
|
|
212
|
+
let matchedNonSeparator = false;
|
|
215
213
|
for (let i = path.length - 1; i >= 1; --i) {
|
|
216
|
-
if (path.charCodeAt(i)
|
|
217
|
-
if (
|
|
214
|
+
if (isPosixPathSeparator(path.charCodeAt(i))) {
|
|
215
|
+
if (matchedNonSeparator) {
|
|
218
216
|
end = i;
|
|
219
217
|
break;
|
|
220
218
|
}
|
|
221
219
|
}
|
|
222
220
|
else {
|
|
223
|
-
|
|
224
|
-
matchedSlash = false;
|
|
221
|
+
matchedNonSeparator = true;
|
|
225
222
|
}
|
|
226
223
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
224
|
+
// No matches. Fallback based on provided path:
|
|
225
|
+
//
|
|
226
|
+
// - leading slashes paths
|
|
227
|
+
// "/foo" => "/"
|
|
228
|
+
// "///foo" => "/"
|
|
229
|
+
// - no slash path
|
|
230
|
+
// "foo" => "."
|
|
231
|
+
if (end === -1) {
|
|
232
|
+
return isPosixPathSeparator(path.charCodeAt(0)) ? "/" : ".";
|
|
233
|
+
}
|
|
234
|
+
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
232
235
|
}
|
|
233
236
|
/**
|
|
234
|
-
* Return the last portion of a `path`.
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
+
* Return the last portion of a `path`.
|
|
238
|
+
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
239
|
+
*
|
|
240
|
+
* @param path - path to extract the name from.
|
|
241
|
+
* @param [suffix] - suffix to remove from extracted name.
|
|
237
242
|
*/
|
|
238
|
-
export function basename(path,
|
|
239
|
-
if (ext !== undefined && typeof ext !== "string") {
|
|
240
|
-
throw new TypeError('"ext" argument must be a string');
|
|
241
|
-
}
|
|
243
|
+
export function basename(path, suffix = "") {
|
|
242
244
|
assertPath(path);
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
|
248
|
-
if (ext.length === path.length && ext === path)
|
|
249
|
-
return "";
|
|
250
|
-
let extIdx = ext.length - 1;
|
|
251
|
-
let firstNonSlashEnd = -1;
|
|
252
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
253
|
-
const code = path.charCodeAt(i);
|
|
254
|
-
if (isPosixPathSeparator(code)) {
|
|
255
|
-
// If we reached a path separator that was not part of a set of path
|
|
256
|
-
// separators at the end of the string, stop now
|
|
257
|
-
if (!matchedSlash) {
|
|
258
|
-
start = i + 1;
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
if (firstNonSlashEnd === -1) {
|
|
264
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
265
|
-
// path component in case we don't match a whole suffix
|
|
266
|
-
matchedSlash = false;
|
|
267
|
-
firstNonSlashEnd = i + 1;
|
|
268
|
-
end = firstNonSlashEnd;
|
|
269
|
-
}
|
|
270
|
-
if (extIdx >= 0) {
|
|
271
|
-
// Try to match the explicit suffix
|
|
272
|
-
if (code === ext.charCodeAt(extIdx)) {
|
|
273
|
-
if (--extIdx === -1) {
|
|
274
|
-
// We matched whole suffix, so mark this as the end of our path
|
|
275
|
-
// component
|
|
276
|
-
end = i;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
// Suffix character does not match, so bail out early
|
|
281
|
-
// from checking rest of characters
|
|
282
|
-
extIdx = -1;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
if (end === -1)
|
|
288
|
-
return "";
|
|
289
|
-
if (start === end)
|
|
290
|
-
end = firstNonSlashEnd;
|
|
291
|
-
return path.slice(start, end);
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
295
|
-
if (isPosixPathSeparator(path.charCodeAt(i))) {
|
|
296
|
-
// If we reached a path separator that was not part of a set of path
|
|
297
|
-
// separators at the end of the string, stop now
|
|
298
|
-
if (!matchedSlash) {
|
|
299
|
-
start = i + 1;
|
|
300
|
-
break;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
else if (end === -1) {
|
|
304
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
305
|
-
// path component
|
|
306
|
-
matchedSlash = false;
|
|
307
|
-
end = i + 1;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
if (end === -1)
|
|
311
|
-
return "";
|
|
312
|
-
return path.slice(start, end);
|
|
245
|
+
if (path.length === 0)
|
|
246
|
+
return path;
|
|
247
|
+
if (typeof suffix !== "string") {
|
|
248
|
+
throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
|
|
313
249
|
}
|
|
250
|
+
const lastSegment = lastPathSegment(path, isPosixPathSeparator);
|
|
251
|
+
const strippedSegment = stripTrailingSeparators(lastSegment, isPosixPathSeparator);
|
|
252
|
+
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
314
253
|
}
|
|
315
254
|
/**
|
|
316
255
|
* Return the extension of the `path` with leading period.
|
|
@@ -328,7 +267,7 @@ export function extname(path) {
|
|
|
328
267
|
let preDotState = 0;
|
|
329
268
|
for (let i = path.length - 1; i >= 0; --i) {
|
|
330
269
|
const code = path.charCodeAt(i);
|
|
331
|
-
if (code
|
|
270
|
+
if (isPosixPathSeparator(code)) {
|
|
332
271
|
// If we reached a path separator that was not part of a set of path
|
|
333
272
|
// separators at the end of the string, stop now
|
|
334
273
|
if (!matchedSlash) {
|
|
@@ -385,7 +324,7 @@ export function parse(path) {
|
|
|
385
324
|
const ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
386
325
|
if (path.length === 0)
|
|
387
326
|
return ret;
|
|
388
|
-
const isAbsolute = path.charCodeAt(0)
|
|
327
|
+
const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
389
328
|
let start;
|
|
390
329
|
if (isAbsolute) {
|
|
391
330
|
ret.root = "/";
|
|
@@ -405,7 +344,7 @@ export function parse(path) {
|
|
|
405
344
|
// Get non-dir info
|
|
406
345
|
for (; i >= start; --i) {
|
|
407
346
|
const code = path.charCodeAt(i);
|
|
408
|
-
if (code
|
|
347
|
+
if (isPosixPathSeparator(code)) {
|
|
409
348
|
// If we reached a path separator that was not part of a set of path
|
|
410
349
|
// separators at the end of the string, stop now
|
|
411
350
|
if (!matchedSlash) {
|
|
@@ -447,6 +386,8 @@ export function parse(path) {
|
|
|
447
386
|
ret.base = ret.name = path.slice(startPart, end);
|
|
448
387
|
}
|
|
449
388
|
}
|
|
389
|
+
// Fallback to '/' in case there is no basename
|
|
390
|
+
ret.base = ret.base || "/";
|
|
450
391
|
}
|
|
451
392
|
else {
|
|
452
393
|
if (startPart === 0 && isAbsolute) {
|
|
@@ -459,8 +400,9 @@ export function parse(path) {
|
|
|
459
400
|
}
|
|
460
401
|
ret.ext = path.slice(startDot, end);
|
|
461
402
|
}
|
|
462
|
-
if (startPart > 0)
|
|
463
|
-
ret.dir = path.slice(0, startPart - 1);
|
|
403
|
+
if (startPart > 0) {
|
|
404
|
+
ret.dir = stripTrailingSeparators(path.slice(0, startPart - 1), isPosixPathSeparator);
|
|
405
|
+
}
|
|
464
406
|
else if (isAbsolute)
|
|
465
407
|
ret.dir = "/";
|
|
466
408
|
return ret;
|
|
@@ -38,15 +38,17 @@ export declare function relative(from: string, to: string): string;
|
|
|
38
38
|
export declare function toNamespacedPath(path: string): string;
|
|
39
39
|
/**
|
|
40
40
|
* Return the directory path of a `path`.
|
|
41
|
-
* @param path to
|
|
41
|
+
* @param path - path to extract the directory from.
|
|
42
42
|
*/
|
|
43
43
|
export declare function dirname(path: string): string;
|
|
44
44
|
/**
|
|
45
|
-
* Return the last portion of a `path`.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
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.
|
|
48
50
|
*/
|
|
49
|
-
export declare function basename(path: string,
|
|
51
|
+
export declare function basename(path: string, suffix?: string): string;
|
|
50
52
|
/**
|
|
51
53
|
* Return the extension of the `path` with leading period.
|
|
52
54
|
* @param path with extension
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// This module is browser compatible.
|
|
5
5
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
6
6
|
import { CHAR_BACKWARD_SLASH, CHAR_COLON, CHAR_DOT, CHAR_QUESTION_MARK, } from "./_constants.js";
|
|
7
|
-
import { _format, assertPath, encodeWhitespace, isPathSeparator, isWindowsDeviceRoot, normalizeString, } from "./_util.js";
|
|
7
|
+
import { _format, assertPath, encodeWhitespace, isPathSeparator, isPosixPathSeparator, isWindowsDeviceRoot, lastPathSegment, normalizeString, stripSuffix, stripTrailingSeparators, } from "./_util.js";
|
|
8
8
|
import { assert } from "../_util/asserts.js";
|
|
9
9
|
export const sep = "\\";
|
|
10
10
|
export const delimiter = ";";
|
|
@@ -508,7 +508,7 @@ export function toNamespacedPath(path) {
|
|
|
508
508
|
}
|
|
509
509
|
/**
|
|
510
510
|
* Return the directory path of a `path`.
|
|
511
|
-
* @param path to
|
|
511
|
+
* @param path - path to extract the directory from.
|
|
512
512
|
*/
|
|
513
513
|
export function dirname(path) {
|
|
514
514
|
assertPath(path);
|
|
@@ -598,25 +598,26 @@ export function dirname(path) {
|
|
|
598
598
|
else
|
|
599
599
|
end = rootEnd;
|
|
600
600
|
}
|
|
601
|
-
return path.slice(0, end);
|
|
601
|
+
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
602
602
|
}
|
|
603
603
|
/**
|
|
604
|
-
* Return the last portion of a `path`.
|
|
605
|
-
*
|
|
606
|
-
*
|
|
604
|
+
* Return the last portion of a `path`.
|
|
605
|
+
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
606
|
+
*
|
|
607
|
+
* @param path - path to extract name from.
|
|
608
|
+
* @param [suffix] - suffix to remove from extracted name.
|
|
607
609
|
*/
|
|
608
|
-
export function basename(path,
|
|
609
|
-
if (ext !== undefined && typeof ext !== "string") {
|
|
610
|
-
throw new TypeError('"ext" argument must be a string');
|
|
611
|
-
}
|
|
610
|
+
export function basename(path, suffix = "") {
|
|
612
611
|
assertPath(path);
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
612
|
+
if (path.length === 0)
|
|
613
|
+
return path;
|
|
614
|
+
if (typeof suffix !== "string") {
|
|
615
|
+
throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
|
|
616
|
+
}
|
|
617
617
|
// Check for a drive letter prefix so as not to mistake the following
|
|
618
618
|
// path separator as an extra separator at the end of the path that can be
|
|
619
619
|
// disregarded
|
|
620
|
+
let start = 0;
|
|
620
621
|
if (path.length >= 2) {
|
|
621
622
|
const drive = path.charCodeAt(0);
|
|
622
623
|
if (isWindowsDeviceRoot(drive)) {
|
|
@@ -624,73 +625,9 @@ export function basename(path, ext = "") {
|
|
|
624
625
|
start = 2;
|
|
625
626
|
}
|
|
626
627
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
let extIdx = ext.length - 1;
|
|
631
|
-
let firstNonSlashEnd = -1;
|
|
632
|
-
for (i = path.length - 1; i >= start; --i) {
|
|
633
|
-
const code = path.charCodeAt(i);
|
|
634
|
-
if (isPathSeparator(code)) {
|
|
635
|
-
// If we reached a path separator that was not part of a set of path
|
|
636
|
-
// separators at the end of the string, stop now
|
|
637
|
-
if (!matchedSlash) {
|
|
638
|
-
start = i + 1;
|
|
639
|
-
break;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
else {
|
|
643
|
-
if (firstNonSlashEnd === -1) {
|
|
644
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
645
|
-
// path component in case we don't match a whole suffix
|
|
646
|
-
matchedSlash = false;
|
|
647
|
-
firstNonSlashEnd = i + 1;
|
|
648
|
-
end = firstNonSlashEnd;
|
|
649
|
-
}
|
|
650
|
-
if (extIdx >= 0) {
|
|
651
|
-
// Try to match the explicit suffix
|
|
652
|
-
if (code === ext.charCodeAt(extIdx)) {
|
|
653
|
-
if (--extIdx === -1) {
|
|
654
|
-
// We matched whole suffix, so mark this as the end of our path
|
|
655
|
-
// component
|
|
656
|
-
end = i;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
else {
|
|
660
|
-
// Suffix character does not match, so bail out early
|
|
661
|
-
// from checking rest of characters
|
|
662
|
-
extIdx = -1;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
if (end === -1)
|
|
668
|
-
return "";
|
|
669
|
-
if (start === end)
|
|
670
|
-
end = firstNonSlashEnd;
|
|
671
|
-
return path.slice(start, end);
|
|
672
|
-
}
|
|
673
|
-
else {
|
|
674
|
-
for (i = path.length - 1; i >= start; --i) {
|
|
675
|
-
if (isPathSeparator(path.charCodeAt(i))) {
|
|
676
|
-
// If we reached a path separator that was not part of a set of path
|
|
677
|
-
// separators at the end of the string, stop now
|
|
678
|
-
if (!matchedSlash) {
|
|
679
|
-
start = i + 1;
|
|
680
|
-
break;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
else if (end === -1) {
|
|
684
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
685
|
-
// path component
|
|
686
|
-
matchedSlash = false;
|
|
687
|
-
end = i + 1;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
if (end === -1)
|
|
691
|
-
return "";
|
|
692
|
-
return path.slice(start, end);
|
|
693
|
-
}
|
|
628
|
+
const lastSegment = lastPathSegment(path, isPathSeparator, start);
|
|
629
|
+
const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator);
|
|
630
|
+
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
694
631
|
}
|
|
695
632
|
/**
|
|
696
633
|
* Return the extension of the `path` with leading period.
|
|
@@ -829,13 +766,14 @@ export function parse(path) {
|
|
|
829
766
|
// `path` contains just a drive root, exit early to avoid
|
|
830
767
|
// unnecessary work
|
|
831
768
|
ret.root = ret.dir = path;
|
|
769
|
+
ret.base = "\\";
|
|
832
770
|
return ret;
|
|
833
771
|
}
|
|
834
772
|
rootEnd = 3;
|
|
835
773
|
}
|
|
836
774
|
}
|
|
837
775
|
else {
|
|
838
|
-
// `path` contains just a drive root, exit early to avoid
|
|
776
|
+
// `path` contains just a relative drive root, exit early to avoid
|
|
839
777
|
// unnecessary work
|
|
840
778
|
ret.root = ret.dir = path;
|
|
841
779
|
return ret;
|
|
@@ -847,6 +785,7 @@ export function parse(path) {
|
|
|
847
785
|
// `path` contains just a path separator, exit early to avoid
|
|
848
786
|
// unnecessary work
|
|
849
787
|
ret.root = ret.dir = path;
|
|
788
|
+
ret.base = "\\";
|
|
850
789
|
return ret;
|
|
851
790
|
}
|
|
852
791
|
if (rootEnd > 0)
|
|
@@ -905,6 +844,8 @@ export function parse(path) {
|
|
|
905
844
|
ret.base = path.slice(startPart, end);
|
|
906
845
|
ret.ext = path.slice(startDot, end);
|
|
907
846
|
}
|
|
847
|
+
// Fallback to '\' in case there is no basename
|
|
848
|
+
ret.base = ret.base || "\\";
|
|
908
849
|
// If the directory is the root, use the entire root as the `dir` including
|
|
909
850
|
// the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
|
|
910
851
|
// trailing slash (`C:\abc\def` -> `C:\abc`).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../deps/deno.land/std@0.133.0/testing/asserts.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Change, Release } from "../../mod.js";
|
|
2
|
+
import { Semver } from "../../src/deps.js";
|
|
3
|
+
declare class CustomRelease extends Release {
|
|
4
|
+
constructor(version?: Semver | string, date?: Date | string, description?: string);
|
|
5
|
+
maintenance(change: string | Change): this;
|
|
6
|
+
}
|
|
7
|
+
export default function (version?: Semver | string, date?: Date | string, description?: string): CustomRelease;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"module": "./esm/mod.js",
|
|
3
3
|
"main": "./script/mod.js",
|
|
4
|
-
"types": "./types/mod.d.ts",
|
|
5
4
|
"bin": {
|
|
6
5
|
"changelog": "./esm/bin.js"
|
|
7
6
|
},
|
|
8
7
|
"name": "keep-a-changelog",
|
|
9
|
-
"version": "2.
|
|
8
|
+
"version": "2.3.0",
|
|
10
9
|
"description": "Node package to parse and generate changelogs following the [keepachangelog](http://keepachangelog.com/en/1.0.0/) format.",
|
|
11
10
|
"homepage": "https://github.com/oscarotero/keep-a-changelog#readme",
|
|
12
11
|
"license": "MIT",
|
|
@@ -25,24 +24,18 @@
|
|
|
25
24
|
},
|
|
26
25
|
"exports": {
|
|
27
26
|
".": {
|
|
28
|
-
"import":
|
|
29
|
-
|
|
30
|
-
"default": "./esm/mod.js"
|
|
31
|
-
},
|
|
32
|
-
"require": {
|
|
33
|
-
"types": "./types/mod.d.ts",
|
|
34
|
-
"default": "./script/mod.js"
|
|
35
|
-
}
|
|
27
|
+
"import": "./esm/mod.js",
|
|
28
|
+
"require": "./script/mod.js"
|
|
36
29
|
}
|
|
37
30
|
},
|
|
38
31
|
"scripts": {
|
|
39
32
|
"test": "node test_runner.js"
|
|
40
33
|
},
|
|
41
34
|
"dependencies": {
|
|
42
|
-
"@deno/shim-deno": "~0.
|
|
35
|
+
"@deno/shim-deno": "~0.16.1"
|
|
43
36
|
},
|
|
44
37
|
"devDependencies": {
|
|
45
38
|
"@types/node": "^18.11.9",
|
|
46
|
-
"
|
|
39
|
+
"picocolors": "^1.0.0"
|
|
47
40
|
}
|
|
48
41
|
}
|
package/script/bin.d.ts
ADDED
package/script/bin.js
CHANGED
|
@@ -26,20 +26,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
require("./_dnt.polyfills.js");
|
|
28
28
|
const dntShim = __importStar(require("./_dnt.shims.js"));
|
|
29
|
-
const mod_js_1 = require("./deps/deno.land/std@0.
|
|
29
|
+
const mod_js_1 = require("./deps/deno.land/std@0.189.0/path/mod.js");
|
|
30
30
|
const mod_js_2 = require("./mod.js");
|
|
31
|
-
const mod_js_3 = require("./deps/deno.land/std@0.
|
|
31
|
+
const mod_js_3 = require("./deps/deno.land/std@0.189.0/flags/mod.js");
|
|
32
32
|
const mod_js_4 = require("./deps/deno.land/x/ini@v2.1.0/mod.js");
|
|
33
33
|
const argv = (0, mod_js_3.parse)(dntShim.Deno.args, {
|
|
34
34
|
default: {
|
|
35
35
|
file: "CHANGELOG.md",
|
|
36
36
|
format: "compact",
|
|
37
37
|
release: null,
|
|
38
|
+
create: null,
|
|
38
39
|
url: null,
|
|
39
40
|
https: true,
|
|
40
41
|
quiet: false,
|
|
41
42
|
},
|
|
42
|
-
string: ["file", "format", "
|
|
43
|
+
string: ["file", "format", "url"],
|
|
43
44
|
boolean: ["https", "init", "latest-release", "quiet"],
|
|
44
45
|
});
|
|
45
46
|
const file = (0, mod_js_1.join)(dntShim.Deno.cwd(), argv.file);
|
|
@@ -80,6 +81,10 @@ try {
|
|
|
80
81
|
dntShim.Deno.exit(1);
|
|
81
82
|
}
|
|
82
83
|
}
|
|
84
|
+
if (argv.create) {
|
|
85
|
+
const version = typeof argv.create === "string" ? argv.create : undefined;
|
|
86
|
+
changelog.addRelease(new mod_js_2.Release(version));
|
|
87
|
+
}
|
|
83
88
|
if (!changelog.url) {
|
|
84
89
|
if (argv.url) {
|
|
85
90
|
changelog.url = argv.url;
|