keep-a-changelog 2.0.1 → 2.2.1
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 +21 -6
- package/esm/_dnt.polyfills.js +15 -0
- package/esm/bin.js +9 -4
- package/esm/deps/deno.land/std@0.173.0/_util/asserts.js +21 -0
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/_util/os.js +4 -1
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/flags/mod.js +145 -36
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_constants.js +1 -0
- package/esm/deps/deno.land/std@0.173.0/path/_interface.js +3 -0
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_util.js +1 -0
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/common.js +1 -1
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/glob.js +1 -1
- package/esm/deps/deno.land/std@0.173.0/path/mod.js +32 -0
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/posix.js +23 -16
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/separator.js +1 -1
- package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/win32.js +20 -15
- package/esm/deps/{deno_land/x/semver_v1.4.0 → deno.land/std@0.173.0/semver}/mod.js +227 -334
- package/esm/deps/{deno_land/std_0.51.0 → deno.land/std@0.51.0}/fs/eol.js +0 -0
- package/esm/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/ini.js +1 -1
- package/esm/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/mod.js +0 -0
- package/esm/mod.js +1 -0
- package/esm/src/Change.js +15 -15
- package/esm/src/Changelog.js +9 -1
- package/esm/src/Release.js +21 -4
- package/esm/src/deps.js +1 -1
- package/esm/src/parser.js +24 -5
- package/esm/test/changelog.custom.type.md +0 -1
- package/esm/test/changelog.expected.linted.md +208 -0
- package/esm/test/changelog.expected.md +6 -4
- package/esm/test/changelog.md +7 -3
- package/esm/test/empty.expected.md +0 -1
- package/package.json +13 -8
- package/script/_dnt.polyfills.js +16 -0
- package/script/_dnt.shims.js +66 -0
- package/script/bin.js +144 -0
- package/script/deps/deno.land/std@0.173.0/_util/asserts.js +27 -0
- package/script/deps/deno.land/std@0.173.0/_util/os.js +44 -0
- package/script/deps/deno.land/std@0.173.0/flags/mod.js +368 -0
- package/script/deps/deno.land/std@0.173.0/path/_constants.js +49 -0
- package/script/deps/deno.land/std@0.173.0/path/_interface.js +4 -0
- package/script/deps/deno.land/std@0.173.0/path/_util.js +125 -0
- package/script/deps/deno.land/std@0.173.0/path/common.js +40 -0
- package/script/deps/deno.land/std@0.173.0/path/glob.js +391 -0
- package/script/deps/deno.land/std@0.173.0/path/mod.js +63 -0
- package/script/deps/deno.land/std@0.173.0/path/posix.js +539 -0
- package/script/deps/deno.land/std@0.173.0/path/separator.js +8 -0
- package/script/deps/deno.land/std@0.173.0/path/win32.js +1007 -0
- package/script/deps/deno.land/std@0.173.0/semver/mod.js +1458 -0
- package/script/deps/deno.land/std@0.51.0/fs/eol.js +34 -0
- package/script/deps/deno.land/x/ini@v2.1.0/ini.js +256 -0
- package/script/deps/deno.land/x/ini@v2.1.0/mod.js +17 -0
- package/script/mod.js +15 -0
- package/{umd → script}/package.json +0 -0
- package/script/src/Change.js +51 -0
- package/script/src/Changelog.js +148 -0
- package/script/src/Release.js +227 -0
- package/script/src/deps.js +9 -0
- package/script/src/parser.js +184 -0
- package/{umd → script}/test/changelog.custom.type.md +0 -1
- package/script/test/changelog.expected.linted.md +208 -0
- package/{umd → script}/test/changelog.expected.md +6 -4
- package/{umd → script}/test/changelog.md +7 -3
- package/{umd → script}/test/empty.expected.md +0 -1
- package/types/_dnt.polyfills.d.ts +11 -0
- package/types/_dnt.shims.d.ts +0 -4
- package/types/bin.d.ts +1 -1
- package/types/deps/deno.land/std@0.173.0/_util/asserts.d.ts +10 -0
- package/types/deps/deno.land/std@0.173.0/_util/os.d.ts +4 -0
- package/types/deps/deno.land/std@0.173.0/flags/mod.d.ts +166 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_constants.d.ts +0 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_interface.d.ts +1 -1
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_util.d.ts +0 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/common.d.ts +0 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/glob.d.ts +10 -5
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/mod.d.ts +0 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/posix.d.ts +9 -5
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/separator.d.ts +0 -0
- package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/win32.d.ts +7 -5
- package/types/deps/deno.land/std@0.173.0/semver/mod.d.ts +398 -0
- package/types/deps/{deno_land/std_0.51.0 → deno.land/std@0.51.0}/fs/eol.d.ts +0 -0
- package/types/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/ini.d.ts +0 -0
- package/types/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/mod.d.ts +0 -0
- package/types/mod.d.ts +1 -0
- package/types/src/Changelog.d.ts +1 -0
- package/types/src/Release.d.ts +2 -0
- package/types/src/deps.d.ts +1 -1
- 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/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/umd/_dnt.shims.js +0 -76
- package/umd/bin.js +0 -145
- package/umd/deps/deno_land/std_0.120.0/_util/assert.js +0 -28
- package/umd/deps/deno_land/std_0.120.0/_util/os.js +0 -47
- package/umd/deps/deno_land/std_0.120.0/flags/mod.js +0 -269
- package/umd/deps/deno_land/std_0.120.0/path/_constants.js +0 -58
- package/umd/deps/deno_land/std_0.120.0/path/_interface.js +0 -14
- package/umd/deps/deno_land/std_0.120.0/path/_util.js +0 -134
- package/umd/deps/deno_land/std_0.120.0/path/common.js +0 -50
- package/umd/deps/deno_land/std_0.120.0/path/glob.js +0 -397
- package/umd/deps/deno_land/std_0.120.0/path/mod.js +0 -51
- package/umd/deps/deno_land/std_0.120.0/path/posix.js +0 -538
- package/umd/deps/deno_land/std_0.120.0/path/separator.js +0 -18
- package/umd/deps/deno_land/std_0.120.0/path/win32.js +0 -1008
- package/umd/deps/deno_land/std_0.51.0/fs/eol.js +0 -44
- package/umd/deps/deno_land/x/ini_v2.1.0/ini.js +0 -262
- package/umd/deps/deno_land/x/ini_v2.1.0/mod.js +0 -23
- package/umd/deps/deno_land/x/semver_v1.4.0/mod.js +0 -1578
- package/umd/mod.js +0 -24
- package/umd/src/Change.js +0 -61
- package/umd/src/Changelog.js +0 -150
- package/umd/src/Release.js +0 -220
- package/umd/src/deps.js +0 -19
- package/umd/src/parser.js +0 -175
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.format = exports.detect = exports.EOL = void 0;
|
|
5
|
+
/** EndOfLine character enum */
|
|
6
|
+
var EOL;
|
|
7
|
+
(function (EOL) {
|
|
8
|
+
EOL["LF"] = "\n";
|
|
9
|
+
EOL["CRLF"] = "\r\n";
|
|
10
|
+
})(EOL = exports.EOL || (exports.EOL = {}));
|
|
11
|
+
const regDetect = /(?:\r?\n)/g;
|
|
12
|
+
/**
|
|
13
|
+
* Detect the EOL character for string input.
|
|
14
|
+
* returns null if no newline
|
|
15
|
+
*/
|
|
16
|
+
function detect(content) {
|
|
17
|
+
const d = content.match(regDetect);
|
|
18
|
+
if (!d || d.length === 0) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const crlf = d.filter((x) => x === EOL.CRLF);
|
|
22
|
+
if (crlf.length > 0) {
|
|
23
|
+
return EOL.CRLF;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return EOL.LF;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.detect = detect;
|
|
30
|
+
/** Format the file to the targeted EOL */
|
|
31
|
+
function format(content, eol) {
|
|
32
|
+
return content.replace(regDetect, eol);
|
|
33
|
+
}
|
|
34
|
+
exports.format = format;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.unsafe = exports.safe = exports.decode = exports.encode = exports.stringify = exports.parse = void 0;
|
|
27
|
+
const dntShim = __importStar(require("../../../../_dnt.shims.js"));
|
|
28
|
+
const eol = __importStar(require("../../std@0.51.0/fs/eol.js"));
|
|
29
|
+
const isWindows = dntShim.Deno.build.os == "windows";
|
|
30
|
+
const EOL = isWindows ? eol.EOL.CRLF : eol.EOL.LF;
|
|
31
|
+
exports.parse = decode;
|
|
32
|
+
exports.stringify = encode;
|
|
33
|
+
/**
|
|
34
|
+
* Encode the object `object` into an ini-style formatted string. If the
|
|
35
|
+
* optional parameter `section` is given, then all top-level properties
|
|
36
|
+
* of the object are put into this section and the `section`-string is
|
|
37
|
+
* prepended to all sub-sections, see the usage example above.
|
|
38
|
+
*
|
|
39
|
+
* The `options` object may contain the following:
|
|
40
|
+
* - `section` A string which will be the first `section` in the encoded
|
|
41
|
+
* ini data. Defaults to none.
|
|
42
|
+
* - `whitespace` Boolean to specify whether to put whitespace around the
|
|
43
|
+
* `=` character. By default, whitespace is omitted, to be friendly to
|
|
44
|
+
* some persnickety old parsers that don't tolerate it well. But some
|
|
45
|
+
* find that it's more human-readable and pretty with the whitespace.
|
|
46
|
+
*
|
|
47
|
+
* For backwards compatibility reasons, if a `string` options is passed,
|
|
48
|
+
* then it is assumed to be the `section` value.
|
|
49
|
+
*
|
|
50
|
+
* @param obj Object to encode
|
|
51
|
+
* @param opt Encoding options
|
|
52
|
+
*/
|
|
53
|
+
function encode(obj, opt = { whitespace: false }) {
|
|
54
|
+
const children = [];
|
|
55
|
+
let out = '';
|
|
56
|
+
let options = typeof opt === 'string' ? { section: opt, whitespace: false } : opt;
|
|
57
|
+
const separator = options.whitespace ? ' = ' : '=';
|
|
58
|
+
Object.keys(obj).forEach(function (k, _, __) {
|
|
59
|
+
const val = obj[k];
|
|
60
|
+
if (val && Array.isArray(val)) {
|
|
61
|
+
val.forEach(function (item) {
|
|
62
|
+
out += safe(k + '[]') + separator + safe(item) + EOL;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else if (val && typeof val === 'object') {
|
|
66
|
+
children.push(k);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
out += safe(k) + separator + safe(val) + EOL;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
if (options.section && out.length) {
|
|
73
|
+
out = '[' + safe(options.section) + ']' + EOL + out;
|
|
74
|
+
}
|
|
75
|
+
children.forEach(function (k, _, __) {
|
|
76
|
+
const nk = dotSplit(k).join('\\.');
|
|
77
|
+
const section = (options.section ? options.section + '.' : '') + nk;
|
|
78
|
+
const child = encode(obj[k], {
|
|
79
|
+
section: section,
|
|
80
|
+
whitespace: options.whitespace
|
|
81
|
+
});
|
|
82
|
+
if (out.length && child.length) {
|
|
83
|
+
out += EOL;
|
|
84
|
+
}
|
|
85
|
+
out += child;
|
|
86
|
+
});
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
exports.encode = encode;
|
|
90
|
+
function dotSplit(str) {
|
|
91
|
+
return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
|
|
92
|
+
.replace(/\\\./g, '\u0001')
|
|
93
|
+
.split(/\./).map(function (part) {
|
|
94
|
+
return part.replace(/\1/g, '\\.')
|
|
95
|
+
.replace(/\2LITERAL\\1LITERAL\2/g, '\u0001');
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Decode the given ini-style formatted document into a nested object.
|
|
100
|
+
* @param str ini-style document
|
|
101
|
+
*/
|
|
102
|
+
function decode(str) {
|
|
103
|
+
const out = {};
|
|
104
|
+
let p = out;
|
|
105
|
+
// section |key = value
|
|
106
|
+
const re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
|
|
107
|
+
const lines = str.split(/[\r\n]+/g);
|
|
108
|
+
lines.forEach(function (line, _, __) {
|
|
109
|
+
if (!line || line.match(/^\s*[;#]/))
|
|
110
|
+
return;
|
|
111
|
+
const match = line.match(re);
|
|
112
|
+
if (!match)
|
|
113
|
+
return;
|
|
114
|
+
if (match[1] !== undefined) {
|
|
115
|
+
let section = unsafe(match[1]);
|
|
116
|
+
p = out[section] = out[section] || {};
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
let key = unsafe(match[2]);
|
|
120
|
+
let value = match[3] ? unsafe(match[4]) : true;
|
|
121
|
+
switch (value) {
|
|
122
|
+
case 'true':
|
|
123
|
+
case 'false':
|
|
124
|
+
case 'null': value = JSON.parse(value);
|
|
125
|
+
}
|
|
126
|
+
const valueAsFloat = parseFloat(`${value}`);
|
|
127
|
+
if (!Number.isNaN(valueAsFloat)) {
|
|
128
|
+
value = valueAsFloat;
|
|
129
|
+
}
|
|
130
|
+
// Convert keys with '[]' suffix to an array
|
|
131
|
+
if (key.length > 2 && key.slice(-2) === '[]') {
|
|
132
|
+
key = key.substring(0, key.length - 2);
|
|
133
|
+
if (!p[key]) {
|
|
134
|
+
p[key] = [];
|
|
135
|
+
}
|
|
136
|
+
else if (!Array.isArray(p[key])) {
|
|
137
|
+
p[key] = [p[key]];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// safeguard against resetting a previously defined
|
|
141
|
+
// array by accidentally forgetting the brackets
|
|
142
|
+
if (Array.isArray(p[key])) {
|
|
143
|
+
p[key].push(value);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
p[key] = value;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
// {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
|
|
150
|
+
// use a filter to return the keys that have to be deleted.
|
|
151
|
+
Object.keys(out).filter(function (k, _, __) {
|
|
152
|
+
if (!out[k] ||
|
|
153
|
+
typeof out[k] !== 'object' ||
|
|
154
|
+
Array.isArray(out[k])) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
// see if the parent section is also an object.
|
|
158
|
+
// if so, add it to that, and mark this one for deletion
|
|
159
|
+
const parts = dotSplit(k);
|
|
160
|
+
let parentSection = out;
|
|
161
|
+
const lastPart = parts.pop() ?? '';
|
|
162
|
+
const nl = lastPart.replace(/\\\./g, '.');
|
|
163
|
+
parts.forEach(function (part, _, __) {
|
|
164
|
+
if (!parentSection[part] || typeof parentSection[part] !== 'object')
|
|
165
|
+
parentSection[part] = {};
|
|
166
|
+
parentSection = parentSection[part];
|
|
167
|
+
});
|
|
168
|
+
if (parentSection === out && nl === lastPart) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
parentSection[nl] = out[k];
|
|
172
|
+
return true;
|
|
173
|
+
}).forEach(function (del, _, __) {
|
|
174
|
+
delete out[del];
|
|
175
|
+
});
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
exports.decode = decode;
|
|
179
|
+
function isQuoted(val) {
|
|
180
|
+
return (val.charAt(0) === '"' && val.slice(-1) === '"') ||
|
|
181
|
+
(val.charAt(0) === "'" && val.slice(-1) === "'");
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Escapes the string `val` such that it is safe to be used as a key or
|
|
185
|
+
* value in an ini-file. Basically escapes quotes. For example:
|
|
186
|
+
*
|
|
187
|
+
* ```javascript
|
|
188
|
+
* ini.safe('"unsafe string"')
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* would result in
|
|
192
|
+
*
|
|
193
|
+
* ```javascript
|
|
194
|
+
* "\"unsafe string\""
|
|
195
|
+
* ```
|
|
196
|
+
* @param val String to escape
|
|
197
|
+
*/
|
|
198
|
+
function safe(val) {
|
|
199
|
+
return (typeof val !== 'string' ||
|
|
200
|
+
val.match(/[=\r\n]/) ||
|
|
201
|
+
val.match(/^\[/) ||
|
|
202
|
+
(val.length > 1 && isQuoted(val)) ||
|
|
203
|
+
val !== val.trim())
|
|
204
|
+
? JSON.stringify(val)
|
|
205
|
+
: val.replace(/;/g, '\\;').replace(/#/g, '\\#');
|
|
206
|
+
}
|
|
207
|
+
exports.safe = safe;
|
|
208
|
+
/**
|
|
209
|
+
* Unescapes the given string value.
|
|
210
|
+
* @param val String to unescape
|
|
211
|
+
*/
|
|
212
|
+
function unsafe(val = '') {
|
|
213
|
+
val = val.trim();
|
|
214
|
+
if (isQuoted(val)) {
|
|
215
|
+
// remove the single quotes before calling JSON.parse
|
|
216
|
+
if (val.charAt(0) === "'") {
|
|
217
|
+
val = val.substr(1, val.length - 2);
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
val = JSON.parse(val);
|
|
221
|
+
}
|
|
222
|
+
catch (_) { }
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
// walk the val to find the first unescaped ; character
|
|
226
|
+
let esc = false;
|
|
227
|
+
let unesc = '';
|
|
228
|
+
for (let i = 0, l = val.length; i < l; i++) {
|
|
229
|
+
const c = val.charAt(i);
|
|
230
|
+
if (esc) {
|
|
231
|
+
if ('\\;#'.indexOf(c) !== -1) {
|
|
232
|
+
unesc += c;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
unesc += '\\' + c;
|
|
236
|
+
}
|
|
237
|
+
esc = false;
|
|
238
|
+
}
|
|
239
|
+
else if (';#'.indexOf(c) !== -1) {
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
else if (c === '\\') {
|
|
243
|
+
esc = true;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
unesc += c;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (esc) {
|
|
250
|
+
unesc += '\\';
|
|
251
|
+
}
|
|
252
|
+
return unesc.trim();
|
|
253
|
+
}
|
|
254
|
+
return val;
|
|
255
|
+
}
|
|
256
|
+
exports.unsafe = unsafe;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ini.js"), exports);
|
package/script/mod.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Release = exports.parser = exports.Changelog = exports.Change = void 0;
|
|
7
|
+
require("./_dnt.polyfills.js");
|
|
8
|
+
const parser_js_1 = __importDefault(require("./src/parser.js"));
|
|
9
|
+
exports.parser = parser_js_1.default;
|
|
10
|
+
const Change_js_1 = __importDefault(require("./src/Change.js"));
|
|
11
|
+
exports.Change = Change_js_1.default;
|
|
12
|
+
const Changelog_js_1 = __importDefault(require("./src/Changelog.js"));
|
|
13
|
+
exports.Changelog = Changelog_js_1.default;
|
|
14
|
+
const Release_js_1 = __importDefault(require("./src/Release.js"));
|
|
15
|
+
exports.Release = Release_js_1.default;
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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
|
+
}
|
|
19
|
+
constructor(title, description = "") {
|
|
20
|
+
Object.defineProperty(this, "title", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "description", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(this, "issues", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: []
|
|
37
|
+
});
|
|
38
|
+
this.title = Change.extractIssues(title, this.issues);
|
|
39
|
+
this.description = Change.extractIssues(description, this.issues);
|
|
40
|
+
}
|
|
41
|
+
toString() {
|
|
42
|
+
let t = this.title.split("\n").map((line) => ` ${line}`.trimEnd());
|
|
43
|
+
t[0] = "-" + t[0].substr(1);
|
|
44
|
+
if (this.description) {
|
|
45
|
+
t.push("");
|
|
46
|
+
t = t.concat(this.description.split("\n").map((line) => ` ${line}`.trimEnd()));
|
|
47
|
+
}
|
|
48
|
+
return t.join("\n").trim();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.default = Change;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const deps_js_1 = require("./deps.js");
|
|
4
|
+
class Changelog {
|
|
5
|
+
constructor(title, description = "") {
|
|
6
|
+
Object.defineProperty(this, "flag", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: void 0
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(this, "title", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: void 0
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "description", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(this, "head", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: "HEAD"
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(this, "footer", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: void 0
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(this, "url", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: void 0
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(this, "releases", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true,
|
|
46
|
+
value: []
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(this, "tagNameBuilder", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: void 0
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(this, "format", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: "compact"
|
|
59
|
+
});
|
|
60
|
+
this.title = title;
|
|
61
|
+
this.description = description;
|
|
62
|
+
}
|
|
63
|
+
addRelease(release) {
|
|
64
|
+
this.releases.push(release);
|
|
65
|
+
this.sortReleases();
|
|
66
|
+
release.changelog = this;
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
findRelease(version) {
|
|
70
|
+
if (!version) {
|
|
71
|
+
return this.releases.find((release) => !release.version);
|
|
72
|
+
}
|
|
73
|
+
return this.releases.find((release) => release.version && (0, deps_js_1.eq)(release.version, version));
|
|
74
|
+
}
|
|
75
|
+
sortReleases() {
|
|
76
|
+
this.releases.sort((a, b) => a.compare(b));
|
|
77
|
+
}
|
|
78
|
+
tagName(release) {
|
|
79
|
+
if (this.tagNameBuilder) {
|
|
80
|
+
return this.tagNameBuilder(release);
|
|
81
|
+
}
|
|
82
|
+
return `v${release.version}`;
|
|
83
|
+
}
|
|
84
|
+
toString() {
|
|
85
|
+
const t = [];
|
|
86
|
+
if (this.flag) {
|
|
87
|
+
t.push(`<!-- ${this.flag} -->`);
|
|
88
|
+
t.push("");
|
|
89
|
+
}
|
|
90
|
+
t.push(`# ${this.title}`);
|
|
91
|
+
if (this.format === "markdownlint") {
|
|
92
|
+
t.push("");
|
|
93
|
+
}
|
|
94
|
+
const links = [];
|
|
95
|
+
const compareLinks = [];
|
|
96
|
+
const description = this.description.trim() ||
|
|
97
|
+
`All notable changes to this project will be documented in this file.
|
|
98
|
+
|
|
99
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
100
|
+
and this project adheres to [Semantic Versioning](http://semver.org/).`;
|
|
101
|
+
if (description) {
|
|
102
|
+
t.push(description);
|
|
103
|
+
}
|
|
104
|
+
this.releases.forEach((release) => {
|
|
105
|
+
t.push("");
|
|
106
|
+
t.push(release.toString(this));
|
|
107
|
+
release.getLinks(this).forEach((link) => {
|
|
108
|
+
if (!links.includes(link)) {
|
|
109
|
+
links.push(link);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const compareLink = release.getCompareLink(this);
|
|
113
|
+
if (compareLink) {
|
|
114
|
+
compareLinks.push(compareLink);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
if (links.length) {
|
|
118
|
+
t.push("");
|
|
119
|
+
links.sort(compare);
|
|
120
|
+
links.forEach((link) => t.push(link));
|
|
121
|
+
}
|
|
122
|
+
if (compareLinks.length) {
|
|
123
|
+
t.push("");
|
|
124
|
+
compareLinks.forEach((link) => t.push(link));
|
|
125
|
+
}
|
|
126
|
+
t.push("");
|
|
127
|
+
if (this.footer) {
|
|
128
|
+
t.push("---");
|
|
129
|
+
t.push("");
|
|
130
|
+
t.push(this.footer);
|
|
131
|
+
t.push("");
|
|
132
|
+
}
|
|
133
|
+
return t.join("\n");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.default = Changelog;
|
|
137
|
+
function compare(a, b) {
|
|
138
|
+
if (a === b) {
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
const reg = /^\[#(\d+)\]:/;
|
|
142
|
+
const aNumber = a.match(reg);
|
|
143
|
+
const bNumber = b.match(reg);
|
|
144
|
+
if (aNumber && bNumber) {
|
|
145
|
+
return parseInt(aNumber[1]) - parseInt(bNumber[1]);
|
|
146
|
+
}
|
|
147
|
+
return a < b ? -1 : 1;
|
|
148
|
+
}
|