@h3ravel/core 1.8.0 → 1.9.1
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/README.md +1 -1
- package/dist/app.globals.d.ts +2 -0
- package/dist/index.cjs +121 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -2
- package/dist/index.d.ts +72 -2
- package/dist/index.js +119 -7
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<a href="https://h3ravel.toneflix.net" target="_blank">
|
|
3
3
|
<img src="https://raw.githubusercontent.com/h3ravel/assets/refs/heads/main/logo-full.svg" width="200" alt="H3ravel Logo">
|
|
4
4
|
</a>
|
|
5
|
-
<h1 align="center"><a href="https://h3ravel.toneflix.net
|
|
5
|
+
<h1 align="center"><a href="https://h3ravel.toneflix.net">H3ravel Core</a></h1>
|
|
6
6
|
|
|
7
7
|
[![Framework][ix]][lx]
|
|
8
8
|
[![Core Package Version][i1]][l1]
|
package/dist/app.globals.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ declare global {
|
|
|
26
26
|
function config<X extends Record<string, any>, T extends Extract<keyof X, string>> (key: T, def?: any): X[T];
|
|
27
27
|
function config<T extends Record<string, any>> (key: T): void;
|
|
28
28
|
|
|
29
|
+
function view (viewPath: string, params?: Record<string, any> | undefined): Promise<string>
|
|
30
|
+
|
|
29
31
|
/**
|
|
30
32
|
* Get app path
|
|
31
33
|
*
|
package/dist/index.cjs
CHANGED
|
@@ -36,6 +36,8 @@ let dotenv = require("dotenv");
|
|
|
36
36
|
dotenv = __toESM(dotenv);
|
|
37
37
|
let dotenv_expand = require("dotenv-expand");
|
|
38
38
|
dotenv_expand = __toESM(dotenv_expand);
|
|
39
|
+
let node_fs_promises = require("node:fs/promises");
|
|
40
|
+
node_fs_promises = __toESM(node_fs_promises);
|
|
39
41
|
let edge_js = require("edge.js");
|
|
40
42
|
edge_js = __toESM(edge_js);
|
|
41
43
|
|
|
@@ -118,7 +120,7 @@ var ContainerResolver = class ContainerResolver {
|
|
|
118
120
|
/**
|
|
119
121
|
* Resolve the bound dependencies
|
|
120
122
|
*/
|
|
121
|
-
|
|
123
|
+
const args = params.filter((e) => ContainerResolver.isClass(e)).map((type) => {
|
|
122
124
|
return this.app.make(type);
|
|
123
125
|
});
|
|
124
126
|
return new Promise((resolve) => {
|
|
@@ -338,7 +340,7 @@ var Application = class Application extends Container {
|
|
|
338
340
|
hostname,
|
|
339
341
|
silent: true
|
|
340
342
|
});
|
|
341
|
-
__h3ravel_shared.Logger.parse([[
|
|
343
|
+
__h3ravel_shared.Logger.parse([["🚀 H3ravel running at:", "green"], [`${server.options.protocol ?? "http"}://${server.options.hostname}:${server.options.port}`, "cyan"]]);
|
|
342
344
|
} else if (this.tries <= tries) {
|
|
343
345
|
await this.fire(h3App, realPort);
|
|
344
346
|
this.tries++;
|
|
@@ -400,6 +402,105 @@ var Application = class Application extends Container {
|
|
|
400
402
|
}
|
|
401
403
|
};
|
|
402
404
|
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/Console/ConsoleCommand.ts
|
|
407
|
+
var ConsoleCommand = class {
|
|
408
|
+
constructor(app, kernel) {
|
|
409
|
+
this.app = app;
|
|
410
|
+
this.kernel = kernel;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* The underlying commander instance.
|
|
414
|
+
*
|
|
415
|
+
* @var Command
|
|
416
|
+
*/
|
|
417
|
+
program;
|
|
418
|
+
/**
|
|
419
|
+
* The name and signature of the console command.
|
|
420
|
+
*
|
|
421
|
+
* @var string
|
|
422
|
+
*/
|
|
423
|
+
signature;
|
|
424
|
+
/**
|
|
425
|
+
* A dictionary of signatures or what not.
|
|
426
|
+
*
|
|
427
|
+
* @var object
|
|
428
|
+
*/
|
|
429
|
+
dictionary = {};
|
|
430
|
+
/**
|
|
431
|
+
* The console command description.
|
|
432
|
+
*
|
|
433
|
+
* @var string
|
|
434
|
+
*/
|
|
435
|
+
description;
|
|
436
|
+
/**
|
|
437
|
+
* The console command input.
|
|
438
|
+
*
|
|
439
|
+
* @var object
|
|
440
|
+
*/
|
|
441
|
+
input = {
|
|
442
|
+
options: {},
|
|
443
|
+
arguments: {}
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* Execute the console command.
|
|
447
|
+
*/
|
|
448
|
+
async handle(..._args) {}
|
|
449
|
+
setApplication(app) {
|
|
450
|
+
this.app = app;
|
|
451
|
+
}
|
|
452
|
+
setInput(options, args, regArgs, dictionary, program) {
|
|
453
|
+
this.program = program;
|
|
454
|
+
this.dictionary = dictionary;
|
|
455
|
+
this.input.options = options;
|
|
456
|
+
this.input.arguments = regArgs.map((e, i) => ({ [e.name()]: args[i] })).reduce((e, x) => Object.assign(e, x), {});
|
|
457
|
+
this.loadBaseFlags();
|
|
458
|
+
}
|
|
459
|
+
getSignature() {
|
|
460
|
+
return this.signature;
|
|
461
|
+
}
|
|
462
|
+
getDescription() {
|
|
463
|
+
return this.description;
|
|
464
|
+
}
|
|
465
|
+
option(key, def) {
|
|
466
|
+
return this.input.options[key] ?? def;
|
|
467
|
+
}
|
|
468
|
+
options(key) {
|
|
469
|
+
if (key) return this.input.options[key];
|
|
470
|
+
return this.input.options;
|
|
471
|
+
}
|
|
472
|
+
argument(key, def) {
|
|
473
|
+
return this.input.arguments[key] ?? def;
|
|
474
|
+
}
|
|
475
|
+
arguments() {
|
|
476
|
+
return this.input.arguments;
|
|
477
|
+
}
|
|
478
|
+
loadBaseFlags() {
|
|
479
|
+
this.input.options.lock = this.program.getOptionValue("lock") ?? false;
|
|
480
|
+
this.input.options.quiet = this.program.getOptionValue("quiet") ?? false;
|
|
481
|
+
this.input.options.silent = this.program.getOptionValue("silent") ?? false;
|
|
482
|
+
this.input.options.verbose = this.program.getOptionValue("verbose") ?? 0;
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/Console/ConsoleKernel.ts
|
|
488
|
+
var ConsoleKernel = class {
|
|
489
|
+
cwd;
|
|
490
|
+
output = typeof __h3ravel_shared.Logger;
|
|
491
|
+
basePath = "";
|
|
492
|
+
modulePath;
|
|
493
|
+
consolePath;
|
|
494
|
+
modulePackage;
|
|
495
|
+
consolePackage;
|
|
496
|
+
constructor(app) {
|
|
497
|
+
this.app = app;
|
|
498
|
+
}
|
|
499
|
+
async ensureDirectoryExists(dir) {
|
|
500
|
+
await (0, node_fs_promises.mkdir)(dir, { recursive: true });
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
|
|
403
504
|
//#endregion
|
|
404
505
|
//#region src/Controller.ts
|
|
405
506
|
/**
|
|
@@ -469,13 +570,25 @@ var Kernel = class {
|
|
|
469
570
|
const ctx = this.context(event);
|
|
470
571
|
const { app } = ctx.request;
|
|
471
572
|
/**
|
|
472
|
-
*
|
|
473
|
-
*
|
|
573
|
+
* Initialize the view handler method
|
|
574
|
+
*
|
|
575
|
+
* @param template
|
|
576
|
+
* @param params
|
|
577
|
+
* @returns
|
|
474
578
|
*/
|
|
475
|
-
|
|
579
|
+
const view = async (template, params) => {
|
|
476
580
|
const edge = app.make("edge");
|
|
477
581
|
return ctx.response.html(await edge.render(template, params));
|
|
478
|
-
}
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* Bind the view method to the global variable space
|
|
585
|
+
*/
|
|
586
|
+
globalThis.view = view;
|
|
587
|
+
/**
|
|
588
|
+
* Dynamically bind the view renderer to the service container.
|
|
589
|
+
* This allows any part of the request lifecycle to render templates using Edge.
|
|
590
|
+
*/
|
|
591
|
+
app.bind("view", () => view);
|
|
479
592
|
/**
|
|
480
593
|
* Run middleware stack and obtain result
|
|
481
594
|
*/
|
|
@@ -588,6 +701,8 @@ var ViewServiceProvider = class extends ServiceProvider {
|
|
|
588
701
|
|
|
589
702
|
//#endregion
|
|
590
703
|
exports.Application = Application;
|
|
704
|
+
exports.ConsoleCommand = ConsoleCommand;
|
|
705
|
+
exports.ConsoleKernel = ConsoleKernel;
|
|
591
706
|
exports.Container = Container;
|
|
592
707
|
exports.ContainerResolver = ContainerResolver;
|
|
593
708
|
exports.Controller = Controller;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["dependencies: any[]","app: Application","params: any[]","args: any[]","app: Application","dd","dump","path","nodepath","PathLoader","port: number","tries: number","hostname: string","e: any","path","context: (event: H3Event) => HttpContext","middleware: IMiddleware[]","Edge"],"sources":["../src/Container.ts","../src/Di/ContainerResolver.ts","../src/Registerer.ts","../src/Application.ts","../src/Controller.ts","../src/Di/Inject.ts","../src/Http/Kernel.ts","../src/ServiceProvider.ts","../src/Providers/CoreServiceProvider.ts","../src/Providers/ViewServiceProvider.ts"],"sourcesContent":["import type { Bindings, IContainer, UseKey } from '@h3ravel/shared'\n\ntype IBinding = UseKey | (new (..._args: any[]) => unknown)\n\nexport class Container implements IContainer {\n private bindings = new Map<IBinding, () => unknown>()\n private singletons = new Map<IBinding, unknown>()\n\n /**\n * Check if the target has any decorators\n * \n * @param target \n * @returns \n */\n static hasAnyDecorator (target: Function): boolean {\n if (Reflect.getMetadataKeys(target).length > 0) return true\n\n const paramLength = target.length\n\n for (let i = 0; i < paramLength; i++) {\n if (Reflect.getMetadataKeys(target, `__param_${i}`).length > 0) {\n return true\n }\n }\n\n return false\n }\n\n /**\n * Bind a transient service to the container\n */\n bind<T> (key: new (...args: any[]) => T, factory: () => T): void\n bind<T extends UseKey> (key: T, factory: () => Bindings[T]): void\n bind<T extends UseKey> (\n key: T,\n factory: () => Bindings[T] | T\n ) {\n this.bindings.set(key, factory)\n }\n\n /**\n * Bind a singleton service to the container\n */\n singleton<T extends UseKey> (\n key: T | (new (..._args: any[]) => Bindings[T]),\n factory: () => Bindings[T]\n ) {\n this.bindings.set(key, () => {\n if (!this.singletons.has(key)) {\n this.singletons.set(key, factory())\n }\n return this.singletons.get(key)!\n })\n }\n\n /**\n * Resolve a service from the container\n */\n make<T extends UseKey, X = undefined> (\n key: T | (new (..._args: any[]) => Bindings[T])\n ): X extends undefined ? Bindings[T] : X {\n /**\n * Direct factory binding\n */\n if (this.bindings.has(key)) {\n return this.bindings.get(key)!() as Bindings[T]\n }\n\n /**\n * If this is a class constructor, auto-resolve via reflection\n */\n if (typeof key === 'function') {\n return this.build(key)\n }\n\n throw new Error(\n `No binding found for key: ${typeof key === 'string' ? key : (key as any)?.name}`\n )\n }\n\n /**\n * Automatically build a class with constructor dependency injection\n */\n private build<T extends UseKey> (ClassType: new (..._args: any[]) => Bindings[T]): Bindings[T] {\n let dependencies: any[] = [];\n\n if (Array.isArray((ClassType as any).__inject__)) {\n dependencies = (ClassType as any).__inject__.map((alias: any) => {\n return this.make(alias)\n });\n } else {\n const paramTypes: any[] = Reflect.getMetadata('design:paramtypes', ClassType) || []\n dependencies = paramTypes.map((dep) => this.make(dep))\n }\n\n return new ClassType(...dependencies);\n }\n\n /**\n * Check if a service is registered\n */\n has (key: UseKey): boolean {\n return this.bindings.has(key)\n }\n}\n","import 'reflect-metadata';\n\nimport { Application } from '..';\n\nexport class ContainerResolver {\n constructor(private app: Application) { }\n\n async resolveMethodParams<I extends Record<string, any>> (instance: I, method: keyof I, _default?: any) {\n /**\n * Get param types for instance method\n */\n let params: any[] = Reflect.getMetadata('design:paramtypes', instance, String(method)) || [];\n\n /**\n * Ensure that the Application class is always available\n */\n if (params.length < 1 && _default) {\n params = [_default]\n }\n\n /**\n * Resolve the bound dependencies\n */\n let args: any[] = params.filter(e => ContainerResolver.isClass(e)).map((type: any) => {\n return this.app.make(type)\n });\n\n return new Promise<I>((resolve) => {\n resolve(instance[method](...args))\n })\n }\n\n static isClass (C: any) {\n return typeof C === \"function\" &&\n C.prototype !== undefined &&\n Object.toString.call(C).substring(0, 5) === 'class'\n }\n}\n","import { dd, dump } from '@h3ravel/support'\n\nimport { Application } from '.'\nimport nodepath from 'node:path'\n\nexport class Registerer {\n constructor(private app: Application) { }\n\n static register (app: Application) {\n const reg = new Registerer(app)\n reg.bootRegister()\n }\n\n bootRegister () {\n globalThis.dd = dd\n globalThis.dump = dump\n globalThis.app_path = (path?: string) => this.appPath(path)\n globalThis.base_path = (path?: string) => this.basePath(path)\n globalThis.public_path = (path?: string) => this.publicPath(path)\n globalThis.storage_path = (path?: string) => this.storagePath(path)\n globalThis.database_path = (path?: string) => this.databasePath(path)\n }\n\n private appPath (path?: string) {\n return this.app.getPath(\n 'base', nodepath.join(`/${process.env.SRC_PATH ?? 'src'}/`.replace(/([^:]\\/)\\/+/g, \"$1\"), 'app', path ?? '')\n )\n }\n\n private basePath (path?: string) {\n return this.app.getPath('base', path)\n }\n\n private publicPath (path?: string) {\n return this.app.getPath('public', path)\n }\n\n private storagePath (path?: string) {\n return this.app.getPath('base', nodepath.join('storage', path ?? ''))\n }\n\n private databasePath (path?: string) {\n return this.app.getPath('database', path)\n }\n}\n","import 'reflect-metadata';\n\nimport { IApplication, IPathName, IServiceProvider, Logger } from '@h3ravel/shared'\n\nimport { Container } from './Container'\nimport { ContainerResolver } from './Di/ContainerResolver';\nimport type { H3 } from 'h3'\nimport { PathLoader } from '@h3ravel/shared'\nimport { Registerer } from './Registerer'\nimport chalk from 'chalk';\nimport { detect } from 'detect-port';\nimport dotenv from 'dotenv'\nimport dotenvExpand from 'dotenv-expand'\nimport path from 'node:path'\n\ntype AServiceProvider = (new (_app: Application) => IServiceProvider) & IServiceProvider\n\nexport class Application extends Container implements IApplication {\n public paths = new PathLoader()\n private tries: number = 0\n private booted = false\n private versions = { app: '0', ts: '0' }\n private basePath: string\n\n private providers: IServiceProvider[] = []\n protected externalProviders: Array<new (_app: Application) => IServiceProvider> = []\n\n /**\n * List of registered console commands\n */\n public registeredCommands: (new (app: any, kernel: any) => any)[] = [];\n\n constructor(basePath: string) {\n super()\n\n dotenvExpand.expand(dotenv.config({ quiet: true }))\n\n this.basePath = basePath\n this.setPath('base', basePath)\n this.loadOptions()\n this.registerBaseBindings();\n Registerer.register(this)\n }\n\n /**\n * Register core bindings into the container\n */\n protected registerBaseBindings () {\n this.bind(Application, () => this)\n this.bind('path.base', () => this.basePath)\n this.bind('load.paths', () => this.paths)\n }\n\n /**\n * Dynamically register all configured providers\n */\n public async registerConfiguredProviders () {\n const providers = await this.getAllProviders()\n\n for (const ProviderClass of providers) {\n if (!ProviderClass) continue\n const provider = new ProviderClass(this)\n await this.register(provider)\n }\n }\n\n protected async loadOptions () {\n const app = await this.safeImport(this.getPath('base', 'package.json'))\n const core = await this.safeImport('../package.json')\n\n if (app && app.dependencies) {\n this.versions.app = app.dependencies['@h3ravel/core']\n }\n if (core && core.devDependencies) {\n this.versions.ts = app.devDependencies.typescript\n }\n }\n\n /**\n * Get all registered providers\n */\n public getRegisteredProviders () {\n return this.providers;\n }\n\n /**\n * Load default and optional providers dynamically\n * \n * Auto-Registration Behavior\n * \n * Minimal App: Loads only core, config, http, router by default.\n * Full-Stack App: Installs database, mail, queue, cache → they self-register via their providers.\n */\n protected async getConfiguredProviders (): Promise<Array<AServiceProvider>> {\n return [\n (await import('@h3ravel/core')).CoreServiceProvider,\n (await import('@h3ravel/core')).ViewServiceProvider,\n ]\n }\n\n protected async getAllProviders (): Promise<Array<AServiceProvider>> {\n const coreProviders = await this.getConfiguredProviders();\n const allProviders = [...coreProviders, ...this.externalProviders];\n\n /**\n * Deduplicate by class reference\n */\n const uniqueProviders = Array.from(new Set(allProviders));\n\n return this.sortProviders(uniqueProviders);\n }\n\n private sortProviders (providers: Array<AServiceProvider>) {\n const priorityMap = new Map<string, number>();\n\n /**\n * Base priority (default 0)\n */\n providers.forEach((Provider) => {\n priorityMap.set(Provider.name, (Provider as any).priority ?? 0);\n });\n\n /**\n * Handle before/after adjustments\n */\n providers.forEach((Provider) => {\n const order = (Provider as any).order;\n if (!order) return;\n\n const [direction, target] = order.split(':');\n const targetPriority = priorityMap.get(target) ?? 0;\n\n if (direction === 'before') {\n priorityMap.set(Provider.name, targetPriority - 1);\n } else if (direction === 'after') {\n priorityMap.set(Provider.name, targetPriority + 1);\n }\n });\n\n /**\n * Service providers sorted based on thier name and priority\n */\n const sorted = providers.sort(\n (A, B) => (priorityMap.get(B.name) ?? 0) - (priorityMap.get(A.name) ?? 0)\n );\n\n /**\n * If debug is enabled, let's show the loaded service provider info\n */\n if (process.env.APP_DEBUG === 'true' && process.env.EXTENDED_DEBUG !== 'false' && !sorted.some(e => e.console)) {\n console.table(\n sorted.map((P) => ({\n Provider: P.name,\n Priority: priorityMap.get(P.name),\n Order: (P as any).order || 'N/A',\n }))\n );\n\n console.info(`Set ${chalk.bgCyan(' APP_DEBUG = false ')} in your .env file to hide this information`, \"\\n\")\n }\n\n return sorted\n }\n\n registerProviders (providers: Array<AServiceProvider>): void {\n this.externalProviders.push(...providers)\n }\n\n /**\n * Register a provider\n */\n public async register (provider: IServiceProvider) {\n await new ContainerResolver(this).resolveMethodParams(provider, 'register', this)\n if (provider.registeredCommands && provider.registeredCommands.length > 0) {\n this.registeredCommands.push(...provider.registeredCommands)\n }\n this.providers.push(provider)\n }\n\n /**\n * checks if the application is running in CLI\n */\n public runningInConsole (): boolean {\n return typeof process !== 'undefined'\n && !!process.stdout\n && !!process.stdin\n\n }\n\n public getRuntimeEnv (): 'browser' | 'node' | 'unknown' {\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n return 'browser'\n }\n if (typeof process !== 'undefined' && process.versions?.node) {\n return 'node'\n }\n return 'unknown'\n }\n\n /**\n * Boot all service providers after registration\n */\n public async boot () {\n if (this.booted) return\n\n for (const provider of this.providers) {\n if (provider.boot) {\n if (Container.hasAnyDecorator(provider.boot)) {\n /**\n * If the service provider is decorated use the IoC container\n */\n await this.make<any>(provider.boot)\n } else {\n /**\n * Otherwise instantiate manually so that we can at least\n * pass the app instance\n */\n await provider.boot(this)\n }\n }\n }\n\n this.booted = true\n }\n\n /**\n * Fire up the developement server using the user provided arguments\n * \n * Port will be auto assigned if provided one is not available\n * \n * @param h3App The current H3 app instance\n * @param preferedPort If provided, this will overide the port set in the evironment\n */\n public async fire (h3App: H3, preferedPort?: number) {\n const serve = this.make('http.serve')\n\n const port: number = preferedPort ?? env('PORT', 3000)\n const tries: number = env('RETRIES', 1)\n const hostname: string = env('HOSTNAME', 'localhost')\n\n try {\n const realPort = await detect(port)\n\n if (port == realPort) {\n const server = serve(h3App, {\n port,\n hostname,\n silent: true,\n })\n\n Logger.parse([\n [`🚀 H3ravel running at:`, 'green'],\n [`${server.options.protocol ?? 'http'}://${server.options.hostname}:${server.options.port}`, 'cyan']]\n )\n } else if (this.tries <= tries) {\n await this.fire(h3App, realPort)\n this.tries++\n } else {\n Logger.parse([\n ['ERROR:', 'bgRed'],\n ['No free port available', 'red'],\n ])\n }\n } catch (e: any) {\n Logger.parse([\n ['An error occured', 'bgRed'],\n [e.message, 'red'],\n [e.stack, 'red']\n ], \"\\n\")\n }\n }\n\n /**\n * Attempt to dynamically import an optional module\n */\n private async safeImport (moduleName: string) {\n try {\n const mod = await import(moduleName)\n return mod.default ?? mod ?? {}\n } catch {\n return null\n }\n }\n\n /**\n * Get the base path of the app\n * \n * @returns \n */\n getBasePath (): string {\n return this.basePath\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 * @returns \n */\n getPath (name: IPathName, suffix?: string) {\n return path.join(this.paths.getPath(name, this.basePath), suffix ?? '')\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 * @returns \n */\n setPath (name: IPathName, path: string) {\n return this.paths.setPath(name, path, this.basePath)\n }\n\n /**\n * Returns the installed version of the system core and typescript.\n *\n * @returns \n */\n getVersion (key: 'app' | 'ts') {\n return this.versions[key]?.replaceAll(/\\^|~/g, '')\n }\n}\n","import { Application } from '.'\nimport { IController } from '@h3ravel/shared'\n\n/**\n * Base controller class\n */\nexport abstract class Controller implements IController {\n protected app: Application\n\n constructor(app: Application) {\n this.app = app\n }\n\n public show (..._ctx: any[]): any { return }\n public index (..._ctx: any[]): any { return }\n public store (..._ctx: any[]): any { return }\n public update (..._ctx: any[]): any { return }\n public destroy (..._ctx: any[]): any { return }\n}\n","export function Inject (...dependencies: string[]) {\n return function (target: any) {\n target.__inject__ = dependencies;\n };\n}\n\n/**\n * Allows binding dependencies to both class and class methods \n * \n * @returns \n */\nexport function Injectable (): ClassDecorator & MethodDecorator {\n return (...args: any[]) => {\n if (args.length === 1) {\n void args[0]; // class target\n }\n if (args.length === 3) {\n void args[0]; // target\n void args[1]; // propertyKey\n void args[2]; // descriptor\n }\n };\n}\n\n// export function Injectable (): MethodDecorator & ClassDecorator {\n// return ((_target: any, _propertyKey?: string, descriptor?: PropertyDescriptor) => {\n// if (descriptor) {\n// const original = descriptor.value;\n// descriptor.value = async function (...args: any[]) {\n// const resolvedArgs = await Promise.all(args);\n// return original.apply(this, resolvedArgs);\n// };\n// }\n// }) as any;\n// }\n","import { HttpContext, IMiddleware } from '@h3ravel/shared'\n\nimport type { H3Event } from 'h3'\n\n/**\n * Kernel class handles middleware execution and response transformations.\n * It acts as the core middleware pipeline for HTTP requests.\n */\nexport class Kernel {\n /**\n * @param context - A factory function that converts an H3Event into an HttpContext.\n * @param middleware - An array of middleware classes that will be executed in sequence.\n */\n constructor(\n protected context: (event: H3Event) => HttpContext,\n protected middleware: IMiddleware[] = [],\n ) { }\n\n /**\n * Handles an incoming request and passes it through middleware before invoking the next handler.\n * \n * @param event - The raw H3 event object.\n * @param next - A callback function that represents the next layer (usually the controller or final handler).\n * @returns A promise resolving to the result of the request pipeline.\n */\n async handle (\n event: H3Event,\n next: (ctx: HttpContext) => Promise<unknown>\n ): Promise<unknown> {\n /**\n * Convert the raw event into a standardized HttpContext\n */\n const ctx = this.context(event)\n const { app } = ctx.request\n\n /**\n * Dynamically bind the view renderer to the service container.\n * This allows any part of the request lifecycle to render templates using Edge.\n */\n app.bind('view', () => async (template: string, params?: Record<string, any>) => {\n const edge = app.make('edge')\n return ctx.response.html(await edge.render(template, params))\n })\n\n /**\n * Run middleware stack and obtain result\n */\n const result = await this.runMiddleware(ctx, () => next(ctx))\n\n /**\n * If a plain object is returned from a controller or middleware,\n * automatically set the JSON Content-Type header for the response.\n */\n if (result !== undefined && this.isPlainObject(result)) {\n event.res.headers.set('Content-Type', 'application/json; charset=UTF-8')\n }\n\n return result\n }\n\n /**\n * Sequentially runs middleware in the order they were registered.\n * \n * @param context - The standardized HttpContext.\n * @param next - Callback to execute when middleware completes.\n * @returns A promise resolving to the final handler's result.\n */\n private async runMiddleware (\n context: HttpContext,\n next: (ctx: HttpContext) => Promise<unknown>\n ) {\n let index = -1\n\n const runner = async (i: number): Promise<unknown> => {\n if (i <= index) throw new Error('next() called multiple times')\n index = i\n const middleware = this.middleware[i]\n\n if (middleware) {\n /**\n * Execute the current middleware and proceed to the next one\n */\n return middleware.handle(context, () => runner(i + 1))\n } else {\n /**\n * If no more middleware, call the final handler\n */\n return next(context)\n }\n }\n\n return runner(0)\n }\n\n /**\n * Utility function to determine if a value is a plain object or array.\n * \n * @param value - The value to check.\n * @returns True if the value is a plain object or array, otherwise false.\n */\n private isPlainObject (value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' &&\n value !== null &&\n (value.constructor === Object || value.constructor === Array)\n }\n}\n","import { Application } from './Application'\nimport { IServiceProvider } from '@h3ravel/shared'\n\nexport abstract class ServiceProvider implements IServiceProvider {\n /**\n * Sort order\n */\n\n public static order?: `before:${string}` | `after:${string}` | string | undefined;\n\n /**\n * Sort priority\n */\n public static priority = 0;\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = false;\n\n /**\n * List of registered console commands\n */\n public registeredCommands?: (new (app: any, kernel: any) => any)[];\n\n protected app: Application\n\n constructor(app: Application) {\n this.app = app\n }\n\n /**\n * Register bindings to the container.\n * Runs before boot().\n */\n abstract register (...app: unknown[]): void | Promise<void>;\n\n /**\n * Perform post-registration booting of services.\n * Runs after all providers have been registered.\n */\n boot?(...app: unknown[]): void | Promise<void>;\n\n /**\n * An array of console commands to register.\n */\n commands (commands: (new (app: any, kernel: any) => any)[]): void {\n this.registeredCommands = commands\n }\n}\n","import 'reflect-metadata'\n\nimport { ServiceProvider } from '../ServiceProvider'\n\n/**\n * Bootstraps core services and bindings.\n * \n * Bind essential services to the container (logger, config repository).\n * Register app-level singletons.\n * Set up exception handling.\n * \n * Auto-Registered\n */\nexport class CoreServiceProvider extends ServiceProvider {\n public static priority = 999;\n\n register () {\n }\n}\n","import { Edge } from 'edge.js'\nimport { ServiceProvider } from '../ServiceProvider'\n\nexport class ViewServiceProvider extends ServiceProvider {\n public static priority = 995;\n\n register (): void {\n const config = this.app.make('config')\n const edge = Edge.create({\n cache: process.env.NODE_ENV === 'production'\n })\n\n edge.mount(this.app.getPath('views'))\n\n edge.global('asset', this.app.make('asset'))\n edge.global('config', config.get)\n edge.global('app', this.app)\n\n this.app.bind('edge', () => edge)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAa,YAAb,MAA6C;CACzC,AAAQ,2BAAW,IAAI,KAA8B;CACrD,AAAQ,6BAAa,IAAI,KAAwB;;;;;;;CAQjD,OAAO,gBAAiB,QAA2B;AAC/C,MAAI,QAAQ,gBAAgB,OAAO,CAAC,SAAS,EAAG,QAAO;EAEvD,MAAM,cAAc,OAAO;AAE3B,OAAK,IAAI,IAAI,GAAG,IAAI,aAAa,IAC7B,KAAI,QAAQ,gBAAgB,QAAQ,WAAW,IAAI,CAAC,SAAS,EACzD,QAAO;AAIf,SAAO;;CAQX,KACI,KACA,SACF;AACE,OAAK,SAAS,IAAI,KAAK,QAAQ;;;;;CAMnC,UACI,KACA,SACF;AACE,OAAK,SAAS,IAAI,WAAW;AACzB,OAAI,CAAC,KAAK,WAAW,IAAI,IAAI,CACzB,MAAK,WAAW,IAAI,KAAK,SAAS,CAAC;AAEvC,UAAO,KAAK,WAAW,IAAI,IAAI;IACjC;;;;;CA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
|
1
|
+
{"version":3,"file":"index.cjs","names":["dependencies: any[]","app: Application","params: any[]","args: any[]","app: Application","dd","dump","path","nodepath","PathLoader","port: number","tries: number","hostname: string","e: any","path","app: Application","kernel: ConsoleKernel","Logger","app: Application","context: (event: H3Event) => HttpContext","middleware: IMiddleware[]","Edge"],"sources":["../src/Container.ts","../src/Di/ContainerResolver.ts","../src/Registerer.ts","../src/Application.ts","../src/Console/ConsoleCommand.ts","../src/Console/ConsoleKernel.ts","../src/Controller.ts","../src/Di/Inject.ts","../src/Http/Kernel.ts","../src/ServiceProvider.ts","../src/Providers/CoreServiceProvider.ts","../src/Providers/ViewServiceProvider.ts"],"sourcesContent":["import type { Bindings, IContainer, UseKey } from '@h3ravel/shared'\n\ntype IBinding = UseKey | (new (..._args: any[]) => unknown)\n\nexport class Container implements IContainer {\n private bindings = new Map<IBinding, () => unknown>()\n private singletons = new Map<IBinding, unknown>()\n\n /**\n * Check if the target has any decorators\n * \n * @param target \n * @returns \n */\n static hasAnyDecorator (target: (...prm: any[]) => any): boolean {\n if (Reflect.getMetadataKeys(target).length > 0) return true\n\n const paramLength = target.length\n\n for (let i = 0; i < paramLength; i++) {\n if (Reflect.getMetadataKeys(target, `__param_${i}`).length > 0) {\n return true\n }\n }\n\n return false\n }\n\n /**\n * Bind a transient service to the container\n */\n bind<T> (key: new (...args: any[]) => T, factory: () => T): void\n bind<T extends UseKey> (key: T, factory: () => Bindings[T]): void\n bind<T extends UseKey> (\n key: T,\n factory: () => Bindings[T] | T\n ) {\n this.bindings.set(key, factory)\n }\n\n /**\n * Bind a singleton service to the container\n */\n singleton<T extends UseKey> (\n key: T | (new (..._args: any[]) => Bindings[T]),\n factory: () => Bindings[T]\n ) {\n this.bindings.set(key, () => {\n if (!this.singletons.has(key)) {\n this.singletons.set(key, factory())\n }\n return this.singletons.get(key)!\n })\n }\n\n /**\n * Resolve a service from the container\n */\n make<T extends UseKey, X = undefined> (\n key: T | (new (..._args: any[]) => Bindings[T])\n ): X extends undefined ? Bindings[T] : X {\n /**\n * Direct factory binding\n */\n if (this.bindings.has(key)) {\n return this.bindings.get(key)!() as Bindings[T]\n }\n\n /**\n * If this is a class constructor, auto-resolve via reflection\n */\n if (typeof key === 'function') {\n return this.build(key)\n }\n\n throw new Error(\n `No binding found for key: ${typeof key === 'string' ? key : (key as any)?.name}`\n )\n }\n\n /**\n * Automatically build a class with constructor dependency injection\n */\n private build<T extends UseKey> (ClassType: new (..._args: any[]) => Bindings[T]): Bindings[T] {\n let dependencies: any[] = []\n\n if (Array.isArray((ClassType as any).__inject__)) {\n dependencies = (ClassType as any).__inject__.map((alias: any) => {\n return this.make(alias)\n })\n } else {\n const paramTypes: any[] = Reflect.getMetadata('design:paramtypes', ClassType) || []\n dependencies = paramTypes.map((dep) => this.make(dep))\n }\n\n return new ClassType(...dependencies)\n }\n\n /**\n * Check if a service is registered\n */\n has (key: UseKey): boolean {\n return this.bindings.has(key)\n }\n}\n","import 'reflect-metadata'\n\nimport { Application } from '..'\n\nexport class ContainerResolver {\n constructor(private app: Application) { }\n\n async resolveMethodParams<I extends Record<string, any>> (instance: I, method: keyof I, _default?: any) {\n /**\n * Get param types for instance method\n */\n let params: any[] = Reflect.getMetadata('design:paramtypes', instance, String(method)) || []\n\n /**\n * Ensure that the Application class is always available\n */\n if (params.length < 1 && _default) {\n params = [_default]\n }\n\n /**\n * Resolve the bound dependencies\n */\n const args: any[] = params.filter(e => ContainerResolver.isClass(e)).map((type: any) => {\n return this.app.make(type)\n })\n\n return new Promise<I>((resolve) => {\n resolve(instance[method](...args))\n })\n }\n\n static isClass (C: any) {\n return typeof C === 'function' &&\n C.prototype !== undefined &&\n Object.toString.call(C).substring(0, 5) === 'class'\n }\n}\n","import { dd, dump } from '@h3ravel/support'\n\nimport { Application } from '.'\nimport nodepath from 'node:path'\n\nexport class Registerer {\n constructor(private app: Application) { }\n\n static register (app: Application) {\n const reg = new Registerer(app)\n reg.bootRegister()\n }\n\n bootRegister () {\n globalThis.dd = dd\n globalThis.dump = dump\n globalThis.app_path = (path?: string) => this.appPath(path)\n globalThis.base_path = (path?: string) => this.basePath(path)\n globalThis.public_path = (path?: string) => this.publicPath(path)\n globalThis.storage_path = (path?: string) => this.storagePath(path)\n globalThis.database_path = (path?: string) => this.databasePath(path)\n }\n\n private appPath (path?: string) {\n return this.app.getPath(\n 'base', nodepath.join(`/${process.env.SRC_PATH ?? 'src'}/`.replace(/([^:]\\/)\\/+/g, '$1'), 'app', path ?? '')\n )\n }\n\n private basePath (path?: string) {\n return this.app.getPath('base', path)\n }\n\n private publicPath (path?: string) {\n return this.app.getPath('public', path)\n }\n\n private storagePath (path?: string) {\n return this.app.getPath('base', nodepath.join('storage', path ?? ''))\n }\n\n private databasePath (path?: string) {\n return this.app.getPath('database', path)\n }\n}\n","import 'reflect-metadata'\n\nimport { IApplication, IPathName, IServiceProvider, Logger } from '@h3ravel/shared'\n\nimport { Container } from './Container'\nimport { ContainerResolver } from './Di/ContainerResolver'\nimport type { H3 } from 'h3'\nimport { PathLoader } from '@h3ravel/shared'\nimport { Registerer } from './Registerer'\nimport chalk from 'chalk'\nimport { detect } from 'detect-port'\nimport dotenv from 'dotenv'\nimport dotenvExpand from 'dotenv-expand'\nimport path from 'node:path'\n\ntype AServiceProvider = (new (_app: Application) => IServiceProvider) & IServiceProvider\n\nexport class Application extends Container implements IApplication {\n public paths = new PathLoader()\n private tries: number = 0\n private booted = false\n private versions = { app: '0', ts: '0' }\n private basePath: string\n\n private providers: IServiceProvider[] = []\n protected externalProviders: Array<new (_app: Application) => IServiceProvider> = []\n\n /**\n * List of registered console commands\n */\n public registeredCommands: (new (app: any, kernel: any) => any)[] = []\n\n constructor(basePath: string) {\n super()\n\n dotenvExpand.expand(dotenv.config({ quiet: true }))\n\n this.basePath = basePath\n this.setPath('base', basePath)\n this.loadOptions()\n this.registerBaseBindings()\n Registerer.register(this)\n }\n\n /**\n * Register core bindings into the container\n */\n protected registerBaseBindings () {\n this.bind(Application, () => this)\n this.bind('path.base', () => this.basePath)\n this.bind('load.paths', () => this.paths)\n }\n\n /**\n * Dynamically register all configured providers\n */\n public async registerConfiguredProviders () {\n const providers = await this.getAllProviders()\n\n for (const ProviderClass of providers) {\n if (!ProviderClass) continue\n const provider = new ProviderClass(this)\n await this.register(provider)\n }\n }\n\n protected async loadOptions () {\n const app = await this.safeImport(this.getPath('base', 'package.json'))\n const core = await this.safeImport('../package.json')\n\n if (app && app.dependencies) {\n this.versions.app = app.dependencies['@h3ravel/core']\n }\n if (core && core.devDependencies) {\n this.versions.ts = app.devDependencies.typescript\n }\n }\n\n /**\n * Get all registered providers\n */\n public getRegisteredProviders () {\n return this.providers\n }\n\n /**\n * Load default and optional providers dynamically\n * \n * Auto-Registration Behavior\n * \n * Minimal App: Loads only core, config, http, router by default.\n * Full-Stack App: Installs database, mail, queue, cache → they self-register via their providers.\n */\n protected async getConfiguredProviders (): Promise<Array<AServiceProvider>> {\n return [\n (await import('@h3ravel/core')).CoreServiceProvider,\n (await import('@h3ravel/core')).ViewServiceProvider,\n ]\n }\n\n protected async getAllProviders (): Promise<Array<AServiceProvider>> {\n const coreProviders = await this.getConfiguredProviders()\n const allProviders = [...coreProviders, ...this.externalProviders]\n\n /**\n * Deduplicate by class reference\n */\n const uniqueProviders = Array.from(new Set(allProviders))\n\n return this.sortProviders(uniqueProviders)\n }\n\n private sortProviders (providers: Array<AServiceProvider>) {\n const priorityMap = new Map<string, number>()\n\n /**\n * Base priority (default 0)\n */\n providers.forEach((Provider) => {\n priorityMap.set(Provider.name, (Provider as any).priority ?? 0)\n })\n\n /**\n * Handle before/after adjustments\n */\n providers.forEach((Provider) => {\n const order = (Provider as any).order\n if (!order) return\n\n const [direction, target] = order.split(':')\n const targetPriority = priorityMap.get(target) ?? 0\n\n if (direction === 'before') {\n priorityMap.set(Provider.name, targetPriority - 1)\n } else if (direction === 'after') {\n priorityMap.set(Provider.name, targetPriority + 1)\n }\n })\n\n /**\n * Service providers sorted based on thier name and priority\n */\n const sorted = providers.sort(\n (A, B) => (priorityMap.get(B.name) ?? 0) - (priorityMap.get(A.name) ?? 0)\n )\n\n /**\n * If debug is enabled, let's show the loaded service provider info\n */\n if (process.env.APP_DEBUG === 'true' && process.env.EXTENDED_DEBUG !== 'false' && !sorted.some(e => e.console)) {\n console.table(\n sorted.map((P) => ({\n Provider: P.name,\n Priority: priorityMap.get(P.name),\n Order: (P as any).order || 'N/A',\n }))\n )\n\n console.info(`Set ${chalk.bgCyan(' APP_DEBUG = false ')} in your .env file to hide this information`, '\\n')\n }\n\n return sorted\n }\n\n registerProviders (providers: Array<AServiceProvider>): void {\n this.externalProviders.push(...providers)\n }\n\n /**\n * Register a provider\n */\n public async register (provider: IServiceProvider) {\n await new ContainerResolver(this).resolveMethodParams(provider, 'register', this)\n if (provider.registeredCommands && provider.registeredCommands.length > 0) {\n this.registeredCommands.push(...provider.registeredCommands)\n }\n this.providers.push(provider)\n }\n\n /**\n * checks if the application is running in CLI\n */\n public runningInConsole (): boolean {\n return typeof process !== 'undefined'\n && !!process.stdout\n && !!process.stdin\n\n }\n\n public getRuntimeEnv (): 'browser' | 'node' | 'unknown' {\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n return 'browser'\n }\n if (typeof process !== 'undefined' && process.versions?.node) {\n return 'node'\n }\n return 'unknown'\n }\n\n /**\n * Boot all service providers after registration\n */\n public async boot () {\n if (this.booted) return\n\n for (const provider of this.providers) {\n if (provider.boot) {\n if (Container.hasAnyDecorator(provider.boot)) {\n /**\n * If the service provider is decorated use the IoC container\n */\n await this.make<any>(provider.boot)\n } else {\n /**\n * Otherwise instantiate manually so that we can at least\n * pass the app instance\n */\n await provider.boot(this)\n }\n }\n }\n\n this.booted = true\n }\n\n /**\n * Fire up the developement server using the user provided arguments\n * \n * Port will be auto assigned if provided one is not available\n * \n * @param h3App The current H3 app instance\n * @param preferedPort If provided, this will overide the port set in the evironment\n */\n public async fire (h3App: H3, preferedPort?: number) {\n const serve = this.make('http.serve')\n\n const port: number = preferedPort ?? env('PORT', 3000)\n const tries: number = env('RETRIES', 1)\n const hostname: string = env('HOSTNAME', 'localhost')\n\n try {\n const realPort = await detect(port)\n\n if (port == realPort) {\n const server = serve(h3App, {\n port,\n hostname,\n silent: true,\n })\n\n Logger.parse([\n ['🚀 H3ravel running at:', 'green'],\n [`${server.options.protocol ?? 'http'}://${server.options.hostname}:${server.options.port}`, 'cyan']]\n )\n } else if (this.tries <= tries) {\n await this.fire(h3App, realPort)\n this.tries++\n } else {\n Logger.parse([\n ['ERROR:', 'bgRed'],\n ['No free port available', 'red'],\n ])\n }\n } catch (e: any) {\n Logger.parse([\n ['An error occured', 'bgRed'],\n [e.message, 'red'],\n [e.stack, 'red']\n ], '\\n')\n }\n }\n\n /**\n * Attempt to dynamically import an optional module\n */\n private async safeImport (moduleName: string) {\n try {\n const mod = await import(moduleName)\n return mod.default ?? mod ?? {}\n } catch {\n return null\n }\n }\n\n /**\n * Get the base path of the app\n * \n * @returns \n */\n getBasePath (): string {\n return this.basePath\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 * @returns \n */\n getPath (name: IPathName, suffix?: string) {\n return path.join(this.paths.getPath(name, this.basePath), suffix ?? '')\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 * @returns \n */\n setPath (name: IPathName, path: string) {\n return this.paths.setPath(name, path, this.basePath)\n }\n\n /**\n * Returns the installed version of the system core and typescript.\n *\n * @returns \n */\n getVersion (key: 'app' | 'ts') {\n return this.versions[key]?.replaceAll(/\\^|~/g, '')\n }\n}\n","import type { Argument, Command } from 'commander'\n\nimport { Application } from '../Application'\nimport { ConsoleKernel } from './ConsoleKernel'\nimport { XGeneric } from '@h3ravel/support'\n\nexport class ConsoleCommand {\n constructor(protected app: Application, protected kernel: ConsoleKernel) { }\n\n /**\n * The underlying commander instance.\n *\n * @var Command\n */\n public program!: Command\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature!: string\n\n /**\n * A dictionary of signatures or what not.\n *\n * @var object\n */\n protected dictionary: Record<string, any> = {}\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description?: string\n\n /**\n * The console command input.\n *\n * @var object\n */\n private input: XGeneric<{ options: Record<string, any>, arguments: Record<string, any> }> = {\n options: {},\n arguments: {},\n }\n\n /**\n * Execute the console command.\n */\n public async handle (..._args: any[]): Promise<void> { }\n\n setApplication (app: Application) {\n this.app = app\n }\n\n setInput (\n options: XGeneric,\n args: string[],\n regArgs: readonly Argument[],\n dictionary: Record<string, any>,\n program: Command,\n ) {\n this.program = program\n this.dictionary = dictionary\n this.input.options = options\n this.input.arguments = regArgs\n .map((e, i) => ({ [e.name()]: args[i] }))\n .reduce((e, x) => Object.assign(e, x), {})\n this.loadBaseFlags()\n }\n\n getSignature () {\n return this.signature\n }\n\n getDescription () {\n return this.description\n }\n\n option (key: string, def?: any) {\n return this.input.options[key] ?? def\n }\n\n options (key?: string) {\n if (key) {\n return this.input.options[key]\n }\n return this.input.options\n }\n\n argument (key: string, def?: any) {\n return this.input.arguments[key] ?? def\n }\n\n arguments () {\n return this.input.arguments\n }\n\n loadBaseFlags () {\n this.input.options.lock = this.program.getOptionValue('lock') ?? false\n this.input.options.quiet = this.program.getOptionValue('quiet') ?? false\n this.input.options.silent = this.program.getOptionValue('silent') ?? false\n this.input.options.verbose = this.program.getOptionValue('verbose') ?? 0\n }\n}\n","import { Application } from '../Application'\nimport { Logger } from '@h3ravel/shared'\nimport { XGeneric } from '@h3ravel/support'\nimport { mkdir } from 'node:fs/promises'\n\nexport class ConsoleKernel {\n public cwd!: string\n public output = typeof Logger\n public basePath: string = ''\n public modulePath!: string\n public consolePath!: string\n public modulePackage!: XGeneric<{ version: string }>\n public consolePackage!: XGeneric<{ version: string }>\n\n constructor(public app: Application) { }\n\n async ensureDirectoryExists (dir: string) {\n await mkdir(dir, { recursive: true })\n }\n}\n","import { Application } from '.'\nimport { IController } from '@h3ravel/shared'\n\n/**\n * Base controller class\n */\nexport abstract class Controller implements IController {\n protected app: Application\n\n constructor(app: Application) {\n this.app = app\n }\n\n public show (..._ctx: any[]): any { return }\n public index (..._ctx: any[]): any { return }\n public store (..._ctx: any[]): any { return }\n public update (..._ctx: any[]): any { return }\n public destroy (..._ctx: any[]): any { return }\n}\n","export function Inject (...dependencies: string[]) {\n return function (target: any) {\n target.__inject__ = dependencies\n }\n}\n\n/**\n * Allows binding dependencies to both class and class methods \n * \n * @returns \n */\nexport function Injectable (): ClassDecorator & MethodDecorator {\n return (...args: any[]) => {\n if (args.length === 1) {\n void args[0] // class target\n }\n if (args.length === 3) {\n void args[0] // target\n void args[1] // propertyKey\n void args[2] // descriptor\n }\n }\n}\n\n// export function Injectable (): MethodDecorator & ClassDecorator {\n// return ((_target: any, _propertyKey?: string, descriptor?: PropertyDescriptor) => {\n// if (descriptor) {\n// const original = descriptor.value;\n// descriptor.value = async function (...args: any[]) {\n// const resolvedArgs = await Promise.all(args);\n// return original.apply(this, resolvedArgs);\n// };\n// }\n// }) as any;\n// }\n","import { HttpContext, IMiddleware } from '@h3ravel/shared'\n\nimport type { H3Event } from 'h3'\n\n/**\n * Kernel class handles middleware execution and response transformations.\n * It acts as the core middleware pipeline for HTTP requests.\n */\nexport class Kernel {\n /**\n * @param context - A factory function that converts an H3Event into an HttpContext.\n * @param middleware - An array of middleware classes that will be executed in sequence.\n */\n constructor(\n protected context: (event: H3Event) => HttpContext,\n protected middleware: IMiddleware[] = [],\n ) { }\n\n /**\n * Handles an incoming request and passes it through middleware before invoking the next handler.\n * \n * @param event - The raw H3 event object.\n * @param next - A callback function that represents the next layer (usually the controller or final handler).\n * @returns A promise resolving to the result of the request pipeline.\n */\n async handle (\n event: H3Event,\n next: (ctx: HttpContext) => Promise<unknown>\n ): Promise<unknown> {\n /**\n * Convert the raw event into a standardized HttpContext\n */\n const ctx = this.context(event)\n const { app } = ctx.request\n\n /**\n * Initialize the view handler method\n * \n * @param template \n * @param params \n * @returns \n */\n const view = async (template: string, params?: Record<string, any>) => {\n const edge = app.make('edge')\n return ctx.response.html(await edge.render(template, params))\n }\n\n /**\n * Bind the view method to the global variable space\n */\n globalThis.view = view\n\n /**\n * Dynamically bind the view renderer to the service container.\n * This allows any part of the request lifecycle to render templates using Edge.\n */\n app.bind('view', () => view)\n\n /**\n * Run middleware stack and obtain result\n */\n const result = await this.runMiddleware(ctx, () => next(ctx))\n\n /**\n * If a plain object is returned from a controller or middleware,\n * automatically set the JSON Content-Type header for the response.\n */\n if (result !== undefined && this.isPlainObject(result)) {\n event.res.headers.set('Content-Type', 'application/json; charset=UTF-8')\n }\n\n return result\n }\n\n /**\n * Sequentially runs middleware in the order they were registered.\n * \n * @param context - The standardized HttpContext.\n * @param next - Callback to execute when middleware completes.\n * @returns A promise resolving to the final handler's result.\n */\n private async runMiddleware (\n context: HttpContext,\n next: (ctx: HttpContext) => Promise<unknown>\n ) {\n let index = -1\n\n const runner = async (i: number): Promise<unknown> => {\n if (i <= index) throw new Error('next() called multiple times')\n index = i\n const middleware = this.middleware[i]\n\n if (middleware) {\n /**\n * Execute the current middleware and proceed to the next one\n */\n return middleware.handle(context, () => runner(i + 1))\n } else {\n /**\n * If no more middleware, call the final handler\n */\n return next(context)\n }\n }\n\n return runner(0)\n }\n\n /**\n * Utility function to determine if a value is a plain object or array.\n * \n * @param value - The value to check.\n * @returns True if the value is a plain object or array, otherwise false.\n */\n private isPlainObject (value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' &&\n value !== null &&\n (value.constructor === Object || value.constructor === Array)\n }\n}\n","import { Application } from './Application'\nimport { IServiceProvider } from '@h3ravel/shared'\n\nexport abstract class ServiceProvider implements IServiceProvider {\n /**\n * Sort order\n */\n\n public static order?: `before:${string}` | `after:${string}` | string | undefined\n\n /**\n * Sort priority\n */\n public static priority = 0\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = false\n\n /**\n * List of registered console commands\n */\n public registeredCommands?: (new (app: any, kernel: any) => any)[]\n\n protected app: Application\n\n constructor(app: Application) {\n this.app = app\n }\n\n /**\n * Register bindings to the container.\n * Runs before boot().\n */\n abstract register (...app: unknown[]): void | Promise<void>;\n\n /**\n * Perform post-registration booting of services.\n * Runs after all providers have been registered.\n */\n boot?(...app: unknown[]): void | Promise<void>;\n\n /**\n * An array of console commands to register.\n */\n commands (commands: (new (app: any, kernel: any) => any)[]): void {\n this.registeredCommands = commands\n }\n}\n","import 'reflect-metadata'\n\nimport { ServiceProvider } from '../ServiceProvider'\n\n/**\n * Bootstraps core services and bindings.\n * \n * Bind essential services to the container (logger, config repository).\n * Register app-level singletons.\n * Set up exception handling.\n * \n * Auto-Registered\n */\nexport class CoreServiceProvider extends ServiceProvider {\n public static priority = 999\n\n register () {\n }\n}\n","import { Edge } from 'edge.js'\nimport { ServiceProvider } from '../ServiceProvider'\n\nexport class ViewServiceProvider extends ServiceProvider {\n public static priority = 995\n\n register (): void {\n const config = this.app.make('config')\n const edge = Edge.create({\n cache: process.env.NODE_ENV === 'production'\n })\n\n edge.mount(this.app.getPath('views'))\n\n edge.global('asset', this.app.make('asset'))\n edge.global('config', config.get)\n edge.global('app', this.app)\n\n this.app.bind('edge', () => edge)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAa,YAAb,MAA6C;CACzC,AAAQ,2BAAW,IAAI,KAA8B;CACrD,AAAQ,6BAAa,IAAI,KAAwB;;;;;;;CAQjD,OAAO,gBAAiB,QAAyC;AAC7D,MAAI,QAAQ,gBAAgB,OAAO,CAAC,SAAS,EAAG,QAAO;EAEvD,MAAM,cAAc,OAAO;AAE3B,OAAK,IAAI,IAAI,GAAG,IAAI,aAAa,IAC7B,KAAI,QAAQ,gBAAgB,QAAQ,WAAW,IAAI,CAAC,SAAS,EACzD,QAAO;AAIf,SAAO;;CAQX,KACI,KACA,SACF;AACE,OAAK,SAAS,IAAI,KAAK,QAAQ;;;;;CAMnC,U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AEzB,WAAY;;;;;ACbhB,IAAa,sBAAb,cAAyC,gBAAgB;CACrD,OAAc,WAAW;CAEzB,WAAkB;EACd,MAAM,SAAS,KAAK,IAAI,KAAK,SAAS;EACtC,MAAM,OAAOC,aAAK,OAAO,EACrB,OAAO,QAAQ,IAAI,aAAa,cACnC,CAAC;AAEF,OAAK,MAAM,KAAK,IAAI,QAAQ,QAAQ,CAAC;AAErC,OAAK,OAAO,SAAS,KAAK,IAAI,KAAK,QAAQ,CAAC;AAC5C,OAAK,OAAO,UAAU,OAAO,IAAI;AACjC,OAAK,OAAO,OAAO,KAAK,IAAI;AAE5B,OAAK,IAAI,KAAK,cAAc,KAAK"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Bindings, HttpContext, IApplication, IContainer, IController, IMiddleware, IPathName, IServiceProvider, PathLoader, UseKey } from "@h3ravel/shared";
|
|
2
2
|
import { H3, H3Event } from "h3";
|
|
3
|
+
import { Argument, Command } from "commander";
|
|
4
|
+
import { XGeneric } from "@h3ravel/support";
|
|
3
5
|
|
|
4
6
|
//#region src/Container.d.ts
|
|
5
7
|
declare class Container implements IContainer {
|
|
@@ -11,7 +13,7 @@ declare class Container implements IContainer {
|
|
|
11
13
|
* @param target
|
|
12
14
|
* @returns
|
|
13
15
|
*/
|
|
14
|
-
static hasAnyDecorator(target:
|
|
16
|
+
static hasAnyDecorator(target: (...prm: any[]) => any): boolean;
|
|
15
17
|
/**
|
|
16
18
|
* Bind a transient service to the container
|
|
17
19
|
*/
|
|
@@ -131,6 +133,74 @@ declare class Application extends Container implements IApplication {
|
|
|
131
133
|
getVersion(key: 'app' | 'ts'): string;
|
|
132
134
|
}
|
|
133
135
|
//#endregion
|
|
136
|
+
//#region src/Console/ConsoleKernel.d.ts
|
|
137
|
+
declare class ConsoleKernel {
|
|
138
|
+
app: Application;
|
|
139
|
+
cwd: string;
|
|
140
|
+
output: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
141
|
+
basePath: string;
|
|
142
|
+
modulePath: string;
|
|
143
|
+
consolePath: string;
|
|
144
|
+
modulePackage: XGeneric<{
|
|
145
|
+
version: string;
|
|
146
|
+
}>;
|
|
147
|
+
consolePackage: XGeneric<{
|
|
148
|
+
version: string;
|
|
149
|
+
}>;
|
|
150
|
+
constructor(app: Application);
|
|
151
|
+
ensureDirectoryExists(dir: string): Promise<void>;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/Console/ConsoleCommand.d.ts
|
|
155
|
+
declare class ConsoleCommand {
|
|
156
|
+
protected app: Application;
|
|
157
|
+
protected kernel: ConsoleKernel;
|
|
158
|
+
constructor(app: Application, kernel: ConsoleKernel);
|
|
159
|
+
/**
|
|
160
|
+
* The underlying commander instance.
|
|
161
|
+
*
|
|
162
|
+
* @var Command
|
|
163
|
+
*/
|
|
164
|
+
program: Command;
|
|
165
|
+
/**
|
|
166
|
+
* The name and signature of the console command.
|
|
167
|
+
*
|
|
168
|
+
* @var string
|
|
169
|
+
*/
|
|
170
|
+
protected signature: string;
|
|
171
|
+
/**
|
|
172
|
+
* A dictionary of signatures or what not.
|
|
173
|
+
*
|
|
174
|
+
* @var object
|
|
175
|
+
*/
|
|
176
|
+
protected dictionary: Record<string, any>;
|
|
177
|
+
/**
|
|
178
|
+
* The console command description.
|
|
179
|
+
*
|
|
180
|
+
* @var string
|
|
181
|
+
*/
|
|
182
|
+
protected description?: string;
|
|
183
|
+
/**
|
|
184
|
+
* The console command input.
|
|
185
|
+
*
|
|
186
|
+
* @var object
|
|
187
|
+
*/
|
|
188
|
+
private input;
|
|
189
|
+
/**
|
|
190
|
+
* Execute the console command.
|
|
191
|
+
*/
|
|
192
|
+
handle(..._args: any[]): Promise<void>;
|
|
193
|
+
setApplication(app: Application): void;
|
|
194
|
+
setInput(options: XGeneric, args: string[], regArgs: readonly Argument[], dictionary: Record<string, any>, program: Command): void;
|
|
195
|
+
getSignature(): string;
|
|
196
|
+
getDescription(): string | undefined;
|
|
197
|
+
option(key: string, def?: any): any;
|
|
198
|
+
options(key?: string): any;
|
|
199
|
+
argument(key: string, def?: any): any;
|
|
200
|
+
arguments(): Record<string, any>;
|
|
201
|
+
loadBaseFlags(): void;
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
134
204
|
//#region src/Contracts/ServiceProviderConstructor.d.ts
|
|
135
205
|
type ServiceProviderConstructor = (new (app: Application) => ServiceProvider) & IServiceProvider;
|
|
136
206
|
//#endregion
|
|
@@ -273,5 +343,5 @@ declare class Registerer {
|
|
|
273
343
|
private databasePath;
|
|
274
344
|
}
|
|
275
345
|
//#endregion
|
|
276
|
-
export { Application, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, Registerer, ServiceProvider, ServiceProviderConstructor, ViewServiceProvider };
|
|
346
|
+
export { Application, ConsoleCommand, ConsoleKernel, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, Registerer, ServiceProvider, ServiceProviderConstructor, ViewServiceProvider };
|
|
277
347
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import { Bindings, HttpContext, IApplication, IContainer, IController, IMiddleware, IPathName, IServiceProvider, PathLoader, UseKey } from "@h3ravel/shared";
|
|
3
|
+
import { XGeneric } from "@h3ravel/support";
|
|
3
4
|
import { H3, H3Event } from "h3";
|
|
5
|
+
import { Argument, Command } from "commander";
|
|
4
6
|
|
|
5
7
|
//#region src/Container.d.ts
|
|
6
8
|
declare class Container implements IContainer {
|
|
@@ -12,7 +14,7 @@ declare class Container implements IContainer {
|
|
|
12
14
|
* @param target
|
|
13
15
|
* @returns
|
|
14
16
|
*/
|
|
15
|
-
static hasAnyDecorator(target:
|
|
17
|
+
static hasAnyDecorator(target: (...prm: any[]) => any): boolean;
|
|
16
18
|
/**
|
|
17
19
|
* Bind a transient service to the container
|
|
18
20
|
*/
|
|
@@ -132,6 +134,74 @@ declare class Application extends Container implements IApplication {
|
|
|
132
134
|
getVersion(key: 'app' | 'ts'): string;
|
|
133
135
|
}
|
|
134
136
|
//#endregion
|
|
137
|
+
//#region src/Console/ConsoleKernel.d.ts
|
|
138
|
+
declare class ConsoleKernel {
|
|
139
|
+
app: Application;
|
|
140
|
+
cwd: string;
|
|
141
|
+
output: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
142
|
+
basePath: string;
|
|
143
|
+
modulePath: string;
|
|
144
|
+
consolePath: string;
|
|
145
|
+
modulePackage: XGeneric<{
|
|
146
|
+
version: string;
|
|
147
|
+
}>;
|
|
148
|
+
consolePackage: XGeneric<{
|
|
149
|
+
version: string;
|
|
150
|
+
}>;
|
|
151
|
+
constructor(app: Application);
|
|
152
|
+
ensureDirectoryExists(dir: string): Promise<void>;
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/Console/ConsoleCommand.d.ts
|
|
156
|
+
declare class ConsoleCommand {
|
|
157
|
+
protected app: Application;
|
|
158
|
+
protected kernel: ConsoleKernel;
|
|
159
|
+
constructor(app: Application, kernel: ConsoleKernel);
|
|
160
|
+
/**
|
|
161
|
+
* The underlying commander instance.
|
|
162
|
+
*
|
|
163
|
+
* @var Command
|
|
164
|
+
*/
|
|
165
|
+
program: Command;
|
|
166
|
+
/**
|
|
167
|
+
* The name and signature of the console command.
|
|
168
|
+
*
|
|
169
|
+
* @var string
|
|
170
|
+
*/
|
|
171
|
+
protected signature: string;
|
|
172
|
+
/**
|
|
173
|
+
* A dictionary of signatures or what not.
|
|
174
|
+
*
|
|
175
|
+
* @var object
|
|
176
|
+
*/
|
|
177
|
+
protected dictionary: Record<string, any>;
|
|
178
|
+
/**
|
|
179
|
+
* The console command description.
|
|
180
|
+
*
|
|
181
|
+
* @var string
|
|
182
|
+
*/
|
|
183
|
+
protected description?: string;
|
|
184
|
+
/**
|
|
185
|
+
* The console command input.
|
|
186
|
+
*
|
|
187
|
+
* @var object
|
|
188
|
+
*/
|
|
189
|
+
private input;
|
|
190
|
+
/**
|
|
191
|
+
* Execute the console command.
|
|
192
|
+
*/
|
|
193
|
+
handle(..._args: any[]): Promise<void>;
|
|
194
|
+
setApplication(app: Application): void;
|
|
195
|
+
setInput(options: XGeneric, args: string[], regArgs: readonly Argument[], dictionary: Record<string, any>, program: Command): void;
|
|
196
|
+
getSignature(): string;
|
|
197
|
+
getDescription(): string | undefined;
|
|
198
|
+
option(key: string, def?: any): any;
|
|
199
|
+
options(key?: string): any;
|
|
200
|
+
argument(key: string, def?: any): any;
|
|
201
|
+
arguments(): Record<string, any>;
|
|
202
|
+
loadBaseFlags(): void;
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
135
205
|
//#region src/Contracts/ServiceProviderConstructor.d.ts
|
|
136
206
|
type ServiceProviderConstructor = (new (app: Application) => ServiceProvider) & IServiceProvider;
|
|
137
207
|
//#endregion
|
|
@@ -274,5 +344,5 @@ declare class Registerer {
|
|
|
274
344
|
private databasePath;
|
|
275
345
|
}
|
|
276
346
|
//#endregion
|
|
277
|
-
export { Application, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, Registerer, ServiceProvider, ServiceProviderConstructor, ViewServiceProvider };
|
|
347
|
+
export { Application, ConsoleCommand, ConsoleKernel, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, Registerer, ServiceProvider, ServiceProviderConstructor, ViewServiceProvider };
|
|
278
348
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import chalk from "chalk";
|
|
|
6
6
|
import { detect } from "detect-port";
|
|
7
7
|
import dotenv from "dotenv";
|
|
8
8
|
import dotenvExpand from "dotenv-expand";
|
|
9
|
+
import { mkdir } from "node:fs/promises";
|
|
9
10
|
import { Edge } from "edge.js";
|
|
10
11
|
|
|
11
12
|
//#region src/Container.ts
|
|
@@ -87,7 +88,7 @@ var ContainerResolver = class ContainerResolver {
|
|
|
87
88
|
/**
|
|
88
89
|
* Resolve the bound dependencies
|
|
89
90
|
*/
|
|
90
|
-
|
|
91
|
+
const args = params.filter((e) => ContainerResolver.isClass(e)).map((type) => {
|
|
91
92
|
return this.app.make(type);
|
|
92
93
|
});
|
|
93
94
|
return new Promise((resolve) => {
|
|
@@ -307,7 +308,7 @@ var Application = class Application extends Container {
|
|
|
307
308
|
hostname,
|
|
308
309
|
silent: true
|
|
309
310
|
});
|
|
310
|
-
Logger.parse([[
|
|
311
|
+
Logger.parse([["🚀 H3ravel running at:", "green"], [`${server.options.protocol ?? "http"}://${server.options.hostname}:${server.options.port}`, "cyan"]]);
|
|
311
312
|
} else if (this.tries <= tries) {
|
|
312
313
|
await this.fire(h3App, realPort);
|
|
313
314
|
this.tries++;
|
|
@@ -369,6 +370,105 @@ var Application = class Application extends Container {
|
|
|
369
370
|
}
|
|
370
371
|
};
|
|
371
372
|
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/Console/ConsoleCommand.ts
|
|
375
|
+
var ConsoleCommand = class {
|
|
376
|
+
constructor(app, kernel) {
|
|
377
|
+
this.app = app;
|
|
378
|
+
this.kernel = kernel;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* The underlying commander instance.
|
|
382
|
+
*
|
|
383
|
+
* @var Command
|
|
384
|
+
*/
|
|
385
|
+
program;
|
|
386
|
+
/**
|
|
387
|
+
* The name and signature of the console command.
|
|
388
|
+
*
|
|
389
|
+
* @var string
|
|
390
|
+
*/
|
|
391
|
+
signature;
|
|
392
|
+
/**
|
|
393
|
+
* A dictionary of signatures or what not.
|
|
394
|
+
*
|
|
395
|
+
* @var object
|
|
396
|
+
*/
|
|
397
|
+
dictionary = {};
|
|
398
|
+
/**
|
|
399
|
+
* The console command description.
|
|
400
|
+
*
|
|
401
|
+
* @var string
|
|
402
|
+
*/
|
|
403
|
+
description;
|
|
404
|
+
/**
|
|
405
|
+
* The console command input.
|
|
406
|
+
*
|
|
407
|
+
* @var object
|
|
408
|
+
*/
|
|
409
|
+
input = {
|
|
410
|
+
options: {},
|
|
411
|
+
arguments: {}
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Execute the console command.
|
|
415
|
+
*/
|
|
416
|
+
async handle(..._args) {}
|
|
417
|
+
setApplication(app) {
|
|
418
|
+
this.app = app;
|
|
419
|
+
}
|
|
420
|
+
setInput(options, args, regArgs, dictionary, program) {
|
|
421
|
+
this.program = program;
|
|
422
|
+
this.dictionary = dictionary;
|
|
423
|
+
this.input.options = options;
|
|
424
|
+
this.input.arguments = regArgs.map((e, i) => ({ [e.name()]: args[i] })).reduce((e, x) => Object.assign(e, x), {});
|
|
425
|
+
this.loadBaseFlags();
|
|
426
|
+
}
|
|
427
|
+
getSignature() {
|
|
428
|
+
return this.signature;
|
|
429
|
+
}
|
|
430
|
+
getDescription() {
|
|
431
|
+
return this.description;
|
|
432
|
+
}
|
|
433
|
+
option(key, def) {
|
|
434
|
+
return this.input.options[key] ?? def;
|
|
435
|
+
}
|
|
436
|
+
options(key) {
|
|
437
|
+
if (key) return this.input.options[key];
|
|
438
|
+
return this.input.options;
|
|
439
|
+
}
|
|
440
|
+
argument(key, def) {
|
|
441
|
+
return this.input.arguments[key] ?? def;
|
|
442
|
+
}
|
|
443
|
+
arguments() {
|
|
444
|
+
return this.input.arguments;
|
|
445
|
+
}
|
|
446
|
+
loadBaseFlags() {
|
|
447
|
+
this.input.options.lock = this.program.getOptionValue("lock") ?? false;
|
|
448
|
+
this.input.options.quiet = this.program.getOptionValue("quiet") ?? false;
|
|
449
|
+
this.input.options.silent = this.program.getOptionValue("silent") ?? false;
|
|
450
|
+
this.input.options.verbose = this.program.getOptionValue("verbose") ?? 0;
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/Console/ConsoleKernel.ts
|
|
456
|
+
var ConsoleKernel = class {
|
|
457
|
+
cwd;
|
|
458
|
+
output = typeof Logger;
|
|
459
|
+
basePath = "";
|
|
460
|
+
modulePath;
|
|
461
|
+
consolePath;
|
|
462
|
+
modulePackage;
|
|
463
|
+
consolePackage;
|
|
464
|
+
constructor(app) {
|
|
465
|
+
this.app = app;
|
|
466
|
+
}
|
|
467
|
+
async ensureDirectoryExists(dir) {
|
|
468
|
+
await mkdir(dir, { recursive: true });
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
|
|
372
472
|
//#endregion
|
|
373
473
|
//#region src/Controller.ts
|
|
374
474
|
/**
|
|
@@ -438,13 +538,25 @@ var Kernel = class {
|
|
|
438
538
|
const ctx = this.context(event);
|
|
439
539
|
const { app } = ctx.request;
|
|
440
540
|
/**
|
|
441
|
-
*
|
|
442
|
-
*
|
|
541
|
+
* Initialize the view handler method
|
|
542
|
+
*
|
|
543
|
+
* @param template
|
|
544
|
+
* @param params
|
|
545
|
+
* @returns
|
|
443
546
|
*/
|
|
444
|
-
|
|
547
|
+
const view = async (template, params) => {
|
|
445
548
|
const edge = app.make("edge");
|
|
446
549
|
return ctx.response.html(await edge.render(template, params));
|
|
447
|
-
}
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* Bind the view method to the global variable space
|
|
553
|
+
*/
|
|
554
|
+
globalThis.view = view;
|
|
555
|
+
/**
|
|
556
|
+
* Dynamically bind the view renderer to the service container.
|
|
557
|
+
* This allows any part of the request lifecycle to render templates using Edge.
|
|
558
|
+
*/
|
|
559
|
+
app.bind("view", () => view);
|
|
448
560
|
/**
|
|
449
561
|
* Run middleware stack and obtain result
|
|
450
562
|
*/
|
|
@@ -556,5 +668,5 @@ var ViewServiceProvider = class extends ServiceProvider {
|
|
|
556
668
|
};
|
|
557
669
|
|
|
558
670
|
//#endregion
|
|
559
|
-
export { Application, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, Registerer, ServiceProvider, ViewServiceProvider };
|
|
671
|
+
export { Application, ConsoleCommand, ConsoleKernel, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, Registerer, ServiceProvider, ViewServiceProvider };
|
|
560
672
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["dependencies: any[]","app: Application","params: any[]","args: any[]","app: Application","path","nodepath","port: number","tries: number","hostname: string","e: any","path","context: (event: H3Event) => HttpContext","middleware: IMiddleware[]"],"sources":["../src/Container.ts","../src/Di/ContainerResolver.ts","../src/Registerer.ts","../src/Application.ts","../src/Controller.ts","../src/Di/Inject.ts","../src/Http/Kernel.ts","../src/ServiceProvider.ts","../src/Providers/CoreServiceProvider.ts","../src/Providers/ViewServiceProvider.ts"],"sourcesContent":["import type { Bindings, IContainer, UseKey } from '@h3ravel/shared'\n\ntype IBinding = UseKey | (new (..._args: any[]) => unknown)\n\nexport class Container implements IContainer {\n private bindings = new Map<IBinding, () => unknown>()\n private singletons = new Map<IBinding, unknown>()\n\n /**\n * Check if the target has any decorators\n * \n * @param target \n * @returns \n */\n static hasAnyDecorator (target: Function): boolean {\n if (Reflect.getMetadataKeys(target).length > 0) return true\n\n const paramLength = target.length\n\n for (let i = 0; i < paramLength; i++) {\n if (Reflect.getMetadataKeys(target, `__param_${i}`).length > 0) {\n return true\n }\n }\n\n return false\n }\n\n /**\n * Bind a transient service to the container\n */\n bind<T> (key: new (...args: any[]) => T, factory: () => T): void\n bind<T extends UseKey> (key: T, factory: () => Bindings[T]): void\n bind<T extends UseKey> (\n key: T,\n factory: () => Bindings[T] | T\n ) {\n this.bindings.set(key, factory)\n }\n\n /**\n * Bind a singleton service to the container\n */\n singleton<T extends UseKey> (\n key: T | (new (..._args: any[]) => Bindings[T]),\n factory: () => Bindings[T]\n ) {\n this.bindings.set(key, () => {\n if (!this.singletons.has(key)) {\n this.singletons.set(key, factory())\n }\n return this.singletons.get(key)!\n })\n }\n\n /**\n * Resolve a service from the container\n */\n make<T extends UseKey, X = undefined> (\n key: T | (new (..._args: any[]) => Bindings[T])\n ): X extends undefined ? Bindings[T] : X {\n /**\n * Direct factory binding\n */\n if (this.bindings.has(key)) {\n return this.bindings.get(key)!() as Bindings[T]\n }\n\n /**\n * If this is a class constructor, auto-resolve via reflection\n */\n if (typeof key === 'function') {\n return this.build(key)\n }\n\n throw new Error(\n `No binding found for key: ${typeof key === 'string' ? key : (key as any)?.name}`\n )\n }\n\n /**\n * Automatically build a class with constructor dependency injection\n */\n private build<T extends UseKey> (ClassType: new (..._args: any[]) => Bindings[T]): Bindings[T] {\n let dependencies: any[] = [];\n\n if (Array.isArray((ClassType as any).__inject__)) {\n dependencies = (ClassType as any).__inject__.map((alias: any) => {\n return this.make(alias)\n });\n } else {\n const paramTypes: any[] = Reflect.getMetadata('design:paramtypes', ClassType) || []\n dependencies = paramTypes.map((dep) => this.make(dep))\n }\n\n return new ClassType(...dependencies);\n }\n\n /**\n * Check if a service is registered\n */\n has (key: UseKey): boolean {\n return this.bindings.has(key)\n }\n}\n","import 'reflect-metadata';\n\nimport { Application } from '..';\n\nexport class ContainerResolver {\n constructor(private app: Application) { }\n\n async resolveMethodParams<I extends Record<string, any>> (instance: I, method: keyof I, _default?: any) {\n /**\n * Get param types for instance method\n */\n let params: any[] = Reflect.getMetadata('design:paramtypes', instance, String(method)) || [];\n\n /**\n * Ensure that the Application class is always available\n */\n if (params.length < 1 && _default) {\n params = [_default]\n }\n\n /**\n * Resolve the bound dependencies\n */\n let args: any[] = params.filter(e => ContainerResolver.isClass(e)).map((type: any) => {\n return this.app.make(type)\n });\n\n return new Promise<I>((resolve) => {\n resolve(instance[method](...args))\n })\n }\n\n static isClass (C: any) {\n return typeof C === \"function\" &&\n C.prototype !== undefined &&\n Object.toString.call(C).substring(0, 5) === 'class'\n }\n}\n","import { dd, dump } from '@h3ravel/support'\n\nimport { Application } from '.'\nimport nodepath from 'node:path'\n\nexport class Registerer {\n constructor(private app: Application) { }\n\n static register (app: Application) {\n const reg = new Registerer(app)\n reg.bootRegister()\n }\n\n bootRegister () {\n globalThis.dd = dd\n globalThis.dump = dump\n globalThis.app_path = (path?: string) => this.appPath(path)\n globalThis.base_path = (path?: string) => this.basePath(path)\n globalThis.public_path = (path?: string) => this.publicPath(path)\n globalThis.storage_path = (path?: string) => this.storagePath(path)\n globalThis.database_path = (path?: string) => this.databasePath(path)\n }\n\n private appPath (path?: string) {\n return this.app.getPath(\n 'base', nodepath.join(`/${process.env.SRC_PATH ?? 'src'}/`.replace(/([^:]\\/)\\/+/g, \"$1\"), 'app', path ?? '')\n )\n }\n\n private basePath (path?: string) {\n return this.app.getPath('base', path)\n }\n\n private publicPath (path?: string) {\n return this.app.getPath('public', path)\n }\n\n private storagePath (path?: string) {\n return this.app.getPath('base', nodepath.join('storage', path ?? ''))\n }\n\n private databasePath (path?: string) {\n return this.app.getPath('database', path)\n }\n}\n","import 'reflect-metadata';\n\nimport { IApplication, IPathName, IServiceProvider, Logger } from '@h3ravel/shared'\n\nimport { Container } from './Container'\nimport { ContainerResolver } from './Di/ContainerResolver';\nimport type { H3 } from 'h3'\nimport { PathLoader } from '@h3ravel/shared'\nimport { Registerer } from './Registerer'\nimport chalk from 'chalk';\nimport { detect } from 'detect-port';\nimport dotenv from 'dotenv'\nimport dotenvExpand from 'dotenv-expand'\nimport path from 'node:path'\n\ntype AServiceProvider = (new (_app: Application) => IServiceProvider) & IServiceProvider\n\nexport class Application extends Container implements IApplication {\n public paths = new PathLoader()\n private tries: number = 0\n private booted = false\n private versions = { app: '0', ts: '0' }\n private basePath: string\n\n private providers: IServiceProvider[] = []\n protected externalProviders: Array<new (_app: Application) => IServiceProvider> = []\n\n /**\n * List of registered console commands\n */\n public registeredCommands: (new (app: any, kernel: any) => any)[] = [];\n\n constructor(basePath: string) {\n super()\n\n dotenvExpand.expand(dotenv.config({ quiet: true }))\n\n this.basePath = basePath\n this.setPath('base', basePath)\n this.loadOptions()\n this.registerBaseBindings();\n Registerer.register(this)\n }\n\n /**\n * Register core bindings into the container\n */\n protected registerBaseBindings () {\n this.bind(Application, () => this)\n this.bind('path.base', () => this.basePath)\n this.bind('load.paths', () => this.paths)\n }\n\n /**\n * Dynamically register all configured providers\n */\n public async registerConfiguredProviders () {\n const providers = await this.getAllProviders()\n\n for (const ProviderClass of providers) {\n if (!ProviderClass) continue\n const provider = new ProviderClass(this)\n await this.register(provider)\n }\n }\n\n protected async loadOptions () {\n const app = await this.safeImport(this.getPath('base', 'package.json'))\n const core = await this.safeImport('../package.json')\n\n if (app && app.dependencies) {\n this.versions.app = app.dependencies['@h3ravel/core']\n }\n if (core && core.devDependencies) {\n this.versions.ts = app.devDependencies.typescript\n }\n }\n\n /**\n * Get all registered providers\n */\n public getRegisteredProviders () {\n return this.providers;\n }\n\n /**\n * Load default and optional providers dynamically\n * \n * Auto-Registration Behavior\n * \n * Minimal App: Loads only core, config, http, router by default.\n * Full-Stack App: Installs database, mail, queue, cache → they self-register via their providers.\n */\n protected async getConfiguredProviders (): Promise<Array<AServiceProvider>> {\n return [\n (await import('@h3ravel/core')).CoreServiceProvider,\n (await import('@h3ravel/core')).ViewServiceProvider,\n ]\n }\n\n protected async getAllProviders (): Promise<Array<AServiceProvider>> {\n const coreProviders = await this.getConfiguredProviders();\n const allProviders = [...coreProviders, ...this.externalProviders];\n\n /**\n * Deduplicate by class reference\n */\n const uniqueProviders = Array.from(new Set(allProviders));\n\n return this.sortProviders(uniqueProviders);\n }\n\n private sortProviders (providers: Array<AServiceProvider>) {\n const priorityMap = new Map<string, number>();\n\n /**\n * Base priority (default 0)\n */\n providers.forEach((Provider) => {\n priorityMap.set(Provider.name, (Provider as any).priority ?? 0);\n });\n\n /**\n * Handle before/after adjustments\n */\n providers.forEach((Provider) => {\n const order = (Provider as any).order;\n if (!order) return;\n\n const [direction, target] = order.split(':');\n const targetPriority = priorityMap.get(target) ?? 0;\n\n if (direction === 'before') {\n priorityMap.set(Provider.name, targetPriority - 1);\n } else if (direction === 'after') {\n priorityMap.set(Provider.name, targetPriority + 1);\n }\n });\n\n /**\n * Service providers sorted based on thier name and priority\n */\n const sorted = providers.sort(\n (A, B) => (priorityMap.get(B.name) ?? 0) - (priorityMap.get(A.name) ?? 0)\n );\n\n /**\n * If debug is enabled, let's show the loaded service provider info\n */\n if (process.env.APP_DEBUG === 'true' && process.env.EXTENDED_DEBUG !== 'false' && !sorted.some(e => e.console)) {\n console.table(\n sorted.map((P) => ({\n Provider: P.name,\n Priority: priorityMap.get(P.name),\n Order: (P as any).order || 'N/A',\n }))\n );\n\n console.info(`Set ${chalk.bgCyan(' APP_DEBUG = false ')} in your .env file to hide this information`, \"\\n\")\n }\n\n return sorted\n }\n\n registerProviders (providers: Array<AServiceProvider>): void {\n this.externalProviders.push(...providers)\n }\n\n /**\n * Register a provider\n */\n public async register (provider: IServiceProvider) {\n await new ContainerResolver(this).resolveMethodParams(provider, 'register', this)\n if (provider.registeredCommands && provider.registeredCommands.length > 0) {\n this.registeredCommands.push(...provider.registeredCommands)\n }\n this.providers.push(provider)\n }\n\n /**\n * checks if the application is running in CLI\n */\n public runningInConsole (): boolean {\n return typeof process !== 'undefined'\n && !!process.stdout\n && !!process.stdin\n\n }\n\n public getRuntimeEnv (): 'browser' | 'node' | 'unknown' {\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n return 'browser'\n }\n if (typeof process !== 'undefined' && process.versions?.node) {\n return 'node'\n }\n return 'unknown'\n }\n\n /**\n * Boot all service providers after registration\n */\n public async boot () {\n if (this.booted) return\n\n for (const provider of this.providers) {\n if (provider.boot) {\n if (Container.hasAnyDecorator(provider.boot)) {\n /**\n * If the service provider is decorated use the IoC container\n */\n await this.make<any>(provider.boot)\n } else {\n /**\n * Otherwise instantiate manually so that we can at least\n * pass the app instance\n */\n await provider.boot(this)\n }\n }\n }\n\n this.booted = true\n }\n\n /**\n * Fire up the developement server using the user provided arguments\n * \n * Port will be auto assigned if provided one is not available\n * \n * @param h3App The current H3 app instance\n * @param preferedPort If provided, this will overide the port set in the evironment\n */\n public async fire (h3App: H3, preferedPort?: number) {\n const serve = this.make('http.serve')\n\n const port: number = preferedPort ?? env('PORT', 3000)\n const tries: number = env('RETRIES', 1)\n const hostname: string = env('HOSTNAME', 'localhost')\n\n try {\n const realPort = await detect(port)\n\n if (port == realPort) {\n const server = serve(h3App, {\n port,\n hostname,\n silent: true,\n })\n\n Logger.parse([\n [`🚀 H3ravel running at:`, 'green'],\n [`${server.options.protocol ?? 'http'}://${server.options.hostname}:${server.options.port}`, 'cyan']]\n )\n } else if (this.tries <= tries) {\n await this.fire(h3App, realPort)\n this.tries++\n } else {\n Logger.parse([\n ['ERROR:', 'bgRed'],\n ['No free port available', 'red'],\n ])\n }\n } catch (e: any) {\n Logger.parse([\n ['An error occured', 'bgRed'],\n [e.message, 'red'],\n [e.stack, 'red']\n ], \"\\n\")\n }\n }\n\n /**\n * Attempt to dynamically import an optional module\n */\n private async safeImport (moduleName: string) {\n try {\n const mod = await import(moduleName)\n return mod.default ?? mod ?? {}\n } catch {\n return null\n }\n }\n\n /**\n * Get the base path of the app\n * \n * @returns \n */\n getBasePath (): string {\n return this.basePath\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 * @returns \n */\n getPath (name: IPathName, suffix?: string) {\n return path.join(this.paths.getPath(name, this.basePath), suffix ?? '')\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 * @returns \n */\n setPath (name: IPathName, path: string) {\n return this.paths.setPath(name, path, this.basePath)\n }\n\n /**\n * Returns the installed version of the system core and typescript.\n *\n * @returns \n */\n getVersion (key: 'app' | 'ts') {\n return this.versions[key]?.replaceAll(/\\^|~/g, '')\n }\n}\n","import { Application } from '.'\nimport { IController } from '@h3ravel/shared'\n\n/**\n * Base controller class\n */\nexport abstract class Controller implements IController {\n protected app: Application\n\n constructor(app: Application) {\n this.app = app\n }\n\n public show (..._ctx: any[]): any { return }\n public index (..._ctx: any[]): any { return }\n public store (..._ctx: any[]): any { return }\n public update (..._ctx: any[]): any { return }\n public destroy (..._ctx: any[]): any { return }\n}\n","export function Inject (...dependencies: string[]) {\n return function (target: any) {\n target.__inject__ = dependencies;\n };\n}\n\n/**\n * Allows binding dependencies to both class and class methods \n * \n * @returns \n */\nexport function Injectable (): ClassDecorator & MethodDecorator {\n return (...args: any[]) => {\n if (args.length === 1) {\n void args[0]; // class target\n }\n if (args.length === 3) {\n void args[0]; // target\n void args[1]; // propertyKey\n void args[2]; // descriptor\n }\n };\n}\n\n// export function Injectable (): MethodDecorator & ClassDecorator {\n// return ((_target: any, _propertyKey?: string, descriptor?: PropertyDescriptor) => {\n// if (descriptor) {\n// const original = descriptor.value;\n// descriptor.value = async function (...args: any[]) {\n// const resolvedArgs = await Promise.all(args);\n// return original.apply(this, resolvedArgs);\n// };\n// }\n// }) as any;\n// }\n","import { HttpContext, IMiddleware } from '@h3ravel/shared'\n\nimport type { H3Event } from 'h3'\n\n/**\n * Kernel class handles middleware execution and response transformations.\n * It acts as the core middleware pipeline for HTTP requests.\n */\nexport class Kernel {\n /**\n * @param context - A factory function that converts an H3Event into an HttpContext.\n * @param middleware - An array of middleware classes that will be executed in sequence.\n */\n constructor(\n protected context: (event: H3Event) => HttpContext,\n protected middleware: IMiddleware[] = [],\n ) { }\n\n /**\n * Handles an incoming request and passes it through middleware before invoking the next handler.\n * \n * @param event - The raw H3 event object.\n * @param next - A callback function that represents the next layer (usually the controller or final handler).\n * @returns A promise resolving to the result of the request pipeline.\n */\n async handle (\n event: H3Event,\n next: (ctx: HttpContext) => Promise<unknown>\n ): Promise<unknown> {\n /**\n * Convert the raw event into a standardized HttpContext\n */\n const ctx = this.context(event)\n const { app } = ctx.request\n\n /**\n * Dynamically bind the view renderer to the service container.\n * This allows any part of the request lifecycle to render templates using Edge.\n */\n app.bind('view', () => async (template: string, params?: Record<string, any>) => {\n const edge = app.make('edge')\n return ctx.response.html(await edge.render(template, params))\n })\n\n /**\n * Run middleware stack and obtain result\n */\n const result = await this.runMiddleware(ctx, () => next(ctx))\n\n /**\n * If a plain object is returned from a controller or middleware,\n * automatically set the JSON Content-Type header for the response.\n */\n if (result !== undefined && this.isPlainObject(result)) {\n event.res.headers.set('Content-Type', 'application/json; charset=UTF-8')\n }\n\n return result\n }\n\n /**\n * Sequentially runs middleware in the order they were registered.\n * \n * @param context - The standardized HttpContext.\n * @param next - Callback to execute when middleware completes.\n * @returns A promise resolving to the final handler's result.\n */\n private async runMiddleware (\n context: HttpContext,\n next: (ctx: HttpContext) => Promise<unknown>\n ) {\n let index = -1\n\n const runner = async (i: number): Promise<unknown> => {\n if (i <= index) throw new Error('next() called multiple times')\n index = i\n const middleware = this.middleware[i]\n\n if (middleware) {\n /**\n * Execute the current middleware and proceed to the next one\n */\n return middleware.handle(context, () => runner(i + 1))\n } else {\n /**\n * If no more middleware, call the final handler\n */\n return next(context)\n }\n }\n\n return runner(0)\n }\n\n /**\n * Utility function to determine if a value is a plain object or array.\n * \n * @param value - The value to check.\n * @returns True if the value is a plain object or array, otherwise false.\n */\n private isPlainObject (value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' &&\n value !== null &&\n (value.constructor === Object || value.constructor === Array)\n }\n}\n","import { Application } from './Application'\nimport { IServiceProvider } from '@h3ravel/shared'\n\nexport abstract class ServiceProvider implements IServiceProvider {\n /**\n * Sort order\n */\n\n public static order?: `before:${string}` | `after:${string}` | string | undefined;\n\n /**\n * Sort priority\n */\n public static priority = 0;\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = false;\n\n /**\n * List of registered console commands\n */\n public registeredCommands?: (new (app: any, kernel: any) => any)[];\n\n protected app: Application\n\n constructor(app: Application) {\n this.app = app\n }\n\n /**\n * Register bindings to the container.\n * Runs before boot().\n */\n abstract register (...app: unknown[]): void | Promise<void>;\n\n /**\n * Perform post-registration booting of services.\n * Runs after all providers have been registered.\n */\n boot?(...app: unknown[]): void | Promise<void>;\n\n /**\n * An array of console commands to register.\n */\n commands (commands: (new (app: any, kernel: any) => any)[]): void {\n this.registeredCommands = commands\n }\n}\n","import 'reflect-metadata'\n\nimport { ServiceProvider } from '../ServiceProvider'\n\n/**\n * Bootstraps core services and bindings.\n * \n * Bind essential services to the container (logger, config repository).\n * Register app-level singletons.\n * Set up exception handling.\n * \n * Auto-Registered\n */\nexport class CoreServiceProvider extends ServiceProvider {\n public static priority = 999;\n\n register () {\n }\n}\n","import { Edge } from 'edge.js'\nimport { ServiceProvider } from '../ServiceProvider'\n\nexport class ViewServiceProvider extends ServiceProvider {\n public static priority = 995;\n\n register (): void {\n const config = this.app.make('config')\n const edge = Edge.create({\n cache: process.env.NODE_ENV === 'production'\n })\n\n edge.mount(this.app.getPath('views'))\n\n edge.global('asset', this.app.make('asset'))\n edge.global('config', config.get)\n edge.global('app', this.app)\n\n this.app.bind('edge', () => edge)\n }\n}\n"],"mappings":";;;;;;;;;;;AAIA,IAAa,YAAb,MAA6C;CACzC,AAAQ,2BAAW,IAAI,KAA8B;CACrD,AAAQ,6BAAa,IAAI,KAAwB;;;;;;;CAQjD,OAAO,gBAAiB,QAA2B;AAC/C,MAAI,QAAQ,gBAAgB,OAAO,CAAC,SAAS,EAAG,QAAO;EAEvD,MAAM,cAAc,OAAO;AAE3B,OAAK,IAAI,IAAI,GAAG,IAAI,aAAa,IAC7B,KAAI,QAAQ,gBAAgB,QAAQ,WAAW,IAAI,CAAC,SAAS,EACzD,QAAO;AAIf,SAAO;;CAQX,KACI,KACA,SACF;AACE,OAAK,SAAS,IAAI,KAAK,QAAQ;;;;;CAMnC,UACI,KACA,SACF;AACE,OAAK,SAAS,IAAI,WAAW;AACzB,OAAI,CAAC,KAAK,WAAW,IAAI,IAAI,CACzB,MAAK,WAAW,IAAI,KAAK,SAAS,CAAC;AAEvC,UAAO,KAAK,WAAW,IAAI,IAAI;IACjC;;;;;CAMN,KACI,KACqC;;;;AAIrC,MAAI,KAAK,SAAS,IAAI,IAAI,CACtB,QAAO,KAAK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,gBAAgB,kCAAkC;AAG5E,SAAO;;;;;;;;;CAUX,MAAc,cACV,SACA,MACF;EACE,IAAI,QAAQ;EAEZ,MAAM,SAAS,OAAO,MAAgC;AAClD,OAAI,KAAK,MAAO,OAAM,IAAI,MAAM,+BAA+B;AAC/D,WAAQ;GACR,MAAM,aAAa,KAAK,WAAW;AAEnC,OAAI;;;;AAIA,UAAO,WAAW,OAAO,eAAe,OAAO,IAAI,EAAE,CAAC;;;;;AAKtD,UAAO,KAAK,QAAQ;;AAI5B,SAAO,OAAO,EAAE;;;;;;;;CASpB,AAAQ,cAAe,OAAkD;AACrE,SAAO,OAAO,UAAU,YACpB,UAAU,SACT,MAAM,gBAAgB,UAAU,MAAM,gBAAgB;;;;;;ACpGnE,IAAsB,kBAAtB,MAAkE;;;;CAK9D,OAAc;;;;CAKd,OAAc,WAAW;;;;CAKzB,OAAc,UAAU;;;;CAKxB,AAAO;CAEP,AAAU;CAEV,YAAY,KAAkB;AAC1B,OAAK,MAAM;;;;;CAkBf,SAAU,UAAwD;AAC9D,OAAK,qBAAqB;;;;;;;;;;;;;;;AClClC,IAAa,sBAAb,cAAyC,gBAAgB;CACrD,OAAc,WAAW;CAEzB,WAAY;;;;;ACbhB,IAAa,sBAAb,cAAyC,gBAAgB;CACrD,OAAc,WAAW;CAEzB,WAAkB;EACd,MAAM,SAAS,KAAK,IAAI,KAAK,SAAS;EACtC,MAAM,OAAO,KAAK,OAAO,EACrB,OAAO,QAAQ,IAAI,aAAa,cACnC,CAAC;AAEF,OAAK,MAAM,KAAK,IAAI,QAAQ,QAAQ,CAAC;AAErC,OAAK,OAAO,SAAS,KAAK,IAAI,KAAK,QAAQ,CAAC;AAC5C,OAAK,OAAO,UAAU,OAAO,IAAI;AACjC,OAAK,OAAO,OAAO,KAAK,IAAI;AAE5B,OAAK,IAAI,KAAK,cAAc,KAAK"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["dependencies: any[]","app: Application","params: any[]","args: any[]","app: Application","path","nodepath","port: number","tries: number","hostname: string","e: any","path","app: Application","kernel: ConsoleKernel","app: Application","context: (event: H3Event) => HttpContext","middleware: IMiddleware[]"],"sources":["../src/Container.ts","../src/Di/ContainerResolver.ts","../src/Registerer.ts","../src/Application.ts","../src/Console/ConsoleCommand.ts","../src/Console/ConsoleKernel.ts","../src/Controller.ts","../src/Di/Inject.ts","../src/Http/Kernel.ts","../src/ServiceProvider.ts","../src/Providers/CoreServiceProvider.ts","../src/Providers/ViewServiceProvider.ts"],"sourcesContent":["import type { Bindings, IContainer, UseKey } from '@h3ravel/shared'\n\ntype IBinding = UseKey | (new (..._args: any[]) => unknown)\n\nexport class Container implements IContainer {\n private bindings = new Map<IBinding, () => unknown>()\n private singletons = new Map<IBinding, unknown>()\n\n /**\n * Check if the target has any decorators\n * \n * @param target \n * @returns \n */\n static hasAnyDecorator (target: (...prm: any[]) => any): boolean {\n if (Reflect.getMetadataKeys(target).length > 0) return true\n\n const paramLength = target.length\n\n for (let i = 0; i < paramLength; i++) {\n if (Reflect.getMetadataKeys(target, `__param_${i}`).length > 0) {\n return true\n }\n }\n\n return false\n }\n\n /**\n * Bind a transient service to the container\n */\n bind<T> (key: new (...args: any[]) => T, factory: () => T): void\n bind<T extends UseKey> (key: T, factory: () => Bindings[T]): void\n bind<T extends UseKey> (\n key: T,\n factory: () => Bindings[T] | T\n ) {\n this.bindings.set(key, factory)\n }\n\n /**\n * Bind a singleton service to the container\n */\n singleton<T extends UseKey> (\n key: T | (new (..._args: any[]) => Bindings[T]),\n factory: () => Bindings[T]\n ) {\n this.bindings.set(key, () => {\n if (!this.singletons.has(key)) {\n this.singletons.set(key, factory())\n }\n return this.singletons.get(key)!\n })\n }\n\n /**\n * Resolve a service from the container\n */\n make<T extends UseKey, X = undefined> (\n key: T | (new (..._args: any[]) => Bindings[T])\n ): X extends undefined ? Bindings[T] : X {\n /**\n * Direct factory binding\n */\n if (this.bindings.has(key)) {\n return this.bindings.get(key)!() as Bindings[T]\n }\n\n /**\n * If this is a class constructor, auto-resolve via reflection\n */\n if (typeof key === 'function') {\n return this.build(key)\n }\n\n throw new Error(\n `No binding found for key: ${typeof key === 'string' ? key : (key as any)?.name}`\n )\n }\n\n /**\n * Automatically build a class with constructor dependency injection\n */\n private build<T extends UseKey> (ClassType: new (..._args: any[]) => Bindings[T]): Bindings[T] {\n let dependencies: any[] = []\n\n if (Array.isArray((ClassType as any).__inject__)) {\n dependencies = (ClassType as any).__inject__.map((alias: any) => {\n return this.make(alias)\n })\n } else {\n const paramTypes: any[] = Reflect.getMetadata('design:paramtypes', ClassType) || []\n dependencies = paramTypes.map((dep) => this.make(dep))\n }\n\n return new ClassType(...dependencies)\n }\n\n /**\n * Check if a service is registered\n */\n has (key: UseKey): boolean {\n return this.bindings.has(key)\n }\n}\n","import 'reflect-metadata'\n\nimport { Application } from '..'\n\nexport class ContainerResolver {\n constructor(private app: Application) { }\n\n async resolveMethodParams<I extends Record<string, any>> (instance: I, method: keyof I, _default?: any) {\n /**\n * Get param types for instance method\n */\n let params: any[] = Reflect.getMetadata('design:paramtypes', instance, String(method)) || []\n\n /**\n * Ensure that the Application class is always available\n */\n if (params.length < 1 && _default) {\n params = [_default]\n }\n\n /**\n * Resolve the bound dependencies\n */\n const args: any[] = params.filter(e => ContainerResolver.isClass(e)).map((type: any) => {\n return this.app.make(type)\n })\n\n return new Promise<I>((resolve) => {\n resolve(instance[method](...args))\n })\n }\n\n static isClass (C: any) {\n return typeof C === 'function' &&\n C.prototype !== undefined &&\n Object.toString.call(C).substring(0, 5) === 'class'\n }\n}\n","import { dd, dump } from '@h3ravel/support'\n\nimport { Application } from '.'\nimport nodepath from 'node:path'\n\nexport class Registerer {\n constructor(private app: Application) { }\n\n static register (app: Application) {\n const reg = new Registerer(app)\n reg.bootRegister()\n }\n\n bootRegister () {\n globalThis.dd = dd\n globalThis.dump = dump\n globalThis.app_path = (path?: string) => this.appPath(path)\n globalThis.base_path = (path?: string) => this.basePath(path)\n globalThis.public_path = (path?: string) => this.publicPath(path)\n globalThis.storage_path = (path?: string) => this.storagePath(path)\n globalThis.database_path = (path?: string) => this.databasePath(path)\n }\n\n private appPath (path?: string) {\n return this.app.getPath(\n 'base', nodepath.join(`/${process.env.SRC_PATH ?? 'src'}/`.replace(/([^:]\\/)\\/+/g, '$1'), 'app', path ?? '')\n )\n }\n\n private basePath (path?: string) {\n return this.app.getPath('base', path)\n }\n\n private publicPath (path?: string) {\n return this.app.getPath('public', path)\n }\n\n private storagePath (path?: string) {\n return this.app.getPath('base', nodepath.join('storage', path ?? ''))\n }\n\n private databasePath (path?: string) {\n return this.app.getPath('database', path)\n }\n}\n","import 'reflect-metadata'\n\nimport { IApplication, IPathName, IServiceProvider, Logger } from '@h3ravel/shared'\n\nimport { Container } from './Container'\nimport { ContainerResolver } from './Di/ContainerResolver'\nimport type { H3 } from 'h3'\nimport { PathLoader } from '@h3ravel/shared'\nimport { Registerer } from './Registerer'\nimport chalk from 'chalk'\nimport { detect } from 'detect-port'\nimport dotenv from 'dotenv'\nimport dotenvExpand from 'dotenv-expand'\nimport path from 'node:path'\n\ntype AServiceProvider = (new (_app: Application) => IServiceProvider) & IServiceProvider\n\nexport class Application extends Container implements IApplication {\n public paths = new PathLoader()\n private tries: number = 0\n private booted = false\n private versions = { app: '0', ts: '0' }\n private basePath: string\n\n private providers: IServiceProvider[] = []\n protected externalProviders: Array<new (_app: Application) => IServiceProvider> = []\n\n /**\n * List of registered console commands\n */\n public registeredCommands: (new (app: any, kernel: any) => any)[] = []\n\n constructor(basePath: string) {\n super()\n\n dotenvExpand.expand(dotenv.config({ quiet: true }))\n\n this.basePath = basePath\n this.setPath('base', basePath)\n this.loadOptions()\n this.registerBaseBindings()\n Registerer.register(this)\n }\n\n /**\n * Register core bindings into the container\n */\n protected registerBaseBindings () {\n this.bind(Application, () => this)\n this.bind('path.base', () => this.basePath)\n this.bind('load.paths', () => this.paths)\n }\n\n /**\n * Dynamically register all configured providers\n */\n public async registerConfiguredProviders () {\n const providers = await this.getAllProviders()\n\n for (const ProviderClass of providers) {\n if (!ProviderClass) continue\n const provider = new ProviderClass(this)\n await this.register(provider)\n }\n }\n\n protected async loadOptions () {\n const app = await this.safeImport(this.getPath('base', 'package.json'))\n const core = await this.safeImport('../package.json')\n\n if (app && app.dependencies) {\n this.versions.app = app.dependencies['@h3ravel/core']\n }\n if (core && core.devDependencies) {\n this.versions.ts = app.devDependencies.typescript\n }\n }\n\n /**\n * Get all registered providers\n */\n public getRegisteredProviders () {\n return this.providers\n }\n\n /**\n * Load default and optional providers dynamically\n * \n * Auto-Registration Behavior\n * \n * Minimal App: Loads only core, config, http, router by default.\n * Full-Stack App: Installs database, mail, queue, cache → they self-register via their providers.\n */\n protected async getConfiguredProviders (): Promise<Array<AServiceProvider>> {\n return [\n (await import('@h3ravel/core')).CoreServiceProvider,\n (await import('@h3ravel/core')).ViewServiceProvider,\n ]\n }\n\n protected async getAllProviders (): Promise<Array<AServiceProvider>> {\n const coreProviders = await this.getConfiguredProviders()\n const allProviders = [...coreProviders, ...this.externalProviders]\n\n /**\n * Deduplicate by class reference\n */\n const uniqueProviders = Array.from(new Set(allProviders))\n\n return this.sortProviders(uniqueProviders)\n }\n\n private sortProviders (providers: Array<AServiceProvider>) {\n const priorityMap = new Map<string, number>()\n\n /**\n * Base priority (default 0)\n */\n providers.forEach((Provider) => {\n priorityMap.set(Provider.name, (Provider as any).priority ?? 0)\n })\n\n /**\n * Handle before/after adjustments\n */\n providers.forEach((Provider) => {\n const order = (Provider as any).order\n if (!order) return\n\n const [direction, target] = order.split(':')\n const targetPriority = priorityMap.get(target) ?? 0\n\n if (direction === 'before') {\n priorityMap.set(Provider.name, targetPriority - 1)\n } else if (direction === 'after') {\n priorityMap.set(Provider.name, targetPriority + 1)\n }\n })\n\n /**\n * Service providers sorted based on thier name and priority\n */\n const sorted = providers.sort(\n (A, B) => (priorityMap.get(B.name) ?? 0) - (priorityMap.get(A.name) ?? 0)\n )\n\n /**\n * If debug is enabled, let's show the loaded service provider info\n */\n if (process.env.APP_DEBUG === 'true' && process.env.EXTENDED_DEBUG !== 'false' && !sorted.some(e => e.console)) {\n console.table(\n sorted.map((P) => ({\n Provider: P.name,\n Priority: priorityMap.get(P.name),\n Order: (P as any).order || 'N/A',\n }))\n )\n\n console.info(`Set ${chalk.bgCyan(' APP_DEBUG = false ')} in your .env file to hide this information`, '\\n')\n }\n\n return sorted\n }\n\n registerProviders (providers: Array<AServiceProvider>): void {\n this.externalProviders.push(...providers)\n }\n\n /**\n * Register a provider\n */\n public async register (provider: IServiceProvider) {\n await new ContainerResolver(this).resolveMethodParams(provider, 'register', this)\n if (provider.registeredCommands && provider.registeredCommands.length > 0) {\n this.registeredCommands.push(...provider.registeredCommands)\n }\n this.providers.push(provider)\n }\n\n /**\n * checks if the application is running in CLI\n */\n public runningInConsole (): boolean {\n return typeof process !== 'undefined'\n && !!process.stdout\n && !!process.stdin\n\n }\n\n public getRuntimeEnv (): 'browser' | 'node' | 'unknown' {\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n return 'browser'\n }\n if (typeof process !== 'undefined' && process.versions?.node) {\n return 'node'\n }\n return 'unknown'\n }\n\n /**\n * Boot all service providers after registration\n */\n public async boot () {\n if (this.booted) return\n\n for (const provider of this.providers) {\n if (provider.boot) {\n if (Container.hasAnyDecorator(provider.boot)) {\n /**\n * If the service provider is decorated use the IoC container\n */\n await this.make<any>(provider.boot)\n } else {\n /**\n * Otherwise instantiate manually so that we can at least\n * pass the app instance\n */\n await provider.boot(this)\n }\n }\n }\n\n this.booted = true\n }\n\n /**\n * Fire up the developement server using the user provided arguments\n * \n * Port will be auto assigned if provided one is not available\n * \n * @param h3App The current H3 app instance\n * @param preferedPort If provided, this will overide the port set in the evironment\n */\n public async fire (h3App: H3, preferedPort?: number) {\n const serve = this.make('http.serve')\n\n const port: number = preferedPort ?? env('PORT', 3000)\n const tries: number = env('RETRIES', 1)\n const hostname: string = env('HOSTNAME', 'localhost')\n\n try {\n const realPort = await detect(port)\n\n if (port == realPort) {\n const server = serve(h3App, {\n port,\n hostname,\n silent: true,\n })\n\n Logger.parse([\n ['🚀 H3ravel running at:', 'green'],\n [`${server.options.protocol ?? 'http'}://${server.options.hostname}:${server.options.port}`, 'cyan']]\n )\n } else if (this.tries <= tries) {\n await this.fire(h3App, realPort)\n this.tries++\n } else {\n Logger.parse([\n ['ERROR:', 'bgRed'],\n ['No free port available', 'red'],\n ])\n }\n } catch (e: any) {\n Logger.parse([\n ['An error occured', 'bgRed'],\n [e.message, 'red'],\n [e.stack, 'red']\n ], '\\n')\n }\n }\n\n /**\n * Attempt to dynamically import an optional module\n */\n private async safeImport (moduleName: string) {\n try {\n const mod = await import(moduleName)\n return mod.default ?? mod ?? {}\n } catch {\n return null\n }\n }\n\n /**\n * Get the base path of the app\n * \n * @returns \n */\n getBasePath (): string {\n return this.basePath\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 * @returns \n */\n getPath (name: IPathName, suffix?: string) {\n return path.join(this.paths.getPath(name, this.basePath), suffix ?? '')\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 * @returns \n */\n setPath (name: IPathName, path: string) {\n return this.paths.setPath(name, path, this.basePath)\n }\n\n /**\n * Returns the installed version of the system core and typescript.\n *\n * @returns \n */\n getVersion (key: 'app' | 'ts') {\n return this.versions[key]?.replaceAll(/\\^|~/g, '')\n }\n}\n","import type { Argument, Command } from 'commander'\n\nimport { Application } from '../Application'\nimport { ConsoleKernel } from './ConsoleKernel'\nimport { XGeneric } from '@h3ravel/support'\n\nexport class ConsoleCommand {\n constructor(protected app: Application, protected kernel: ConsoleKernel) { }\n\n /**\n * The underlying commander instance.\n *\n * @var Command\n */\n public program!: Command\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature!: string\n\n /**\n * A dictionary of signatures or what not.\n *\n * @var object\n */\n protected dictionary: Record<string, any> = {}\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description?: string\n\n /**\n * The console command input.\n *\n * @var object\n */\n private input: XGeneric<{ options: Record<string, any>, arguments: Record<string, any> }> = {\n options: {},\n arguments: {},\n }\n\n /**\n * Execute the console command.\n */\n public async handle (..._args: any[]): Promise<void> { }\n\n setApplication (app: Application) {\n this.app = app\n }\n\n setInput (\n options: XGeneric,\n args: string[],\n regArgs: readonly Argument[],\n dictionary: Record<string, any>,\n program: Command,\n ) {\n this.program = program\n this.dictionary = dictionary\n this.input.options = options\n this.input.arguments = regArgs\n .map((e, i) => ({ [e.name()]: args[i] }))\n .reduce((e, x) => Object.assign(e, x), {})\n this.loadBaseFlags()\n }\n\n getSignature () {\n return this.signature\n }\n\n getDescription () {\n return this.description\n }\n\n option (key: string, def?: any) {\n return this.input.options[key] ?? def\n }\n\n options (key?: string) {\n if (key) {\n return this.input.options[key]\n }\n return this.input.options\n }\n\n argument (key: string, def?: any) {\n return this.input.arguments[key] ?? def\n }\n\n arguments () {\n return this.input.arguments\n }\n\n loadBaseFlags () {\n this.input.options.lock = this.program.getOptionValue('lock') ?? false\n this.input.options.quiet = this.program.getOptionValue('quiet') ?? false\n this.input.options.silent = this.program.getOptionValue('silent') ?? false\n this.input.options.verbose = this.program.getOptionValue('verbose') ?? 0\n }\n}\n","import { Application } from '../Application'\nimport { Logger } from '@h3ravel/shared'\nimport { XGeneric } from '@h3ravel/support'\nimport { mkdir } from 'node:fs/promises'\n\nexport class ConsoleKernel {\n public cwd!: string\n public output = typeof Logger\n public basePath: string = ''\n public modulePath!: string\n public consolePath!: string\n public modulePackage!: XGeneric<{ version: string }>\n public consolePackage!: XGeneric<{ version: string }>\n\n constructor(public app: Application) { }\n\n async ensureDirectoryExists (dir: string) {\n await mkdir(dir, { recursive: true })\n }\n}\n","import { Application } from '.'\nimport { IController } from '@h3ravel/shared'\n\n/**\n * Base controller class\n */\nexport abstract class Controller implements IController {\n protected app: Application\n\n constructor(app: Application) {\n this.app = app\n }\n\n public show (..._ctx: any[]): any { return }\n public index (..._ctx: any[]): any { return }\n public store (..._ctx: any[]): any { return }\n public update (..._ctx: any[]): any { return }\n public destroy (..._ctx: any[]): any { return }\n}\n","export function Inject (...dependencies: string[]) {\n return function (target: any) {\n target.__inject__ = dependencies\n }\n}\n\n/**\n * Allows binding dependencies to both class and class methods \n * \n * @returns \n */\nexport function Injectable (): ClassDecorator & MethodDecorator {\n return (...args: any[]) => {\n if (args.length === 1) {\n void args[0] // class target\n }\n if (args.length === 3) {\n void args[0] // target\n void args[1] // propertyKey\n void args[2] // descriptor\n }\n }\n}\n\n// export function Injectable (): MethodDecorator & ClassDecorator {\n// return ((_target: any, _propertyKey?: string, descriptor?: PropertyDescriptor) => {\n// if (descriptor) {\n// const original = descriptor.value;\n// descriptor.value = async function (...args: any[]) {\n// const resolvedArgs = await Promise.all(args);\n// return original.apply(this, resolvedArgs);\n// };\n// }\n// }) as any;\n// }\n","import { HttpContext, IMiddleware } from '@h3ravel/shared'\n\nimport type { H3Event } from 'h3'\n\n/**\n * Kernel class handles middleware execution and response transformations.\n * It acts as the core middleware pipeline for HTTP requests.\n */\nexport class Kernel {\n /**\n * @param context - A factory function that converts an H3Event into an HttpContext.\n * @param middleware - An array of middleware classes that will be executed in sequence.\n */\n constructor(\n protected context: (event: H3Event) => HttpContext,\n protected middleware: IMiddleware[] = [],\n ) { }\n\n /**\n * Handles an incoming request and passes it through middleware before invoking the next handler.\n * \n * @param event - The raw H3 event object.\n * @param next - A callback function that represents the next layer (usually the controller or final handler).\n * @returns A promise resolving to the result of the request pipeline.\n */\n async handle (\n event: H3Event,\n next: (ctx: HttpContext) => Promise<unknown>\n ): Promise<unknown> {\n /**\n * Convert the raw event into a standardized HttpContext\n */\n const ctx = this.context(event)\n const { app } = ctx.request\n\n /**\n * Initialize the view handler method\n * \n * @param template \n * @param params \n * @returns \n */\n const view = async (template: string, params?: Record<string, any>) => {\n const edge = app.make('edge')\n return ctx.response.html(await edge.render(template, params))\n }\n\n /**\n * Bind the view method to the global variable space\n */\n globalThis.view = view\n\n /**\n * Dynamically bind the view renderer to the service container.\n * This allows any part of the request lifecycle to render templates using Edge.\n */\n app.bind('view', () => view)\n\n /**\n * Run middleware stack and obtain result\n */\n const result = await this.runMiddleware(ctx, () => next(ctx))\n\n /**\n * If a plain object is returned from a controller or middleware,\n * automatically set the JSON Content-Type header for the response.\n */\n if (result !== undefined && this.isPlainObject(result)) {\n event.res.headers.set('Content-Type', 'application/json; charset=UTF-8')\n }\n\n return result\n }\n\n /**\n * Sequentially runs middleware in the order they were registered.\n * \n * @param context - The standardized HttpContext.\n * @param next - Callback to execute when middleware completes.\n * @returns A promise resolving to the final handler's result.\n */\n private async runMiddleware (\n context: HttpContext,\n next: (ctx: HttpContext) => Promise<unknown>\n ) {\n let index = -1\n\n const runner = async (i: number): Promise<unknown> => {\n if (i <= index) throw new Error('next() called multiple times')\n index = i\n const middleware = this.middleware[i]\n\n if (middleware) {\n /**\n * Execute the current middleware and proceed to the next one\n */\n return middleware.handle(context, () => runner(i + 1))\n } else {\n /**\n * If no more middleware, call the final handler\n */\n return next(context)\n }\n }\n\n return runner(0)\n }\n\n /**\n * Utility function to determine if a value is a plain object or array.\n * \n * @param value - The value to check.\n * @returns True if the value is a plain object or array, otherwise false.\n */\n private isPlainObject (value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' &&\n value !== null &&\n (value.constructor === Object || value.constructor === Array)\n }\n}\n","import { Application } from './Application'\nimport { IServiceProvider } from '@h3ravel/shared'\n\nexport abstract class ServiceProvider implements IServiceProvider {\n /**\n * Sort order\n */\n\n public static order?: `before:${string}` | `after:${string}` | string | undefined\n\n /**\n * Sort priority\n */\n public static priority = 0\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = false\n\n /**\n * List of registered console commands\n */\n public registeredCommands?: (new (app: any, kernel: any) => any)[]\n\n protected app: Application\n\n constructor(app: Application) {\n this.app = app\n }\n\n /**\n * Register bindings to the container.\n * Runs before boot().\n */\n abstract register (...app: unknown[]): void | Promise<void>;\n\n /**\n * Perform post-registration booting of services.\n * Runs after all providers have been registered.\n */\n boot?(...app: unknown[]): void | Promise<void>;\n\n /**\n * An array of console commands to register.\n */\n commands (commands: (new (app: any, kernel: any) => any)[]): void {\n this.registeredCommands = commands\n }\n}\n","import 'reflect-metadata'\n\nimport { ServiceProvider } from '../ServiceProvider'\n\n/**\n * Bootstraps core services and bindings.\n * \n * Bind essential services to the container (logger, config repository).\n * Register app-level singletons.\n * Set up exception handling.\n * \n * Auto-Registered\n */\nexport class CoreServiceProvider extends ServiceProvider {\n public static priority = 999\n\n register () {\n }\n}\n","import { Edge } from 'edge.js'\nimport { ServiceProvider } from '../ServiceProvider'\n\nexport class ViewServiceProvider extends ServiceProvider {\n public static priority = 995\n\n register (): void {\n const config = this.app.make('config')\n const edge = Edge.create({\n cache: process.env.NODE_ENV === 'production'\n })\n\n edge.mount(this.app.getPath('views'))\n\n edge.global('asset', this.app.make('asset'))\n edge.global('config', config.get)\n edge.global('app', this.app)\n\n this.app.bind('edge', () => edge)\n }\n}\n"],"mappings":";;;;;;;;;;;;AAIA,IAAa,YAAb,MAA6C;CACzC,AAAQ,2BAAW,IAAI,KAA8B;CACrD,AAAQ,6BAAa,IAAI,KAAwB;;;;;;;CAQjD,OAAO,gBAAiB,QAAyC;AAC7D,MAAI,QAAQ,gBAAgB,OAAO,CAAC,SAAS,EAAG,QAAO;EAEvD,MAAM,cAAc,OAAO;AAE3B,OAAK,IAAI,IAAI,GAAG,IAAI,aAAa,IAC7B,KAAI,QAAQ,gBAAgB,QAAQ,WAAW,IAAI,CAAC,SAAS,EACzD,QAAO;AAIf,SAAO;;CAQX,KACI,KACA,SACF;AACE,OAAK,SAAS,IAAI,KAAK,QAAQ;;;;;CAMnC,UACI,KACA,SACF;AACE,OAAK,SAAS,IAAI,WAAW;AACzB,OAAI,CAAC,KAAK,WAAW,IAAI,IAAI,CACzB,MAAK,WAAW,IAAI,KAAK,SAAS,CAAC;AAEvC,UAAO,KA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O,KAAK,OAAO,EACrB,OAAO,QAAQ,IAAI,aAAa,cACnC,CAAC;AAEF,OAAK,MAAM,KAAK,IAAI,QAAQ,QAAQ,CAAC;AAErC,OAAK,OAAO,SAAS,KAAK,IAAI,KAAK,QAAQ,CAAC;AAC5C,OAAK,OAAO,UAAU,OAAO,IAAI;AACjC,OAAK,OAAO,OAAO,KAAK,IAAI;AAE5B,OAAK,IAAI,KAAK,cAAc,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Core application container, lifecycle management and service providers for H3ravel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"chalk": "^5.6.2",
|
|
47
|
+
"commander": "^14.0.1",
|
|
48
|
+
"detect-port": "^2.1.0",
|
|
47
49
|
"dotenv": "^17.2.2",
|
|
48
50
|
"dotenv-expand": "^12.0.3",
|
|
49
51
|
"edge.js": "^6.3.0",
|
|
@@ -51,9 +53,8 @@
|
|
|
51
53
|
"reflect-metadata": "^0.2.2",
|
|
52
54
|
"srvx": "^0.8.7",
|
|
53
55
|
"tslib": "^2.8.1",
|
|
54
|
-
"
|
|
55
|
-
"@h3ravel/support": "^0.10.0"
|
|
56
|
-
"@h3ravel/shared": "^0.18.0"
|
|
56
|
+
"@h3ravel/shared": "^0.19.0",
|
|
57
|
+
"@h3ravel/support": "^0.10.0"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"typescript": "^5.9.2"
|