keep-a-changelog 0.10.4 → 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 -196
  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 -128
  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 -182
@@ -0,0 +1,9 @@
1
+ import * as _win32 from "./win32.js";
2
+ import * as _posix from "./posix.js";
3
+ export declare const win32: typeof _win32;
4
+ export declare const posix: typeof _posix;
5
+ export declare const basename: typeof _posix.basename | typeof _win32.basename, delimiter: string, dirname: typeof _posix.dirname | typeof _win32.dirname, extname: typeof _posix.extname | typeof _win32.extname, format: typeof _posix.format | typeof _win32.format, fromFileUrl: typeof _posix.fromFileUrl | typeof _win32.fromFileUrl, isAbsolute: typeof _win32.isAbsolute | typeof _posix.isAbsolute, join: typeof _posix.join | typeof _win32.join, normalize: typeof _win32.normalize | typeof _posix.normalize, parse: typeof _posix.parse | typeof _win32.parse, relative: typeof _posix.relative | typeof _win32.relative, resolve: typeof _win32.resolve | typeof _posix.resolve, sep: string, toFileUrl: typeof _posix.toFileUrl | typeof _win32.toFileUrl, toNamespacedPath: typeof _posix.toNamespacedPath | typeof _win32.toNamespacedPath;
6
+ export * from "./common.js";
7
+ export { SEP, SEP_PATTERN } from "./separator.js";
8
+ export * from "./_interface.js";
9
+ export * from "./glob.js";
@@ -0,0 +1,80 @@
1
+ import type { FormatInputPathObject, ParsedPath } from "./_interface.js";
2
+ export declare const sep = "/";
3
+ export declare const delimiter = ":";
4
+ /**
5
+ * Resolves `pathSegments` into an absolute path.
6
+ * @param pathSegments an array of path segments
7
+ */
8
+ export declare function resolve(...pathSegments: string[]): string;
9
+ /**
10
+ * Normalize the `path`, resolving `'..'` and `'.'` segments.
11
+ * @param path to be normalized
12
+ */
13
+ export declare function normalize(path: string): string;
14
+ /**
15
+ * Verifies whether provided path is absolute
16
+ * @param path to be verified as absolute
17
+ */
18
+ export declare function isAbsolute(path: string): boolean;
19
+ /**
20
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
21
+ * @param paths to be joined and normalized
22
+ */
23
+ export declare function join(...paths: string[]): string;
24
+ /**
25
+ * Return the relative path from `from` to `to` based on current working directory.
26
+ * @param from path in current working directory
27
+ * @param to path in current working directory
28
+ */
29
+ export declare function relative(from: string, to: string): string;
30
+ /**
31
+ * Resolves path to a namespace path
32
+ * @param path to resolve to namespace
33
+ */
34
+ export declare function toNamespacedPath(path: string): string;
35
+ /**
36
+ * Return the directory name of a `path`.
37
+ * @param path to determine name for
38
+ */
39
+ export declare function dirname(path: string): string;
40
+ /**
41
+ * Return the last portion of a `path`. Trailing directory separators are ignored.
42
+ * @param path to process
43
+ * @param ext of path directory
44
+ */
45
+ export declare function basename(path: string, ext?: string): string;
46
+ /**
47
+ * Return the extension of the `path`.
48
+ * @param path with extension
49
+ */
50
+ export declare function extname(path: string): string;
51
+ /**
52
+ * Generate a path from `FormatInputPathObject` object.
53
+ * @param pathObject with path
54
+ */
55
+ export declare function format(pathObject: FormatInputPathObject): string;
56
+ /**
57
+ * Return a `ParsedPath` object of the `path`.
58
+ * @param path to process
59
+ */
60
+ export declare function parse(path: string): ParsedPath;
61
+ /**
62
+ * Converts a file URL to a path string.
63
+ *
64
+ * ```ts
65
+ * import { fromFileUrl } from "./posix.ts";
66
+ * fromFileUrl("file:///home/foo"); // "/home/foo"
67
+ * ```
68
+ * @param url of a file URL
69
+ */
70
+ export declare function fromFileUrl(url: string | URL): string;
71
+ /**
72
+ * Converts a path string to a file URL.
73
+ *
74
+ * ```ts
75
+ * import { toFileUrl } from "./posix.ts";
76
+ * toFileUrl("/home/foo"); // new URL("file:///home/foo")
77
+ * ```
78
+ * @param path to convert to file URL
79
+ */
80
+ export declare function toFileUrl(path: string): URL;
@@ -0,0 +1,2 @@
1
+ export declare const SEP: string;
2
+ export declare const SEP_PATTERN: RegExp;
@@ -0,0 +1,87 @@
1
+ import type { FormatInputPathObject, ParsedPath } from "./_interface.js";
2
+ export declare const sep = "\\";
3
+ export declare const delimiter = ";";
4
+ /**
5
+ * Resolves path segments into a `path`
6
+ * @param pathSegments to process to path
7
+ */
8
+ export declare function resolve(...pathSegments: string[]): string;
9
+ /**
10
+ * Normalizes a `path`
11
+ * @param path to normalize
12
+ */
13
+ export declare function normalize(path: string): string;
14
+ /**
15
+ * Verifies whether path is absolute
16
+ * @param path to verify
17
+ */
18
+ export declare function isAbsolute(path: string): boolean;
19
+ /**
20
+ * Join all given a sequence of `paths`,then normalizes the resulting path.
21
+ * @param paths to be joined and normalized
22
+ */
23
+ export declare function join(...paths: string[]): string;
24
+ /**
25
+ * It will solve the relative path from `from` to `to`, for instance:
26
+ * from = 'C:\\orandea\\test\\aaa'
27
+ * to = 'C:\\orandea\\impl\\bbb'
28
+ * The output of the function should be: '..\\..\\impl\\bbb'
29
+ * @param from relative path
30
+ * @param to relative path
31
+ */
32
+ export declare function relative(from: string, to: string): string;
33
+ /**
34
+ * Resolves path to a namespace path
35
+ * @param path to resolve to namespace
36
+ */
37
+ export declare function toNamespacedPath(path: string): string;
38
+ /**
39
+ * Return the directory name of a `path`.
40
+ * @param path to determine name for
41
+ */
42
+ export declare function dirname(path: string): string;
43
+ /**
44
+ * Return the last portion of a `path`. Trailing directory separators are ignored.
45
+ * @param path to process
46
+ * @param ext of path directory
47
+ */
48
+ export declare function basename(path: string, ext?: string): string;
49
+ /**
50
+ * Return the extension of the `path`.
51
+ * @param path with extension
52
+ */
53
+ export declare function extname(path: string): string;
54
+ /**
55
+ * Generate a path from `FormatInputPathObject` object.
56
+ * @param pathObject with path
57
+ */
58
+ export declare function format(pathObject: FormatInputPathObject): string;
59
+ /**
60
+ * Return a `ParsedPath` object of the `path`.
61
+ * @param path to process
62
+ */
63
+ export declare function parse(path: string): ParsedPath;
64
+ /**
65
+ * Converts a file URL to a path string.
66
+ *
67
+ * ```ts
68
+ * import { fromFileUrl } from "./win32.ts";
69
+ * fromFileUrl("file:///home/foo"); // "\\home\\foo"
70
+ * fromFileUrl("file:///C:/Users/foo"); // "C:\\Users\\foo"
71
+ * fromFileUrl("file://localhost/home/foo"); // "\\\\localhost\\home\\foo"
72
+ * ```
73
+ * @param url of a file URL
74
+ */
75
+ export declare function fromFileUrl(url: string | URL): string;
76
+ /**
77
+ * Converts a path string to a file URL.
78
+ *
79
+ * ```ts
80
+ * import { toFileUrl } from "./win32.ts";
81
+ * toFileUrl("\\home\\foo"); // new URL("file:///home/foo")
82
+ * toFileUrl("C:\\Users\\foo"); // new URL("file:///C:/Users/foo")
83
+ * toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file://127.0.0.1/home/foo")
84
+ * ```
85
+ * @param path to convert to file URL
86
+ */
87
+ export declare function toFileUrl(path: string): URL;
@@ -0,0 +1,270 @@
1
+ /** RGB 8-bits per channel. Each in range `0->255` or `0x00->0xff` */
2
+ interface Rgb {
3
+ r: number;
4
+ g: number;
5
+ b: number;
6
+ }
7
+ /**
8
+ * Set changing text color to enabled or disabled
9
+ * @param value
10
+ */
11
+ export declare function setColorEnabled(value: boolean): void;
12
+ /** Get whether text color change is enabled or disabled. */
13
+ export declare function getColorEnabled(): boolean;
14
+ /**
15
+ * Reset the text modified
16
+ * @param str text to reset
17
+ */
18
+ export declare function reset(str: string): string;
19
+ /**
20
+ * Make the text bold.
21
+ * @param str text to make bold
22
+ */
23
+ export declare function bold(str: string): string;
24
+ /**
25
+ * The text emits only a small amount of light.
26
+ * @param str text to dim
27
+ */
28
+ export declare function dim(str: string): string;
29
+ /**
30
+ * Make the text italic.
31
+ * @param str text to make italic
32
+ */
33
+ export declare function italic(str: string): string;
34
+ /**
35
+ * Make the text underline.
36
+ * @param str text to underline
37
+ */
38
+ export declare function underline(str: string): string;
39
+ /**
40
+ * Invert background color and text color.
41
+ * @param str text to invert its color
42
+ */
43
+ export declare function inverse(str: string): string;
44
+ /**
45
+ * Make the text hidden.
46
+ * @param str text to hide
47
+ */
48
+ export declare function hidden(str: string): string;
49
+ /**
50
+ * Put horizontal line through the center of the text.
51
+ * @param str text to strike through
52
+ */
53
+ export declare function strikethrough(str: string): string;
54
+ /**
55
+ * Set text color to black.
56
+ * @param str text to make black
57
+ */
58
+ export declare function black(str: string): string;
59
+ /**
60
+ * Set text color to red.
61
+ * @param str text to make red
62
+ */
63
+ export declare function red(str: string): string;
64
+ /**
65
+ * Set text color to green.
66
+ * @param str text to make green
67
+ */
68
+ export declare function green(str: string): string;
69
+ /**
70
+ * Set text color to yellow.
71
+ * @param str text to make yellow
72
+ */
73
+ export declare function yellow(str: string): string;
74
+ /**
75
+ * Set text color to blue.
76
+ * @param str text to make blue
77
+ */
78
+ export declare function blue(str: string): string;
79
+ /**
80
+ * Set text color to magenta.
81
+ * @param str text to make magenta
82
+ */
83
+ export declare function magenta(str: string): string;
84
+ /**
85
+ * Set text color to cyan.
86
+ * @param str text to make cyan
87
+ */
88
+ export declare function cyan(str: string): string;
89
+ /**
90
+ * Set text color to white.
91
+ * @param str text to make white
92
+ */
93
+ export declare function white(str: string): string;
94
+ /**
95
+ * Set text color to gray.
96
+ * @param str text to make gray
97
+ */
98
+ export declare function gray(str: string): string;
99
+ /**
100
+ * Set text color to bright black.
101
+ * @param str text to make bright-black
102
+ */
103
+ export declare function brightBlack(str: string): string;
104
+ /**
105
+ * Set text color to bright red.
106
+ * @param str text to make bright-red
107
+ */
108
+ export declare function brightRed(str: string): string;
109
+ /**
110
+ * Set text color to bright green.
111
+ * @param str text to make bright-green
112
+ */
113
+ export declare function brightGreen(str: string): string;
114
+ /**
115
+ * Set text color to bright yellow.
116
+ * @param str text to make bright-yellow
117
+ */
118
+ export declare function brightYellow(str: string): string;
119
+ /**
120
+ * Set text color to bright blue.
121
+ * @param str text to make bright-blue
122
+ */
123
+ export declare function brightBlue(str: string): string;
124
+ /**
125
+ * Set text color to bright magenta.
126
+ * @param str text to make bright-magenta
127
+ */
128
+ export declare function brightMagenta(str: string): string;
129
+ /**
130
+ * Set text color to bright cyan.
131
+ * @param str text to make bright-cyan
132
+ */
133
+ export declare function brightCyan(str: string): string;
134
+ /**
135
+ * Set text color to bright white.
136
+ * @param str text to make bright-white
137
+ */
138
+ export declare function brightWhite(str: string): string;
139
+ /**
140
+ * Set background color to black.
141
+ * @param str text to make its background black
142
+ */
143
+ export declare function bgBlack(str: string): string;
144
+ /**
145
+ * Set background color to red.
146
+ * @param str text to make its background red
147
+ */
148
+ export declare function bgRed(str: string): string;
149
+ /**
150
+ * Set background color to green.
151
+ * @param str text to make its background green
152
+ */
153
+ export declare function bgGreen(str: string): string;
154
+ /**
155
+ * Set background color to yellow.
156
+ * @param str text to make its background yellow
157
+ */
158
+ export declare function bgYellow(str: string): string;
159
+ /**
160
+ * Set background color to blue.
161
+ * @param str text to make its background blue
162
+ */
163
+ export declare function bgBlue(str: string): string;
164
+ /**
165
+ * Set background color to magenta.
166
+ * @param str text to make its background magenta
167
+ */
168
+ export declare function bgMagenta(str: string): string;
169
+ /**
170
+ * Set background color to cyan.
171
+ * @param str text to make its background cyan
172
+ */
173
+ export declare function bgCyan(str: string): string;
174
+ /**
175
+ * Set background color to white.
176
+ * @param str text to make its background white
177
+ */
178
+ export declare function bgWhite(str: string): string;
179
+ /**
180
+ * Set background color to bright black.
181
+ * @param str text to make its background bright-black
182
+ */
183
+ export declare function bgBrightBlack(str: string): string;
184
+ /**
185
+ * Set background color to bright red.
186
+ * @param str text to make its background bright-red
187
+ */
188
+ export declare function bgBrightRed(str: string): string;
189
+ /**
190
+ * Set background color to bright green.
191
+ * @param str text to make its background bright-green
192
+ */
193
+ export declare function bgBrightGreen(str: string): string;
194
+ /**
195
+ * Set background color to bright yellow.
196
+ * @param str text to make its background bright-yellow
197
+ */
198
+ export declare function bgBrightYellow(str: string): string;
199
+ /**
200
+ * Set background color to bright blue.
201
+ * @param str text to make its background bright-blue
202
+ */
203
+ export declare function bgBrightBlue(str: string): string;
204
+ /**
205
+ * Set background color to bright magenta.
206
+ * @param str text to make its background bright-magenta
207
+ */
208
+ export declare function bgBrightMagenta(str: string): string;
209
+ /**
210
+ * Set background color to bright cyan.
211
+ * @param str text to make its background bright-cyan
212
+ */
213
+ export declare function bgBrightCyan(str: string): string;
214
+ /**
215
+ * Set background color to bright white.
216
+ * @param str text to make its background bright-white
217
+ */
218
+ export declare function bgBrightWhite(str: string): string;
219
+ /**
220
+ * Set text color using paletted 8bit colors.
221
+ * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
222
+ * @param str text color to apply paletted 8bit colors to
223
+ * @param color code
224
+ */
225
+ export declare function rgb8(str: string, color: number): string;
226
+ /**
227
+ * Set background color using paletted 8bit colors.
228
+ * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
229
+ * @param str text color to apply paletted 8bit background colors to
230
+ * @param color code
231
+ */
232
+ export declare function bgRgb8(str: string, color: number): string;
233
+ /**
234
+ * Set text color using 24bit rgb.
235
+ * `color` can be a number in range `0x000000` to `0xffffff` or
236
+ * an `Rgb`.
237
+ *
238
+ * To produce the color magenta:
239
+ *
240
+ * ```ts
241
+ * import { rgb24 } from "./colors.ts";
242
+ * rgb24("foo", 0xff00ff);
243
+ * rgb24("foo", {r: 255, g: 0, b: 255});
244
+ * ```
245
+ * @param str text color to apply 24bit rgb to
246
+ * @param color code
247
+ */
248
+ export declare function rgb24(str: string, color: number | Rgb): string;
249
+ /**
250
+ * Set background color using 24bit rgb.
251
+ * `color` can be a number in range `0x000000` to `0xffffff` or
252
+ * an `Rgb`.
253
+ *
254
+ * To produce the color magenta:
255
+ *
256
+ * ```ts
257
+ * import { bgRgb24 } from "./colors.ts";
258
+ * bgRgb24("foo", 0xff00ff);
259
+ * bgRgb24("foo", {r: 255, g: 0, b: 255});
260
+ * ```
261
+ * @param str text color to apply 24bit rgb to
262
+ * @param color code
263
+ */
264
+ export declare function bgRgb24(str: string, color: number | Rgb): string;
265
+ /**
266
+ * Remove ANSI escape codes from the string.
267
+ * @param string to remove ANSI escape codes from
268
+ */
269
+ export declare function stripColor(string: string): string;
270
+ export {};
@@ -0,0 +1,23 @@
1
+ export declare enum DiffType {
2
+ removed = "removed",
3
+ common = "common",
4
+ added = "added"
5
+ }
6
+ export interface DiffResult<T> {
7
+ type: DiffType;
8
+ value: T;
9
+ details?: Array<DiffResult<T>>;
10
+ }
11
+ /**
12
+ * Renders the differences between the actual and expected values
13
+ * @param A Actual value
14
+ * @param B Expected value
15
+ */
16
+ export declare function diff<T>(A: T[], B: T[]): Array<DiffResult<T>>;
17
+ /**
18
+ * Renders the differences between the actual and expected strings
19
+ * Partially inspired from https://github.com/kpdecker/jsdiff
20
+ * @param A Actual string
21
+ * @param B Expected string
22
+ */
23
+ export declare function diffstr(A: string, B: string): DiffResult<string>[];
@@ -0,0 +1,151 @@
1
+ export declare class AssertionError extends Error {
2
+ name: string;
3
+ constructor(message: string);
4
+ }
5
+ /**
6
+ * Converts the input into a string. Objects, Sets and Maps are sorted so as to
7
+ * make tests less flaky
8
+ * @param v Value to be formatted
9
+ */
10
+ export declare function _format(v: unknown): string;
11
+ /**
12
+ * Deep equality comparison used in assertions
13
+ * @param c actual value
14
+ * @param d expected value
15
+ */
16
+ export declare function equal(c: unknown, d: unknown): boolean;
17
+ /** Make an assertion, error will be thrown if `expr` does not have truthy value. */
18
+ export declare function assert(expr: unknown, msg?: string): asserts expr;
19
+ /**
20
+ * Make an assertion that `actual` and `expected` are equal, deeply. If not
21
+ * deeply equal, then throw.
22
+ *
23
+ * Type parameter can be specified to ensure values under comparison have the same type.
24
+ * For example:
25
+ * ```ts
26
+ * import { assertEquals } from "./asserts.ts";
27
+ *
28
+ * assertEquals<number>(1, 2)
29
+ * ```
30
+ */
31
+ export declare function assertEquals(actual: unknown, expected: unknown, msg?: string): void;
32
+ export declare function assertEquals<T>(actual: T, expected: T, msg?: string): void;
33
+ /**
34
+ * Make an assertion that `actual` and `expected` are not equal, deeply.
35
+ * If not then throw.
36
+ *
37
+ * Type parameter can be specified to ensure values under comparison have the same type.
38
+ * For example:
39
+ * ```ts
40
+ * import { assertNotEquals } from "./asserts.ts";
41
+ *
42
+ * assertNotEquals<number>(1, 2)
43
+ * ```
44
+ */
45
+ export declare function assertNotEquals(actual: unknown, expected: unknown, msg?: string): void;
46
+ export declare function assertNotEquals<T>(actual: T, expected: T, msg?: string): void;
47
+ /**
48
+ * Make an assertion that `actual` and `expected` are strictly equal. If
49
+ * not then throw.
50
+ *
51
+ * ```ts
52
+ * import { assertStrictEquals } from "./asserts.ts";
53
+ *
54
+ * assertStrictEquals(1, 2)
55
+ * ```
56
+ */
57
+ export declare function assertStrictEquals(actual: unknown, expected: unknown, msg?: string): void;
58
+ export declare function assertStrictEquals<T>(actual: T, expected: T, msg?: string): void;
59
+ /**
60
+ * Make an assertion that `actual` and `expected` are not strictly equal.
61
+ * If the values are strictly equal then throw.
62
+ *
63
+ * ```ts
64
+ * import { assertNotStrictEquals } from "./asserts.ts";
65
+ *
66
+ * assertNotStrictEquals(1, 1)
67
+ * ```
68
+ */
69
+ export declare function assertNotStrictEquals(actual: unknown, expected: unknown, msg?: string): void;
70
+ export declare function assertNotStrictEquals<T>(actual: T, expected: T, msg?: string): void;
71
+ /**
72
+ * Make an assertion that actual is not null or undefined.
73
+ * If not then throw.
74
+ */
75
+ export declare function assertExists<T>(actual: T, msg?: string): asserts actual is NonNullable<T>;
76
+ /**
77
+ * Make an assertion that actual includes expected. If not
78
+ * then throw.
79
+ */
80
+ export declare function assertStringIncludes(actual: string, expected: string, msg?: string): void;
81
+ /**
82
+ * Make an assertion that `actual` includes the `expected` values.
83
+ * If not then an error will be thrown.
84
+ *
85
+ * Type parameter can be specified to ensure values under comparison have the same type.
86
+ * For example:
87
+ *
88
+ * ```ts
89
+ * import { assertArrayIncludes } from "./asserts.ts";
90
+ *
91
+ * assertArrayIncludes<number>([1, 2], [2])
92
+ * ```
93
+ */
94
+ export declare function assertArrayIncludes(actual: ArrayLike<unknown>, expected: ArrayLike<unknown>, msg?: string): void;
95
+ export declare function assertArrayIncludes<T>(actual: ArrayLike<T>, expected: ArrayLike<T>, msg?: string): void;
96
+ /**
97
+ * Make an assertion that `actual` match RegExp `expected`. If not
98
+ * then throw.
99
+ */
100
+ export declare function assertMatch(actual: string, expected: RegExp, msg?: string): void;
101
+ /**
102
+ * Make an assertion that `actual` not match RegExp `expected`. If match
103
+ * then throw.
104
+ */
105
+ export declare function assertNotMatch(actual: string, expected: RegExp, msg?: string): void;
106
+ /**
107
+ * Make an assertion that `actual` object is a subset of `expected` object, deeply.
108
+ * If not, then throw.
109
+ */
110
+ export declare function assertObjectMatch(actual: Record<PropertyKey, any>, expected: Record<PropertyKey, unknown>): void;
111
+ /**
112
+ * Forcefully throws a failed assertion
113
+ */
114
+ export declare function fail(msg?: string): never;
115
+ /**
116
+ * Make an assertion that `error` is an `Error`.
117
+ * If not then an error will be thrown.
118
+ * An error class and a string that should be included in the
119
+ * error message can also be asserted.
120
+ */
121
+ export declare function assertIsError<E extends Error = Error>(error: unknown, ErrorClass?: new (...args: any[]) => E, msgIncludes?: string, msg?: string): asserts error is E;
122
+ /**
123
+ * Executes a function, expecting it to throw. If it does not, then it
124
+ * throws. An error class and a string that should be included in the
125
+ * error message can also be asserted. Or you can pass a
126
+ * callback which will be passed the error, usually to apply some custom
127
+ * assertions on it.
128
+ */
129
+ export declare function assertThrows<E extends Error = Error>(fn: () => unknown, ErrorClass?: new (...args: any[]) => E, msgIncludes?: string, msg?: string): void;
130
+ export declare function assertThrows(fn: () => unknown, errorCallback: (e: Error) => unknown, msg?: string): void;
131
+ /**
132
+ * Executes a function which returns a promise, expecting it to throw or reject.
133
+ * If it does not, then it throws. An error class and a string that should be
134
+ * included in the error message can also be asserted. Or you can pass a
135
+ * callback which will be passed the error, usually to apply some custom
136
+ * assertions on it.
137
+ */
138
+ export declare function assertRejects<E extends Error = Error>(fn: () => Promise<unknown>, ErrorClass?: new (...args: any[]) => E, msgIncludes?: string, msg?: string): Promise<void>;
139
+ export declare function assertRejects(fn: () => Promise<unknown>, errorCallback: (e: Error) => unknown, msg?: string): Promise<void>;
140
+ /**
141
+ * Executes a function which returns a promise, expecting it to throw or reject.
142
+ * If it does not, then it throws. An error class and a string that should be
143
+ * included in the error message can also be asserted.
144
+ *
145
+ * @deprecated Use assertRejects instead.
146
+ */
147
+ export declare const assertThrowsAsync: typeof assertRejects;
148
+ /** Use this to stub out methods that will throw when invoked. */
149
+ export declare function unimplemented(msg?: string): never;
150
+ /** Use this to assert unreachable code. */
151
+ export declare function unreachable(): never;
@@ -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';