keep-a-changelog 0.10.1 → 2.0.0-beta

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