@js-utils-kit/types 1.0.0

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.
@@ -0,0 +1,122 @@
1
+ import { ArchiverOptions, ArchiverOptions as ArchiverOptions$1 } from "archiver";
2
+
3
+ //#region src/ArchiveFormat.d.ts
4
+ /**
5
+ * Supported archive formats.
6
+ */
7
+ type ArchiveFormat = 'zip' | 'tar';
8
+ //#endregion
9
+ //#region src/CreateArchiveOptions.d.ts
10
+ /**
11
+ * Configuration options.
12
+ */
13
+ interface CreateArchiveOptions {
14
+ /**
15
+ * Archive format to use {@link ArchiveFormat}.
16
+ */
17
+ format: ArchiveFormat;
18
+ /**
19
+ * Path to the source directory that should be archived.
20
+ */
21
+ source: string;
22
+ /**
23
+ * Destination file path where the archive will be written
24
+ * @example
25
+ * - For `zip` format: `dist.zip`
26
+ * - For `tar` format: `dist.tar`
27
+ */
28
+ destination: string;
29
+ /**
30
+ * Additional options passed directly to the archiver library. See {@link ArchiverOptions}.
31
+ */
32
+ options?: ArchiverOptions$1;
33
+ /**
34
+ * Optional flag to enable internal logging. Useful for CLI mode.
35
+ */
36
+ log?: boolean;
37
+ /**
38
+ * Called after archiving is complete — receives total size in bytes.
39
+ */
40
+ onSuccess?: (bytes: number) => void;
41
+ }
42
+ //#endregion
43
+ //#region src/Environment.d.ts
44
+ /**
45
+ * Represents the standard runtime environments used in application development.
46
+ *
47
+ * This enum is typically used with {@link https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production process.env.NODE_ENV } to determine
48
+ * whether the app is running in development, production, or test mode.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * if (process.env.NODE_ENV === Environment.DEV) {
53
+ * console.log('Running in development mode');
54
+ * }
55
+ * ```
56
+ */
57
+ declare const Environment: {
58
+ /** Production environment (`"production"`) */
59
+ readonly PROD: "production";
60
+ /** Development environment (`"development"`) */
61
+ readonly DEV: "development";
62
+ /** Testing environment (`"test"`) */
63
+ readonly TEST: "test";
64
+ /** Unknown or undefined environment */
65
+ readonly UNKNOWN: "unknown";
66
+ };
67
+ type Environment = (typeof Environment)[keyof typeof Environment];
68
+ //#endregion
69
+ //#region src/Hour.d.ts
70
+ /**
71
+ * Represents an hour value in a 24-hour format.
72
+ *
73
+ * @remarks
74
+ * - Valid range is `0–23`.
75
+ */
76
+ type Hour = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
77
+ //#endregion
78
+ //#region src/MinuteOrSecond.d.ts
79
+ /**
80
+ * Represents a minute or second value in time.
81
+ *
82
+ * @remarks
83
+ * - Valid range is `0–59`.
84
+ */
85
+ type MinuteOrSecond = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59;
86
+ //#endregion
87
+ //#region src/Trim.d.ts
88
+ /**
89
+ * Trims whitespace from a string with methods for leading and trailing and normalizing whitespace.
90
+ */
91
+ interface Trim {
92
+ /**
93
+ * Removes whitespace from both ends of a string.
94
+ *
95
+ * @param str - The string to trim.
96
+ * @returns The trimmed string.
97
+ */
98
+ (str: string): string;
99
+ /**
100
+ * Removes leading whitespace from a string.
101
+ *
102
+ * @param str - The string to trim.
103
+ * @returns The string with leading whitespace removed.
104
+ */
105
+ start(str: string): string;
106
+ /**
107
+ * Removes trailing whitespace from a string.
108
+ *
109
+ * @param str - The string to trim.
110
+ * @returns The string with trailing whitespace removed.
111
+ */
112
+ end(str: string): string;
113
+ /**
114
+ * Trims the string and replaces sequences of whitespace with a single space.
115
+ *
116
+ * @param str - The string to normalize.
117
+ * @returns The string with normalized whitespace.
118
+ */
119
+ normalizeWhitespace(str: string): string;
120
+ }
121
+ //#endregion
122
+ export { ArchiveFormat, ArchiverOptions, CreateArchiveOptions, Environment, Hour, MinuteOrSecond, Trim };
@@ -0,0 +1,122 @@
1
+ import { ArchiverOptions, ArchiverOptions as ArchiverOptions$1 } from "archiver";
2
+
3
+ //#region src/ArchiveFormat.d.ts
4
+ /**
5
+ * Supported archive formats.
6
+ */
7
+ type ArchiveFormat = 'zip' | 'tar';
8
+ //#endregion
9
+ //#region src/CreateArchiveOptions.d.ts
10
+ /**
11
+ * Configuration options.
12
+ */
13
+ interface CreateArchiveOptions {
14
+ /**
15
+ * Archive format to use {@link ArchiveFormat}.
16
+ */
17
+ format: ArchiveFormat;
18
+ /**
19
+ * Path to the source directory that should be archived.
20
+ */
21
+ source: string;
22
+ /**
23
+ * Destination file path where the archive will be written
24
+ * @example
25
+ * - For `zip` format: `dist.zip`
26
+ * - For `tar` format: `dist.tar`
27
+ */
28
+ destination: string;
29
+ /**
30
+ * Additional options passed directly to the archiver library. See {@link ArchiverOptions}.
31
+ */
32
+ options?: ArchiverOptions$1;
33
+ /**
34
+ * Optional flag to enable internal logging. Useful for CLI mode.
35
+ */
36
+ log?: boolean;
37
+ /**
38
+ * Called after archiving is complete — receives total size in bytes.
39
+ */
40
+ onSuccess?: (bytes: number) => void;
41
+ }
42
+ //#endregion
43
+ //#region src/Environment.d.ts
44
+ /**
45
+ * Represents the standard runtime environments used in application development.
46
+ *
47
+ * This enum is typically used with {@link https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production process.env.NODE_ENV } to determine
48
+ * whether the app is running in development, production, or test mode.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * if (process.env.NODE_ENV === Environment.DEV) {
53
+ * console.log('Running in development mode');
54
+ * }
55
+ * ```
56
+ */
57
+ declare const Environment: {
58
+ /** Production environment (`"production"`) */
59
+ readonly PROD: "production";
60
+ /** Development environment (`"development"`) */
61
+ readonly DEV: "development";
62
+ /** Testing environment (`"test"`) */
63
+ readonly TEST: "test";
64
+ /** Unknown or undefined environment */
65
+ readonly UNKNOWN: "unknown";
66
+ };
67
+ type Environment = (typeof Environment)[keyof typeof Environment];
68
+ //#endregion
69
+ //#region src/Hour.d.ts
70
+ /**
71
+ * Represents an hour value in a 24-hour format.
72
+ *
73
+ * @remarks
74
+ * - Valid range is `0–23`.
75
+ */
76
+ type Hour = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
77
+ //#endregion
78
+ //#region src/MinuteOrSecond.d.ts
79
+ /**
80
+ * Represents a minute or second value in time.
81
+ *
82
+ * @remarks
83
+ * - Valid range is `0–59`.
84
+ */
85
+ type MinuteOrSecond = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59;
86
+ //#endregion
87
+ //#region src/Trim.d.ts
88
+ /**
89
+ * Trims whitespace from a string with methods for leading and trailing and normalizing whitespace.
90
+ */
91
+ interface Trim {
92
+ /**
93
+ * Removes whitespace from both ends of a string.
94
+ *
95
+ * @param str - The string to trim.
96
+ * @returns The trimmed string.
97
+ */
98
+ (str: string): string;
99
+ /**
100
+ * Removes leading whitespace from a string.
101
+ *
102
+ * @param str - The string to trim.
103
+ * @returns The string with leading whitespace removed.
104
+ */
105
+ start(str: string): string;
106
+ /**
107
+ * Removes trailing whitespace from a string.
108
+ *
109
+ * @param str - The string to trim.
110
+ * @returns The string with trailing whitespace removed.
111
+ */
112
+ end(str: string): string;
113
+ /**
114
+ * Trims the string and replaces sequences of whitespace with a single space.
115
+ *
116
+ * @param str - The string to normalize.
117
+ * @returns The string with normalized whitespace.
118
+ */
119
+ normalizeWhitespace(str: string): string;
120
+ }
121
+ //#endregion
122
+ export { ArchiveFormat, ArchiverOptions, CreateArchiveOptions, Environment, Hour, MinuteOrSecond, Trim };