@h3ravel/shared 0.22.0 → 0.22.2
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 +44 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -11
- package/dist/index.d.ts +29 -11
- package/dist/index.js +44 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -145,6 +145,29 @@ var FileSystem = class {
|
|
|
145
145
|
//#endregion
|
|
146
146
|
//#region src/Utils/Logger.ts
|
|
147
147
|
var Logger = class Logger {
|
|
148
|
+
/**
|
|
149
|
+
* Global verbosity configuration
|
|
150
|
+
*/
|
|
151
|
+
static verbosity = 0;
|
|
152
|
+
static isQuiet = false;
|
|
153
|
+
static isSilent = false;
|
|
154
|
+
/**
|
|
155
|
+
* Configure global verbosity levels
|
|
156
|
+
*/
|
|
157
|
+
static configure(options = {}) {
|
|
158
|
+
this.verbosity = options.verbosity ?? 0;
|
|
159
|
+
this.isQuiet = options.quiet ?? false;
|
|
160
|
+
this.isSilent = options.silent ?? false;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Check if output should be suppressed
|
|
164
|
+
*/
|
|
165
|
+
static shouldSuppressOutput(level) {
|
|
166
|
+
if (this.isSilent) return true;
|
|
167
|
+
if (this.isQuiet && (level === "info" || level === "success")) return true;
|
|
168
|
+
if (level === "debug" && this.verbosity < 3) return true;
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
148
171
|
static twoColumnDetail(name, value, log = true, spacer = ".") {
|
|
149
172
|
const regex = /\x1b\[\d+m/g;
|
|
150
173
|
const width = Math.max(process.stdout.columns, 100);
|
|
@@ -157,7 +180,7 @@ var Logger = class Logger {
|
|
|
157
180
|
];
|
|
158
181
|
}
|
|
159
182
|
static describe(name, desc, width = 50, log = true) {
|
|
160
|
-
width = Math.
|
|
183
|
+
width = Math.max(width, 30);
|
|
161
184
|
const dots = Math.max(width - name.replace(/\x1b\[\d+m/g, "").length, 0);
|
|
162
185
|
if (log) return console.log(name, " ".repeat(dots), desc);
|
|
163
186
|
else return [
|
|
@@ -202,38 +225,40 @@ var Logger = class Logger {
|
|
|
202
225
|
return color(` ${first} `) + rest.join(":");
|
|
203
226
|
}
|
|
204
227
|
/**
|
|
205
|
-
* Logs a
|
|
228
|
+
* Logs a success message
|
|
206
229
|
*
|
|
207
230
|
* @param msg
|
|
208
231
|
* @param exit
|
|
209
232
|
* @param preserveCol
|
|
210
233
|
*/
|
|
211
|
-
static
|
|
212
|
-
if (
|
|
213
|
-
else console.log(chalk.default.gray("ℹ"), this.textFormat(msg, chalk.default.bgGray, preserveCol));
|
|
234
|
+
static success(msg, exit = false, preserveCol = false) {
|
|
235
|
+
if (!this.shouldSuppressOutput("success")) console.log(chalk.default.green("✓"), this.textFormat(msg, chalk.default.bgGreen, preserveCol));
|
|
214
236
|
if (exit) process.exit(0);
|
|
215
237
|
}
|
|
216
238
|
/**
|
|
217
|
-
* Logs
|
|
239
|
+
* Logs an informational message
|
|
218
240
|
*
|
|
219
241
|
* @param msg
|
|
220
242
|
* @param exit
|
|
221
243
|
* @param preserveCol
|
|
222
244
|
*/
|
|
223
|
-
static
|
|
224
|
-
console.log(chalk.default.
|
|
245
|
+
static info(msg, exit = false, preserveCol = false) {
|
|
246
|
+
if (!this.shouldSuppressOutput("info")) console.log(chalk.default.blue("ℹ"), this.textFormat(msg, chalk.default.bgBlue, preserveCol));
|
|
225
247
|
if (exit) process.exit(0);
|
|
226
248
|
}
|
|
227
249
|
/**
|
|
228
|
-
* Logs an
|
|
250
|
+
* Logs an error message
|
|
229
251
|
*
|
|
230
252
|
* @param msg
|
|
231
253
|
* @param exit
|
|
232
254
|
* @param preserveCol
|
|
233
255
|
*/
|
|
234
|
-
static
|
|
235
|
-
|
|
236
|
-
|
|
256
|
+
static error(msg, exit = true, preserveCol = false) {
|
|
257
|
+
if (!this.shouldSuppressOutput("error")) if (msg instanceof Error) {
|
|
258
|
+
if (msg.message) console.error(chalk.default.red("✖"), this.textFormat("ERROR:" + msg.message, chalk.default.bgRed, preserveCol));
|
|
259
|
+
console.error(chalk.default.red(`${msg.detail ? `${msg.detail}\n` : ""}${msg.stack}`));
|
|
260
|
+
} else console.error(chalk.default.red("✖"), this.textFormat(msg, chalk.default.bgRed, preserveCol));
|
|
261
|
+
if (exit) process.exit(1);
|
|
237
262
|
}
|
|
238
263
|
/**
|
|
239
264
|
* Logs a warning message
|
|
@@ -243,22 +268,20 @@ var Logger = class Logger {
|
|
|
243
268
|
* @param preserveCol
|
|
244
269
|
*/
|
|
245
270
|
static warn(msg, exit = false, preserveCol = false) {
|
|
246
|
-
console.
|
|
271
|
+
if (!this.shouldSuppressOutput("warn")) console.warn(chalk.default.yellow("⚠"), this.textFormat(msg, chalk.default.bgYellow, preserveCol));
|
|
247
272
|
if (exit) process.exit(0);
|
|
248
273
|
}
|
|
249
274
|
/**
|
|
250
|
-
* Logs
|
|
275
|
+
* Logs a debug message (only shown with verbosity >= 3)
|
|
251
276
|
*
|
|
252
277
|
* @param msg
|
|
253
278
|
* @param exit
|
|
254
279
|
* @param preserveCol
|
|
255
280
|
*/
|
|
256
|
-
static
|
|
257
|
-
if (msg
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
} else console.error(chalk.default.red("✖"), this.textFormat(msg, chalk.default.bgRed, preserveCol));
|
|
261
|
-
if (exit) process.exit(1);
|
|
281
|
+
static debug(msg, exit = false, preserveCol = false) {
|
|
282
|
+
if (!this.shouldSuppressOutput("debug")) if (Array.isArray(msg)) for (let i = 0; i < msg.length; i++) console.log(chalk.default.gray("🐛"), chalk.default.bgGray(i + 1), this.textFormat(msg[i], chalk.default.bgGray, preserveCol));
|
|
283
|
+
else console.log(chalk.default.gray("🐛"), this.textFormat(msg, chalk.default.bgGray, preserveCol));
|
|
284
|
+
if (exit) process.exit(0);
|
|
262
285
|
}
|
|
263
286
|
/**
|
|
264
287
|
* Terminates the process
|
|
@@ -279,7 +302,7 @@ var Logger = class Logger {
|
|
|
279
302
|
if (!sc) return output;
|
|
280
303
|
return this.textFormat(output, Logger.chalker(Array.isArray(sc) ? sc : [sc]));
|
|
281
304
|
}).join(joiner);
|
|
282
|
-
if (log) console.log(string);
|
|
305
|
+
if (log && !this.shouldSuppressOutput("line")) console.log(string);
|
|
283
306
|
else return string;
|
|
284
307
|
}
|
|
285
308
|
/**
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 * 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.min(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 debug message\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 (Array.isArray(msg)) {\n for (let i = 0; i < msg.length; i++) {\n console.log(chalk.bgGray(i + 1), chalk.gray('ℹ'), this.textFormat(msg[i], chalk.bgGray, preserveCol), '\\n')\n }\n } else {\n console.log(chalk.gray('ℹ'), this.textFormat(msg, chalk.bgGray, preserveCol))\n }\n if (exit) process.exit(0)\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 console.log(chalk.green('✓'), this.textFormat(msg, chalk.bgGreen, preserveCol))\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 console.log(chalk.blue('ℹ'), this.textFormat(msg, chalk.bgBlue, preserveCol))\n if (exit) process.exit(0)\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 console.log(chalk.yellow('ℹ'), this.textFormat(msg, chalk.bgYellow, preserveCol))\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 (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 if (exit) process.exit(1)\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) 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,OAAO,KAAM,KAAiF;;;;AAI1F,SAAO,IAAI,YAAY,IAAI,KAAK,IAAI,SAAS,IAAI,SAAS;;;;;;ACxJlE,IAAa,YAAb,MAAuB;CAEnB,OAAO,MAAO,SAA0C;EACpD,MAAM,SAAS,EAAE,GAAG,SAAS;AAE7B,OAAK,MAAM,OAAO,QAAQ;GACtB,MAAMC,QAAa,OAAO;AAC1B,UAAO,OAAO,KAAK,WAAW,MAAM;;AAGxC,SAAO;;CAGX,OAAO,WAAY,OAAY;;;;AAI3B,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;;;;AAKlD,MAAI,UAAU,OAAQ,QAAO;AAC7B,MAAI,UAAU,QAAS,QAAO;;;;AAK9B,MAAI,CAAC,MAAM,MAAM,IAAI,MAAM,MAAM,KAAK,GAClC,QAAO,OAAO,MAAM;;;;AAMxB,MAAI,UAAU,OAAQ,QAAO;AAC7B,MAAI,UAAU,YAAa,QAAO;;;;AAKlC,SAAO;;;;;;ACvCf,IAAa,aAAb,MAAwB;CACpB,OAAO,cAAe,UAAkB,KAAc;EAClD,MAAM,QAAQ,SAAS,QAAQ,OAAO,IAAI,CAAC,MAAM,IAAI;EAErD,IAAI,cAAc;AAElB,MAAI,MAAM,SAAS,KAAK,MAAM,GAAG,OAAO,IACpC,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AAM,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"}
|
|
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;CACrB,YACI,AAAOA,KACP,AAAOC,SACP,AAAOC,UACT;EAHS;EACA;EACA;;;;;;;CAQX,OAAO,KAAM,KAAiF;;;;AAI1F,SAAO,IAAI,YAAY,IAAI,KAAK,IAAI,SAAS,IAAI,SAAS;;;;;;ACxJlE,IAAa,YAAb,MAAuB;CAEnB,OAAO,MAAO,SAA0C;EACpD,MAAM,SAAS,EAAE,GAAG,SAAS;AAE7B,OAAK,MAAM,OAAO,QAAQ;GACtB,MAAMC,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,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.d.cts
CHANGED
|
@@ -122,7 +122,7 @@ interface IApplication extends IContainer {
|
|
|
122
122
|
/**
|
|
123
123
|
* Boots all registered providers.
|
|
124
124
|
*/
|
|
125
|
-
boot(): Promise<
|
|
125
|
+
boot(): Promise<this>;
|
|
126
126
|
/**
|
|
127
127
|
* Gets the base path of the application.
|
|
128
128
|
* @returns The base path as a string.
|
|
@@ -443,6 +443,24 @@ interface RouteDefinition {
|
|
|
443
443
|
//#endregion
|
|
444
444
|
//#region src/Utils/Logger.d.ts
|
|
445
445
|
declare class Logger {
|
|
446
|
+
/**
|
|
447
|
+
* Global verbosity configuration
|
|
448
|
+
*/
|
|
449
|
+
private static verbosity;
|
|
450
|
+
private static isQuiet;
|
|
451
|
+
private static isSilent;
|
|
452
|
+
/**
|
|
453
|
+
* Configure global verbosity levels
|
|
454
|
+
*/
|
|
455
|
+
static configure(options?: {
|
|
456
|
+
verbosity?: number;
|
|
457
|
+
quiet?: boolean;
|
|
458
|
+
silent?: boolean;
|
|
459
|
+
}): void;
|
|
460
|
+
/**
|
|
461
|
+
* Check if output should be suppressed
|
|
462
|
+
*/
|
|
463
|
+
private static shouldSuppressOutput;
|
|
446
464
|
/**
|
|
447
465
|
* Logs the message in two columns
|
|
448
466
|
*
|
|
@@ -484,29 +502,31 @@ declare class Logger {
|
|
|
484
502
|
*/
|
|
485
503
|
static textFormat(txt: unknown, color: (txt: string) => string, preserveCol?: boolean): string;
|
|
486
504
|
/**
|
|
487
|
-
* Logs a
|
|
505
|
+
* Logs a success message
|
|
488
506
|
*
|
|
489
507
|
* @param msg
|
|
490
508
|
* @param exit
|
|
491
509
|
* @param preserveCol
|
|
492
510
|
*/
|
|
493
|
-
static
|
|
511
|
+
static success(msg: any, exit?: boolean, preserveCol?: boolean): void;
|
|
494
512
|
/**
|
|
495
|
-
* Logs
|
|
513
|
+
* Logs an informational message
|
|
496
514
|
*
|
|
497
515
|
* @param msg
|
|
498
516
|
* @param exit
|
|
499
517
|
* @param preserveCol
|
|
500
518
|
*/
|
|
501
|
-
static
|
|
519
|
+
static info(msg: any, exit?: boolean, preserveCol?: boolean): void;
|
|
502
520
|
/**
|
|
503
|
-
* Logs an
|
|
521
|
+
* Logs an error message
|
|
504
522
|
*
|
|
505
523
|
* @param msg
|
|
506
524
|
* @param exit
|
|
507
525
|
* @param preserveCol
|
|
508
526
|
*/
|
|
509
|
-
static
|
|
527
|
+
static error(msg: string | string[] | Error & {
|
|
528
|
+
detail?: string;
|
|
529
|
+
}, exit?: boolean, preserveCol?: boolean): void;
|
|
510
530
|
/**
|
|
511
531
|
* Logs a warning message
|
|
512
532
|
*
|
|
@@ -516,15 +536,13 @@ declare class Logger {
|
|
|
516
536
|
*/
|
|
517
537
|
static warn(msg: any, exit?: boolean, preserveCol?: boolean): void;
|
|
518
538
|
/**
|
|
519
|
-
* Logs
|
|
539
|
+
* Logs a debug message (only shown with verbosity >= 3)
|
|
520
540
|
*
|
|
521
541
|
* @param msg
|
|
522
542
|
* @param exit
|
|
523
543
|
* @param preserveCol
|
|
524
544
|
*/
|
|
525
|
-
static
|
|
526
|
-
detail?: string;
|
|
527
|
-
}, exit?: boolean, preserveCol?: boolean): void;
|
|
545
|
+
static debug<M = any>(msg: M | M[], exit?: boolean, preserveCol?: boolean): void;
|
|
528
546
|
/**
|
|
529
547
|
* Terminates the process
|
|
530
548
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -122,7 +122,7 @@ interface IApplication extends IContainer {
|
|
|
122
122
|
/**
|
|
123
123
|
* Boots all registered providers.
|
|
124
124
|
*/
|
|
125
|
-
boot(): Promise<
|
|
125
|
+
boot(): Promise<this>;
|
|
126
126
|
/**
|
|
127
127
|
* Gets the base path of the application.
|
|
128
128
|
* @returns The base path as a string.
|
|
@@ -443,6 +443,24 @@ interface RouteDefinition {
|
|
|
443
443
|
//#endregion
|
|
444
444
|
//#region src/Utils/Logger.d.ts
|
|
445
445
|
declare class Logger {
|
|
446
|
+
/**
|
|
447
|
+
* Global verbosity configuration
|
|
448
|
+
*/
|
|
449
|
+
private static verbosity;
|
|
450
|
+
private static isQuiet;
|
|
451
|
+
private static isSilent;
|
|
452
|
+
/**
|
|
453
|
+
* Configure global verbosity levels
|
|
454
|
+
*/
|
|
455
|
+
static configure(options?: {
|
|
456
|
+
verbosity?: number;
|
|
457
|
+
quiet?: boolean;
|
|
458
|
+
silent?: boolean;
|
|
459
|
+
}): void;
|
|
460
|
+
/**
|
|
461
|
+
* Check if output should be suppressed
|
|
462
|
+
*/
|
|
463
|
+
private static shouldSuppressOutput;
|
|
446
464
|
/**
|
|
447
465
|
* Logs the message in two columns
|
|
448
466
|
*
|
|
@@ -484,29 +502,31 @@ declare class Logger {
|
|
|
484
502
|
*/
|
|
485
503
|
static textFormat(txt: unknown, color: (txt: string) => string, preserveCol?: boolean): string;
|
|
486
504
|
/**
|
|
487
|
-
* Logs a
|
|
505
|
+
* Logs a success message
|
|
488
506
|
*
|
|
489
507
|
* @param msg
|
|
490
508
|
* @param exit
|
|
491
509
|
* @param preserveCol
|
|
492
510
|
*/
|
|
493
|
-
static
|
|
511
|
+
static success(msg: any, exit?: boolean, preserveCol?: boolean): void;
|
|
494
512
|
/**
|
|
495
|
-
* Logs
|
|
513
|
+
* Logs an informational message
|
|
496
514
|
*
|
|
497
515
|
* @param msg
|
|
498
516
|
* @param exit
|
|
499
517
|
* @param preserveCol
|
|
500
518
|
*/
|
|
501
|
-
static
|
|
519
|
+
static info(msg: any, exit?: boolean, preserveCol?: boolean): void;
|
|
502
520
|
/**
|
|
503
|
-
* Logs an
|
|
521
|
+
* Logs an error message
|
|
504
522
|
*
|
|
505
523
|
* @param msg
|
|
506
524
|
* @param exit
|
|
507
525
|
* @param preserveCol
|
|
508
526
|
*/
|
|
509
|
-
static
|
|
527
|
+
static error(msg: string | string[] | Error & {
|
|
528
|
+
detail?: string;
|
|
529
|
+
}, exit?: boolean, preserveCol?: boolean): void;
|
|
510
530
|
/**
|
|
511
531
|
* Logs a warning message
|
|
512
532
|
*
|
|
@@ -516,15 +536,13 @@ declare class Logger {
|
|
|
516
536
|
*/
|
|
517
537
|
static warn(msg: any, exit?: boolean, preserveCol?: boolean): void;
|
|
518
538
|
/**
|
|
519
|
-
* Logs
|
|
539
|
+
* Logs a debug message (only shown with verbosity >= 3)
|
|
520
540
|
*
|
|
521
541
|
* @param msg
|
|
522
542
|
* @param exit
|
|
523
543
|
* @param preserveCol
|
|
524
544
|
*/
|
|
525
|
-
static
|
|
526
|
-
detail?: string;
|
|
527
|
-
}, exit?: boolean, preserveCol?: boolean): void;
|
|
545
|
+
static debug<M = any>(msg: M | M[], exit?: boolean, preserveCol?: boolean): void;
|
|
528
546
|
/**
|
|
529
547
|
* Terminates the process
|
|
530
548
|
*/
|
package/dist/index.js
CHANGED
|
@@ -116,6 +116,29 @@ var FileSystem = class {
|
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region src/Utils/Logger.ts
|
|
118
118
|
var Logger = class Logger {
|
|
119
|
+
/**
|
|
120
|
+
* Global verbosity configuration
|
|
121
|
+
*/
|
|
122
|
+
static verbosity = 0;
|
|
123
|
+
static isQuiet = false;
|
|
124
|
+
static isSilent = false;
|
|
125
|
+
/**
|
|
126
|
+
* Configure global verbosity levels
|
|
127
|
+
*/
|
|
128
|
+
static configure(options = {}) {
|
|
129
|
+
this.verbosity = options.verbosity ?? 0;
|
|
130
|
+
this.isQuiet = options.quiet ?? false;
|
|
131
|
+
this.isSilent = options.silent ?? false;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Check if output should be suppressed
|
|
135
|
+
*/
|
|
136
|
+
static shouldSuppressOutput(level) {
|
|
137
|
+
if (this.isSilent) return true;
|
|
138
|
+
if (this.isQuiet && (level === "info" || level === "success")) return true;
|
|
139
|
+
if (level === "debug" && this.verbosity < 3) return true;
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
119
142
|
static twoColumnDetail(name, value, log = true, spacer = ".") {
|
|
120
143
|
const regex = /\x1b\[\d+m/g;
|
|
121
144
|
const width = Math.max(process.stdout.columns, 100);
|
|
@@ -128,7 +151,7 @@ var Logger = class Logger {
|
|
|
128
151
|
];
|
|
129
152
|
}
|
|
130
153
|
static describe(name, desc, width = 50, log = true) {
|
|
131
|
-
width = Math.
|
|
154
|
+
width = Math.max(width, 30);
|
|
132
155
|
const dots = Math.max(width - name.replace(/\x1b\[\d+m/g, "").length, 0);
|
|
133
156
|
if (log) return console.log(name, " ".repeat(dots), desc);
|
|
134
157
|
else return [
|
|
@@ -173,38 +196,40 @@ var Logger = class Logger {
|
|
|
173
196
|
return color(` ${first} `) + rest.join(":");
|
|
174
197
|
}
|
|
175
198
|
/**
|
|
176
|
-
* Logs a
|
|
199
|
+
* Logs a success message
|
|
177
200
|
*
|
|
178
201
|
* @param msg
|
|
179
202
|
* @param exit
|
|
180
203
|
* @param preserveCol
|
|
181
204
|
*/
|
|
182
|
-
static
|
|
183
|
-
if (
|
|
184
|
-
else console.log(chalk.gray("ℹ"), this.textFormat(msg, chalk.bgGray, preserveCol));
|
|
205
|
+
static success(msg, exit = false, preserveCol = false) {
|
|
206
|
+
if (!this.shouldSuppressOutput("success")) console.log(chalk.green("✓"), this.textFormat(msg, chalk.bgGreen, preserveCol));
|
|
185
207
|
if (exit) process.exit(0);
|
|
186
208
|
}
|
|
187
209
|
/**
|
|
188
|
-
* Logs
|
|
210
|
+
* Logs an informational message
|
|
189
211
|
*
|
|
190
212
|
* @param msg
|
|
191
213
|
* @param exit
|
|
192
214
|
* @param preserveCol
|
|
193
215
|
*/
|
|
194
|
-
static
|
|
195
|
-
console.log(chalk.
|
|
216
|
+
static info(msg, exit = false, preserveCol = false) {
|
|
217
|
+
if (!this.shouldSuppressOutput("info")) console.log(chalk.blue("ℹ"), this.textFormat(msg, chalk.bgBlue, preserveCol));
|
|
196
218
|
if (exit) process.exit(0);
|
|
197
219
|
}
|
|
198
220
|
/**
|
|
199
|
-
* Logs an
|
|
221
|
+
* Logs an error message
|
|
200
222
|
*
|
|
201
223
|
* @param msg
|
|
202
224
|
* @param exit
|
|
203
225
|
* @param preserveCol
|
|
204
226
|
*/
|
|
205
|
-
static
|
|
206
|
-
|
|
207
|
-
|
|
227
|
+
static error(msg, exit = true, preserveCol = false) {
|
|
228
|
+
if (!this.shouldSuppressOutput("error")) if (msg instanceof Error) {
|
|
229
|
+
if (msg.message) console.error(chalk.red("✖"), this.textFormat("ERROR:" + msg.message, chalk.bgRed, preserveCol));
|
|
230
|
+
console.error(chalk.red(`${msg.detail ? `${msg.detail}\n` : ""}${msg.stack}`));
|
|
231
|
+
} else console.error(chalk.red("✖"), this.textFormat(msg, chalk.bgRed, preserveCol));
|
|
232
|
+
if (exit) process.exit(1);
|
|
208
233
|
}
|
|
209
234
|
/**
|
|
210
235
|
* Logs a warning message
|
|
@@ -214,22 +239,20 @@ var Logger = class Logger {
|
|
|
214
239
|
* @param preserveCol
|
|
215
240
|
*/
|
|
216
241
|
static warn(msg, exit = false, preserveCol = false) {
|
|
217
|
-
console.
|
|
242
|
+
if (!this.shouldSuppressOutput("warn")) console.warn(chalk.yellow("⚠"), this.textFormat(msg, chalk.bgYellow, preserveCol));
|
|
218
243
|
if (exit) process.exit(0);
|
|
219
244
|
}
|
|
220
245
|
/**
|
|
221
|
-
* Logs
|
|
246
|
+
* Logs a debug message (only shown with verbosity >= 3)
|
|
222
247
|
*
|
|
223
248
|
* @param msg
|
|
224
249
|
* @param exit
|
|
225
250
|
* @param preserveCol
|
|
226
251
|
*/
|
|
227
|
-
static
|
|
228
|
-
if (msg
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
} else console.error(chalk.red("✖"), this.textFormat(msg, chalk.bgRed, preserveCol));
|
|
232
|
-
if (exit) process.exit(1);
|
|
252
|
+
static debug(msg, exit = false, preserveCol = false) {
|
|
253
|
+
if (!this.shouldSuppressOutput("debug")) if (Array.isArray(msg)) for (let i = 0; i < msg.length; i++) console.log(chalk.gray("🐛"), chalk.bgGray(i + 1), this.textFormat(msg[i], chalk.bgGray, preserveCol));
|
|
254
|
+
else console.log(chalk.gray("🐛"), this.textFormat(msg, chalk.bgGray, preserveCol));
|
|
255
|
+
if (exit) process.exit(0);
|
|
233
256
|
}
|
|
234
257
|
/**
|
|
235
258
|
* Terminates the process
|
|
@@ -250,7 +273,7 @@ var Logger = class Logger {
|
|
|
250
273
|
if (!sc) return output;
|
|
251
274
|
return this.textFormat(output, Logger.chalker(Array.isArray(sc) ? sc : [sc]));
|
|
252
275
|
}).join(joiner);
|
|
253
|
-
if (log) console.log(string);
|
|
276
|
+
if (log && !this.shouldSuppressOutput("line")) console.log(string);
|
|
254
277
|
else return string;
|
|
255
278
|
}
|
|
256
279
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 * 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.min(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 debug message\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 (Array.isArray(msg)) {\n for (let i = 0; i < msg.length; i++) {\n console.log(chalk.bgGray(i + 1), chalk.gray('ℹ'), this.textFormat(msg[i], chalk.bgGray, preserveCol), '\\n')\n }\n } else {\n console.log(chalk.gray('ℹ'), this.textFormat(msg, chalk.bgGray, preserveCol))\n }\n if (exit) process.exit(0)\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 console.log(chalk.green('✓'), this.textFormat(msg, chalk.bgGreen, preserveCol))\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 console.log(chalk.blue('ℹ'), this.textFormat(msg, chalk.bgBlue, preserveCol))\n if (exit) process.exit(0)\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 console.log(chalk.yellow('ℹ'), this.textFormat(msg, chalk.bgYellow, preserveCol))\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 (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 if (exit) process.exit(1)\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) 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,OAAO,KAAM,KAAiF;;;;AAI1F,SAAO,IAAI,YAAY,IAAI,KAAK,IAAI,SAAS,IAAI,SAAS;;;;;;ACxJlE,IAAa,YAAb,MAAuB;CAEnB,OAAO,MAAO,SAA0C;EACpD,MAAM,SAAS,EAAE,GAAG,SAAS;AAE7B,OAAK,MAAM,OAAO,QAAQ;GACtB,MAAMC,QAAa,OAAO;AAC1B,UAAO,OAAO,KAAK,WAAW,MAAM;;AAGxC,SAAO;;CAGX,OAAO,WAAY,OAAY;;;;AAI3B,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;;;;AAKlD,MAAI,UAAU,OAAQ,QAAO;AAC7B,MAAI,UAAU,QAAS,QAAO;;;;AAK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,MACA,MACsB;EACtB,MAAM,YAAY,QAAQ,QAAQ;EAClC,MAAM,CAAC,WAAW,YAAY;AAE9B,MAAI,SACA,QAAO,gBAAgB,UAAU,IAAI,OAAO,IAAI,UAAU,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"}
|
|
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":";;;;;;;;;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