@h3ravel/shared 0.22.2 → 0.23.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.
package/dist/index.cjs CHANGED
@@ -29,6 +29,10 @@ let path = require("path");
29
29
  path = __toESM(path);
30
30
  let chalk = require("chalk");
31
31
  chalk = __toESM(chalk);
32
+ let inquirer_autocomplete_standalone = require("inquirer-autocomplete-standalone");
33
+ inquirer_autocomplete_standalone = __toESM(inquirer_autocomplete_standalone);
34
+ let __inquirer_prompts = require("@inquirer/prompts");
35
+ __inquirer_prompts = __toESM(__inquirer_prompts);
32
36
  let crypto = require("crypto");
33
37
  crypto = __toESM(crypto);
34
38
  let preferred_pm = require("preferred-pm");
@@ -290,10 +294,10 @@ var Logger = class Logger {
290
294
  process.exit(0);
291
295
  }
292
296
  static chalker(styles) {
293
- return (input) => styles.reduce((acc, style) => {
297
+ return (input$1) => styles.reduce((acc, style) => {
294
298
  if (style in chalk.default) return (typeof style === "function" ? style : chalk.default[style])(acc);
295
299
  return acc;
296
- }, input);
300
+ }, input$1);
297
301
  }
298
302
  static parse(config, joiner = " ", log = true, sc) {
299
303
  const string = config.map(([str, opt]) => {
@@ -361,6 +365,67 @@ var PathLoader = class {
361
365
  }
362
366
  };
363
367
 
368
+ //#endregion
369
+ //#region src/Utils/Prompts.ts
370
+ var Prompts = class extends Logger {
371
+ /**
372
+ * Allows users to pick from a predefined set of choices when asked a question.
373
+ */
374
+ static async choice(message, choices, defaultIndex) {
375
+ return (0, __inquirer_prompts.select)({
376
+ message,
377
+ choices,
378
+ default: defaultIndex ? choices.at(defaultIndex) : void 0
379
+ });
380
+ }
381
+ /**
382
+ * Ask the user for a simple "yes or no" confirmation.
383
+ * By default, this method returns `false`. However, if the user enters y or yes
384
+ * in response to the prompt, the method would return `true`.
385
+ */
386
+ static async confirm(message, def) {
387
+ return (0, __inquirer_prompts.confirm)({
388
+ message,
389
+ default: def
390
+ });
391
+ }
392
+ /**
393
+ * Prompt the user with the given question, accept their input,
394
+ * and then return the user's input back to your command.
395
+ */
396
+ static async ask(message, def) {
397
+ return (0, __inquirer_prompts.input)({
398
+ message,
399
+ default: def
400
+ });
401
+ }
402
+ /**
403
+ * Prompt the user with the given question, accept their input which
404
+ * will not be visible to them as they type in the console,
405
+ * and then return the user's input back to your command.
406
+ */
407
+ static async secret(message, mask) {
408
+ return (0, __inquirer_prompts.password)({
409
+ message,
410
+ mask
411
+ });
412
+ }
413
+ /**
414
+ * Provide auto-completion for possible choices.
415
+ * The user can still provide any answer, regardless of the auto-completion hints.
416
+ */
417
+ static async anticipate(message, source, def) {
418
+ return (0, inquirer_autocomplete_standalone.default)({
419
+ message,
420
+ source: Array.isArray(source) ? async (term) => {
421
+ return (term ? source.filter((e) => e.includes(term)) : source).map((e) => ({ value: e }));
422
+ } : source,
423
+ suggestOnly: true,
424
+ default: def
425
+ });
426
+ }
427
+ };
428
+
364
429
  //#endregion
365
430
  //#region src/Utils/Resolver.ts
366
431
  var Resolver = class {
@@ -482,9 +547,9 @@ exports.FileSystem = FileSystem;
482
547
  exports.HttpContext = HttpContext;
483
548
  exports.Logger = Logger;
484
549
  exports.PathLoader = PathLoader;
550
+ exports.Prompts = Prompts;
485
551
  exports.Resolver = Resolver;
486
552
  exports.TaskManager = TaskManager;
487
553
  exports.baseTsconfig = baseTsconfig;
488
554
  exports.mainTsconfig = mainTsconfig;
489
- exports.packageJsonScript = packageJsonScript;
490
- //# sourceMappingURL=index.cjs.map
555
+ exports.packageJsonScript = packageJsonScript;
package/dist/index.d.cts CHANGED
@@ -3,29 +3,31 @@ import { H3, H3Event, Middleware, MiddlewareOptions, serve } from "h3";
3
3
  import { Edge } from "edge.js";
4
4
  import { ResponseHeaderMap, TypedHeaders } from "fetchdts";
5
5
  import { DotNestedKeys as DotNestedKeys$1, DotNestedValue as DotNestedValue$1 } from "@h3ravel/shared";
6
+ import { Separator } from "@inquirer/prompts";
6
7
  import { ChalkInstance } from "chalk";
8
+ import { ChoiceOrSeparatorArray } from "inquirer-autocomplete-standalone";
7
9
 
8
10
  //#region src/Contracts/ObjContract.d.ts
9
11
  /**
10
12
  * Adds a dot prefix to nested keys
11
13
  */
12
- type DotPrefix<T extends string, U extends string> = T extends '' ? U : `${T}.${U}`;
14
+ type DotPrefix<T$1 extends string, U extends string> = T$1 extends '' ? U : `${T$1}.${U}`;
13
15
  /**
14
16
  * Converts a union of objects into a single merged object
15
17
  */
16
- type MergeUnion<T> = (T extends any ? (k: T) => void : never) extends ((k: infer I) => void) ? { [K in keyof I]: I[K] } : never;
18
+ type MergeUnion<T$1> = (T$1 extends any ? (k: T$1) => void : never) extends ((k: infer I) => void) ? { [K in keyof I]: I[K] } : never;
17
19
  /**
18
20
  * Flattens nested objects into dotted keys
19
21
  */
20
- type DotFlatten<T, Prefix extends string = ''> = MergeUnion<{ [K in keyof T & string]: T[K] extends Record<string, any> ? DotFlatten<T[K], DotPrefix<Prefix, K>> : { [P in DotPrefix<Prefix, K>]: T[K] } }[keyof T & string]>;
22
+ type DotFlatten<T$1, Prefix extends string = ''> = MergeUnion<{ [K in keyof T$1 & string]: T$1[K] extends Record<string, any> ? DotFlatten<T$1[K], DotPrefix<Prefix, K>> : { [P in DotPrefix<Prefix, K>]: T$1[K] } }[keyof T$1 & string]>;
21
23
  /**
22
24
  * Builds "nested.key" paths for autocompletion
23
25
  */
24
- type DotNestedKeys<T> = { [K in keyof T & string]: T[K] extends object ? `${K}` | `${K}.${DotNestedKeys<T[K]>}` : `${K}` }[keyof T & string];
26
+ type DotNestedKeys<T$1> = { [K in keyof T$1 & string]: T$1[K] extends object ? `${K}` | `${K}.${DotNestedKeys<T$1[K]>}` : `${K}` }[keyof T$1 & string];
25
27
  /**
26
28
  * Retrieves type at a given dot-path
27
29
  */
28
- type DotNestedValue<T, Path extends string> = Path extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? DotNestedValue<T[Key], Rest> : never : Path extends keyof T ? T[Path] : never;
30
+ type DotNestedValue<T$1, Path extends string> = Path extends `${infer Key}.${infer Rest}` ? Key extends keyof T$1 ? DotNestedValue<T$1[Key], Rest> : never : Path extends keyof T$1 ? T$1[Path] : never;
29
31
  /**
30
32
  * A generic object type that supports nullable string values
31
33
  */
@@ -253,7 +255,7 @@ interface IResponse {
253
255
  //#endregion
254
256
  //#region src/Contracts/IHttp.d.ts
255
257
  type RouterEnd = 'get' | 'delete' | 'put' | 'post' | 'patch' | 'apiResource' | 'group' | 'route';
256
- type ExtractControllerMethods<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? K : never }[keyof T];
258
+ type ExtractControllerMethods<T$1> = { [K in keyof T$1]: T$1[K] extends ((...args: any[]) => any) ? K : never }[keyof T$1];
257
259
  /**
258
260
  * Interface for the Router contract, defining methods for HTTP routing.
259
261
  */
@@ -406,7 +408,7 @@ declare class PathLoader {
406
408
  }
407
409
  //#endregion
408
410
  //#region src/Contracts/BindingsContract.d.ts
409
- type RemoveIndexSignature<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K] };
411
+ type RemoveIndexSignature<T$1> = { [K in keyof T$1 as string extends K ? never : number extends K ? never : K]: T$1[K] };
410
412
  type Bindings = {
411
413
  [key: string]: any;
412
414
  [key: `app.${string}`]: any;
@@ -431,6 +433,17 @@ type Bindings = {
431
433
  };
432
434
  type UseKey = keyof RemoveIndexSignature<Bindings>;
433
435
  //#endregion
436
+ //#region src/Contracts/PromptsContract.d.ts
437
+ type Choice<Value> = {
438
+ value: Value;
439
+ name?: string;
440
+ description?: string;
441
+ short?: string;
442
+ disabled?: boolean | string;
443
+ type?: never;
444
+ };
445
+ type Choices = readonly (string | Separator)[] | readonly (Separator | Choice<string>)[];
446
+ //#endregion
434
447
  //#region src/Contracts/Router.d.ts
435
448
  type RouteMethod = 'get' | 'head' | 'put' | 'patch' | 'post' | 'delete';
436
449
  interface RouteDefinition {
@@ -616,6 +629,86 @@ declare class FileSystem {
616
629
  static resolveFileUp(name: string, extensions: string[] | ((dir: string, filesNames: string[]) => string | false), cwd?: string): string | undefined;
617
630
  }
618
631
  //#endregion
632
+ //#region src/Utils/Prompts.d.ts
633
+ declare class Prompts extends Logger {
634
+ /**
635
+ * Allows users to pick from a predefined set of choices when asked a question.
636
+ */
637
+ static choice(
638
+ /**
639
+ * Message to dislpay
640
+ */
641
+ message: string,
642
+ /**
643
+ * The choices available to the user
644
+ */
645
+ choices: Choices,
646
+ /**
647
+ * Item index front of which the cursor will initially appear
648
+ */
649
+ defaultIndex?: number): Promise<string>;
650
+ /**
651
+ * Ask the user for a simple "yes or no" confirmation.
652
+ * By default, this method returns `false`. However, if the user enters y or yes
653
+ * in response to the prompt, the method would return `true`.
654
+ */
655
+ static confirm(
656
+ /**
657
+ * Message to dislpay
658
+ */
659
+ message: string,
660
+ /**
661
+ * The default value
662
+ */
663
+ def?: boolean | undefined): Promise<boolean>;
664
+ /**
665
+ * Prompt the user with the given question, accept their input,
666
+ * and then return the user's input back to your command.
667
+ */
668
+ static ask(
669
+ /**
670
+ * Message to dislpay
671
+ */
672
+ message: string,
673
+ /**
674
+ * The default value
675
+ */
676
+ def?: string | undefined): Promise<string>;
677
+ /**
678
+ * Prompt the user with the given question, accept their input which
679
+ * will not be visible to them as they type in the console,
680
+ * and then return the user's input back to your command.
681
+ */
682
+ static secret(
683
+ /**
684
+ * Message to dislpay
685
+ */
686
+ message: string,
687
+ /**
688
+ * Mask the user input
689
+ *
690
+ * @default true
691
+ */
692
+ mask?: string | boolean): Promise<string>;
693
+ /**
694
+ * Provide auto-completion for possible choices.
695
+ * The user can still provide any answer, regardless of the auto-completion hints.
696
+ */
697
+ static anticipate(
698
+ /**
699
+ * Message to dislpay
700
+ */
701
+ message: string,
702
+ /**
703
+ * The source of completions
704
+ */
705
+ source: string[] | ((input?: string | undefined) => Promise<ChoiceOrSeparatorArray<any>>),
706
+ /**
707
+ * Set a default value
708
+ */
709
+ def?: string): Promise<any>;
710
+ }
711
+ //#endregion
619
712
  //#region src/Utils/Resolver.d.ts
620
713
  declare class Resolver {
621
714
  static getPakageInstallCommand(pkg?: string): Promise<string>;
@@ -676,5 +769,4 @@ declare class TaskManager {
676
769
  static advancedTaskRunner<R = any>(info: [[string, string], [string, string]] | [[string, string]], task: (() => Promise<R>) | (() => R)): Promise<R | undefined>;
677
770
  }
678
771
  //#endregion
679
- export { Bindings, DotFlatten, DotNestedKeys, DotNestedValue, EnvParser, EventHandler, ExtractControllerMethods, FileSystem, GenericWithNullableStringValues, HttpContext, IApplication, IContainer, IController, IMiddleware, IPathName, IRequest, IResponse, IRouter, IServiceProvider, Logger, LoggerChalk, LoggerLog, LoggerParseSignature, PathLoader, Resolver, RouteDefinition, RouteEventHandler, RouteMethod, RouterEnd, TaskManager, UseKey, baseTsconfig, mainTsconfig, packageJsonScript };
680
- //# sourceMappingURL=index.d.cts.map
772
+ export { Bindings, Choice, Choices, DotFlatten, DotNestedKeys, DotNestedValue, EnvParser, EventHandler, ExtractControllerMethods, FileSystem, GenericWithNullableStringValues, HttpContext, IApplication, IContainer, IController, IMiddleware, IPathName, IRequest, IResponse, IRouter, IServiceProvider, Logger, LoggerChalk, LoggerLog, LoggerParseSignature, PathLoader, Prompts, Resolver, RouteDefinition, RouteEventHandler, RouteMethod, RouterEnd, TaskManager, UseKey, baseTsconfig, mainTsconfig, packageJsonScript };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
2
  import { ChalkInstance } from "chalk";
3
+ import { ChoiceOrSeparatorArray } from "inquirer-autocomplete-standalone";
4
+ import { Separator } from "@inquirer/prompts";
3
5
  import { H3, H3Event, Middleware, MiddlewareOptions, serve } from "h3";
4
6
  import { Edge } from "edge.js";
5
7
  import { ResponseHeaderMap, TypedHeaders } from "fetchdts";
@@ -9,23 +11,23 @@ import { DotNestedKeys as DotNestedKeys$1, DotNestedValue as DotNestedValue$1 }
9
11
  /**
10
12
  * Adds a dot prefix to nested keys
11
13
  */
12
- type DotPrefix<T extends string, U extends string> = T extends '' ? U : `${T}.${U}`;
14
+ type DotPrefix<T$1 extends string, U extends string> = T$1 extends '' ? U : `${T$1}.${U}`;
13
15
  /**
14
16
  * Converts a union of objects into a single merged object
15
17
  */
16
- type MergeUnion<T> = (T extends any ? (k: T) => void : never) extends ((k: infer I) => void) ? { [K in keyof I]: I[K] } : never;
18
+ type MergeUnion<T$1> = (T$1 extends any ? (k: T$1) => void : never) extends ((k: infer I) => void) ? { [K in keyof I]: I[K] } : never;
17
19
  /**
18
20
  * Flattens nested objects into dotted keys
19
21
  */
20
- type DotFlatten<T, Prefix extends string = ''> = MergeUnion<{ [K in keyof T & string]: T[K] extends Record<string, any> ? DotFlatten<T[K], DotPrefix<Prefix, K>> : { [P in DotPrefix<Prefix, K>]: T[K] } }[keyof T & string]>;
22
+ type DotFlatten<T$1, Prefix extends string = ''> = MergeUnion<{ [K in keyof T$1 & string]: T$1[K] extends Record<string, any> ? DotFlatten<T$1[K], DotPrefix<Prefix, K>> : { [P in DotPrefix<Prefix, K>]: T$1[K] } }[keyof T$1 & string]>;
21
23
  /**
22
24
  * Builds "nested.key" paths for autocompletion
23
25
  */
24
- type DotNestedKeys<T> = { [K in keyof T & string]: T[K] extends object ? `${K}` | `${K}.${DotNestedKeys<T[K]>}` : `${K}` }[keyof T & string];
26
+ type DotNestedKeys<T$1> = { [K in keyof T$1 & string]: T$1[K] extends object ? `${K}` | `${K}.${DotNestedKeys<T$1[K]>}` : `${K}` }[keyof T$1 & string];
25
27
  /**
26
28
  * Retrieves type at a given dot-path
27
29
  */
28
- type DotNestedValue<T, Path extends string> = Path extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? DotNestedValue<T[Key], Rest> : never : Path extends keyof T ? T[Path] : never;
30
+ type DotNestedValue<T$1, Path extends string> = Path extends `${infer Key}.${infer Rest}` ? Key extends keyof T$1 ? DotNestedValue<T$1[Key], Rest> : never : Path extends keyof T$1 ? T$1[Path] : never;
29
31
  /**
30
32
  * A generic object type that supports nullable string values
31
33
  */
@@ -253,7 +255,7 @@ interface IResponse {
253
255
  //#endregion
254
256
  //#region src/Contracts/IHttp.d.ts
255
257
  type RouterEnd = 'get' | 'delete' | 'put' | 'post' | 'patch' | 'apiResource' | 'group' | 'route';
256
- type ExtractControllerMethods<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? K : never }[keyof T];
258
+ type ExtractControllerMethods<T$1> = { [K in keyof T$1]: T$1[K] extends ((...args: any[]) => any) ? K : never }[keyof T$1];
257
259
  /**
258
260
  * Interface for the Router contract, defining methods for HTTP routing.
259
261
  */
@@ -406,7 +408,7 @@ declare class PathLoader {
406
408
  }
407
409
  //#endregion
408
410
  //#region src/Contracts/BindingsContract.d.ts
409
- type RemoveIndexSignature<T> = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K] };
411
+ type RemoveIndexSignature<T$1> = { [K in keyof T$1 as string extends K ? never : number extends K ? never : K]: T$1[K] };
410
412
  type Bindings = {
411
413
  [key: string]: any;
412
414
  [key: `app.${string}`]: any;
@@ -431,6 +433,17 @@ type Bindings = {
431
433
  };
432
434
  type UseKey = keyof RemoveIndexSignature<Bindings>;
433
435
  //#endregion
436
+ //#region src/Contracts/PromptsContract.d.ts
437
+ type Choice<Value> = {
438
+ value: Value;
439
+ name?: string;
440
+ description?: string;
441
+ short?: string;
442
+ disabled?: boolean | string;
443
+ type?: never;
444
+ };
445
+ type Choices = readonly (string | Separator)[] | readonly (Separator | Choice<string>)[];
446
+ //#endregion
434
447
  //#region src/Contracts/Router.d.ts
435
448
  type RouteMethod = 'get' | 'head' | 'put' | 'patch' | 'post' | 'delete';
436
449
  interface RouteDefinition {
@@ -616,6 +629,86 @@ declare class FileSystem {
616
629
  static resolveFileUp(name: string, extensions: string[] | ((dir: string, filesNames: string[]) => string | false), cwd?: string): string | undefined;
617
630
  }
618
631
  //#endregion
632
+ //#region src/Utils/Prompts.d.ts
633
+ declare class Prompts extends Logger {
634
+ /**
635
+ * Allows users to pick from a predefined set of choices when asked a question.
636
+ */
637
+ static choice(
638
+ /**
639
+ * Message to dislpay
640
+ */
641
+ message: string,
642
+ /**
643
+ * The choices available to the user
644
+ */
645
+ choices: Choices,
646
+ /**
647
+ * Item index front of which the cursor will initially appear
648
+ */
649
+ defaultIndex?: number): Promise<string>;
650
+ /**
651
+ * Ask the user for a simple "yes or no" confirmation.
652
+ * By default, this method returns `false`. However, if the user enters y or yes
653
+ * in response to the prompt, the method would return `true`.
654
+ */
655
+ static confirm(
656
+ /**
657
+ * Message to dislpay
658
+ */
659
+ message: string,
660
+ /**
661
+ * The default value
662
+ */
663
+ def?: boolean | undefined): Promise<boolean>;
664
+ /**
665
+ * Prompt the user with the given question, accept their input,
666
+ * and then return the user's input back to your command.
667
+ */
668
+ static ask(
669
+ /**
670
+ * Message to dislpay
671
+ */
672
+ message: string,
673
+ /**
674
+ * The default value
675
+ */
676
+ def?: string | undefined): Promise<string>;
677
+ /**
678
+ * Prompt the user with the given question, accept their input which
679
+ * will not be visible to them as they type in the console,
680
+ * and then return the user's input back to your command.
681
+ */
682
+ static secret(
683
+ /**
684
+ * Message to dislpay
685
+ */
686
+ message: string,
687
+ /**
688
+ * Mask the user input
689
+ *
690
+ * @default true
691
+ */
692
+ mask?: string | boolean): Promise<string>;
693
+ /**
694
+ * Provide auto-completion for possible choices.
695
+ * The user can still provide any answer, regardless of the auto-completion hints.
696
+ */
697
+ static anticipate(
698
+ /**
699
+ * Message to dislpay
700
+ */
701
+ message: string,
702
+ /**
703
+ * The source of completions
704
+ */
705
+ source: string[] | ((input?: string | undefined) => Promise<ChoiceOrSeparatorArray<any>>),
706
+ /**
707
+ * Set a default value
708
+ */
709
+ def?: string): Promise<any>;
710
+ }
711
+ //#endregion
619
712
  //#region src/Utils/Resolver.d.ts
620
713
  declare class Resolver {
621
714
  static getPakageInstallCommand(pkg?: string): Promise<string>;
@@ -676,5 +769,4 @@ declare class TaskManager {
676
769
  static advancedTaskRunner<R = any>(info: [[string, string], [string, string]] | [[string, string]], task: (() => Promise<R>) | (() => R)): Promise<R | undefined>;
677
770
  }
678
771
  //#endregion
679
- export { Bindings, DotFlatten, DotNestedKeys, DotNestedValue, EnvParser, EventHandler, ExtractControllerMethods, FileSystem, GenericWithNullableStringValues, HttpContext, IApplication, IContainer, IController, IMiddleware, IPathName, IRequest, IResponse, IRouter, IServiceProvider, Logger, LoggerChalk, LoggerLog, LoggerParseSignature, PathLoader, Resolver, RouteDefinition, RouteEventHandler, RouteMethod, RouterEnd, TaskManager, UseKey, baseTsconfig, mainTsconfig, packageJsonScript };
680
- //# sourceMappingURL=index.d.ts.map
772
+ export { Bindings, Choice, Choices, DotFlatten, DotNestedKeys, DotNestedValue, EnvParser, EventHandler, ExtractControllerMethods, FileSystem, GenericWithNullableStringValues, HttpContext, IApplication, IContainer, IController, IMiddleware, IPathName, IRequest, IResponse, IRouter, IServiceProvider, Logger, LoggerChalk, LoggerLog, LoggerParseSignature, PathLoader, Prompts, Resolver, RouteDefinition, RouteEventHandler, RouteMethod, RouterEnd, TaskManager, UseKey, baseTsconfig, mainTsconfig, packageJsonScript };
package/dist/index.js CHANGED
@@ -2,6 +2,8 @@ import { access } from "fs/promises";
2
2
  import escalade from "escalade/sync";
3
3
  import path from "path";
4
4
  import chalk from "chalk";
5
+ import autocomplete from "inquirer-autocomplete-standalone";
6
+ import { confirm, input, password, select } from "@inquirer/prompts";
5
7
  import crypto from "crypto";
6
8
  import preferredPM from "preferred-pm";
7
9
 
@@ -261,10 +263,10 @@ var Logger = class Logger {
261
263
  process.exit(0);
262
264
  }
263
265
  static chalker(styles) {
264
- return (input) => styles.reduce((acc, style) => {
266
+ return (input$1) => styles.reduce((acc, style) => {
265
267
  if (style in chalk) return (typeof style === "function" ? style : chalk[style])(acc);
266
268
  return acc;
267
- }, input);
269
+ }, input$1);
268
270
  }
269
271
  static parse(config, joiner = " ", log = true, sc) {
270
272
  const string = config.map(([str, opt]) => {
@@ -332,6 +334,67 @@ var PathLoader = class {
332
334
  }
333
335
  };
334
336
 
337
+ //#endregion
338
+ //#region src/Utils/Prompts.ts
339
+ var Prompts = class extends Logger {
340
+ /**
341
+ * Allows users to pick from a predefined set of choices when asked a question.
342
+ */
343
+ static async choice(message, choices, defaultIndex) {
344
+ return select({
345
+ message,
346
+ choices,
347
+ default: defaultIndex ? choices.at(defaultIndex) : void 0
348
+ });
349
+ }
350
+ /**
351
+ * Ask the user for a simple "yes or no" confirmation.
352
+ * By default, this method returns `false`. However, if the user enters y or yes
353
+ * in response to the prompt, the method would return `true`.
354
+ */
355
+ static async confirm(message, def) {
356
+ return confirm({
357
+ message,
358
+ default: def
359
+ });
360
+ }
361
+ /**
362
+ * Prompt the user with the given question, accept their input,
363
+ * and then return the user's input back to your command.
364
+ */
365
+ static async ask(message, def) {
366
+ return input({
367
+ message,
368
+ default: def
369
+ });
370
+ }
371
+ /**
372
+ * Prompt the user with the given question, accept their input which
373
+ * will not be visible to them as they type in the console,
374
+ * and then return the user's input back to your command.
375
+ */
376
+ static async secret(message, mask) {
377
+ return password({
378
+ message,
379
+ mask
380
+ });
381
+ }
382
+ /**
383
+ * Provide auto-completion for possible choices.
384
+ * The user can still provide any answer, regardless of the auto-completion hints.
385
+ */
386
+ static async anticipate(message, source, def) {
387
+ return autocomplete({
388
+ message,
389
+ source: Array.isArray(source) ? async (term) => {
390
+ return (term ? source.filter((e) => e.includes(term)) : source).map((e) => ({ value: e }));
391
+ } : source,
392
+ suggestOnly: true,
393
+ default: def
394
+ });
395
+ }
396
+ };
397
+
335
398
  //#endregion
336
399
  //#region src/Utils/Resolver.ts
337
400
  var Resolver = class {
@@ -448,5 +511,4 @@ var TaskManager = class {
448
511
  };
449
512
 
450
513
  //#endregion
451
- export { EnvParser, FileSystem, HttpContext, Logger, PathLoader, Resolver, TaskManager, baseTsconfig, mainTsconfig, packageJsonScript };
452
- //# sourceMappingURL=index.js.map
514
+ export { EnvParser, FileSystem, HttpContext, Logger, PathLoader, Prompts, Resolver, TaskManager, baseTsconfig, mainTsconfig, packageJsonScript };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/shared",
3
- "version": "0.22.2",
3
+ "version": "0.23.0",
4
4
  "description": "Shared Utilities.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -44,15 +44,16 @@
44
44
  "laravel"
45
45
  ],
46
46
  "dependencies": {
47
- "h3": "^2.0.0-beta.4",
47
+ "@inquirer/prompts": "^7.9.0",
48
48
  "chalk": "^5.6.0",
49
49
  "edge.js": "^6.3.0",
50
- "preferred-pm": "^4.1.1",
51
- "escalade": "^3.2.0"
50
+ "escalade": "^3.2.0",
51
+ "h3": "^2.0.0-beta.4",
52
+ "inquirer-autocomplete-standalone": "^0.8.1",
53
+ "preferred-pm": "^4.1.1"
52
54
  },
53
55
  "devDependencies": {
54
56
  "fetchdts": "^0.1.6",
55
- "install": "^0.13.0",
56
57
  "pnpm": "^10.14.0"
57
58
  },
58
59
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["app: IApplication","request: IRequest","response: IResponse","value: any","path","path: string","nodepath","path","result: any","e: any"],"sources":["../src/Contracts/IHttp.ts","../src/Utils/EnvParser.ts","../src/Utils/FileSystem.ts","../src/Utils/Logger.ts","../src/Utils/PathLoader.ts","../src/Utils/Resolver.ts","../src/Utils/scripts.ts","../src/Utils/TaskManager.ts"],"sourcesContent":["import type { Middleware, MiddlewareOptions } from 'h3'\n\nimport { IApplication } from './IApplication'\nimport { IRequest } from './IRequest'\nimport { IResponse } from './IResponse'\n\nexport type RouterEnd = 'get' | 'delete' | 'put' | 'post' | 'patch' | 'apiResource' | 'group' | 'route';\n\nexport type ExtractControllerMethods<T> = {\n [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never\n}[keyof T];\n\n/**\n * Interface for the Router contract, defining methods for HTTP routing.\n */\nexport interface IRouter {\n /**\n * Registers a GET route.\n * @param path - The route path.\n * @param definition - The handler function or [controller class, method] array.\n * @param name - Optional route name.\n * @param middleware - Optional middleware array.\n */\n get<C extends new (...args: any) => any> (\n path: string,\n definition: EventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>],\n name?: string,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd>;\n\n /**\n * Registers a POST route.\n * @param path - The route path.\n * @param definition - The handler function or [controller class, method] array.\n * @param name - Optional route name.\n * @param middleware - Optional middleware array.\n */\n post<C extends new (...args: any) => any> (\n path: string,\n definition: EventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>],\n name?: string,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd>;\n\n /**\n * Registers a PUT route.\n * @param path - The route path.\n * @param definition - The handler function or [controller class, method] array.\n * @param name - Optional route name.\n * @param middleware - Optional middleware array.\n */\n put<C extends new (...args: any) => any> (\n path: string,\n definition: EventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>],\n name?: string,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd>;\n\n /**\n * Registers a route that responds to HTTP PATCH requests.\n *\n * @param path The URL pattern to match (can include parameters, e.g., '/users/:id').\n * @param definition Either:\n * - An EventHandler function\n * - A tuple: [ControllerClass, methodName]\n * @param name Optional route name (for URL generation or referencing).\n * @param middleware Optional array of middleware functions to execute before the handler.\n */\n patch<C extends new (...args: any) => any> (\n path: string,\n definition: EventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>],\n name?: string,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd>;\n\n /**\n * Registers a DELETE route.\n * @param path - The route path.\n * @param definition - The handler function or [controller class, method] array.\n * @param name - Optional route name.\n * @param middleware - Optional middleware array.\n */\n delete<C extends new (...args: any) => any> (\n path: string,\n definition: EventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>],\n name?: string,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd>;\n\n /**\n * Registers an API resource with standard CRUD routes.\n * @param path - The base path for the resource.\n * @param controller - The controller class handling the resource.\n * @param middleware - Optional middleware array.\n */\n apiResource (\n path: string,\n controller: new (app: IApplication) => IController,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd | 'name'>;\n\n /**\n * Generates a URL for a named route.\n * @param name - The name of the route.\n * @param params - Optional parameters to replace in the route path.\n * @returns The generated URL or undefined if the route is not found.\n */\n route (name: string, params?: Record<string, string>): string | undefined;\n\n\n /**\n * Set the name of the current route\n * \n * @param name \n */\n name (name: string): this\n\n /**\n * Groups routes with shared prefix or middleware.\n * @param options - Configuration for prefix or middleware.\n * @param callback - Callback function defining grouped routes.\n */\n group (options: { prefix?: string; middleware?: EventHandler[] }, callback: () => this): this;\n\n /**\n * Registers middleware for a specific path.\n * @param path - The path to apply the middleware.\n * @param handler - The middleware handler.\n * @param opts - Optional middleware options.\n */\n middleware (path: Middleware, opts?: Middleware | MiddlewareOptions): this\n middleware (path: string | IMiddleware[] | Middleware, handler: Middleware | MiddlewareOptions, opts?: MiddlewareOptions): this;\n}\n\n/**\n * Represents the HTTP context for a single request lifecycle.\n * Encapsulates the application instance, request, and response objects.\n */\nexport class HttpContext {\n constructor(\n public app: IApplication,\n public request: IRequest,\n public response: IResponse\n ) { }\n\n /**\n * Factory method to create a new HttpContext instance from a context object.\n * @param ctx - Object containing app, request, and response\n * @returns A new HttpContext instance\n */\n static init (ctx: { app: IApplication; request: IRequest; response: IResponse }): HttpContext {\n /**\n * Return a new instance\n */\n return new HttpContext(ctx.app, ctx.request, ctx.response)\n }\n}\n\n\n/**\n * Type for EventHandler, representing a function that handles an H3 event.\n */\nexport type EventHandler = (ctx: HttpContext) => any\nexport type RouteEventHandler = (...args: any[]) => any\n\n/**\n * Defines the contract for all controllers.\n * Any controller implementing this must define these methods.\n */\nexport interface IController {\n show?(...ctx: any[]): any\n index?(...ctx: any[]): any\n store?(...ctx: any[]): any\n update?(...ctx: any[]): any\n destroy?(...ctx: any[]): any\n}\n\n/**\n * Defines the contract for all middlewares.\n * Any middleware implementing this must define these methods.\n */\nexport interface IMiddleware {\n handle (context: HttpContext, next: () => Promise<any>): Promise<any>\n} \n","import { GenericWithNullableStringValues } from '../Contracts/ObjContract'\n\nexport class EnvParser {\n\n static parse (initial: GenericWithNullableStringValues) {\n const parsed = { ...initial }\n\n for (const key in parsed) {\n const value: any = parsed[key]\n parsed[key] = this.parseValue(value)\n }\n\n return parsed\n }\n\n static parseValue (value: any) {\n /**\n * Null/undefined stay untouched \n */\n if (value === null || value === undefined) return value\n\n /**\n * Convert string \"true\"/\"false\" to boolean \n */\n if (value === 'true') return true\n if (value === 'false') return false\n\n /**\n * Convert string numbers to number \n */\n if (!isNaN(value) && value.trim() !== '') {\n return Number(value)\n }\n\n /**\n * Convert string \"null\" and \"undefined\"\n */\n if (value === 'null') return null\n if (value === 'undefined') return undefined\n\n /**\n * Otherwise return as-is (string)\n */\n return value\n }\n}\n","import { access } from 'fs/promises'\nimport escalade from 'escalade/sync'\nimport path from 'path'\n\nexport class FileSystem {\n static findModulePkg (moduleId: string, cwd?: string) {\n const parts = moduleId.replace(/\\\\/g, '/').split('/')\n\n let packageName = ''\n // Handle scoped package name\n if (parts.length > 0 && parts[0][0] === '@') {\n packageName += parts.shift() + '/'\n }\n packageName += parts.shift()\n\n const packageJson = path.join(cwd ?? process.cwd(), 'node_modules', packageName)\n\n const resolved = this.resolveFileUp('package', ['json'], packageJson)\n\n if (!resolved) {\n return\n }\n\n return path.join(path.dirname(resolved), parts.join('/'))\n }\n\n /**\n * Check if file exists\n * \n * @param path \n * @returns \n */\n static async fileExists (path: string): Promise<boolean> {\n try {\n await access(path)\n return true\n } catch {\n return false\n }\n }\n\n /**\n * Recursively find files starting from given cwd\n * \n * @param name \n * @param extensions \n * @param cwd \n * \n * @returns \n */\n static resolveFileUp (\n name: string,\n extensions: string[] | ((dir: string, filesNames: string[]) => string | false),\n cwd?: string\n ) {\n cwd ??= process.cwd()\n\n return escalade(cwd, (dir, filesNames) => {\n if (typeof extensions === 'function') {\n return extensions(dir, filesNames)\n }\n\n const candidates = new Set(extensions.map(ext => `${name}.${ext}`))\n for (const filename of filesNames) {\n if (candidates.has(filename)) {\n return filename\n }\n }\n\n return false\n }) ?? undefined\n }\n} \n","import chalk, { type ChalkInstance } from 'chalk'\nimport { LoggerChalk, LoggerLog, LoggerParseSignature } from '../Contracts/Utils'\n\nexport class Logger {\n /**\n * Global verbosity configuration\n */\n private static verbosity: number = 0\n private static isQuiet: boolean = false\n private static isSilent: boolean = false\n\n /**\n * Configure global verbosity levels\n */\n static configure (options: { verbosity?: number, quiet?: boolean, silent?: boolean } = {}) {\n this.verbosity = options.verbosity ?? 0\n this.isQuiet = options.quiet ?? false\n this.isSilent = options.silent ?? false\n }\n\n /**\n * Check if output should be suppressed\n */\n private static shouldSuppressOutput (level: 'line' | 'debug' | 'info' | 'warn' | 'error' | 'success'): boolean {\n if (this.isSilent) return true\n if (this.isQuiet && (level === 'info' || level === 'success')) return true\n if (level === 'debug' && this.verbosity < 3) return true\n return false\n }\n /**\n * Logs the message in two columns\n * \n * @param name \n * @param value \n * @param log If set to false, array of [name, dots, value] output will be returned and not logged \n * @returns \n */\n static twoColumnDetail (name: string, value: string, log?: true, spacer?: string): void\n static twoColumnDetail (name: string, value: string, log?: false, spacer?: string): [string, string, string]\n static twoColumnDetail (name: string, value: string, log = true, spacer = '.'): [string, string, string] | void {\n // eslint-disable-next-line no-control-regex\n const regex = /\\x1b\\[\\d+m/g\n const width = Math.max(process.stdout.columns, 100)\n const dots = Math.max(width - name.replace(regex, '').length - value.replace(regex, '').length - 10, 0)\n\n if (log) return console.log(name, chalk.gray(spacer.repeat(dots)), value)\n else return [name, chalk.gray(spacer.repeat(dots)), value]\n }\n\n /**\n * Logs the message in two columns\n * \n * @param name \n * @param desc \n * @param width \n * @param log If set to false, array of [name, dots, value] output will be returned and not logged \n * @returns \n */\n static describe (name: string, desc: string, width?: number, log?: true): void\n static describe (name: string, desc: string, width?: number, log?: false): [string, string, string]\n static describe (name: string, desc: string, width = 50, log = true): [string, string, string] | void {\n width = Math.max(width, 30)\n // eslint-disable-next-line no-control-regex\n const regex = /\\x1b\\[\\d+m/g\n const dots = Math.max(width - name.replace(regex, '').length, 0)\n\n if (log) return console.log(name, ' '.repeat(dots), desc)\n else return [name, ' '.repeat(dots), desc]\n }\n\n /**\n * Logs the message in two columns but allways passing status\n * \n * @param name \n * @param value \n * @param status \n * @param exit \n * @param preserveCol \n */\n static split (name: string, value: string, status?: 'success' | 'info' | 'error', exit = false, preserveCol = false) {\n status ??= 'info'\n const color = { success: chalk.bgGreen, info: chalk.bgBlue, error: chalk.bgRed }\n\n const [_name, dots, val] = this.twoColumnDetail(name, value, false)\n\n console.log(this.textFormat(_name, color[status], preserveCol), dots, val)\n\n if (exit) process.exit(0)\n }\n\n /**\n * Wraps text with chalk\n * \n * @param txt \n * @param color \n * @param preserveCol \n * @returns \n */\n static textFormat (\n txt: unknown,\n color: (txt: string) => string,\n preserveCol = false\n ): string {\n const str = String(txt)\n\n if (preserveCol) return str\n\n const [first, ...rest] = str.split(':')\n if (rest.length === 0) return str\n\n return color(` ${first} `) + rest.join(':')\n }\n\n /**\n * Logs a success message\n * \n * @param msg \n * @param exit \n * @param preserveCol \n */\n static success (msg: any, exit = false, preserveCol = false) {\n if (!this.shouldSuppressOutput('success')) {\n console.log(chalk.green('✓'), this.textFormat(msg, chalk.bgGreen, preserveCol))\n }\n if (exit) process.exit(0)\n }\n\n /**\n * Logs an informational message\n * \n * @param msg \n * @param exit \n * @param preserveCol \n */\n static info (msg: any, exit = false, preserveCol = false) {\n if (!this.shouldSuppressOutput('info')) {\n console.log(chalk.blue('ℹ'), this.textFormat(msg, chalk.bgBlue, preserveCol))\n }\n if (exit) process.exit(0)\n }\n\n /**\n * Logs an error message\n * \n * @param msg \n * @param exit \n * @param preserveCol \n */\n static error (msg: string | string[] | Error & { detail?: string }, exit = true, preserveCol = false) {\n if (!this.shouldSuppressOutput('error')) {\n if (msg instanceof Error) {\n if (msg.message) {\n console.error(chalk.red('✖'), this.textFormat('ERROR:' + msg.message, chalk.bgRed, preserveCol))\n }\n console.error(chalk.red(`${msg.detail ? `${msg.detail}\\n` : ''}${msg.stack}`))\n }\n else {\n console.error(chalk.red('✖'), this.textFormat(msg, chalk.bgRed, preserveCol))\n }\n }\n if (exit) process.exit(1)\n }\n\n /**\n * Logs a warning message\n * \n * @param msg \n * @param exit \n * @param preserveCol \n */\n static warn (msg: any, exit = false, preserveCol = false) {\n if (!this.shouldSuppressOutput('warn')) {\n console.warn(chalk.yellow('⚠'), this.textFormat(msg, chalk.bgYellow, preserveCol))\n }\n if (exit) process.exit(0)\n }\n\n /**\n * Logs a debug message (only shown with verbosity >= 3)\n * \n * @param msg \n * @param exit \n * @param preserveCol \n */\n static debug<M = any> (msg: M | M[], exit = false, preserveCol = false) {\n if (!this.shouldSuppressOutput('debug')) {\n if (Array.isArray(msg)) {\n for (let i = 0; i < msg.length; i++) {\n console.log(chalk.gray('🐛'), chalk.bgGray(i + 1), this.textFormat(msg[i], chalk.bgGray, preserveCol))\n }\n } else {\n console.log(chalk.gray('🐛'), this.textFormat(msg, chalk.bgGray, preserveCol))\n }\n }\n if (exit) process.exit(0)\n }\n\n /**\n * Terminates the process\n */\n static quiet () {\n process.exit(0)\n }\n\n static chalker (styles: LoggerChalk[]) {\n return (input: any): string =>\n styles.reduce((acc, style) => {\n if ((style as any) in chalk) {\n const fn = typeof style === 'function'\n ? style\n : chalk[style as never]\n return fn(acc)\n }\n return acc\n }, input)\n }\n\n /**\n * Parse an array formated message and logs it\n * \n * @param config \n * @param joiner \n * @param log If set to false, string output will be returned and not logged \n * @param sc color to use ue on split text if : is found \n */\n static parse (config: LoggerParseSignature, joiner?: string, log?: true, sc?: LoggerChalk): void\n static parse (config: LoggerParseSignature, joiner?: string, log?: false, sc?: LoggerChalk): string\n static parse (config: LoggerParseSignature, joiner = ' ', log = true, sc?: LoggerChalk): string | void {\n const string = config.map(([str, opt]) => {\n if (Array.isArray(opt)) {\n opt = Logger.chalker(opt) as ChalkInstance\n }\n\n const output = typeof opt === 'string' && typeof chalk[opt] === 'function'\n ? (chalk as any)[opt](str)\n : typeof opt === 'function' ? opt(str) : str\n\n if (!sc) {\n return output\n }\n\n return this.textFormat(output, Logger.chalker(Array.isArray(sc) ? sc : [sc]))\n }).join(joiner)\n\n if (log && !this.shouldSuppressOutput('line')) console.log(string)\n else return string\n }\n\n /**\n * Ouput formater object or format the output\n * \n * @returns \n */\n public static log: LoggerLog = ((config, joiner, log: boolean = true, sc) => {\n if (typeof config === 'string') {\n const conf = [[config, joiner]] as [string, keyof ChalkInstance][]\n return this.parse(conf, '', log as false, sc)\n } else if (config) {\n return this.parse(config, String(joiner), log as false, sc)\n }\n\n return this\n }) as LoggerLog\n}\n","import { IPathName } from '../Contracts/IApplication'\nimport nodepath from 'path'\n\nexport class PathLoader {\n private paths = {\n base: '',\n views: '/src/resources/views',\n assets: '/public/assets',\n routes: '/src/routes',\n config: '/src/config',\n public: '/public',\n storage: '/storage',\n database: '/src/database',\n }\n\n /**\n * Dynamically retrieves a path property from the class.\n * Any property ending with \"Path\" is accessible automatically.\n *\n * @param name - The base name of the path property\n * @param prefix - The base path to prefix to the path\n * @returns \n */\n getPath (name: IPathName, prefix?: string): string {\n let path: string\n\n if (prefix && name !== 'base') {\n path = nodepath.join(prefix, this.paths[name])\n } else {\n path = this.paths[name]\n }\n\n\n if (name === 'public') {\n path = path.replace('/public', nodepath.join('/', process.env.DIST_DIR ?? '.h3ravel/serve'))\n } else {\n path = path.replace('/src/', `/${process.env.DIST_DIR ?? 'src'}/`.replace(/([^:]\\/)\\/+/g, '$1'))\n }\n\n return nodepath.normalize(path)\n }\n\n /**\n * Programatically set the paths.\n *\n * @param name - The base name of the path property\n * @param path - The new path\n * @param base - The base path to include to the path\n */\n setPath (name: IPathName, path: string, base?: string) {\n if (base && name !== 'base') {\n this.paths[name] = nodepath.join(base, path)\n }\n\n this.paths[name] = path\n }\n}\n","import crypto from 'crypto'\nimport preferredPM from 'preferred-pm'\n\nexport class Resolver {\n static async getPakageInstallCommand (pkg?: string) {\n const pm = (await preferredPM(process.cwd()))?.name ?? 'pnpm'\n\n let cmd = 'install '\n\n if (!pkg) {\n if (pm === 'npm' || pm === 'pnpm' || pm === 'bun')\n cmd = 'install'\n else\n cmd = ''\n } else if (pm === 'yarn' || pm === 'pnpm' || pm === 'bun')\n cmd = 'add '\n\n return `${pm} ${cmd}${pkg ?? ''}`\n }\n\n static async getInstallCommand (pkg: string) {\n const pm = (await preferredPM(process.cwd()))?.name ?? 'pnpm'\n\n let cmd = 'install'\n if (pm === 'yarn' || pm === 'pnpm')\n cmd = 'add'\n else if (pm === 'bun')\n cmd = 'create'\n\n return `${pm} ${cmd} ${pkg}`\n }\n\n\n /**\n * Create a hash for a function or an object\n * \n * @param provider \n * @returns \n */\n static hashObjectOrFunction (provider: object | ((..._: any[]) => any)): string {\n return crypto\n .createHash('sha1')\n .update(provider.toString())\n .digest('hex')\n }\n}\n","export const mainTsconfig = {\n extends: '@h3ravel/shared/tsconfig.json',\n compilerOptions: {\n baseUrl: '.',\n outDir: 'dist',\n paths: {\n 'src/*': ['./../src/*'],\n 'App/*': ['./../src/app/*'],\n 'root/*': ['./../*'],\n 'routes/*': ['./../src/routes/*'],\n 'config/*': ['./../src/config/*'],\n 'resources/*': ['./../src/resources/*']\n },\n target: 'es2022',\n module: 'es2022',\n moduleResolution: 'Node',\n esModuleInterop: true,\n strict: true,\n allowJs: true,\n skipLibCheck: true,\n resolveJsonModule: true,\n noEmit: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true\n },\n include: ['./**/*.d.ts', './../**/*'],\n exclude: [\n '.',\n './../**/console/bin',\n './../dist',\n './../**/dist',\n './../**/node_modules',\n './../.node_modules',\n './../**/node_modules/*',\n './../**/public',\n './../public',\n './../**/storage',\n './../storage',\n './../**coverage**',\n './../eslint.config.js',\n './../jest.config.ts',\n './../arquebus.config.js'\n ]\n}\n\nexport const baseTsconfig = {\n extends: './.h3ravel/tsconfig.json'\n}\n\nexport const packageJsonScript = {\n build: 'NODE_ENV=production tsdown --config-loader unconfig -c tsdown.default.config.ts',\n dev: 'NODE_ENV=development pnpm tsdown --config-loader unconfig -c tsdown.default.config.ts',\n start: 'DIST_DIR=dist node -r source-map-support/register dist/server.js',\n lint: 'eslint . --ext .ts',\n test: 'NODE_NO_WARNINGS=1 NODE_ENV=testing jest --passWithNoTests',\n postinstall: 'pnpm spawn'\n}\n","import { Logger } from './Logger'\n\nexport class TaskManager {\n public static async taskRunner (\n description: string,\n task: (() => Promise<any>) | (() => any)\n ): Promise<void> {\n const startTime = process.hrtime()\n let result: any = false\n\n try {\n result = await Promise.all([(task || (() => true))()].flat())\n } finally {\n const endTime = process.hrtime(startTime)\n const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6\n Logger.twoColumnDetail(\n Logger.parse([[description, 'green']], '', false),\n [\n Logger.parse([[`${Math.floor(duration)}ms`, 'gray']], '', false),\n Logger.parse([[result !== false ? '✔' : '✘', result !== false ? 'green' : 'red']], '', false),\n ].join(' ')\n )\n }\n }\n\n public static async advancedTaskRunner<R = any> (\n info: [[string, string], [string, string]] | [[string, string]],\n task: (() => Promise<R>) | (() => R)\n ): Promise<R | undefined> {\n const startTime = process.hrtime()\n const [startInfo, stopInfo] = info\n\n if (stopInfo) {\n Logger.twoColumnDetail(startInfo[0], Logger.log(startInfo[1], ['yellow', 'bold'], false))\n }\n\n try {\n return await Promise.race([task()])\n } catch (e: any) {\n Logger.error('ERROR: ' + e.message)\n } finally {\n const endTime = process.hrtime(startTime)\n const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6\n\n Logger.twoColumnDetail(\n stopInfo?.[0] ?? startInfo[0],\n [\n Logger.parse([[`${Math.floor(duration)}ms`, 'gray']], '', false),\n Logger.parse([[`✔ ${stopInfo?.[1] ?? startInfo[1]}`, ['green', 'bold']]], '', false),\n ].join(' ')\n )\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0IA,IAAa,cAAb,MAAa,YAAY;CACr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IAAI,CAAC,UAAU,OAAO,EAAE,MAAM,CAAC;AAG7F,MAAI;AACA,UAAO,MAAM,QAAQ,KAAK,CAAC,MAAM,CAAC,CAAC;WAC9BC,GAAQ;AACb,UAAO,MAAM,YAAY,EAAE,QAAQ;YAC7B;GACN,MAAM,UAAU,QAAQ,OAAO,UAAU;GACzC,MAAM,YAAY,QAAQ,KAAK,MAAM,QAAQ,MAAM;AAEnD,UAAO,gBACH,WAAW,MAAM,UAAU,IAC3B,CACI,OAAO,MAAM,CAAC,CAAC,GAAG,KAAK,MAAM,SAAS,CAAC,KAAK,OAAO,CAAC,EAAE,IAAI,MAAM,EAChE,OAAO,MAAM,CAAC,CAAC,KAAK,WAAW,MAAM,UAAU,MAAM,CAAC,SAAS,OAAO,CAAC,CAAC,EAAE,IAAI,MAAM,CACvF,CAAC,KAAK,IAAI,CACd"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["app: IApplication","request: IRequest","response: IResponse","value: any","path","path: string","nodepath","path","result: any","e: any"],"sources":["../src/Contracts/IHttp.ts","../src/Utils/EnvParser.ts","../src/Utils/FileSystem.ts","../src/Utils/Logger.ts","../src/Utils/PathLoader.ts","../src/Utils/Resolver.ts","../src/Utils/scripts.ts","../src/Utils/TaskManager.ts"],"sourcesContent":["import type { Middleware, MiddlewareOptions } from 'h3'\n\nimport { IApplication } from './IApplication'\nimport { IRequest } from './IRequest'\nimport { IResponse } from './IResponse'\n\nexport type RouterEnd = 'get' | 'delete' | 'put' | 'post' | 'patch' | 'apiResource' | 'group' | 'route';\n\nexport type ExtractControllerMethods<T> = {\n [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never\n}[keyof T];\n\n/**\n * Interface for the Router contract, defining methods for HTTP routing.\n */\nexport interface IRouter {\n /**\n * Registers a GET route.\n * @param path - The route path.\n * @param definition - The handler function or [controller class, method] array.\n * @param name - Optional route name.\n * @param middleware - Optional middleware array.\n */\n get<C extends new (...args: any) => any> (\n path: string,\n definition: EventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>],\n name?: string,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd>;\n\n /**\n * Registers a POST route.\n * @param path - The route path.\n * @param definition - The handler function or [controller class, method] array.\n * @param name - Optional route name.\n * @param middleware - Optional middleware array.\n */\n post<C extends new (...args: any) => any> (\n path: string,\n definition: EventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>],\n name?: string,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd>;\n\n /**\n * Registers a PUT route.\n * @param path - The route path.\n * @param definition - The handler function or [controller class, method] array.\n * @param name - Optional route name.\n * @param middleware - Optional middleware array.\n */\n put<C extends new (...args: any) => any> (\n path: string,\n definition: EventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>],\n name?: string,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd>;\n\n /**\n * Registers a route that responds to HTTP PATCH requests.\n *\n * @param path The URL pattern to match (can include parameters, e.g., '/users/:id').\n * @param definition Either:\n * - An EventHandler function\n * - A tuple: [ControllerClass, methodName]\n * @param name Optional route name (for URL generation or referencing).\n * @param middleware Optional array of middleware functions to execute before the handler.\n */\n patch<C extends new (...args: any) => any> (\n path: string,\n definition: EventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>],\n name?: string,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd>;\n\n /**\n * Registers a DELETE route.\n * @param path - The route path.\n * @param definition - The handler function or [controller class, method] array.\n * @param name - Optional route name.\n * @param middleware - Optional middleware array.\n */\n delete<C extends new (...args: any) => any> (\n path: string,\n definition: EventHandler | [C, methodName: ExtractControllerMethods<InstanceType<C>>],\n name?: string,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd>;\n\n /**\n * Registers an API resource with standard CRUD routes.\n * @param path - The base path for the resource.\n * @param controller - The controller class handling the resource.\n * @param middleware - Optional middleware array.\n */\n apiResource (\n path: string,\n controller: new (app: IApplication) => IController,\n middleware?: IMiddleware[]\n ): Omit<this, RouterEnd | 'name'>;\n\n /**\n * Generates a URL for a named route.\n * @param name - The name of the route.\n * @param params - Optional parameters to replace in the route path.\n * @returns The generated URL or undefined if the route is not found.\n */\n route (name: string, params?: Record<string, string>): string | undefined;\n\n\n /**\n * Set the name of the current route\n * \n * @param name \n */\n name (name: string): this\n\n /**\n * Groups routes with shared prefix or middleware.\n * @param options - Configuration for prefix or middleware.\n * @param callback - Callback function defining grouped routes.\n */\n group (options: { prefix?: string; middleware?: EventHandler[] }, callback: () => this): this;\n\n /**\n * Registers middleware for a specific path.\n * @param path - The path to apply the middleware.\n * @param handler - The middleware handler.\n * @param opts - Optional middleware options.\n */\n middleware (path: Middleware, opts?: Middleware | MiddlewareOptions): this\n middleware (path: string | IMiddleware[] | Middleware, handler: Middleware | MiddlewareOptions, opts?: MiddlewareOptions): this;\n}\n\n/**\n * Represents the HTTP context for a single request lifecycle.\n * Encapsulates the application instance, request, and response objects.\n */\nexport class HttpContext {\n constructor(\n public app: IApplication,\n public request: IRequest,\n public response: IResponse\n ) { }\n\n /**\n * Factory method to create a new HttpContext instance from a context object.\n * @param ctx - Object containing app, request, and response\n * @returns A new HttpContext instance\n */\n static init (ctx: { app: IApplication; request: IRequest; response: IResponse }): HttpContext {\n /**\n * Return a new instance\n */\n return new HttpContext(ctx.app, ctx.request, ctx.response)\n }\n}\n\n\n/**\n * Type for EventHandler, representing a function that handles an H3 event.\n */\nexport type EventHandler = (ctx: HttpContext) => any\nexport type RouteEventHandler = (...args: any[]) => any\n\n/**\n * Defines the contract for all controllers.\n * Any controller implementing this must define these methods.\n */\nexport interface IController {\n show?(...ctx: any[]): any\n index?(...ctx: any[]): any\n store?(...ctx: any[]): any\n update?(...ctx: any[]): any\n destroy?(...ctx: any[]): any\n}\n\n/**\n * Defines the contract for all middlewares.\n * Any middleware implementing this must define these methods.\n */\nexport interface IMiddleware {\n handle (context: HttpContext, next: () => Promise<any>): Promise<any>\n} \n","import { GenericWithNullableStringValues } from '../Contracts/ObjContract'\n\nexport class EnvParser {\n\n static parse (initial: GenericWithNullableStringValues) {\n const parsed = { ...initial }\n\n for (const key in parsed) {\n const value: any = parsed[key]\n parsed[key] = this.parseValue(value)\n }\n\n return parsed\n }\n\n static parseValue (value: any) {\n /**\n * Null/undefined stay untouched \n */\n if (value === null || value === undefined) return value\n\n /**\n * Convert string \"true\"/\"false\" to boolean \n */\n if (value === 'true') return true\n if (value === 'false') return false\n\n /**\n * Convert string numbers to number \n */\n if (!isNaN(value) && value.trim() !== '') {\n return Number(value)\n }\n\n /**\n * Convert string \"null\" and \"undefined\"\n */\n if (value === 'null') return null\n if (value === 'undefined') return undefined\n\n /**\n * Otherwise return as-is (string)\n */\n return value\n }\n}\n","import { access } from 'fs/promises'\nimport escalade from 'escalade/sync'\nimport path from 'path'\n\nexport class FileSystem {\n static findModulePkg (moduleId: string, cwd?: string) {\n const parts = moduleId.replace(/\\\\/g, '/').split('/')\n\n let packageName = ''\n // Handle scoped package name\n if (parts.length > 0 && parts[0][0] === '@') {\n packageName += parts.shift() + '/'\n }\n packageName += parts.shift()\n\n const packageJson = path.join(cwd ?? process.cwd(), 'node_modules', packageName)\n\n const resolved = this.resolveFileUp('package', ['json'], packageJson)\n\n if (!resolved) {\n return\n }\n\n return path.join(path.dirname(resolved), parts.join('/'))\n }\n\n /**\n * Check if file exists\n * \n * @param path \n * @returns \n */\n static async fileExists (path: string): Promise<boolean> {\n try {\n await access(path)\n return true\n } catch {\n return false\n }\n }\n\n /**\n * Recursively find files starting from given cwd\n * \n * @param name \n * @param extensions \n * @param cwd \n * \n * @returns \n */\n static resolveFileUp (\n name: string,\n extensions: string[] | ((dir: string, filesNames: string[]) => string | false),\n cwd?: string\n ) {\n cwd ??= process.cwd()\n\n return escalade(cwd, (dir, filesNames) => {\n if (typeof extensions === 'function') {\n return extensions(dir, filesNames)\n }\n\n const candidates = new Set(extensions.map(ext => `${name}.${ext}`))\n for (const filename of filesNames) {\n if (candidates.has(filename)) {\n return filename\n }\n }\n\n return false\n }) ?? undefined\n }\n} \n","import chalk, { type ChalkInstance } from 'chalk'\nimport { LoggerChalk, LoggerLog, LoggerParseSignature } from '../Contracts/Utils'\n\nexport class Logger {\n /**\n * Global verbosity configuration\n */\n private static verbosity: number = 0\n private static isQuiet: boolean = false\n private static isSilent: boolean = false\n\n /**\n * Configure global verbosity levels\n */\n static configure (options: { verbosity?: number, quiet?: boolean, silent?: boolean } = {}) {\n this.verbosity = options.verbosity ?? 0\n this.isQuiet = options.quiet ?? false\n this.isSilent = options.silent ?? false\n }\n\n /**\n * Check if output should be suppressed\n */\n private static shouldSuppressOutput (level: 'line' | 'debug' | 'info' | 'warn' | 'error' | 'success'): boolean {\n if (this.isSilent) return true\n if (this.isQuiet && (level === 'info' || level === 'success')) return true\n if (level === 'debug' && this.verbosity < 3) return true\n return false\n }\n /**\n * Logs the message in two columns\n * \n * @param name \n * @param value \n * @param log If set to false, array of [name, dots, value] output will be returned and not logged \n * @returns \n */\n static twoColumnDetail (name: string, value: string, log?: true, spacer?: string): void\n static twoColumnDetail (name: string, value: string, log?: false, spacer?: string): [string, string, string]\n static twoColumnDetail (name: string, value: string, log = true, spacer = '.'): [string, string, string] | void {\n // eslint-disable-next-line no-control-regex\n const regex = /\\x1b\\[\\d+m/g\n const width = Math.max(process.stdout.columns, 100)\n const dots = Math.max(width - name.replace(regex, '').length - value.replace(regex, '').length - 10, 0)\n\n if (log) return console.log(name, chalk.gray(spacer.repeat(dots)), value)\n else return [name, chalk.gray(spacer.repeat(dots)), value]\n }\n\n /**\n * Logs the message in two columns\n * \n * @param name \n * @param desc \n * @param width \n * @param log If set to false, array of [name, dots, value] output will be returned and not logged \n * @returns \n */\n static describe (name: string, desc: string, width?: number, log?: true): void\n static describe (name: string, desc: string, width?: number, log?: false): [string, string, string]\n static describe (name: string, desc: string, width = 50, log = true): [string, string, string] | void {\n width = Math.max(width, 30)\n // eslint-disable-next-line no-control-regex\n const regex = /\\x1b\\[\\d+m/g\n const dots = Math.max(width - name.replace(regex, '').length, 0)\n\n if (log) return console.log(name, ' '.repeat(dots), desc)\n else return [name, ' '.repeat(dots), desc]\n }\n\n /**\n * Logs the message in two columns but allways passing status\n * \n * @param name \n * @param value \n * @param status \n * @param exit \n * @param preserveCol \n */\n static split (name: string, value: string, status?: 'success' | 'info' | 'error', exit = false, preserveCol = false) {\n status ??= 'info'\n const color = { success: chalk.bgGreen, info: chalk.bgBlue, error: chalk.bgRed }\n\n const [_name, dots, val] = this.twoColumnDetail(name, value, false)\n\n console.log(this.textFormat(_name, color[status], preserveCol), dots, val)\n\n if (exit) process.exit(0)\n }\n\n /**\n * Wraps text with chalk\n * \n * @param txt \n * @param color \n * @param preserveCol \n * @returns \n */\n static textFormat (\n txt: unknown,\n color: (txt: string) => string,\n preserveCol = false\n ): string {\n const str = String(txt)\n\n if (preserveCol) return str\n\n const [first, ...rest] = str.split(':')\n if (rest.length === 0) return str\n\n return color(` ${first} `) + rest.join(':')\n }\n\n /**\n * Logs a success message\n * \n * @param msg \n * @param exit \n * @param preserveCol \n */\n static success (msg: any, exit = false, preserveCol = false) {\n if (!this.shouldSuppressOutput('success')) {\n console.log(chalk.green('✓'), this.textFormat(msg, chalk.bgGreen, preserveCol))\n }\n if (exit) process.exit(0)\n }\n\n /**\n * Logs an informational message\n * \n * @param msg \n * @param exit \n * @param preserveCol \n */\n static info (msg: any, exit = false, preserveCol = false) {\n if (!this.shouldSuppressOutput('info')) {\n console.log(chalk.blue('ℹ'), this.textFormat(msg, chalk.bgBlue, preserveCol))\n }\n if (exit) process.exit(0)\n }\n\n /**\n * Logs an error message\n * \n * @param msg \n * @param exit \n * @param preserveCol \n */\n static error (msg: string | string[] | Error & { detail?: string }, exit = true, preserveCol = false) {\n if (!this.shouldSuppressOutput('error')) {\n if (msg instanceof Error) {\n if (msg.message) {\n console.error(chalk.red('✖'), this.textFormat('ERROR:' + msg.message, chalk.bgRed, preserveCol))\n }\n console.error(chalk.red(`${msg.detail ? `${msg.detail}\\n` : ''}${msg.stack}`))\n }\n else {\n console.error(chalk.red('✖'), this.textFormat(msg, chalk.bgRed, preserveCol))\n }\n }\n if (exit) process.exit(1)\n }\n\n /**\n * Logs a warning message\n * \n * @param msg \n * @param exit \n * @param preserveCol \n */\n static warn (msg: any, exit = false, preserveCol = false) {\n if (!this.shouldSuppressOutput('warn')) {\n console.warn(chalk.yellow('⚠'), this.textFormat(msg, chalk.bgYellow, preserveCol))\n }\n if (exit) process.exit(0)\n }\n\n /**\n * Logs a debug message (only shown with verbosity >= 3)\n * \n * @param msg \n * @param exit \n * @param preserveCol \n */\n static debug<M = any> (msg: M | M[], exit = false, preserveCol = false) {\n if (!this.shouldSuppressOutput('debug')) {\n if (Array.isArray(msg)) {\n for (let i = 0; i < msg.length; i++) {\n console.log(chalk.gray('🐛'), chalk.bgGray(i + 1), this.textFormat(msg[i], chalk.bgGray, preserveCol))\n }\n } else {\n console.log(chalk.gray('🐛'), this.textFormat(msg, chalk.bgGray, preserveCol))\n }\n }\n if (exit) process.exit(0)\n }\n\n /**\n * Terminates the process\n */\n static quiet () {\n process.exit(0)\n }\n\n static chalker (styles: LoggerChalk[]) {\n return (input: any): string =>\n styles.reduce((acc, style) => {\n if ((style as any) in chalk) {\n const fn = typeof style === 'function'\n ? style\n : chalk[style as never]\n return fn(acc)\n }\n return acc\n }, input)\n }\n\n /**\n * Parse an array formated message and logs it\n * \n * @param config \n * @param joiner \n * @param log If set to false, string output will be returned and not logged \n * @param sc color to use ue on split text if : is found \n */\n static parse (config: LoggerParseSignature, joiner?: string, log?: true, sc?: LoggerChalk): void\n static parse (config: LoggerParseSignature, joiner?: string, log?: false, sc?: LoggerChalk): string\n static parse (config: LoggerParseSignature, joiner = ' ', log = true, sc?: LoggerChalk): string | void {\n const string = config.map(([str, opt]) => {\n if (Array.isArray(opt)) {\n opt = Logger.chalker(opt) as ChalkInstance\n }\n\n const output = typeof opt === 'string' && typeof chalk[opt] === 'function'\n ? (chalk as any)[opt](str)\n : typeof opt === 'function' ? opt(str) : str\n\n if (!sc) {\n return output\n }\n\n return this.textFormat(output, Logger.chalker(Array.isArray(sc) ? sc : [sc]))\n }).join(joiner)\n\n if (log && !this.shouldSuppressOutput('line')) console.log(string)\n else return string\n }\n\n /**\n * Ouput formater object or format the output\n * \n * @returns \n */\n public static log: LoggerLog = ((config, joiner, log: boolean = true, sc) => {\n if (typeof config === 'string') {\n const conf = [[config, joiner]] as [string, keyof ChalkInstance][]\n return this.parse(conf, '', log as false, sc)\n } else if (config) {\n return this.parse(config, String(joiner), log as false, sc)\n }\n\n return this\n }) as LoggerLog\n}\n","import { IPathName } from '../Contracts/IApplication'\nimport nodepath from 'path'\n\nexport class PathLoader {\n private paths = {\n base: '',\n views: '/src/resources/views',\n assets: '/public/assets',\n routes: '/src/routes',\n config: '/src/config',\n public: '/public',\n storage: '/storage',\n database: '/src/database',\n }\n\n /**\n * Dynamically retrieves a path property from the class.\n * Any property ending with \"Path\" is accessible automatically.\n *\n * @param name - The base name of the path property\n * @param prefix - The base path to prefix to the path\n * @returns \n */\n getPath (name: IPathName, prefix?: string): string {\n let path: string\n\n if (prefix && name !== 'base') {\n path = nodepath.join(prefix, this.paths[name])\n } else {\n path = this.paths[name]\n }\n\n\n if (name === 'public') {\n path = path.replace('/public', nodepath.join('/', process.env.DIST_DIR ?? '.h3ravel/serve'))\n } else {\n path = path.replace('/src/', `/${process.env.DIST_DIR ?? 'src'}/`.replace(/([^:]\\/)\\/+/g, '$1'))\n }\n\n return nodepath.normalize(path)\n }\n\n /**\n * Programatically set the paths.\n *\n * @param name - The base name of the path property\n * @param path - The new path\n * @param base - The base path to include to the path\n */\n setPath (name: IPathName, path: string, base?: string) {\n if (base && name !== 'base') {\n this.paths[name] = nodepath.join(base, path)\n }\n\n this.paths[name] = path\n }\n}\n","import crypto from 'crypto'\nimport preferredPM from 'preferred-pm'\n\nexport class Resolver {\n static async getPakageInstallCommand (pkg?: string) {\n const pm = (await preferredPM(process.cwd()))?.name ?? 'pnpm'\n\n let cmd = 'install '\n\n if (!pkg) {\n if (pm === 'npm' || pm === 'pnpm' || pm === 'bun')\n cmd = 'install'\n else\n cmd = ''\n } else if (pm === 'yarn' || pm === 'pnpm' || pm === 'bun')\n cmd = 'add '\n\n return `${pm} ${cmd}${pkg ?? ''}`\n }\n\n static async getInstallCommand (pkg: string) {\n const pm = (await preferredPM(process.cwd()))?.name ?? 'pnpm'\n\n let cmd = 'install'\n if (pm === 'yarn' || pm === 'pnpm')\n cmd = 'add'\n else if (pm === 'bun')\n cmd = 'create'\n\n return `${pm} ${cmd} ${pkg}`\n }\n\n\n /**\n * Create a hash for a function or an object\n * \n * @param provider \n * @returns \n */\n static hashObjectOrFunction (provider: object | ((..._: any[]) => any)): string {\n return crypto\n .createHash('sha1')\n .update(provider.toString())\n .digest('hex')\n }\n}\n","export const mainTsconfig = {\n extends: '@h3ravel/shared/tsconfig.json',\n compilerOptions: {\n baseUrl: '.',\n outDir: 'dist',\n paths: {\n 'src/*': ['./../src/*'],\n 'App/*': ['./../src/app/*'],\n 'root/*': ['./../*'],\n 'routes/*': ['./../src/routes/*'],\n 'config/*': ['./../src/config/*'],\n 'resources/*': ['./../src/resources/*']\n },\n target: 'es2022',\n module: 'es2022',\n moduleResolution: 'Node',\n esModuleInterop: true,\n strict: true,\n allowJs: true,\n skipLibCheck: true,\n resolveJsonModule: true,\n noEmit: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true\n },\n include: ['./**/*.d.ts', './../**/*'],\n exclude: [\n '.',\n './../**/console/bin',\n './../dist',\n './../**/dist',\n './../**/node_modules',\n './../.node_modules',\n './../**/node_modules/*',\n './../**/public',\n './../public',\n './../**/storage',\n './../storage',\n './../**coverage**',\n './../eslint.config.js',\n './../jest.config.ts',\n './../arquebus.config.js'\n ]\n}\n\nexport const baseTsconfig = {\n extends: './.h3ravel/tsconfig.json'\n}\n\nexport const packageJsonScript = {\n build: 'NODE_ENV=production tsdown --config-loader unconfig -c tsdown.default.config.ts',\n dev: 'NODE_ENV=development pnpm tsdown --config-loader unconfig -c tsdown.default.config.ts',\n start: 'DIST_DIR=dist node -r source-map-support/register dist/server.js',\n lint: 'eslint . --ext .ts',\n test: 'NODE_NO_WARNINGS=1 NODE_ENV=testing jest --passWithNoTests',\n postinstall: 'pnpm spawn'\n}\n","import { Logger } from './Logger'\n\nexport class TaskManager {\n public static async taskRunner (\n description: string,\n task: (() => Promise<any>) | (() => any)\n ): Promise<void> {\n const startTime = process.hrtime()\n let result: any = false\n\n try {\n result = await Promise.all([(task || (() => true))()].flat())\n } finally {\n const endTime = process.hrtime(startTime)\n const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6\n Logger.twoColumnDetail(\n Logger.parse([[description, 'green']], '', false),\n [\n Logger.parse([[`${Math.floor(duration)}ms`, 'gray']], '', false),\n Logger.parse([[result !== false ? '✔' : '✘', result !== false ? 'green' : 'red']], '', false),\n ].join(' ')\n )\n }\n }\n\n public static async advancedTaskRunner<R = any> (\n info: [[string, string], [string, string]] | [[string, string]],\n task: (() => Promise<R>) | (() => R)\n ): Promise<R | undefined> {\n const startTime = process.hrtime()\n const [startInfo, stopInfo] = info\n\n if (stopInfo) {\n Logger.twoColumnDetail(startInfo[0], Logger.log(startInfo[1], ['yellow', 'bold'], false))\n }\n\n try {\n return await Promise.race([task()])\n } catch (e: any) {\n Logger.error('ERROR: ' + e.message)\n } finally {\n const endTime = process.hrtime(startTime)\n const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6\n\n Logger.twoColumnDetail(\n stopInfo?.[0] ?? startInfo[0],\n [\n Logger.parse([[`${Math.floor(duration)}ms`, 'gray']], '', false),\n Logger.parse([[`✔ ${stopInfo?.[1] ?? startInfo[1]}`, ['green', 'bold']]], '', false),\n ].join(' ')\n )\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AA0IA,IAAa,cAAb,MAAa,YAAY;CACrB,YACI,AAAOA,KACP,AAAOC,SACP,AAAOC,UACT;EAHS;EACA;EACA;;;;;;;CAQX,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