@homedev/framework 1.0.5 → 1.0.6
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/dist/index.js +8 -8
- package/package.json +1 -1
- package/README.md +0 -673
- package/dist/index.d.ts +0 -652
package/dist/index.d.ts
DELETED
|
@@ -1,652 +0,0 @@
|
|
|
1
|
-
export declare type ColorValue = string | {
|
|
2
|
-
r: number;
|
|
3
|
-
g: number;
|
|
4
|
-
b: number;
|
|
5
|
-
} | [number, number, number] | number;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Parses and queries command-line arguments.
|
|
9
|
-
*
|
|
10
|
-
* Accepts argv-like arrays and parses only the provided tokens.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export declare class CommandLineArgs {
|
|
15
|
-
#private;
|
|
16
|
-
/**
|
|
17
|
-
* Creates a parser for the provided command-line tokens.
|
|
18
|
-
*
|
|
19
|
-
* @param args - Argument tokens to parse.
|
|
20
|
-
* @param definitions - Known argument definitions used by usage output.
|
|
21
|
-
*/
|
|
22
|
-
constructor(args: string[], definitions?: CommandLineArgumentDefinition[]);
|
|
23
|
-
/**
|
|
24
|
-
* Returns normalized parsed argument tokens.
|
|
25
|
-
*/
|
|
26
|
-
get args(): string[];
|
|
27
|
-
/**
|
|
28
|
-
* Returns non-option positional values.
|
|
29
|
-
*/
|
|
30
|
-
get positionals(): string[];
|
|
31
|
-
/**
|
|
32
|
-
* Returns true if a flag was provided.
|
|
33
|
-
*
|
|
34
|
-
* @param flag - Option name with or without `-`/`--` prefix.
|
|
35
|
-
*/
|
|
36
|
-
has(flag: string): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Returns values for a flag.
|
|
39
|
-
*
|
|
40
|
-
* @param flag - Option name with or without `-`/`--` prefix.
|
|
41
|
-
*/
|
|
42
|
-
getArgs(flag: string): string[];
|
|
43
|
-
/**
|
|
44
|
-
* Returns true for boolean flags, first value for valued flags, or undefined.
|
|
45
|
-
*
|
|
46
|
-
* @param flag - Option name with or without `-`/`--` prefix.
|
|
47
|
-
*/
|
|
48
|
-
get(flag: string): string | true | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Returns all options as a plain object.
|
|
51
|
-
*/
|
|
52
|
-
toObject(): Record<string, string[] | true>;
|
|
53
|
-
/**
|
|
54
|
-
* Builds usage output from provided argument definitions.
|
|
55
|
-
*
|
|
56
|
-
* @param command - Command name shown in usage output.
|
|
57
|
-
*/
|
|
58
|
-
usage(command?: string): string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Defines an argument for usage output.
|
|
63
|
-
*
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
|
-
export declare interface CommandLineArgumentDefinition {
|
|
67
|
-
name: string;
|
|
68
|
-
alias?: string;
|
|
69
|
-
description?: string;
|
|
70
|
-
takesValue?: boolean;
|
|
71
|
-
multiple?: boolean;
|
|
72
|
-
valueName?: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Parsed representation of a single CLI option.
|
|
77
|
-
*
|
|
78
|
-
* @public
|
|
79
|
-
*/
|
|
80
|
-
export declare interface CommandLineOption {
|
|
81
|
-
values: string[];
|
|
82
|
-
sawEqualsStyle: boolean;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Checks whether a file is readable.
|
|
87
|
-
*
|
|
88
|
-
* @param fileName - File path to check.
|
|
89
|
-
* @returns True when the file can be accessed for reading.
|
|
90
|
-
* @public
|
|
91
|
-
*/
|
|
92
|
-
export declare const exists: (fileName: string) => Promise<boolean>;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @public
|
|
96
|
-
*/
|
|
97
|
-
export declare interface FilePatternOptions {
|
|
98
|
-
cwd: string;
|
|
99
|
-
filter?: (fileName: string, index: number, array: string[]) => boolean;
|
|
100
|
-
map: (fileName: string, index: number, array: string[]) => Promise<any>;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Resolves the working directory used by file utilities.
|
|
105
|
-
*
|
|
106
|
-
* @param cwd - Optional absolute or relative directory override.
|
|
107
|
-
* @returns Absolute working directory path.
|
|
108
|
-
* @public
|
|
109
|
-
*/
|
|
110
|
-
export declare const getCwd: (cwd?: string) => string;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Maps files matching a glob pattern (or a single path) with async projection.
|
|
114
|
-
*
|
|
115
|
-
* @param pattern - Glob pattern(s) or direct file path.
|
|
116
|
-
* @param options - Mapping options including cwd, optional filter, and map function.
|
|
117
|
-
* @returns Mapped result for a direct path, or mapped array for glob patterns.
|
|
118
|
-
* @public
|
|
119
|
-
*/
|
|
120
|
-
export declare const globMap: <T>(pattern: string | string[], options: FilePatternOptions) => Promise<T[] | T>;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @public
|
|
124
|
-
*/
|
|
125
|
-
export declare const importGlob: (patterns: string[], options?: ImportOptions) => Promise<any[]>;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @public
|
|
129
|
-
*/
|
|
130
|
-
export declare const importList: (modules: string[], options?: ImportOptions) => Promise<any[]>;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* @public
|
|
134
|
-
*/
|
|
135
|
-
export declare interface ImportOptions {
|
|
136
|
-
cwd?: string;
|
|
137
|
-
resolveDefault?: boolean | 'only';
|
|
138
|
-
filter?: (name: string) => boolean | undefined;
|
|
139
|
-
fail?: (name: string, error: any) => boolean | undefined;
|
|
140
|
-
map?: (module: any, name: string) => any;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* @public
|
|
145
|
-
* @param fileName - Name or path of the file to load.
|
|
146
|
-
* @param options - Loading options including parser selection and lookup directories.
|
|
147
|
-
* @returns Parsed file content and path metadata.
|
|
148
|
-
* @throws - When no parser is resolved or locating/reading/parsing fails.
|
|
149
|
-
*/
|
|
150
|
-
export declare const loadFormat: <T = any>(fileName: string, options?: LoadOptions) => Promise<LoadResult<T>>;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* @public
|
|
154
|
-
*/
|
|
155
|
-
export declare interface LoadFormatParser {
|
|
156
|
-
matching?: string[];
|
|
157
|
-
fn: (data: string) => any;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* @public
|
|
162
|
-
*/
|
|
163
|
-
export declare interface LoadOptions {
|
|
164
|
-
dirs?: string[];
|
|
165
|
-
parsers?: Record<string, LoadFormatParser>;
|
|
166
|
-
format?: string;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Result of loading and parsing a file.
|
|
171
|
-
*
|
|
172
|
-
* @typeParam T - Parsed content type.
|
|
173
|
-
* @public
|
|
174
|
-
*/
|
|
175
|
-
export declare interface LoadResult<T> {
|
|
176
|
-
fullPath: string;
|
|
177
|
-
folderPath: string;
|
|
178
|
-
content: T;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Resolves a file path by searching the provided directories.
|
|
183
|
-
*
|
|
184
|
-
* @param fileName - File name or path to locate.
|
|
185
|
-
* @param dirs - Optional directories to search when fileName is relative.
|
|
186
|
-
* @returns Absolute path to the first matching file.
|
|
187
|
-
* @throws - When no matching file is found.
|
|
188
|
-
* @public
|
|
189
|
-
*/
|
|
190
|
-
export declare const locate: (fileName: string, dirs?: string[]) => Promise<string>;
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* @public
|
|
194
|
-
*/
|
|
195
|
-
export declare type LogFunction = (className: string, ...args: any[]) => void;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* @public
|
|
199
|
-
*/
|
|
200
|
-
export declare class Logger {
|
|
201
|
-
options: LoggerOptions;
|
|
202
|
-
/**
|
|
203
|
-
* Creates a logger with optional configuration overrides.
|
|
204
|
-
*
|
|
205
|
-
* @param options - Partial logger options to merge with defaults.
|
|
206
|
-
*/
|
|
207
|
-
constructor(options?: Partial<LoggerOptions>);
|
|
208
|
-
/**
|
|
209
|
-
* Writes a log entry when the message level passes the configured filter.
|
|
210
|
-
*
|
|
211
|
-
* @param className - Log level name.
|
|
212
|
-
* @param args - Log payload values.
|
|
213
|
-
*/
|
|
214
|
-
write(className: string, ...args: any[]): void;
|
|
215
|
-
/**
|
|
216
|
-
* Wraps a text in an RGB color code for console output.
|
|
217
|
-
* @param text - The text to color.
|
|
218
|
-
* @param color - The RGB color.
|
|
219
|
-
* @returns The colored text for console output.
|
|
220
|
-
*/
|
|
221
|
-
color(text: string, color: ColorValue): string;
|
|
222
|
-
/**
|
|
223
|
-
* Writes an INFO level log entry.
|
|
224
|
-
*
|
|
225
|
-
* @param args - Log payload values.
|
|
226
|
-
*/
|
|
227
|
-
info(...args: any[]): void;
|
|
228
|
-
/**
|
|
229
|
-
* Writes an ERROR level log entry.
|
|
230
|
-
*
|
|
231
|
-
* @param args - Log payload values.
|
|
232
|
-
*/
|
|
233
|
-
error(...args: any[]): void;
|
|
234
|
-
/**
|
|
235
|
-
* Writes a WARN level log entry.
|
|
236
|
-
*
|
|
237
|
-
* @param args - Log payload values.
|
|
238
|
-
*/
|
|
239
|
-
warn(...args: any[]): void;
|
|
240
|
-
/**
|
|
241
|
-
* Writes a DEBUG level log entry.
|
|
242
|
-
*
|
|
243
|
-
* @param args - Log payload values.
|
|
244
|
-
*/
|
|
245
|
-
debug(...args: any[]): void;
|
|
246
|
-
/**
|
|
247
|
-
* Writes a VERBOSE level log entry.
|
|
248
|
-
*
|
|
249
|
-
* @param args - Log payload values.
|
|
250
|
-
*/
|
|
251
|
-
verbose(...args: any[]): void;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* @public
|
|
256
|
-
*/
|
|
257
|
-
export declare interface LoggerOptions {
|
|
258
|
-
level: string;
|
|
259
|
-
showClass: boolean;
|
|
260
|
-
useColors: boolean;
|
|
261
|
-
levels: string[];
|
|
262
|
-
timeStamp: boolean;
|
|
263
|
-
timeLocale?: string;
|
|
264
|
-
timeOptions?: Intl.DateTimeFormatOptions;
|
|
265
|
-
logFunction: LogFunction;
|
|
266
|
-
onClass: (className: string) => string;
|
|
267
|
-
onTime: (time: string, className: string) => string;
|
|
268
|
-
onPrefix: (prefix: string, className: string) => string;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Fluent markdown content builder.
|
|
273
|
-
*
|
|
274
|
-
* @public
|
|
275
|
-
*/
|
|
276
|
-
export declare class Markdown extends StringBuilder {
|
|
277
|
-
#private;
|
|
278
|
-
/**
|
|
279
|
-
* Writes a markdown heading and trailing blank line.
|
|
280
|
-
*
|
|
281
|
-
* @param text - Heading text.
|
|
282
|
-
* @param level - Heading level from 1 to 6.
|
|
283
|
-
*/
|
|
284
|
-
header(text: string, level?: number): this;
|
|
285
|
-
/**
|
|
286
|
-
* Starts a fenced code block and optionally writes code and closes it.
|
|
287
|
-
*
|
|
288
|
-
* @param code - Optional code content.
|
|
289
|
-
* @param language - Optional code language id.
|
|
290
|
-
*/
|
|
291
|
-
codeBlock(code?: string, language?: string): this;
|
|
292
|
-
/** Closes the current fenced code block. */
|
|
293
|
-
endCodeBlock(): this;
|
|
294
|
-
/** Writes an inline markdown link. */
|
|
295
|
-
link(text: string, url: string, title?: string): this;
|
|
296
|
-
/** Writes a markdown table from headers and rows. */
|
|
297
|
-
table(headers: string[], rows: string[][]): this;
|
|
298
|
-
/** Writes one or more quoted lines. */
|
|
299
|
-
blockquote(text: string): this;
|
|
300
|
-
/** Writes bold text. */
|
|
301
|
-
bold(text: string): this;
|
|
302
|
-
/** Writes italic text. */
|
|
303
|
-
italic(text: string): this;
|
|
304
|
-
/** Writes a bullet item line. */
|
|
305
|
-
item(text: string): this;
|
|
306
|
-
/** Writes bullet items from an array or key-value map. */
|
|
307
|
-
items(items: string[] | Record<string, any>): this;
|
|
308
|
-
/** Writes an ordered list starting from the provided number. */
|
|
309
|
-
orderedList(items: string[], start?: number): this;
|
|
310
|
-
/** Writes inline code text. */
|
|
311
|
-
code(text: string): this;
|
|
312
|
-
/** Writes a horizontal rule. */
|
|
313
|
-
horizontalRule(): this;
|
|
314
|
-
/** Writes an image markdown line. */
|
|
315
|
-
image(alt: string, url: string): this;
|
|
316
|
-
/** Writes strikethrough text. */
|
|
317
|
-
strikethrough(text: string): this;
|
|
318
|
-
/** Writes highlighted text using == syntax. */
|
|
319
|
-
highlight(text: string): this;
|
|
320
|
-
/** Writes subscript text using ~ syntax. */
|
|
321
|
-
subscript(text: string): this;
|
|
322
|
-
/** Writes superscript text using ^ syntax. */
|
|
323
|
-
superscript(text: string): this;
|
|
324
|
-
/** Writes a markdown task list. */
|
|
325
|
-
taskList(items: {
|
|
326
|
-
text: string;
|
|
327
|
-
checked: boolean;
|
|
328
|
-
}[]): this;
|
|
329
|
-
/**
|
|
330
|
-
* Starts a section heading and increments internal nesting level.
|
|
331
|
-
*
|
|
332
|
-
* @param text - Section title.
|
|
333
|
-
* @param level - Optional explicit heading level baseline.
|
|
334
|
-
*/
|
|
335
|
-
section(text: string, level?: number): this;
|
|
336
|
-
/** Decrements section nesting level by one. */
|
|
337
|
-
endSection(): this;
|
|
338
|
-
/** Sets the internal section nesting level directly. */
|
|
339
|
-
setSectionLevel(level: number): this;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* @public
|
|
344
|
-
*/
|
|
345
|
-
export declare type MergeMode = 'merge' | 'source' | 'target' | 'skip';
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* @public
|
|
349
|
-
*/
|
|
350
|
-
export declare interface MergeOptions {
|
|
351
|
-
conflict?: (key: string, source: any, target: any, sourceContainer: any, targetContainer: any) => any;
|
|
352
|
-
mismatch?: (key: string, source: any, target: any, sourceContainer: any, targetContainer: any) => any;
|
|
353
|
-
navigate?: (key: string, source: any, target: any, sourceContainer: any, targetContainer: any) => boolean | undefined;
|
|
354
|
-
mode?: (key: string, source: any, target: any, sourceContainer: any, targetContainer: any) => MergeMode | void;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* @public
|
|
359
|
-
*/
|
|
360
|
-
export declare enum NavigateAction {
|
|
361
|
-
Explore = 0,
|
|
362
|
-
SkipSiblings = 1,
|
|
363
|
-
NoExplore = 2,
|
|
364
|
-
ReplaceParent = 3,
|
|
365
|
-
DeleteParent = 4,
|
|
366
|
-
MergeParent = 5,
|
|
367
|
-
ReplaceItem = 6,
|
|
368
|
-
DeleteItem = 7
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* @public
|
|
373
|
-
*/
|
|
374
|
-
export declare type NavigateCallback = (context: NavigateContext) => Promise<NavigateResult> | NavigateResult;
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* @public
|
|
378
|
-
*/
|
|
379
|
-
export declare interface NavigateContext {
|
|
380
|
-
key: string;
|
|
381
|
-
value: any;
|
|
382
|
-
path: string[];
|
|
383
|
-
parent: any;
|
|
384
|
-
parents: any[];
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* @public
|
|
389
|
-
*/
|
|
390
|
-
export declare class NavigateResult {
|
|
391
|
-
readonly action: NavigateAction;
|
|
392
|
-
by?: any | undefined;
|
|
393
|
-
skipSiblings?: boolean | undefined;
|
|
394
|
-
reexplore?: boolean | undefined;
|
|
395
|
-
constructor(action: NavigateAction, by?: any | undefined, skipSiblings?: boolean | undefined, reexplore?: boolean | undefined);
|
|
396
|
-
private static readonly _explore;
|
|
397
|
-
private static readonly _noExplore;
|
|
398
|
-
private static readonly _skipSiblings;
|
|
399
|
-
private static readonly _deleteParent;
|
|
400
|
-
static ReplaceParent(by: any, reexplore?: boolean): NavigateResult;
|
|
401
|
-
static SkipSiblings(): NavigateResult;
|
|
402
|
-
static Explore(): NavigateResult;
|
|
403
|
-
static NoExplore(): NavigateResult;
|
|
404
|
-
static DeleteParent(): NavigateResult;
|
|
405
|
-
static MergeParent(by: any): NavigateResult;
|
|
406
|
-
static ReplaceItem(by: any, skipSiblings?: boolean): NavigateResult;
|
|
407
|
-
static DeleteItem(skipSiblings?: boolean): NavigateResult;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* @public
|
|
412
|
-
*/
|
|
413
|
-
export declare interface Output {
|
|
414
|
-
name: string;
|
|
415
|
-
type?: 'json' | 'yaml' | 'text';
|
|
416
|
-
value: any;
|
|
417
|
-
class?: string;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Options for configuring the select function behavior
|
|
422
|
-
* @public
|
|
423
|
-
*/
|
|
424
|
-
export declare interface SelectOptions {
|
|
425
|
-
/** Value to set at the selected path */
|
|
426
|
-
set?: any;
|
|
427
|
-
/** Alternative key to use (currently unused) */
|
|
428
|
-
key?: string;
|
|
429
|
-
/** Path separator character (default: '.') */
|
|
430
|
-
separator?: string;
|
|
431
|
-
/** Default value to return when path is not found */
|
|
432
|
-
defaultValue?: any;
|
|
433
|
-
/** If true, returns undefined instead of throwing on missing paths */
|
|
434
|
-
optional?: boolean;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* @public
|
|
439
|
-
*/
|
|
440
|
-
export declare class StringBuilder {
|
|
441
|
-
#private;
|
|
442
|
-
options: StringBuilderOptions;
|
|
443
|
-
/**
|
|
444
|
-
* Creates a new StringBuilder instance.
|
|
445
|
-
*
|
|
446
|
-
* @param initial - Optional initial content.
|
|
447
|
-
* @param options - Builder formatting options.
|
|
448
|
-
*/
|
|
449
|
-
constructor(initial?: string | string[] | StringBuilder, options?: StringBuilderOptions);
|
|
450
|
-
/**
|
|
451
|
-
* Replaces current formatting options.
|
|
452
|
-
*
|
|
453
|
-
* @param options - New builder options.
|
|
454
|
-
* @returns Current builder instance.
|
|
455
|
-
*/
|
|
456
|
-
setOptions(options: StringBuilderOptions): this;
|
|
457
|
-
/** Clears all buffered blocks. */
|
|
458
|
-
clear(): this;
|
|
459
|
-
/** Returns true when no content is buffered. */
|
|
460
|
-
isEmpty(): boolean;
|
|
461
|
-
/** Returns concatenated content. */
|
|
462
|
-
toString(): string;
|
|
463
|
-
/** Increases indentation level by one. */
|
|
464
|
-
indent(): this;
|
|
465
|
-
/** Decreases indentation level by one when possible. */
|
|
466
|
-
dedent(): this;
|
|
467
|
-
/** Returns current indentation level. */
|
|
468
|
-
getCurrentIndent(): number;
|
|
469
|
-
/** Returns current content split by newline. */
|
|
470
|
-
getLines(): string[];
|
|
471
|
-
/**
|
|
472
|
-
* Formats a line according to indentation and line options.
|
|
473
|
-
*
|
|
474
|
-
* @param line - Input line to format.
|
|
475
|
-
* @returns Formatted line including line separator.
|
|
476
|
-
*/
|
|
477
|
-
formatLine(line?: string): string;
|
|
478
|
-
/**
|
|
479
|
-
* Appends one or more values to the buffer.
|
|
480
|
-
*
|
|
481
|
-
* @param args - Values to append.
|
|
482
|
-
* @returns Current builder instance.
|
|
483
|
-
*/
|
|
484
|
-
write(...args: any[]): this;
|
|
485
|
-
/**
|
|
486
|
-
* Writes one or more formatted lines.
|
|
487
|
-
*
|
|
488
|
-
* @param args - Values to write as lines.
|
|
489
|
-
* @returns Current builder instance.
|
|
490
|
-
*/
|
|
491
|
-
writeLine(...args: any[]): this;
|
|
492
|
-
/**
|
|
493
|
-
* Maps input items to writes using a callback.
|
|
494
|
-
*
|
|
495
|
-
* @param items - Source items.
|
|
496
|
-
* @param fn - Mapping callback.
|
|
497
|
-
* @returns Current builder instance.
|
|
498
|
-
*/
|
|
499
|
-
writeMap<T>(items: T[], fn: (item: T, index: number, builder: this) => string | this): this;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* @public
|
|
504
|
-
*/
|
|
505
|
-
export declare interface StringBuilderOptions {
|
|
506
|
-
indentChar?: string;
|
|
507
|
-
indentSize?: number;
|
|
508
|
-
trim?: boolean;
|
|
509
|
-
lineSeparator?: string;
|
|
510
|
-
linePrefix?: string;
|
|
511
|
-
lineSuffix?: string;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Encodes and writes content to a file path using the selected format encoder.
|
|
516
|
-
*
|
|
517
|
-
* @param filePath - Destination file path.
|
|
518
|
-
* @param content - Data to encode and write.
|
|
519
|
-
* @param options - Encoder selection options.
|
|
520
|
-
* @returns Promise resolved when writing completes.
|
|
521
|
-
* @throws - When no encoder can be resolved.
|
|
522
|
-
* @public
|
|
523
|
-
*/
|
|
524
|
-
export declare const writeFormat: (filePath: string, content: any, options?: WriteFormatOptions) => Promise<void>;
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* @public
|
|
528
|
-
*/
|
|
529
|
-
export declare interface WriteFormatEncoder {
|
|
530
|
-
matching?: string[];
|
|
531
|
-
fn: (data: any) => Promise<string> | string;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* @public
|
|
536
|
-
*/
|
|
537
|
-
export declare interface WriteFormatOptions {
|
|
538
|
-
format: string;
|
|
539
|
-
encoders?: Record<string, WriteFormatEncoder>;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* Writes a single output entry to disk.
|
|
544
|
-
*
|
|
545
|
-
* @param o - Output entry to write.
|
|
546
|
-
* @param options - Writing behavior configuration.
|
|
547
|
-
* @returns Promise resolved when output is processed.
|
|
548
|
-
* @throws - When class requirements fail or file operations fail.
|
|
549
|
-
* @public
|
|
550
|
-
*/
|
|
551
|
-
export declare const writeOutput: (o: Output, options?: WriteOutputOption) => Promise<void>;
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* @public
|
|
555
|
-
*/
|
|
556
|
-
export declare interface WriteOutputOption {
|
|
557
|
-
targetDirectory?: string;
|
|
558
|
-
writing?: (output: Output) => boolean | undefined | void;
|
|
559
|
-
classes?: string[];
|
|
560
|
-
classRequired?: boolean;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Writes multiple outputs to disk.
|
|
565
|
-
*
|
|
566
|
-
* @param outputs - Output definitions to write.
|
|
567
|
-
* @param options - Writing behavior configuration.
|
|
568
|
-
* @returns Promise resolved when all outputs are processed.
|
|
569
|
-
* @public
|
|
570
|
-
*/
|
|
571
|
-
export declare const writeOutputs: (outputs: Output[], options?: WriteOutputsOption) => Promise<void>;
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* @public
|
|
575
|
-
*/
|
|
576
|
-
export declare interface WriteOutputsOption extends WriteOutputOption {
|
|
577
|
-
removeFirst?: boolean;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
export { }
|
|
581
|
-
|
|
582
|
-
/* Global declarations */
|
|
583
|
-
|
|
584
|
-
declare global {
|
|
585
|
-
type Constructor<T = any> = new (...args: any[]) => T;
|
|
586
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
587
|
-
type AsyncFunction<T = any> = (...args: any[]) => Promise<T>;
|
|
588
|
-
var AsyncFunction: typeof Function;
|
|
589
|
-
var defined: <T>(value: T | undefined | null, msg?: string) => T;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
declare global {
|
|
593
|
-
interface String {
|
|
594
|
-
capitalize(): string;
|
|
595
|
-
toPascal(): string;
|
|
596
|
-
toCamel(): string;
|
|
597
|
-
toSnake(): string;
|
|
598
|
-
toKebab(): string;
|
|
599
|
-
changeCase(to: 'upper' | 'lower' | 'pascal' | 'camel' | 'snake' | 'kebab'): string;
|
|
600
|
-
splitWithQuotes(separator?: string): {
|
|
601
|
-
value: string;
|
|
602
|
-
quoted: boolean;
|
|
603
|
-
}[];
|
|
604
|
-
splitNested(separator: string, open: string, close: string): string[];
|
|
605
|
-
padBlock(indent: number, separator?: string, padder?: string): string;
|
|
606
|
-
tokenize(from: Record<string, unknown>, tokenizer?: RegExp): string;
|
|
607
|
-
stripIndent(): string;
|
|
608
|
-
toHtmlLink(path?: string): string;
|
|
609
|
-
toStringBuilder(): StringBuilder;
|
|
610
|
-
toRgb(): string;
|
|
611
|
-
toArgb(): string;
|
|
612
|
-
single(char: string): string;
|
|
613
|
-
remove(char: string): string;
|
|
614
|
-
toAlphanum(replaceWith?: string): string;
|
|
615
|
-
toAlpha(replaceWith?: string): string;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
declare global {
|
|
620
|
-
interface Array<T> {
|
|
621
|
-
mapAsync<U>(callback: (value: T, index: number, array: T[]) => Promise<U>): Promise<U[]>;
|
|
622
|
-
forEachAsync(callback: (value: T, index: number, array: T[]) => Promise<void>): Promise<void>;
|
|
623
|
-
sortBy<K extends keyof T>(selector: (item: T) => T[K], ascending?: boolean): T[];
|
|
624
|
-
unique(): T[];
|
|
625
|
-
uniqueBy<K extends keyof T>(selector: (item: T) => T[K]): T[];
|
|
626
|
-
groupBy<K extends keyof T>(selector: (item: T) => T[K]): Record<T[K] & (string | number | symbol), T[]>;
|
|
627
|
-
toObject<K extends keyof T, V>(keySelector: (item: T) => T[K], valueSelector?: (item: T) => V): Record<T[K] & (string | number | symbol), V>;
|
|
628
|
-
toObjectWithKey<K extends keyof T>(key: K): Record<string, T>;
|
|
629
|
-
nonNullMap<U>(callback: (value: T, index: number, array: T[]) => U | null | undefined): U[];
|
|
630
|
-
nonNullMapAsync<U>(callback: (value: T, index: number, array: T[]) => Promise<U | null | undefined>): Promise<U[]>;
|
|
631
|
-
findOrFail(predicate: (value: T, index: number, array: T[]) => boolean, message?: string, thisArg?: any): T;
|
|
632
|
-
selectFor<K>(predicate: (value: T, index: number, array: T[]) => boolean, selector: (value: T) => K, message?: string, thisArg?: any): K;
|
|
633
|
-
createInstances<TTarget>(targetConstructor: new (...args: any[]) => TTarget, ...args: any[]): TTarget[];
|
|
634
|
-
mergeAll(options?: MergeOptions): any;
|
|
635
|
-
}
|
|
636
|
-
interface ArrayConstructor {
|
|
637
|
-
flat<T>(v: T | T[] | T[][]): T[];
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
declare global {
|
|
642
|
-
interface ObjectConstructor {
|
|
643
|
-
mapEntries<T extends object, U>(obj: T, callback: (key: keyof T, value: T[keyof T]) => [string | number | symbol, U]): Record<string | number | symbol, U>;
|
|
644
|
-
toList<T extends object, U extends object, X extends string>(obj: T, key: X): (Record<X, string> & U)[];
|
|
645
|
-
deepClone<T extends object>(obj: T): T;
|
|
646
|
-
merge(source: any, target: any, options?: MergeOptions): void;
|
|
647
|
-
navigate(o: any, cb: NavigateCallback): Promise<void>;
|
|
648
|
-
find(from: any, cb: (path: string, value: any) => boolean): Promise<any[]>;
|
|
649
|
-
select(from: any, path: string, options?: SelectOptions): any;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|