@rzl-zone/build-tools 0.0.5
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 +21 -0
- package/dist/.references/index.d.cts +18 -0
- package/dist/.references/index.d.ts +18 -0
- package/dist/bundler/rolldown.cjs +32 -0
- package/dist/bundler/rolldown.cjs.map +1 -0
- package/dist/bundler/rolldown.d.cts +162 -0
- package/dist/bundler/rolldown.d.ts +162 -0
- package/dist/bundler/rolldown.js +25 -0
- package/dist/bundler/rolldown.js.map +1 -0
- package/dist/bundler/tsdown.cjs +132 -0
- package/dist/bundler/tsdown.cjs.map +1 -0
- package/dist/bundler/tsdown.d.cts +1165 -0
- package/dist/bundler/tsdown.d.ts +1165 -0
- package/dist/bundler/tsdown.js +124 -0
- package/dist/bundler/tsdown.js.map +1 -0
- package/dist/bundler/utils.cjs +24 -0
- package/dist/bundler/utils.cjs.map +1 -0
- package/dist/bundler/utils.d.cts +40 -0
- package/dist/bundler/utils.d.ts +40 -0
- package/dist/bundler/utils.js +21 -0
- package/dist/bundler/utils.js.map +1 -0
- package/dist/client-XhkdKJ4d.js +160 -0
- package/dist/client-XhkdKJ4d.js.map +1 -0
- package/dist/client-u8yLSxEI.cjs +221 -0
- package/dist/client-u8yLSxEI.cjs.map +1 -0
- package/dist/commander-kit/index.cjs +569 -0
- package/dist/commander-kit/index.cjs.map +1 -0
- package/dist/commander-kit/index.d.cts +1383 -0
- package/dist/commander-kit/index.d.ts +1383 -0
- package/dist/commander-kit/index.js +550 -0
- package/dist/commander-kit/index.js.map +1 -0
- package/dist/extra-CVuXMpEw.d.ts +994 -0
- package/dist/extra-CxDwtQEy.d.cts +994 -0
- package/dist/fast-globe-options-6r2aj6UC.d.ts +126 -0
- package/dist/fast-globe-options-BFt__e__.d.cts +126 -0
- package/dist/helper-BdjaR8Yv.js +215 -0
- package/dist/helper-BdjaR8Yv.js.map +1 -0
- package/dist/helper-DorgNsB9.cjs +377 -0
- package/dist/helper-DorgNsB9.cjs.map +1 -0
- package/dist/identity-BJ0QX7AJ.js +88 -0
- package/dist/identity-BJ0QX7AJ.js.map +1 -0
- package/dist/identity-CxR9DRMh.cjs +100 -0
- package/dist/identity-CxR9DRMh.cjs.map +1 -0
- package/dist/index-B-NeF7PU.d.cts +670 -0
- package/dist/index-CzxZta4Z.d.ts +356 -0
- package/dist/index-Idak1iwg.d.cts +356 -0
- package/dist/index-PXsb85LI.d.ts +670 -0
- package/dist/index.cjs +1689 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2193 -0
- package/dist/index.d.ts +2193 -0
- package/dist/index.js +1641 -0
- package/dist/index.js.map +1 -0
- package/dist/package-banner-6RzEf-mV.cjs +54 -0
- package/dist/package-banner-6RzEf-mV.cjs.map +1 -0
- package/dist/package-banner-BzheZbxy.js +41 -0
- package/dist/package-banner-BzheZbxy.js.map +1 -0
- package/dist/server-B2hBoGDR.cjs +181 -0
- package/dist/server-B2hBoGDR.cjs.map +1 -0
- package/dist/server-CWrDd29Y.js +142 -0
- package/dist/server-CWrDd29Y.js.map +1 -0
- package/dist/utils/client.cjs +23 -0
- package/dist/utils/client.d.cts +887 -0
- package/dist/utils/client.d.ts +887 -0
- package/dist/utils/client.js +12 -0
- package/dist/utils/server.cjs +17 -0
- package/dist/utils/server.d.cts +124 -0
- package/dist/utils/server.d.ts +124 -0
- package/dist/utils/server.js +12 -0
- package/package.json +151 -0
|
@@ -0,0 +1,887 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/build-tools
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `0.0.5`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { Colors } from "picocolors/types";
|
|
12
|
+
|
|
13
|
+
type Picocolors = Colors & {
|
|
14
|
+
createColors: (enabled?: boolean) => Colors;
|
|
15
|
+
};
|
|
16
|
+
/** ----------------------------------------------------------------
|
|
17
|
+
* * ***Re-export of the `picocolors` default export.***
|
|
18
|
+
* ----------------------------------------------------------------
|
|
19
|
+
* This utility provides a lightweight and dependency-free
|
|
20
|
+
* terminal color formatting helper, identical to the
|
|
21
|
+
* original `picocolors` package export.
|
|
22
|
+
*
|
|
23
|
+
* - **It is re-exported to:**
|
|
24
|
+
* - Provide a stable internal import path.
|
|
25
|
+
* - Avoid direct dependency imports in consumers.
|
|
26
|
+
* - Ensure consistent color handling across the codebase.
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://github.com/alexeyraspopov/picocolors | **`picocolors repository`**.}
|
|
29
|
+
*/
|
|
30
|
+
declare const picocolors: Picocolors;
|
|
31
|
+
/** ----------------------------------------------------------------
|
|
32
|
+
* * ***Normalized newline character.***
|
|
33
|
+
* ----------------------------------------------------------------
|
|
34
|
+
*
|
|
35
|
+
* Represents a single line feed character (`\n`), used as a
|
|
36
|
+
* **consistent newline** across all platforms.
|
|
37
|
+
*
|
|
38
|
+
* This value is intentionally **not platform-specific** and does
|
|
39
|
+
* not vary between operating systems (e.g. Windows CRLF vs POSIX LF).
|
|
40
|
+
* It is suitable for generated files, formatters, and build tools
|
|
41
|
+
* where deterministic output is required.
|
|
42
|
+
*
|
|
43
|
+
* The value is base64-encoded to avoid embedding a literal newline
|
|
44
|
+
* in the bundled output during minification.
|
|
45
|
+
*
|
|
46
|
+
* @type {string}
|
|
47
|
+
*/
|
|
48
|
+
declare const NEWLINE: string;
|
|
49
|
+
/** ----------------------------------------------------------------
|
|
50
|
+
* * ***Platform-specific end-of-line character.***
|
|
51
|
+
* ----------------------------------------------------------------
|
|
52
|
+
*
|
|
53
|
+
* Resolves to the operating system's default end-of-line sequence:
|
|
54
|
+
* - `\n` on POSIX systems (Linux, macOS)
|
|
55
|
+
* - `\r\n` on Windows
|
|
56
|
+
*
|
|
57
|
+
* Used to ensure generated multiline strings are compatible
|
|
58
|
+
* with the host environment.
|
|
59
|
+
*
|
|
60
|
+
* In non-Node environments, this value falls back to `\n`.
|
|
61
|
+
* The fallback is encoded to avoid embedding a literal newline
|
|
62
|
+
* in the bundled output during minification.
|
|
63
|
+
*
|
|
64
|
+
* @type {string}
|
|
65
|
+
*/
|
|
66
|
+
declare const EOL: string;
|
|
67
|
+
/** -------------------------------------------------------
|
|
68
|
+
* * ***Utility Function: `plural`.***
|
|
69
|
+
* -------------------------------------------------------
|
|
70
|
+
* **Returns the correct singular or plural form of a word
|
|
71
|
+
* based on a numeric count.**
|
|
72
|
+
*
|
|
73
|
+
* This helper is commonly used when generating human-readable
|
|
74
|
+
* CLI messages where a word must change depending on quantity.
|
|
75
|
+
*
|
|
76
|
+
* By default, the function pluralizes a word by appending `"s"`
|
|
77
|
+
* when the `count` is not equal to `1`.
|
|
78
|
+
*
|
|
79
|
+
* For irregular plural forms, a custom `pluralWord` may be
|
|
80
|
+
* provided explicitly.
|
|
81
|
+
*
|
|
82
|
+
* ⚠️ This utility performs **simple English pluralization only**.
|
|
83
|
+
* It does **not** automatically handle irregular plural forms
|
|
84
|
+
* such as `person ➔ people` or `child ➔ children` unless the
|
|
85
|
+
* plural form is provided manually.
|
|
86
|
+
*
|
|
87
|
+
* - **Behavior:**
|
|
88
|
+
* - If `count === 1` ➔ returns the singular `word`.
|
|
89
|
+
* - Otherwise ➔ returns `pluralWord` if provided,
|
|
90
|
+
* or `${word}s` by default.
|
|
91
|
+
*
|
|
92
|
+
* @param count - The numeric count used to determine pluralization.
|
|
93
|
+
* @param word - The singular form of the word.
|
|
94
|
+
* @param pluralWord - Optional explicit plural form.
|
|
95
|
+
*
|
|
96
|
+
* @returns The appropriate singular or plural word form.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* plural(1, "file");
|
|
101
|
+
* // ➔ "file"
|
|
102
|
+
*
|
|
103
|
+
* plural(3, "file");
|
|
104
|
+
* // ➔ "files"
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* plural(1, "person", "people");
|
|
110
|
+
* // ➔ "person"
|
|
111
|
+
*
|
|
112
|
+
* plural(5, "person", "people");
|
|
113
|
+
* // ➔ "people"
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* const count = 2;
|
|
119
|
+
* console.log(`${count} ${plural(count, "file")} copied`);
|
|
120
|
+
* // ➔ "2 files copied"
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
declare function plural(count: number, word: string, pluralWord?: string): string;
|
|
124
|
+
/** ----------------------------------------------------------------
|
|
125
|
+
* * ***Conditionally pads a value with leading and/or trailing spaces.***
|
|
126
|
+
* ----------------------------------------------------------------
|
|
127
|
+
*
|
|
128
|
+
* Formats a value by optionally prepending and/or appending a single
|
|
129
|
+
* space character (`" "`), depending on the provided options.
|
|
130
|
+
*
|
|
131
|
+
* Only **valid non-empty strings** are padded.
|
|
132
|
+
* A value is considered **invalid** when it is:
|
|
133
|
+
* - not a string.
|
|
134
|
+
* - an empty string (`""`).
|
|
135
|
+
* - a string containing only whitespace.
|
|
136
|
+
*
|
|
137
|
+
* When the value is invalid, this utility can optionally return
|
|
138
|
+
* a single space instead of an empty string.
|
|
139
|
+
*
|
|
140
|
+
* @param {unknown} value - The value to be padded.
|
|
141
|
+
* @param {{ start?: boolean; end?: boolean; padOnInvalid?: boolean; }} options - Padding behavior configuration.
|
|
142
|
+
* @param options.start - Prepend a single space before the value.
|
|
143
|
+
* @param options.end - Append a single space after the value.
|
|
144
|
+
* @param options.padOnInvalid - Return a single space when the value
|
|
145
|
+
* is not a valid non-empty string.
|
|
146
|
+
*
|
|
147
|
+
* @returns A formatted string with optional leading and/or trailing
|
|
148
|
+
* spaces, or a single space / empty string when the input is invalid.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* padText("hello");
|
|
153
|
+
* // ➔ " hello "
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* padText("hello", { start: true, end: false });
|
|
159
|
+
* // ➔ " hello"
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* padText("", { padOnInvalid: true });
|
|
165
|
+
* // ➔ " "
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* padText(null, { padOnInvalid: false });
|
|
171
|
+
* // ➔ ""
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
declare function padText(value: unknown, options?: {
|
|
175
|
+
/**
|
|
176
|
+
* Whether to prepend a single space to the output.
|
|
177
|
+
*
|
|
178
|
+
* @default true
|
|
179
|
+
*/
|
|
180
|
+
start?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Whether to append a single space to the output.
|
|
183
|
+
*
|
|
184
|
+
* @default true
|
|
185
|
+
*/
|
|
186
|
+
end?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Return a single space when the input is not a valid non-empty string.
|
|
189
|
+
*
|
|
190
|
+
* This applies to non-string values, empty strings,
|
|
191
|
+
* or strings containing only whitespace.
|
|
192
|
+
*
|
|
193
|
+
* @default true
|
|
194
|
+
*/
|
|
195
|
+
padOnInvalid?: boolean;
|
|
196
|
+
}): string;
|
|
197
|
+
/** ----------------------------------------------------------------
|
|
198
|
+
* * ***Joins text segments into a compact space-separated string.***
|
|
199
|
+
* ----------------------------------------------------------------
|
|
200
|
+
*
|
|
201
|
+
* Joins multiple values into a single string separated by a
|
|
202
|
+
* **single space character** (`" "`).
|
|
203
|
+
*
|
|
204
|
+
* This utility removes all non-renderable values before joining,
|
|
205
|
+
* producing a compact inline string without unintended spacing.
|
|
206
|
+
*
|
|
207
|
+
* - *Filtering behavior:*
|
|
208
|
+
* - `false`, `null`, and `undefined` are removed.
|
|
209
|
+
* - Empty strings (`""`) are also removed.
|
|
210
|
+
*
|
|
211
|
+
* This makes the output suitable for inline text composition
|
|
212
|
+
* where line breaks and extra spacing are not desired.
|
|
213
|
+
*
|
|
214
|
+
* - *Useful for:*
|
|
215
|
+
* - Inline CLI messages.
|
|
216
|
+
* - Error summaries.
|
|
217
|
+
* - Concatenating optional labels or fragments.
|
|
218
|
+
* - Single-line log output.
|
|
219
|
+
*
|
|
220
|
+
* @param {Array<string | false | null | undefined>} text - A list of
|
|
221
|
+
* strings or falsy values to be joined. Empty strings are excluded
|
|
222
|
+
* to prevent extra spaces in the output.
|
|
223
|
+
*
|
|
224
|
+
* @returns {string} A single string with values joined by a
|
|
225
|
+
* single space character.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* joinInline("Hello", false, "", "world");
|
|
230
|
+
* // ➔ "Hello world"
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* joinInline(
|
|
236
|
+
* "Error:",
|
|
237
|
+
* undefined,
|
|
238
|
+
* "Invalid",
|
|
239
|
+
* null,
|
|
240
|
+
* "input"
|
|
241
|
+
* );
|
|
242
|
+
* // ➔ "Error: Invalid input"
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
declare function joinInline(...text: Array<string | false | null | undefined>): string;
|
|
246
|
+
/** ----------------------------------------------------------------
|
|
247
|
+
* * ***Joins text lines into a compact newline-separated string.***
|
|
248
|
+
* ----------------------------------------------------------------
|
|
249
|
+
*
|
|
250
|
+
* Joins multiple values into a single string separated by the
|
|
251
|
+
* platform-specific end-of-line character ({@link EOL | **`EOL`**}).
|
|
252
|
+
*
|
|
253
|
+
* This utility removes all non-renderable values before joining,
|
|
254
|
+
* ensuring a compact output with no unintended blank lines.
|
|
255
|
+
*
|
|
256
|
+
* - *Filtering behavior:*
|
|
257
|
+
* - `false`, `null`, and `undefined` are removed.
|
|
258
|
+
* - Empty strings (`""`) are also removed.
|
|
259
|
+
*
|
|
260
|
+
* This makes the output dense and suitable for cases where
|
|
261
|
+
* vertical spacing should not be preserved.
|
|
262
|
+
*
|
|
263
|
+
* - *Useful for:*
|
|
264
|
+
* - CLI error messages.
|
|
265
|
+
* - Compact help or status output.
|
|
266
|
+
* - Multi-line logs without spacing gaps.
|
|
267
|
+
*
|
|
268
|
+
* @param {Array<string | false | null | undefined>} text - A list of
|
|
269
|
+
* strings or falsy values to be joined. Empty strings are excluded
|
|
270
|
+
* to prevent blank lines in the output.
|
|
271
|
+
*
|
|
272
|
+
* @returns {string} A single string joined using the OS-specific
|
|
273
|
+
* end-of-line character.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* joinLines("Line 1", false, "", "Line 2");
|
|
278
|
+
* // ➔ "Line 1\nLine 2"
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```ts
|
|
283
|
+
* joinLines(
|
|
284
|
+
* "Header",
|
|
285
|
+
* undefined,
|
|
286
|
+
* "",
|
|
287
|
+
* "Body",
|
|
288
|
+
* null,
|
|
289
|
+
* "Footer"
|
|
290
|
+
* );
|
|
291
|
+
* // ➔ "Header\nBody\nFooter"
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
declare function joinLines(...text: Array<string | false | null | undefined>): string;
|
|
295
|
+
/** ----------------------------------------------------------------
|
|
296
|
+
* * ***Joins text lines while preserving explicit empty lines.***
|
|
297
|
+
* ----------------------------------------------------------------
|
|
298
|
+
*
|
|
299
|
+
* Joins multiple values into a single string separated by the
|
|
300
|
+
* platform-specific end-of-line character ({@link EOL | **`EOL`**}).
|
|
301
|
+
*
|
|
302
|
+
* Unlike {@link joinLines | **`joinLines`**}, this variant **preserves empty strings**
|
|
303
|
+
* (`""`) to intentionally create blank lines in the output.
|
|
304
|
+
*
|
|
305
|
+
* - *Filtering behavior:*
|
|
306
|
+
* - `false`, `null`, and `undefined` are removed.
|
|
307
|
+
* - Empty strings (`""`) are kept as-is.
|
|
308
|
+
*
|
|
309
|
+
* This allows precise control over vertical spacing when composing
|
|
310
|
+
* formatted text.
|
|
311
|
+
*
|
|
312
|
+
* - *Useful for:*
|
|
313
|
+
* - CLI help output with paragraph separation.
|
|
314
|
+
* - Multi-section descriptions.
|
|
315
|
+
* - Human-readable documentation formatting.
|
|
316
|
+
*
|
|
317
|
+
* @param {Array<string | false | null | undefined>} text - A list of
|
|
318
|
+
* strings or falsy values to be joined. Empty strings are preserved
|
|
319
|
+
* to produce blank lines in the output.
|
|
320
|
+
*
|
|
321
|
+
* @returns {string} A single string joined using the OS-specific
|
|
322
|
+
* end-of-line character.
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```ts
|
|
326
|
+
* joinLinesLoose(
|
|
327
|
+
* "Line one",
|
|
328
|
+
* "Line two",
|
|
329
|
+
* "",
|
|
330
|
+
* "New paragraph"
|
|
331
|
+
* );
|
|
332
|
+
* // ➔ "Line one\nLine two\n\nNew paragraph"
|
|
333
|
+
* ```
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ```ts
|
|
337
|
+
* joinLinesLoose(
|
|
338
|
+
* "Header",
|
|
339
|
+
* null,
|
|
340
|
+
* "",
|
|
341
|
+
* "Body",
|
|
342
|
+
* false,
|
|
343
|
+
* null,
|
|
344
|
+
* undefined
|
|
345
|
+
* );
|
|
346
|
+
* // ➔ "Header\n\nBody"
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
declare function joinLinesLoose(...text: Array<string | false | null | undefined>): string;
|
|
350
|
+
type FormatOptionValueOptions = {
|
|
351
|
+
/** @default false */pretty?: boolean; /** @default 2 */
|
|
352
|
+
indent?: number; /** @default false */
|
|
353
|
+
sortKeys?: boolean; /** @default false */
|
|
354
|
+
sortArray?: boolean;
|
|
355
|
+
};
|
|
356
|
+
/** ----------------------------------------------------------------
|
|
357
|
+
* * Formats a value into a compact, colorized CLI representation.
|
|
358
|
+
* ----------------------------------------------------------------
|
|
359
|
+
*
|
|
360
|
+
* Recursively converts an arbitrary value into a human-readable,
|
|
361
|
+
* ANSI-colored string intended strictly for terminal output.
|
|
362
|
+
*
|
|
363
|
+
* This formatter is designed for developer-facing CLI diagnostics
|
|
364
|
+
* and must NOT be used for logging, serialization, persistence,
|
|
365
|
+
* or programmatic comparison.
|
|
366
|
+
*
|
|
367
|
+
* - *Behavior:*
|
|
368
|
+
* - Arrays are rendered inline: `[a, b, c]`.
|
|
369
|
+
* - `Set` values are converted to arrays before rendering.
|
|
370
|
+
* - `Map` values are converted to plain objects via `Object.fromEntries`.
|
|
371
|
+
* - Plain objects are rendered inline: `{ key: value }`.
|
|
372
|
+
* - `RegExp` values are colorized by delimiter, source, and flags.
|
|
373
|
+
* - Strings are wrapped in double quotes.
|
|
374
|
+
* - Numbers (including `NaN`) and booleans are highlighted.
|
|
375
|
+
* - `null` and `undefined` are red-bright color.
|
|
376
|
+
* - Other objects fall back to `Object.prototype.toString`.
|
|
377
|
+
*
|
|
378
|
+
* - *Characteristics:*
|
|
379
|
+
* - Recursive.
|
|
380
|
+
* - Compact (single-line).
|
|
381
|
+
* - No pretty-print indentation.
|
|
382
|
+
* - No key or array sorting.
|
|
383
|
+
* - No JSON serialization.
|
|
384
|
+
* - No circular reference handling.
|
|
385
|
+
*
|
|
386
|
+
* @param value - The value to format for CLI display.
|
|
387
|
+
*
|
|
388
|
+
* @returns A colorized string optimized for terminal readability.
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* formatOptionValue(["a", "b"]);
|
|
392
|
+
* // ➔ [ "a", "b" ]
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* formatOptionValue({ foo: 1, bar: true });
|
|
396
|
+
* // ➔ { foo: 1, bar: true }
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* formatOptionValue(new Set(["dist/**"]));
|
|
400
|
+
* // ➔ [ "dist/**" ]
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* formatOptionValue(/abc/i);
|
|
404
|
+
* // ➔ /abc/i (colorized segments)
|
|
405
|
+
*/
|
|
406
|
+
declare function formatOptionValue(value: unknown, options?: FormatOptionValueOptions): string;
|
|
407
|
+
/** ----------------------------------------------------------------
|
|
408
|
+
* * ***Structured metadata for {@link ConfigurationError | `ConfigurationError`}.***
|
|
409
|
+
* ----------------------------------------------------------------
|
|
410
|
+
*
|
|
411
|
+
* Describes machine-readable contextual information attached to a
|
|
412
|
+
* {@link ConfigurationError | `ConfigurationError`} instance.
|
|
413
|
+
*
|
|
414
|
+
* - ***This structure is designed to:***
|
|
415
|
+
* - Provide debugging insight without parsing the error message.
|
|
416
|
+
* - Support structured logging and telemetry pipelines.
|
|
417
|
+
* - Remain extensible while preserving strong autocomplete support.
|
|
418
|
+
*
|
|
419
|
+
* ----------------------------------------------------------------
|
|
420
|
+
* #### Common Fields:
|
|
421
|
+
* ----------------------------------------------------------------
|
|
422
|
+
*
|
|
423
|
+
* - `received` — The actual value that failed validation.
|
|
424
|
+
* - `context` — Logical origin of the validation
|
|
425
|
+
* (e.g. function or factory name).
|
|
426
|
+
*
|
|
427
|
+
* Additional custom metadata may be attached as needed.
|
|
428
|
+
*
|
|
429
|
+
* ----------------------------------------------------------------
|
|
430
|
+
* @remarks
|
|
431
|
+
* - All properties are optional.
|
|
432
|
+
* - This type intentionally allows arbitrary additional keys.
|
|
433
|
+
* - Intended for machine-readable data (not human-facing text).
|
|
434
|
+
*/
|
|
435
|
+
interface ConfigurationErrorDetails {
|
|
436
|
+
/** * ***The actual received value that caused the validation failure.*** */
|
|
437
|
+
readonly received?: unknown;
|
|
438
|
+
/** * ***Logical origin of the validation (e.g. function name).*** */
|
|
439
|
+
readonly context?: string;
|
|
440
|
+
/** * ***Additional arbitrary metadata.*** */
|
|
441
|
+
readonly [key: string]: unknown;
|
|
442
|
+
}
|
|
443
|
+
/** ----------------------------------------------------------------
|
|
444
|
+
* * ***Represents a developer configuration error.***
|
|
445
|
+
* ----------------------------------------------------------------
|
|
446
|
+
*
|
|
447
|
+
* Thrown when invalid, inconsistent, or malformed configuration
|
|
448
|
+
* is detected during application or library initialization.
|
|
449
|
+
*
|
|
450
|
+
* This error indicates a **programmer mistake** in how a component,
|
|
451
|
+
* module, or library has been configured. It should **not** be used
|
|
452
|
+
* for runtime user input validation.
|
|
453
|
+
*
|
|
454
|
+
* ----------------------------------------------------------------
|
|
455
|
+
* #### When to use?
|
|
456
|
+
* ----------------------------------------------------------------
|
|
457
|
+
*
|
|
458
|
+
* Use `ConfigurationError` for configuration-related issues such as:
|
|
459
|
+
*
|
|
460
|
+
* - Invalid initialization or factory options.
|
|
461
|
+
* - Incorrect constructor arguments.
|
|
462
|
+
* - Broken integration or adapter contracts.
|
|
463
|
+
* - Misconfigured environment or setup parameters.
|
|
464
|
+
* - Violations of expected configuration schemas.
|
|
465
|
+
*
|
|
466
|
+
* Do **not** use this error type for runtime user input validation
|
|
467
|
+
* (such as request payloads, form data, or command arguments).
|
|
468
|
+
* Those scenarios should use domain-specific validation errors instead.
|
|
469
|
+
*
|
|
470
|
+
* ----------------------------------------------------------------
|
|
471
|
+
* #### Behavior
|
|
472
|
+
* ----------------------------------------------------------------
|
|
473
|
+
*
|
|
474
|
+
* - Extends the native {@link Error | `Error`}.
|
|
475
|
+
* - Sets `.name` to `"ConfigurationError"`.
|
|
476
|
+
* - Preserves the original stack trace.
|
|
477
|
+
* - Supports contextual metadata via `details`.
|
|
478
|
+
* - Exposes a stable `code` identifier for programmatic handling.
|
|
479
|
+
*
|
|
480
|
+
* ----------------------------------------------------------------
|
|
481
|
+
* #### Handling
|
|
482
|
+
* ----------------------------------------------------------------
|
|
483
|
+
*
|
|
484
|
+
* Consumers may safely narrow using `instanceof`
|
|
485
|
+
* or {@link ConfigurationError.is | `ConfigurationError.is`}
|
|
486
|
+
* to access structured metadata.
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
* ```ts
|
|
490
|
+
* try {
|
|
491
|
+
* initializeSetup(options);
|
|
492
|
+
* } catch (err) {
|
|
493
|
+
* if (err instanceof ConfigurationError) {
|
|
494
|
+
* console.error(err.message);
|
|
495
|
+
* console.error("Code:", err.code);
|
|
496
|
+
* console.error("Details:", err.details);
|
|
497
|
+
* }
|
|
498
|
+
* }
|
|
499
|
+
* ```
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```ts
|
|
503
|
+
* throw ConfigurationError.invalid(
|
|
504
|
+
* "options.timeout",
|
|
505
|
+
* "must be a positive number",
|
|
506
|
+
* { received: value },
|
|
507
|
+
* "createComponent"
|
|
508
|
+
* );
|
|
509
|
+
* ```
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
* ```ts
|
|
513
|
+
* throw ConfigurationError.type(
|
|
514
|
+
* "config.adapter",
|
|
515
|
+
* "function",
|
|
516
|
+
* value
|
|
517
|
+
* );
|
|
518
|
+
* ```
|
|
519
|
+
*
|
|
520
|
+
* ----------------------------------------------------------------
|
|
521
|
+
* @remarks
|
|
522
|
+
* - Represents a **programmer-level configuration mistake**.
|
|
523
|
+
* - Typically indicates a **non-recoverable initialization failure**.
|
|
524
|
+
* - Intended for validating configuration in libraries or frameworks.
|
|
525
|
+
*/
|
|
526
|
+
declare class ConfigurationError extends Error {
|
|
527
|
+
/** ----------------------------------------------------------------
|
|
528
|
+
* * ***Creates a new `ConfigurationError` instance.***
|
|
529
|
+
* ----------------------------------------------------------------
|
|
530
|
+
*
|
|
531
|
+
* @param message - Fully formatted error message.
|
|
532
|
+
* @param details - Optional structured metadata describing the error.
|
|
533
|
+
*
|
|
534
|
+
* @remarks
|
|
535
|
+
* - The message is expected to be finalized (including punctuation).
|
|
536
|
+
* - Restores the prototype chain for ES5 targets.
|
|
537
|
+
* - Captures a clean stack trace in Node.js environments.
|
|
538
|
+
*/
|
|
539
|
+
constructor(message: string, details?: Readonly<ConfigurationErrorDetails>);
|
|
540
|
+
/** ----------------------------------------------------------------
|
|
541
|
+
* * ***Stable runtime name for this error type.***
|
|
542
|
+
* ----------------------------------------------------------------
|
|
543
|
+
*
|
|
544
|
+
* - ***Mirrors the class identifier and is used to:***
|
|
545
|
+
* - Set the `.name` property consistently.
|
|
546
|
+
* - Provide cross-runtime identification.
|
|
547
|
+
* - Avoid hardcoded string duplication.
|
|
548
|
+
*
|
|
549
|
+
* This value should remain stable across versions.
|
|
550
|
+
*/
|
|
551
|
+
static readonly NAME = "ConfigurationError";
|
|
552
|
+
/** ----------------------------------------------------------------
|
|
553
|
+
* * ***Stable error identifier for `ConfigurationError`.***
|
|
554
|
+
* ----------------------------------------------------------------
|
|
555
|
+
*
|
|
556
|
+
* Can be used for:
|
|
557
|
+
* - Programmatic error discrimination.
|
|
558
|
+
* - Cross-bundle or cross-runtime error detection.
|
|
559
|
+
* - Structured logging and telemetry systems.
|
|
560
|
+
*
|
|
561
|
+
* This identifier is guaranteed to remain stable across versions.
|
|
562
|
+
*/
|
|
563
|
+
static readonly CODE = "CONFIGURATION_ERROR";
|
|
564
|
+
/** ----------------------------------------------------------------
|
|
565
|
+
* * ***Stable error code associated with this instance.***
|
|
566
|
+
* ----------------------------------------------------------------
|
|
567
|
+
*
|
|
568
|
+
* Mirrors {@link CODE | `ConfigurationError.CODE`}.
|
|
569
|
+
*
|
|
570
|
+
* Useful when `instanceof` checks are not reliable
|
|
571
|
+
* across different runtime contexts.
|
|
572
|
+
*/
|
|
573
|
+
readonly code: "CONFIGURATION_ERROR";
|
|
574
|
+
/** ----------------------------------------------------------------
|
|
575
|
+
* * ***Optional structured metadata associated with this error.***
|
|
576
|
+
* ----------------------------------------------------------------
|
|
577
|
+
*
|
|
578
|
+
* Provides additional contextual information useful for:
|
|
579
|
+
*
|
|
580
|
+
* - Debugging.
|
|
581
|
+
* - Structured logging.
|
|
582
|
+
* - Programmatic error handling.
|
|
583
|
+
*
|
|
584
|
+
* The structure of this object is defined by
|
|
585
|
+
* {@link ConfigurationErrorDetails| `ConfigurationErrorDetails`}.
|
|
586
|
+
*
|
|
587
|
+
* ----------------------------------------------------------------
|
|
588
|
+
* #### Common Usage
|
|
589
|
+
* ----------------------------------------------------------------
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* ```ts
|
|
593
|
+
* try {
|
|
594
|
+
* throw ConfigurationError.type(
|
|
595
|
+
* "options.myFunction",
|
|
596
|
+
* "myFunction",
|
|
597
|
+
* value
|
|
598
|
+
* );
|
|
599
|
+
* } catch (err) {
|
|
600
|
+
* if (err instanceof ConfigurationError) {
|
|
601
|
+
* console.log(err.details?.received);
|
|
602
|
+
* console.log(err.details?.context);
|
|
603
|
+
* }
|
|
604
|
+
* }
|
|
605
|
+
* ```
|
|
606
|
+
* ----------------------------------------------------------------
|
|
607
|
+
* @remarks
|
|
608
|
+
* - Intended for machine-readable data.
|
|
609
|
+
* - Immutable (`readonly`) to prevent accidental mutation.
|
|
610
|
+
* - May contain additional custom metadata fields.
|
|
611
|
+
*/
|
|
612
|
+
readonly details?: Readonly<ConfigurationErrorDetails>;
|
|
613
|
+
/** ----------------------------------------------------------------
|
|
614
|
+
* * ***Normalizes an error message to ensure a single trailing period.***
|
|
615
|
+
* ----------------------------------------------------------------
|
|
616
|
+
*
|
|
617
|
+
* - Trims surrounding whitespace.
|
|
618
|
+
* - Removes any existing trailing period(s).
|
|
619
|
+
* - Appends exactly one `.` at the end.
|
|
620
|
+
*
|
|
621
|
+
* This guarantees consistent punctuation regardless of how
|
|
622
|
+
* the message fragments are constructed.
|
|
623
|
+
*
|
|
624
|
+
* ----------------------------------------------------------------
|
|
625
|
+
* @example
|
|
626
|
+
* ```ts
|
|
627
|
+
* ConfigurationError.format("Invalid value")
|
|
628
|
+
* // ➔ "Invalid value."
|
|
629
|
+
* ```
|
|
630
|
+
*
|
|
631
|
+
* @example
|
|
632
|
+
* ```ts
|
|
633
|
+
* ConfigurationError.format("Invalid value.")
|
|
634
|
+
* // ➔ "Invalid value."
|
|
635
|
+
* ```
|
|
636
|
+
*
|
|
637
|
+
* @example
|
|
638
|
+
* ```ts
|
|
639
|
+
* ConfigurationError.format(" Invalid value... ")
|
|
640
|
+
* // ➔ "Invalid value."
|
|
641
|
+
* ```
|
|
642
|
+
* ----------------------------------------------------------------
|
|
643
|
+
*/
|
|
644
|
+
static format(message: string): string;
|
|
645
|
+
/** ----------------------------------------------------------------
|
|
646
|
+
* * ***Safely wraps a string in a single pair of backticks.***
|
|
647
|
+
* ----------------------------------------------------------------
|
|
648
|
+
*
|
|
649
|
+
* Ensures consistent inline-code formatting while preventing
|
|
650
|
+
* duplicated or nested backticks.
|
|
651
|
+
*
|
|
652
|
+
* - Removes any existing backticks from the input.
|
|
653
|
+
* - Trims surrounding whitespace.
|
|
654
|
+
* - Wraps the cleaned value in exactly one pair of backticks.
|
|
655
|
+
*
|
|
656
|
+
* This prevents malformed output such as:
|
|
657
|
+
*
|
|
658
|
+
* ```text
|
|
659
|
+
* ``validateConfig``
|
|
660
|
+
* ```
|
|
661
|
+
*
|
|
662
|
+
* ----------------------------------------------------------------
|
|
663
|
+
* @param value - Raw string to be formatted as inline code.
|
|
664
|
+
* @returns The sanitized value wrapped in a single pair of backticks.
|
|
665
|
+
*
|
|
666
|
+
* ----------------------------------------------------------------
|
|
667
|
+
* @example
|
|
668
|
+
* ```ts
|
|
669
|
+
* ConfigurationError.wrapCode("fieldName")
|
|
670
|
+
* // ➔ "`fieldName`"
|
|
671
|
+
* ```
|
|
672
|
+
*
|
|
673
|
+
* @example
|
|
674
|
+
* ```ts
|
|
675
|
+
* ConfigurationError.wrapCode("`fieldName`")
|
|
676
|
+
* // ➔ "`fieldName`"
|
|
677
|
+
* ```
|
|
678
|
+
*
|
|
679
|
+
* @example
|
|
680
|
+
* ```ts
|
|
681
|
+
* ConfigurationError.wrapCode(" ``fieldName`` ")
|
|
682
|
+
* // ➔ "`fieldName`"
|
|
683
|
+
* ```
|
|
684
|
+
* ----------------------------------------------------------------
|
|
685
|
+
*/
|
|
686
|
+
static wrapCode(value: string): string;
|
|
687
|
+
/** ----------------------------------------------------------------
|
|
688
|
+
* * ***Type guard for `ConfigurationError`.***
|
|
689
|
+
* ----------------------------------------------------------------
|
|
690
|
+
*
|
|
691
|
+
* Provides a robust alternative to `instanceof`,
|
|
692
|
+
* especially across bundle boundaries or mixed module systems.
|
|
693
|
+
*
|
|
694
|
+
* @param value - Unknown value to test.
|
|
695
|
+
* @returns `true` if the value is a {@link ConfigurationError | `ConfigurationError`}.
|
|
696
|
+
*
|
|
697
|
+
* @example
|
|
698
|
+
* if (ConfigurationError.is(err)) {
|
|
699
|
+
* console.error(err.code);
|
|
700
|
+
* }
|
|
701
|
+
*/
|
|
702
|
+
static is(value: unknown): value is ConfigurationError;
|
|
703
|
+
/** ----------------------------------------------------------------
|
|
704
|
+
* * ***Serializes the error into a structured JSON representation.***
|
|
705
|
+
* ----------------------------------------------------------------
|
|
706
|
+
*
|
|
707
|
+
* Provides a stable, machine-readable representation of the error,
|
|
708
|
+
* suitable for:
|
|
709
|
+
*
|
|
710
|
+
* - Structured logging.
|
|
711
|
+
* - Transport across process boundaries.
|
|
712
|
+
* - Diagnostics.
|
|
713
|
+
* - JSON.stringify().
|
|
714
|
+
*
|
|
715
|
+
* Unlike the native `Error` object, this method ensures that:
|
|
716
|
+
*
|
|
717
|
+
* - `name`, `message`, and `code` are always included.
|
|
718
|
+
* - `details` is preserved (if provided).
|
|
719
|
+
* - `stack` is included only when available.
|
|
720
|
+
*
|
|
721
|
+
* This guarantees predictable output when serializing errors.
|
|
722
|
+
*
|
|
723
|
+
* ----------------------------------------------------------------
|
|
724
|
+
* @returns A plain JSON-safe object describing the error.
|
|
725
|
+
*
|
|
726
|
+
* ----------------------------------------------------------------
|
|
727
|
+
* @example
|
|
728
|
+
* ```ts
|
|
729
|
+
* const err = ConfigurationError.invalid(
|
|
730
|
+
* "options.title",
|
|
731
|
+
* "must be a non-empty string",
|
|
732
|
+
* { received: "" }
|
|
733
|
+
* );
|
|
734
|
+
*
|
|
735
|
+
* console.log(JSON.stringify(err, null, 2));
|
|
736
|
+
* ```
|
|
737
|
+
*
|
|
738
|
+
* Possible output:
|
|
739
|
+
*
|
|
740
|
+
* ```json
|
|
741
|
+
* {
|
|
742
|
+
* "name": "ConfigurationError",
|
|
743
|
+
* "message": "Invalid configuration: `options.title` must be a non-empty string.",
|
|
744
|
+
* "code": "CONFIGURATION_ERROR",
|
|
745
|
+
* "details": { "received": "" },
|
|
746
|
+
* "stack": "ConfigurationError: ..."
|
|
747
|
+
* }
|
|
748
|
+
* ```
|
|
749
|
+
* ----------------------------------------------------------------
|
|
750
|
+
*/
|
|
751
|
+
toJSON(): {
|
|
752
|
+
/** ----------------------------------------------------------------
|
|
753
|
+
* * ***Runtime identifier of the error instance.***
|
|
754
|
+
* ----------------------------------------------------------------
|
|
755
|
+
*
|
|
756
|
+
* Mirrors {@link ConfigurationError.NAME | `ConfigurationError.NAME`}.
|
|
757
|
+
*
|
|
758
|
+
* - ***Intended for:***
|
|
759
|
+
* - Programmatic error discrimination.
|
|
760
|
+
* - Logging and diagnostic pipelines.
|
|
761
|
+
* - Cross-runtime error identification.
|
|
762
|
+
*
|
|
763
|
+
* This property is useful when `instanceof` checks are unreliable
|
|
764
|
+
* across module boundaries or bundled execution contexts.
|
|
765
|
+
*/
|
|
766
|
+
name: string;
|
|
767
|
+
/** ----------------------------------------------------------------
|
|
768
|
+
* * ***Fully formatted error message.***
|
|
769
|
+
* ----------------------------------------------------------------
|
|
770
|
+
*
|
|
771
|
+
* The message is guaranteed to be normalized by internal factory helpers.
|
|
772
|
+
*
|
|
773
|
+
* - ***Guarantees:***
|
|
774
|
+
* - Consistent punctuation rules.
|
|
775
|
+
* - Safe inline-code formatting.
|
|
776
|
+
* - Stable human-readable output.
|
|
777
|
+
*
|
|
778
|
+
* The message is expected to represent a finalized diagnostic string
|
|
779
|
+
* suitable for display, logging, or transport.
|
|
780
|
+
*/
|
|
781
|
+
message: string;
|
|
782
|
+
/** ----------------------------------------------------------------
|
|
783
|
+
* * ***Stable machine-readable error code.***
|
|
784
|
+
* ----------------------------------------------------------------
|
|
785
|
+
*
|
|
786
|
+
* Mirrors {@link ConfigurationError.CODE | `ConfigurationError.CODE`}.
|
|
787
|
+
*
|
|
788
|
+
* - ***Intended for:***
|
|
789
|
+
* - Cross-runtime error identification.
|
|
790
|
+
* - Structured logging systems.
|
|
791
|
+
* - Type-safe error discrimination without relying on `instanceof`.
|
|
792
|
+
*
|
|
793
|
+
* This identifier is guaranteed to remain stable across versions.
|
|
794
|
+
*/
|
|
795
|
+
code: typeof ConfigurationError.CODE;
|
|
796
|
+
/** ----------------------------------------------------------------
|
|
797
|
+
* * ***Optional structured debugging metadata attached to the error.***
|
|
798
|
+
* ----------------------------------------------------------------
|
|
799
|
+
*
|
|
800
|
+
* #### Contains machine-readable contextual information such as:
|
|
801
|
+
* - Validation input values that caused the error.
|
|
802
|
+
* - Logical origin or execution context.
|
|
803
|
+
* - Custom diagnostic extensions.
|
|
804
|
+
*
|
|
805
|
+
* #### This field is designed for:
|
|
806
|
+
* - Developer debugging.
|
|
807
|
+
* - Telemetry collection.
|
|
808
|
+
* - Internal system analysis.
|
|
809
|
+
*
|
|
810
|
+
* The structure is defined by
|
|
811
|
+
* {@link ConfigurationErrorDetails | `ConfigurationErrorDetails`}.
|
|
812
|
+
*/
|
|
813
|
+
details?: Readonly<ConfigurationErrorDetails>;
|
|
814
|
+
/** ----------------------------------------------------------------
|
|
815
|
+
* * ***Optional stack trace captured at the error creation site.***
|
|
816
|
+
* ----------------------------------------------------------------
|
|
817
|
+
*
|
|
818
|
+
* May be undefined in environments where stack capture is unavailable.
|
|
819
|
+
*
|
|
820
|
+
* Stack traces are preserved primarily for debugging and
|
|
821
|
+
* post-mortem diagnostics.
|
|
822
|
+
*/
|
|
823
|
+
stack?: string;
|
|
824
|
+
};
|
|
825
|
+
/** ----------------------------------------------------------------
|
|
826
|
+
* * ***Factory helper for generic configuration validation errors.***
|
|
827
|
+
* ----------------------------------------------------------------
|
|
828
|
+
*
|
|
829
|
+
* Produces a standardized error when a configuration field
|
|
830
|
+
* fails validation.
|
|
831
|
+
*
|
|
832
|
+
* @param field - Dot-notated configuration path (e.g. `"ui.usage"`).
|
|
833
|
+
* @param reason - Short descriptive phrase explaining the issue
|
|
834
|
+
* (without trailing period).
|
|
835
|
+
* @param details - Optional structured metadata for debugging.
|
|
836
|
+
* @param context - Optional logical origin of the validation
|
|
837
|
+
* (e.g. `"validateConfig"`), when provided,
|
|
838
|
+
* it is included in {@link details | `details`}
|
|
839
|
+
* under the `context` key and reflected in the error message.
|
|
840
|
+
*
|
|
841
|
+
* @returns A `ConfigurationError` instance with a normalized message.
|
|
842
|
+
*
|
|
843
|
+
* @example
|
|
844
|
+
* ConfigurationError.invalid(
|
|
845
|
+
* "ui.usage",
|
|
846
|
+
* "must be a non-empty string",
|
|
847
|
+
* { received: usage },
|
|
848
|
+
* "validateConfig"
|
|
849
|
+
* );
|
|
850
|
+
*
|
|
851
|
+
* // ➔ Invalid configuration in `validateConfig`:
|
|
852
|
+
* // `ui.usage` must be a non-empty string.
|
|
853
|
+
*/
|
|
854
|
+
static invalid(field: string, reason: string, details?: Record<string, unknown>, context?: string): ConfigurationError;
|
|
855
|
+
/** ----------------------------------------------------------------
|
|
856
|
+
* * ***Factory helper for configuration type mismatch errors.***
|
|
857
|
+
* ----------------------------------------------------------------
|
|
858
|
+
*
|
|
859
|
+
* Produces a standardized error when a configuration field
|
|
860
|
+
* does not match the expected type or structural contract.
|
|
861
|
+
*
|
|
862
|
+
* @param field - Dot-notated configuration path.
|
|
863
|
+
* @param expected - Short description of the expected type or shape
|
|
864
|
+
* (without trailing period).
|
|
865
|
+
* @param received - The actual received value.
|
|
866
|
+
* @param context - Optional logical origin of the validation
|
|
867
|
+
* (e.g. `"myFunction"`), when provided,
|
|
868
|
+
* it is included in {@link details | `details`}
|
|
869
|
+
* under the `context` key and reflected in the error message.
|
|
870
|
+
*
|
|
871
|
+
* @returns A `ConfigurationError` instance including the received value.
|
|
872
|
+
*
|
|
873
|
+
* @example
|
|
874
|
+
* ConfigurationError.type(
|
|
875
|
+
* "options.myMainFunction",
|
|
876
|
+
* "MyMainFunction",
|
|
877
|
+
* value,
|
|
878
|
+
* "myFunction"
|
|
879
|
+
* );
|
|
880
|
+
*
|
|
881
|
+
* // ➔ Invalid configuration in `myFunction`:
|
|
882
|
+
* // `options.myMainFunction` must be MyMainFunction.
|
|
883
|
+
*/
|
|
884
|
+
static type(field: string, expected: string, received: unknown, context?: string): ConfigurationError;
|
|
885
|
+
}
|
|
886
|
+
export { ConfigurationError, type ConfigurationErrorDetails, EOL, NEWLINE, formatOptionValue, joinInline, joinLines, joinLinesLoose, padText, picocolors, plural };
|
|
887
|
+
//# sourceMappingURL=client.d.ts.map
|