@releasekit/version 0.2.0-next.9 → 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sam Maister
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -22,6 +22,8 @@ npm install -g @releasekit/version
22
22
  pnpm add -g @releasekit/version
23
23
  ```
24
24
 
25
+ > **Note:** This package is ESM only and requires Node.js 20+.
26
+
25
27
  ## Quick Start
26
28
 
27
29
  ```bash
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseVersionError
3
- } from "./chunk-GQLJ7JQY.js";
3
+ } from "./chunk-PVBHVUZB.js";
4
4
  export {
5
5
  BaseVersionError as BasePackageVersionerError,
6
6
  BaseVersionError
@@ -0,0 +1,71 @@
1
+ // ../core/dist/index.js
2
+ import chalk from "chalk";
3
+ var LOG_LEVELS = {
4
+ error: 0,
5
+ warn: 1,
6
+ info: 2,
7
+ debug: 3,
8
+ trace: 4
9
+ };
10
+ var PREFIXES = {
11
+ error: "[ERROR]",
12
+ warn: "[WARN]",
13
+ info: "[INFO]",
14
+ debug: "[DEBUG]",
15
+ trace: "[TRACE]"
16
+ };
17
+ var COLORS = {
18
+ error: chalk.red,
19
+ warn: chalk.yellow,
20
+ info: chalk.blue,
21
+ debug: chalk.gray,
22
+ trace: chalk.dim
23
+ };
24
+ var currentLevel = "info";
25
+ var quietMode = false;
26
+ function shouldLog(level) {
27
+ if (quietMode && level !== "error") return false;
28
+ return LOG_LEVELS[level] <= LOG_LEVELS[currentLevel];
29
+ }
30
+ function log(message, level = "info") {
31
+ if (!shouldLog(level)) return;
32
+ const formatted = COLORS[level](`${PREFIXES[level]} ${message}`);
33
+ console.error(formatted);
34
+ }
35
+ var ReleaseKitError = class _ReleaseKitError extends Error {
36
+ constructor(message) {
37
+ super(message);
38
+ this.name = this.constructor.name;
39
+ }
40
+ logError() {
41
+ log(this.message, "error");
42
+ if (this.suggestions.length > 0) {
43
+ log("\nSuggested solutions:", "info");
44
+ for (const [i, suggestion] of this.suggestions.entries()) {
45
+ log(`${i + 1}. ${suggestion}`, "info");
46
+ }
47
+ }
48
+ }
49
+ static isReleaseKitError(error2) {
50
+ return error2 instanceof _ReleaseKitError;
51
+ }
52
+ };
53
+
54
+ // src/errors/baseError.ts
55
+ var BaseVersionError = class _BaseVersionError extends ReleaseKitError {
56
+ code;
57
+ suggestions;
58
+ constructor(message, code, suggestions) {
59
+ super(message);
60
+ this.code = code;
61
+ this.suggestions = suggestions ?? [];
62
+ }
63
+ static isVersionError(error) {
64
+ return error instanceof _BaseVersionError;
65
+ }
66
+ };
67
+
68
+ export {
69
+ ReleaseKitError,
70
+ BaseVersionError
71
+ };