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.
Files changed (117) hide show
  1. package/CHANGELOG.md +28 -2
  2. package/README.md +21 -6
  3. package/esm/_dnt.polyfills.js +15 -0
  4. package/esm/bin.js +9 -4
  5. package/esm/deps/deno.land/std@0.173.0/_util/asserts.js +21 -0
  6. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/_util/os.js +4 -1
  7. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/flags/mod.js +145 -36
  8. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_constants.js +1 -0
  9. package/esm/deps/deno.land/std@0.173.0/path/_interface.js +3 -0
  10. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_util.js +1 -0
  11. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/common.js +1 -1
  12. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/glob.js +1 -1
  13. package/esm/deps/deno.land/std@0.173.0/path/mod.js +32 -0
  14. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/posix.js +23 -16
  15. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/separator.js +1 -1
  16. package/esm/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/win32.js +20 -15
  17. package/esm/deps/{deno_land/x/semver_v1.4.0 → deno.land/std@0.173.0/semver}/mod.js +227 -334
  18. package/esm/deps/{deno_land/std_0.51.0 → deno.land/std@0.51.0}/fs/eol.js +0 -0
  19. package/esm/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/ini.js +1 -1
  20. package/esm/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/mod.js +0 -0
  21. package/esm/mod.js +1 -0
  22. package/esm/src/Change.js +15 -15
  23. package/esm/src/Changelog.js +9 -1
  24. package/esm/src/Release.js +21 -4
  25. package/esm/src/deps.js +1 -1
  26. package/esm/src/parser.js +24 -5
  27. package/esm/test/changelog.custom.type.md +0 -1
  28. package/esm/test/changelog.expected.linted.md +208 -0
  29. package/esm/test/changelog.expected.md +6 -4
  30. package/esm/test/changelog.md +7 -3
  31. package/esm/test/empty.expected.md +0 -1
  32. package/package.json +13 -8
  33. package/script/_dnt.polyfills.js +16 -0
  34. package/script/_dnt.shims.js +66 -0
  35. package/script/bin.js +144 -0
  36. package/script/deps/deno.land/std@0.173.0/_util/asserts.js +27 -0
  37. package/script/deps/deno.land/std@0.173.0/_util/os.js +44 -0
  38. package/script/deps/deno.land/std@0.173.0/flags/mod.js +368 -0
  39. package/script/deps/deno.land/std@0.173.0/path/_constants.js +49 -0
  40. package/script/deps/deno.land/std@0.173.0/path/_interface.js +4 -0
  41. package/script/deps/deno.land/std@0.173.0/path/_util.js +125 -0
  42. package/script/deps/deno.land/std@0.173.0/path/common.js +40 -0
  43. package/script/deps/deno.land/std@0.173.0/path/glob.js +391 -0
  44. package/script/deps/deno.land/std@0.173.0/path/mod.js +63 -0
  45. package/script/deps/deno.land/std@0.173.0/path/posix.js +539 -0
  46. package/script/deps/deno.land/std@0.173.0/path/separator.js +8 -0
  47. package/script/deps/deno.land/std@0.173.0/path/win32.js +1007 -0
  48. package/script/deps/deno.land/std@0.173.0/semver/mod.js +1458 -0
  49. package/script/deps/deno.land/std@0.51.0/fs/eol.js +34 -0
  50. package/script/deps/deno.land/x/ini@v2.1.0/ini.js +256 -0
  51. package/script/deps/deno.land/x/ini@v2.1.0/mod.js +17 -0
  52. package/script/mod.js +15 -0
  53. package/{umd → script}/package.json +0 -0
  54. package/script/src/Change.js +51 -0
  55. package/script/src/Changelog.js +148 -0
  56. package/script/src/Release.js +227 -0
  57. package/script/src/deps.js +9 -0
  58. package/script/src/parser.js +184 -0
  59. package/{umd → script}/test/changelog.custom.type.md +0 -1
  60. package/script/test/changelog.expected.linted.md +208 -0
  61. package/{umd → script}/test/changelog.expected.md +6 -4
  62. package/{umd → script}/test/changelog.md +7 -3
  63. package/{umd → script}/test/empty.expected.md +0 -1
  64. package/types/_dnt.polyfills.d.ts +11 -0
  65. package/types/_dnt.shims.d.ts +0 -4
  66. package/types/bin.d.ts +1 -1
  67. package/types/deps/deno.land/std@0.173.0/_util/asserts.d.ts +10 -0
  68. package/types/deps/deno.land/std@0.173.0/_util/os.d.ts +4 -0
  69. package/types/deps/deno.land/std@0.173.0/flags/mod.d.ts +166 -0
  70. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_constants.d.ts +0 -0
  71. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_interface.d.ts +1 -1
  72. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/_util.d.ts +0 -0
  73. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/common.d.ts +0 -0
  74. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/glob.d.ts +10 -5
  75. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/mod.d.ts +0 -0
  76. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/posix.d.ts +9 -5
  77. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/separator.d.ts +0 -0
  78. package/types/deps/{deno_land/std_0.120.0 → deno.land/std@0.173.0}/path/win32.d.ts +7 -5
  79. package/types/deps/deno.land/std@0.173.0/semver/mod.d.ts +398 -0
  80. package/types/deps/{deno_land/std_0.51.0 → deno.land/std@0.51.0}/fs/eol.d.ts +0 -0
  81. package/types/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/ini.d.ts +0 -0
  82. package/types/deps/{deno_land/x/ini_v2.1.0 → deno.land/x/ini@v2.1.0}/mod.d.ts +0 -0
  83. package/types/mod.d.ts +1 -0
  84. package/types/src/Changelog.d.ts +1 -0
  85. package/types/src/Release.d.ts +2 -0
  86. package/types/src/deps.d.ts +1 -1
  87. package/esm/deps/deno_land/std_0.120.0/_util/assert.js +0 -13
  88. package/esm/deps/deno_land/std_0.120.0/path/_interface.js +0 -3
  89. package/esm/deps/deno_land/std_0.120.0/path/mod.js +0 -14
  90. package/types/deps/deno_land/std_0.120.0/_util/assert.d.ts +0 -5
  91. package/types/deps/deno_land/std_0.120.0/_util/os.d.ts +0 -3
  92. package/types/deps/deno_land/std_0.120.0/flags/mod.d.ts +0 -50
  93. package/types/deps/deno_land/x/semver_v1.4.0/mod.d.ts +0 -116
  94. package/umd/_dnt.shims.js +0 -76
  95. package/umd/bin.js +0 -145
  96. package/umd/deps/deno_land/std_0.120.0/_util/assert.js +0 -28
  97. package/umd/deps/deno_land/std_0.120.0/_util/os.js +0 -47
  98. package/umd/deps/deno_land/std_0.120.0/flags/mod.js +0 -269
  99. package/umd/deps/deno_land/std_0.120.0/path/_constants.js +0 -58
  100. package/umd/deps/deno_land/std_0.120.0/path/_interface.js +0 -14
  101. package/umd/deps/deno_land/std_0.120.0/path/_util.js +0 -134
  102. package/umd/deps/deno_land/std_0.120.0/path/common.js +0 -50
  103. package/umd/deps/deno_land/std_0.120.0/path/glob.js +0 -397
  104. package/umd/deps/deno_land/std_0.120.0/path/mod.js +0 -51
  105. package/umd/deps/deno_land/std_0.120.0/path/posix.js +0 -538
  106. package/umd/deps/deno_land/std_0.120.0/path/separator.js +0 -18
  107. package/umd/deps/deno_land/std_0.120.0/path/win32.js +0 -1008
  108. package/umd/deps/deno_land/std_0.51.0/fs/eol.js +0 -44
  109. package/umd/deps/deno_land/x/ini_v2.1.0/ini.js +0 -262
  110. package/umd/deps/deno_land/x/ini_v2.1.0/mod.js +0 -23
  111. package/umd/deps/deno_land/x/semver_v1.4.0/mod.js +0 -1578
  112. package/umd/mod.js +0 -24
  113. package/umd/src/Change.js +0 -61
  114. package/umd/src/Changelog.js +0 -150
  115. package/umd/src/Release.js +0 -220
  116. package/umd/src/deps.js +0 -19
  117. package/umd/src/parser.js +0 -175
@@ -0,0 +1,398 @@
1
+ /**
2
+ * The semantic version parser.
3
+ *
4
+ * Adapted directly from [semver](https://github.com/npm/node-semver).
5
+ *
6
+ * ## Versions
7
+ *
8
+ * A "version" is described by the `v2.0.0` specification found at
9
+ * <https://semver.org>.
10
+ *
11
+ * A leading `"="` or `"v"` character is stripped off and ignored.
12
+ *
13
+ * ## Ranges
14
+ *
15
+ * A `version range` is a set of `comparators` which specify versions that satisfy
16
+ * the range.
17
+ *
18
+ * A `comparator` is composed of an `operator` and a `version`. The set of
19
+ * primitive `operators` is:
20
+ *
21
+ * - `<` Less than
22
+ * - `<=` Less than or equal to
23
+ * - `>` Greater than
24
+ * - `>=` Greater than or equal to
25
+ * - `=` Equal. If no operator is specified, then equality is assumed, so this
26
+ * operator is optional, but MAY be included.
27
+ *
28
+ * For example, the comparator `>=1.2.7` would match the versions `1.2.7`, `1.2.8`,
29
+ * `2.5.3`, and `1.3.9`, but not the versions `1.2.6` or `1.1.0`.
30
+ *
31
+ * Comparators can be joined by whitespace to form a `comparator set`, which is
32
+ * satisfied by the **intersection** of all of the comparators it includes.
33
+ *
34
+ * A range is composed of one or more comparator sets, joined by `||`. A version
35
+ * matches a range if and only if every comparator in at least one of the
36
+ * `||`-separated comparator sets is satisfied by the version.
37
+ *
38
+ * For example, the range `>=1.2.7 <1.3.0` would match the versions `1.2.7`,
39
+ * `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, or `1.1.0`.
40
+ *
41
+ * The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, `1.2.9`,
42
+ * and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
43
+ *
44
+ * ### Prerelease Tags
45
+ *
46
+ * If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then it will
47
+ * only be allowed to satisfy comparator sets if at least one comparator with the
48
+ * same `[major, minor, patch]` tuple also has a prerelease tag.
49
+ *
50
+ * For example, the range `>1.2.3-alpha.3` would be allowed to match the version
51
+ * `1.2.3-alpha.7`, but it would _not_ be satisfied by `3.4.5-alpha.9`, even though
52
+ * `3.4.5-alpha.9` is technically "greater than" `1.2.3-alpha.3` according to the
53
+ * SemVer sort rules. The version range only accepts prerelease tags on the `1.2.3`
54
+ * version. The version `3.4.5` _would_ satisfy the range, because it does not have
55
+ * a prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
56
+ *
57
+ * The purpose for this behavior is twofold. First, prerelease versions frequently
58
+ * are updated very quickly, and contain many breaking changes that are (by the
59
+ * author"s design) not yet fit for public consumption. Therefore, by default, they
60
+ * are excluded from range matching semantics.
61
+ *
62
+ * Second, a user who has opted into using a prerelease version has clearly
63
+ * indicated the intent to use _that specific_ set of alpha/beta/rc versions. By
64
+ * including a prerelease tag in the range, the user is indicating that they are
65
+ * aware of the risk. However, it is still not appropriate to assume that they have
66
+ * opted into taking a similar risk on the _next_ set of prerelease versions.
67
+ *
68
+ * Note that this behavior can be suppressed (treating all prerelease versions as
69
+ * if they were normal versions, for the purpose of range matching) by setting the
70
+ * `includePrerelease` flag on the options object to any [functions](#functions)
71
+ * that do range matching.
72
+ *
73
+ * #### Prerelease Identifiers
74
+ *
75
+ * The method `.increment` takes an additional `identifier` string argument that
76
+ * will append the value of the string as a prerelease identifier:
77
+ *
78
+ * ```javascript
79
+ * semver.increment("1.2.3", "prerelease", "beta");
80
+ * // "1.2.4-beta.0"
81
+ * ```
82
+ *
83
+ * ### Advanced Range Syntax
84
+ *
85
+ * Advanced range syntax desugars to primitive comparators in deterministic ways.
86
+ *
87
+ * Advanced ranges may be combined in the same way as primitive comparators using
88
+ * white space or `||`.
89
+ *
90
+ * #### Hyphen Ranges `X.Y.Z - A.B.C`
91
+ *
92
+ * Specifies an inclusive set.
93
+ *
94
+ * - `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
95
+ *
96
+ * If a partial version is provided as the first version in the inclusive range,
97
+ * then the missing pieces are replaced with zeroes.
98
+ *
99
+ * - `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
100
+ *
101
+ * If a partial version is provided as the second version in the inclusive range,
102
+ * then all versions that start with the supplied parts of the tuple are accepted,
103
+ * but nothing that would be greater than the provided tuple parts.
104
+ *
105
+ * - `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
106
+ * - `1.2.3 - 2` := `>=1.2.3 <3.0.0`
107
+ *
108
+ * #### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
109
+ *
110
+ * Any of `X`, `x`, or `*` may be used to "stand in" for one of the numeric values
111
+ * in the `[major, minor, patch]` tuple.
112
+ *
113
+ * - `*` := `>=0.0.0` (Any version satisfies)
114
+ * - `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
115
+ * - `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
116
+ *
117
+ * A partial version range is treated as an X-Range, so the special character is in
118
+ * fact optional.
119
+ *
120
+ * - `""` (empty string) := `*` := `>=0.0.0`
121
+ * - `1` := `1.x.x` := `>=1.0.0 <2.0.0`
122
+ * - `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
123
+ *
124
+ * #### Tilde Ranges `~1.2.3` `~1.2` `~1`
125
+ *
126
+ * Allows patch-level changes if a minor version is specified on the comparator.
127
+ * Allows minor-level changes if not.
128
+ *
129
+ * - `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
130
+ * - `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
131
+ * - `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
132
+ * - `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
133
+ * - `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
134
+ * - `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
135
+ * - `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in the
136
+ * `1.2.3` version will be allowed, if they are greater than or equal to
137
+ * `beta.2`. So, `1.2.3-beta.4` would be allowed, but `1.2.4-beta.2` would not,
138
+ * because it is a prerelease of a different `[major, minor, patch]` tuple.
139
+ *
140
+ * #### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
141
+ *
142
+ * Allows changes that do not modify the left-most non-zero element in the
143
+ * `[major, minor, patch]` tuple. In other words, this allows patch and minor
144
+ * updates for versions `1.0.0` and above, patch updates for versions
145
+ * `0.X >=0.1.0`, and _no_ updates for versions `0.0.X`.
146
+ *
147
+ * Many authors treat a `0.x` version as if the `x` were the major
148
+ * "breaking-change" indicator.
149
+ *
150
+ * Caret ranges are ideal when an author may make breaking changes between `0.2.4`
151
+ * and `0.3.0` releases, which is a common practice. However, it presumes that
152
+ * there will _not_ be breaking changes between `0.2.4` and `0.2.5`. It allows for
153
+ * changes that are presumed to be additive (but non-breaking), according to
154
+ * commonly observed practices.
155
+ *
156
+ * - `^1.2.3` := `>=1.2.3 <2.0.0`
157
+ * - `^0.2.3` := `>=0.2.3 <0.3.0`
158
+ * - `^0.0.3` := `>=0.0.3 <0.0.4`
159
+ * - `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in the
160
+ * `1.2.3` version will be allowed, if they are greater than or equal to
161
+ * `beta.2`. So, `1.2.3-beta.4` would be allowed, but `1.2.4-beta.2` would not,
162
+ * because it is a prerelease of a different `[major, minor, patch]` tuple.
163
+ * - `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the `0.0.3`
164
+ * version _only_ will be allowed, if they are greater than or equal to `beta`.
165
+ * So, `0.0.3-pr.2` would be allowed.
166
+ *
167
+ * When parsing caret ranges, a missing `patch` value desugars to the number `0`,
168
+ * but will allow flexibility within that value, even if the major and minor
169
+ * versions are both `0`.
170
+ *
171
+ * - `^1.2.x` := `>=1.2.0 <2.0.0`
172
+ * - `^0.0.x` := `>=0.0.0 <0.1.0`
173
+ * - `^0.0` := `>=0.0.0 <0.1.0`
174
+ *
175
+ * A missing `minor` and `patch` values will desugar to zero, but also allow
176
+ * flexibility within those values, even if the major version is zero.
177
+ *
178
+ * - `^1.x` := `>=1.0.0 <2.0.0`
179
+ * - `^0.x` := `>=0.0.0 <1.0.0`
180
+ *
181
+ * ### Range Grammar
182
+ *
183
+ * Putting all this together, here is a Backus-Naur grammar for ranges, for the
184
+ * benefit of parser authors:
185
+ *
186
+ * ```bnf
187
+ * range-set ::= range ( logical-or range ) *
188
+ * logical-or ::= ( " " ) * "||" ( " " ) *
189
+ * range ::= hyphen | simple ( " " simple ) * | ""
190
+ * hyphen ::= partial " - " partial
191
+ * simple ::= primitive | partial | tilde | caret
192
+ * primitive ::= ( "<" | ">" | ">=" | "<=" | "=" ) partial
193
+ * partial ::= xr ( "." xr ( "." xr qualifier ? )? )?
194
+ * xr ::= "x" | "X" | "*" | nr
195
+ * nr ::= "0" | ["1"-"9"] ( ["0"-"9"] ) *
196
+ * tilde ::= "~" partial
197
+ * caret ::= "^" partial
198
+ * qualifier ::= ( "-" pre )? ( "+" build )?
199
+ * pre ::= parts
200
+ * build ::= parts
201
+ * parts ::= part ( "." part ) *
202
+ * part ::= nr | [-0-9A-Za-z]+
203
+ * ```
204
+ *
205
+ * Note that, since ranges may be non-contiguous, a version might not be greater
206
+ * than a range, less than a range, _or_ satisfy a range! For example, the range
207
+ * `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` until `2.0.0`, so the
208
+ * version `1.2.10` would not be greater than the range (because `2.0.1` satisfies,
209
+ * which is higher), nor less than the range (since `1.2.8` satisfies, which is
210
+ * lower), and it also does not satisfy the range.
211
+ *
212
+ * If you want to know if a version satisfies or does not satisfy a range, use the
213
+ * {@linkcode satisfies} function.
214
+ *
215
+ * This module is browser compatible.
216
+ *
217
+ * @example
218
+ * ```ts
219
+ * import * as semver from "https://deno.land/std@$STD_VERSION/semver/mod.ts";
220
+ *
221
+ * semver.valid("1.2.3"); // "1.2.3"
222
+ * semver.valid("a.b.c"); // null
223
+ * semver.satisfies("1.2.3", "1.x || >=2.5.0 || 5.0.0 - 7.2.3"); // true
224
+ * semver.gt("1.2.3", "9.8.7"); // false
225
+ * semver.lt("1.2.3", "9.8.7"); // true
226
+ * semver.minVersion(">=1.0.0"); // "1.0.0"
227
+ * ```
228
+ *
229
+ * @module
230
+ */
231
+ export type ReleaseType = "pre" | "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease";
232
+ export type Operator = "===" | "!==" | "" | "=" | "==" | "!=" | ">" | ">=" | "<" | "<=";
233
+ export interface Options {
234
+ /**
235
+ * Set to suppress the default behavior of excluding prerelease tagged
236
+ * versions from ranges unless they are explicitly opted into.
237
+ */
238
+ includePrerelease?: boolean;
239
+ }
240
+ export declare const SEMVER_SPEC_VERSION = "2.0.0";
241
+ /**
242
+ * Attempt to parse a string as a semantic version, returning either a `SemVer`
243
+ * object or `null`.
244
+ */
245
+ export declare function parse(version: string | SemVer | null, options?: Options): SemVer | null;
246
+ /** Returns the parsed version, or null if it's not valid. */
247
+ export declare function valid(version: string | SemVer | null, options?: Options): string | null;
248
+ export declare class SemVer {
249
+ raw: string;
250
+ options: Options;
251
+ major: number;
252
+ minor: number;
253
+ patch: number;
254
+ version: string;
255
+ build: ReadonlyArray<string>;
256
+ prerelease: Array<string | number>;
257
+ constructor(version: string | SemVer, options?: Options);
258
+ format(): string;
259
+ compare(other: string | SemVer): 1 | 0 | -1;
260
+ compareMain(other: string | SemVer): 1 | 0 | -1;
261
+ comparePre(other: string | SemVer): 1 | 0 | -1;
262
+ compareBuild(other: string | SemVer): 1 | 0 | -1;
263
+ increment(release: ReleaseType, identifier?: string): SemVer;
264
+ toString(): string;
265
+ }
266
+ /**
267
+ * Returns the version incremented by the release type
268
+ * (major, minor, patch, or prerelease), or null if it's not valid.
269
+ *
270
+ * `premajor` in one call will bump the version up to the next major version and
271
+ * down to a prerelease of that major version. `preminor`, and `prepatch` work
272
+ * the same way.
273
+ *
274
+ * If called from a non-prerelease version, the `prerelease` will work the same
275
+ * as `prepatch`. It increments the patch version, then makes a prerelease. If
276
+ * the input version is already a prerelease it simply increments it.
277
+ */
278
+ export declare function increment(version: string | SemVer, release: ReleaseType, options?: Options, identifier?: string): string | null;
279
+ /**
280
+ * Returns difference between two versions by the release type (`major`,
281
+ * `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), or
282
+ * null if the versions are the same.
283
+ */
284
+ export declare function difference(version1: string | SemVer, version2: string | SemVer, options?: Options): ReleaseType | null;
285
+ export declare function compareIdentifiers(a: string | number | null, b: string | number | null): 1 | 0 | -1;
286
+ export declare function rcompareIdentifiers(a: string | null, b: string | null): 1 | 0 | -1;
287
+ /** Returns the major version number. */
288
+ export declare function major(v: string | SemVer, options?: Options): number;
289
+ /** Returns the minor version number. */
290
+ export declare function minor(v: string | SemVer, options?: Options): number;
291
+ /** Returns the patch version number. */
292
+ export declare function patch(v: string | SemVer, options?: Options): number;
293
+ /**
294
+ * Returns `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if `v2` is
295
+ * greater. Sorts in ascending order if passed to `Array.sort()`,
296
+ */
297
+ export declare function compare(v1: string | SemVer, v2: string | SemVer, options?: Options): 1 | 0 | -1;
298
+ /**
299
+ * The same as {@linkcode compare} but considers `build` when two versions are
300
+ * equal. Sorts in ascending order if passed to `Array.sort()`.
301
+ */
302
+ export declare function compareBuild(a: string | SemVer, b: string | SemVer, options?: Options): 1 | 0 | -1;
303
+ /**
304
+ * Returns `0` if `v1 == v2`, or `-1` if `v1` is greater, or `1` if `v2` is
305
+ * greater. Sorts in descending order if passed to `Array.sort()`,
306
+ */
307
+ export declare function rcompare(v1: string | SemVer, v2: string | SemVer, options?: Options): 1 | 0 | -1;
308
+ export declare function sort<T extends string | SemVer>(list: T[], options?: Options): T[];
309
+ export declare function rsort<T extends string | SemVer>(list: T[], options?: Options): T[];
310
+ /** Greater than comparison */
311
+ export declare function gt(v1: string | SemVer, v2: string | SemVer, options?: Options): boolean;
312
+ /** Less than comparison */
313
+ export declare function lt(v1: string | SemVer, v2: string | SemVer, options?: Options): boolean;
314
+ /**
315
+ * This is true if they're logically equivalent, even if they're not the exact
316
+ * same string.
317
+ */
318
+ export declare function eq(v1: string | SemVer, v2: string | SemVer, options?: Options): boolean;
319
+ /**
320
+ * This is true if they're not logically equivalent, even if they're the exact
321
+ * same string.
322
+ */
323
+ export declare function neq(v1: string | SemVer, v2: string | SemVer, options?: Options): boolean;
324
+ /** Greater than or equal comparison */
325
+ export declare function gte(v1: string | SemVer, v2: string | SemVer, options?: Options): boolean;
326
+ /** Less than or equal comparison */
327
+ export declare function lte(v1: string | SemVer, v2: string | SemVer, options?: Options): boolean;
328
+ /**
329
+ * Pass in a comparison string, and it'll call the corresponding comparison
330
+ * function. `"==="` and `"!=="` do simple string comparison, but are included
331
+ * for completeness. Throws if an invalid comparison string is provided.
332
+ */
333
+ export declare function cmp(v1: string | SemVer, operator: Operator, v2: string | SemVer, options?: Options): boolean;
334
+ export declare class Comparator {
335
+ semver: SemVer;
336
+ operator: "" | "=" | "<" | ">" | "<=" | ">=";
337
+ value: string;
338
+ options: Options;
339
+ constructor(comp: string | Comparator, options?: Options);
340
+ parse(comp: string): void;
341
+ test(version: string | SemVer): boolean;
342
+ intersects(comp: Comparator, options?: Options): boolean;
343
+ toString(): string;
344
+ }
345
+ export declare class Range {
346
+ range: string;
347
+ raw: string;
348
+ options: Options;
349
+ includePrerelease: boolean;
350
+ set: ReadonlyArray<ReadonlyArray<Comparator>>;
351
+ constructor(range: string | Range | Comparator, options?: Options);
352
+ format(): string;
353
+ parseRange(range: string): ReadonlyArray<Comparator>;
354
+ test(version: string | SemVer): boolean;
355
+ intersects(range?: Range, options?: Options): boolean;
356
+ toString(): string;
357
+ }
358
+ export declare function toComparators(range: string | Range, options?: Options): string[][];
359
+ /** Returns true if the version satisfies the range. */
360
+ export declare function satisfies(version: string | SemVer, range: string | Range, options?: Options): boolean;
361
+ /**
362
+ * Returns the highest version in the list that satisfies the range, or `null`
363
+ * if none of them do.
364
+ */
365
+ export declare function maxSatisfying<T extends string | SemVer>(versions: ReadonlyArray<T>, range: string | Range, options?: Options): T | null;
366
+ /**
367
+ * Returns the lowest version in the list that satisfies the range, or `null` if
368
+ * none of them do.
369
+ */
370
+ export declare function minSatisfying<T extends string | SemVer>(versions: ReadonlyArray<T>, range: string | Range, options?: Options): T | null;
371
+ /** Returns the lowest version that can possibly match the given range. */
372
+ export declare function minVersion(range: string | Range, options?: Options): SemVer | null;
373
+ /** Returns the valid range or null if it's not valid. */
374
+ export declare function validRange(range: string | Range | null, options?: Options): string | null;
375
+ /**
376
+ * Returns true if version is less than all the versions possible in the range.
377
+ */
378
+ export declare function ltr(version: string | SemVer, range: string | Range, options?: Options): boolean;
379
+ /**
380
+ * Returns true if version is greater than all the versions possible in the range.
381
+ */
382
+ export declare function gtr(version: string | SemVer, range: string | Range, options?: Options): boolean;
383
+ /**
384
+ * Returns true if the version is outside the bounds of the range in either the
385
+ * high or low direction. The hilo argument must be either the string '>' or
386
+ * '<'. (This is the function called by {@linkcode gtr} and {@linkcode ltr}.)
387
+ */
388
+ export declare function outside(version: string | SemVer, range: string | Range, hilo: ">" | "<", options?: Options): boolean;
389
+ /**
390
+ * Returns an array of prerelease components, or null if none exist.
391
+ *
392
+ * @example
393
+ * `prerelease("1.2.3-alpha.1") -> ["alpha", 1]`
394
+ */
395
+ export declare function prerelease(version: string | SemVer, options?: Options): ReadonlyArray<string | number> | null;
396
+ /** Returns true if the two supplied ranges or comparators intersect. */
397
+ export declare function intersects(range1: string | Range | Comparator, range2: string | Range | Comparator, options?: Options): boolean;
398
+ export default SemVer;
package/types/mod.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import "./_dnt.polyfills.js";
1
2
  import parser from "./src/parser.js";
2
3
  import Change from "./src/Change.js";
3
4
  import Changelog from "./src/Changelog.js";
@@ -9,6 +9,7 @@ export default class Changelog {
9
9
  url?: string;
10
10
  releases: Release[];
11
11
  tagNameBuilder?: (release: Release) => string;
12
+ format: "compact" | "markdownlint";
12
13
  constructor(title: string, description?: string);
13
14
  addRelease(release: Release): this;
14
15
  findRelease(version?: Semver | string): Release | undefined;
@@ -5,6 +5,7 @@ export default class Release {
5
5
  changelog?: Changelog;
6
6
  version?: Semver;
7
7
  date?: Date;
8
+ yanked: boolean;
8
9
  description: string;
9
10
  changes: Map<string, Change[]>;
10
11
  constructor(version?: string | Semver, date?: string | Date, description?: string);
@@ -12,6 +13,7 @@ export default class Release {
12
13
  isEmpty(): boolean;
13
14
  setVersion(version?: string | Semver): void;
14
15
  setDate(date?: Date | string): void;
16
+ setYanked(yanked?: boolean): this;
15
17
  addChange(type: string, change: Change | string): this;
16
18
  added(change: Change | string): this;
17
19
  changed(change: Change | string): this;
@@ -1 +1 @@
1
- export { default as Semver, eq, } from "../deps/deno_land/x/semver_v1.4.0/mod.js";
1
+ export { default as Semver, eq, } from "../deps/deno.land/std@0.173.0/semver/mod.js";
@@ -1,13 +0,0 @@
1
- // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
2
- export class DenoStdInternalError extends Error {
3
- constructor(message) {
4
- super(message);
5
- this.name = "DenoStdInternalError";
6
- }
7
- }
8
- /** Make an assertion, if not `true`, then throw. */
9
- export function assert(expr, msg = "") {
10
- if (!expr) {
11
- throw new DenoStdInternalError(msg);
12
- }
13
- }
@@ -1,3 +0,0 @@
1
- // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
2
- // This module is browser compatible.
3
- export {};
@@ -1,14 +0,0 @@
1
- // Copyright the Browserify authors. MIT License.
2
- // Ported mostly from https://github.com/browserify/path-browserify/
3
- // This module is browser compatible.
4
- import { isWindows } from "../_util/os.js";
5
- import * as _win32 from "./win32.js";
6
- import * as _posix from "./posix.js";
7
- const path = isWindows ? _win32 : _posix;
8
- export const win32 = _win32;
9
- export const posix = _posix;
10
- export const { basename, delimiter, dirname, extname, format, fromFileUrl, isAbsolute, join, normalize, parse, relative, resolve, sep, toFileUrl, toNamespacedPath, } = path;
11
- export * from "./common.js";
12
- export { SEP, SEP_PATTERN } from "./separator.js";
13
- export * from "./_interface.js";
14
- export * from "./glob.js";
@@ -1,5 +0,0 @@
1
- export declare class DenoStdInternalError extends Error {
2
- constructor(message: string);
3
- }
4
- /** Make an assertion, if not `true`, then throw. */
5
- export declare function assert(expr: unknown, msg?: string): asserts expr;
@@ -1,3 +0,0 @@
1
- export declare type OSType = "windows" | "linux" | "darwin";
2
- export declare const osType: OSType;
3
- export declare const isWindows: boolean;
@@ -1,50 +0,0 @@
1
- export interface Args {
2
- /** Contains all the arguments that didn't have an option associated with
3
- * them. */
4
- _: Array<string | number>;
5
- [key: string]: any;
6
- }
7
- export interface ArgParsingOptions {
8
- /** When `true`, populate the result `_` with everything before the `--` and
9
- * the result `['--']` with everything after the `--`. Here's an example:
10
- *
11
- * ```ts
12
- * // $ deno run example.ts -- a arg1
13
- * import { parse } from "./mod.ts";
14
- * console.dir(parse(Deno.args, { "--": false }));
15
- * // output: { _: [ "a", "arg1" ] }
16
- * console.dir(parse(Deno.args, { "--": true }));
17
- * // output: { _: [], --: [ "a", "arg1" ] }
18
- * ```
19
- *
20
- * Defaults to `false`.
21
- */
22
- "--"?: boolean;
23
- /** An object mapping string names to strings or arrays of string argument
24
- * names to use as aliases */
25
- alias?: Record<string, string | string[]>;
26
- /** A boolean, string or array of strings to always treat as booleans. If
27
- * `true` will treat all double hyphenated arguments without equal signs as
28
- * `boolean` (e.g. affects `--foo`, not `-f` or `--foo=bar`) */
29
- boolean?: boolean | string | string[];
30
- /** An object mapping string argument names to default values. */
31
- default?: Record<string, unknown>;
32
- /** When `true`, populate the result `_` with everything after the first
33
- * non-option. */
34
- stopEarly?: boolean;
35
- /** A string or array of strings argument names to always treat as strings. */
36
- string?: string | string[];
37
- /** A function which is invoked with a command line parameter not defined in
38
- * the `options` configuration object. If the function returns `false`, the
39
- * unknown option is not added to `parsedArgs`. */
40
- unknown?: (arg: string, key?: string, value?: unknown) => unknown;
41
- }
42
- /** Take a set of command line arguments, with an optional set of options, and
43
- * return an object representation of those argument.
44
- *
45
- * ```ts
46
- * import { parse } from "./mod.ts";
47
- * const parsedArgs = parse(Deno.args);
48
- * ```
49
- */
50
- export declare function parse(args: string[], { "--": doubleDash, alias, boolean, default: defaults, stopEarly, string, unknown, }?: ArgParsingOptions): Args;
@@ -1,116 +0,0 @@
1
- export declare type ReleaseType = "pre" | "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease";
2
- export declare type Operator = "===" | "!==" | "" | "=" | "==" | "!=" | ">" | ">=" | "<" | "<=";
3
- export interface Options {
4
- loose?: boolean;
5
- includePrerelease?: boolean;
6
- }
7
- export declare const SEMVER_SPEC_VERSION = "2.0.0";
8
- export declare function parse(version: string | SemVer | null, optionsOrLoose?: boolean | Options): SemVer | null;
9
- export declare function valid(version: string | SemVer | null, optionsOrLoose?: boolean | Options): string | null;
10
- export declare function clean(version: string, optionsOrLoose?: boolean | Options): string | null;
11
- export declare class SemVer {
12
- raw: string;
13
- loose: boolean;
14
- options: Options;
15
- major: number;
16
- minor: number;
17
- patch: number;
18
- version: string;
19
- build: ReadonlyArray<string>;
20
- prerelease: Array<string | number>;
21
- constructor(version: string | SemVer, optionsOrLoose?: boolean | Options);
22
- format(): string;
23
- compare(other: string | SemVer): 1 | 0 | -1;
24
- compareMain(other: string | SemVer): 1 | 0 | -1;
25
- comparePre(other: string | SemVer): 1 | 0 | -1;
26
- compareBuild(other: string | SemVer): 1 | 0 | -1;
27
- inc(release: ReleaseType, identifier?: string): SemVer;
28
- toString(): string;
29
- }
30
- /**
31
- * Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid.
32
- */
33
- export declare function inc(version: string | SemVer, release: ReleaseType, optionsOrLoose?: boolean | Options, identifier?: string): string | null;
34
- export declare function diff(version1: string | SemVer, version2: string | SemVer, optionsOrLoose?: boolean | Options): ReleaseType | null;
35
- export declare function compareIdentifiers(a: string | number | null, b: string | number | null): 1 | 0 | -1;
36
- export declare function rcompareIdentifiers(a: string | null, b: string | null): 1 | 0 | -1;
37
- /**
38
- * Return the major version number.
39
- */
40
- export declare function major(v: string | SemVer, optionsOrLoose?: boolean | Options): number;
41
- /**
42
- * Return the minor version number.
43
- */
44
- export declare function minor(v: string | SemVer, optionsOrLoose?: boolean | Options): number;
45
- /**
46
- * Return the patch version number.
47
- */
48
- export declare function patch(v: string | SemVer, optionsOrLoose?: boolean | Options): number;
49
- export declare function compare(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): 1 | 0 | -1;
50
- export declare function compareLoose(a: string | SemVer, b: string | SemVer): 1 | 0 | -1;
51
- export declare function compareBuild(a: string | SemVer, b: string | SemVer, loose?: boolean | Options): 1 | 0 | -1;
52
- export declare function rcompare(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): 1 | 0 | -1;
53
- export declare function sort<T extends string | SemVer>(list: T[], optionsOrLoose?: boolean | Options): T[];
54
- export declare function rsort<T extends string | SemVer>(list: T[], optionsOrLoose?: boolean | Options): T[];
55
- export declare function gt(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean;
56
- export declare function lt(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean;
57
- export declare function eq(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean;
58
- export declare function neq(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean;
59
- export declare function gte(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean;
60
- export declare function lte(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean;
61
- export declare function cmp(v1: string | SemVer, operator: Operator, v2: string | SemVer, optionsOrLoose?: boolean | Options): boolean;
62
- export declare class Comparator {
63
- semver: SemVer;
64
- operator: "" | "=" | "<" | ">" | "<=" | ">=";
65
- value: string;
66
- loose: boolean;
67
- options: Options;
68
- constructor(comp: string | Comparator, optionsOrLoose?: boolean | Options);
69
- parse(comp: string): void;
70
- test(version: string | SemVer): boolean;
71
- intersects(comp: Comparator, optionsOrLoose?: boolean | Options): boolean;
72
- toString(): string;
73
- }
74
- export declare class Range {
75
- range: string;
76
- raw: string;
77
- loose: boolean;
78
- options: Options;
79
- includePrerelease: boolean;
80
- set: ReadonlyArray<ReadonlyArray<Comparator>>;
81
- constructor(range: string | Range | Comparator, optionsOrLoose?: boolean | Options);
82
- format(): string;
83
- parseRange(range: string): ReadonlyArray<Comparator>;
84
- test(version: string | SemVer): boolean;
85
- intersects(range?: Range, optionsOrLoose?: boolean | Options): boolean;
86
- toString(): string;
87
- }
88
- export declare function toComparators(range: string | Range, optionsOrLoose?: boolean | Options): string[][];
89
- export declare function satisfies(version: string | SemVer, range: string | Range, optionsOrLoose?: boolean | Options): boolean;
90
- export declare function maxSatisfying<T extends string | SemVer>(versions: ReadonlyArray<T>, range: string | Range, optionsOrLoose?: boolean | Options): T | null;
91
- export declare function minSatisfying<T extends string | SemVer>(versions: ReadonlyArray<T>, range: string | Range, optionsOrLoose?: boolean | Options): T | null;
92
- export declare function minVersion(range: string | Range, optionsOrLoose?: boolean | Options): SemVer | null;
93
- export declare function validRange(range: string | Range | null, optionsOrLoose?: boolean | Options): string | null;
94
- /**
95
- * Return true if version is less than all the versions possible in the range.
96
- */
97
- export declare function ltr(version: string | SemVer, range: string | Range, optionsOrLoose?: boolean | Options): boolean;
98
- /**
99
- * Return true if version is greater than all the versions possible in the range.
100
- */
101
- export declare function gtr(version: string | SemVer, range: string | Range, optionsOrLoose?: boolean | Options): boolean;
102
- /**
103
- * Return true if the version is outside the bounds of the range in either the high or low direction.
104
- * The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.)
105
- */
106
- export declare function outside(version: string | SemVer, range: string | Range, hilo: ">" | "<", optionsOrLoose?: boolean | Options): boolean;
107
- export declare function prerelease(version: string | SemVer, optionsOrLoose?: boolean | Options): ReadonlyArray<string | number> | null;
108
- /**
109
- * Return true if any of the ranges comparators intersect
110
- */
111
- export declare function intersects(range1: string | Range | Comparator, range2: string | Range | Comparator, optionsOrLoose?: boolean | Options): boolean;
112
- /**
113
- * Coerces a string to semver if possible
114
- */
115
- export declare function coerce(version: string | SemVer, optionsOrLoose?: boolean | Options): SemVer | null;
116
- export default SemVer;