@h3ravel/core 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/package.json +3 -3
- package/src/Application.ts +5 -5
- package/src/Container.ts +1 -1
- package/src/Contracts/BindingsContract.ts +5 -5
- package/src/Controller.ts +2 -2
- package/src/Utils/PathLoader.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @h3ravel/core
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8ceb2c1: implement the Application class directly since it already implements the IClass contract
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- a27f452: chore: fix all linting issues.
|
|
12
|
+
- c906050: chore: migrate tests suite to jest
|
|
13
|
+
- Updated dependencies [8ceb2c1]
|
|
14
|
+
- Updated dependencies [a27f452]
|
|
15
|
+
- Updated dependencies [c906050]
|
|
16
|
+
- @h3ravel/shared@0.4.0
|
|
17
|
+
|
|
3
18
|
## 0.3.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Core application container, lifecycle management and service providers for H3ravel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"reflect-metadata": "^0.2.2",
|
|
15
15
|
"srvx": "^0.8.2",
|
|
16
16
|
"tslib": "^2.6.0",
|
|
17
|
-
"@h3ravel/shared": "0.
|
|
17
|
+
"@h3ravel/shared": "0.4.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"typescript": "^5.4.0"
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"dev": "tsx watch src/index.ts",
|
|
26
26
|
"start": "node dist/index.js",
|
|
27
27
|
"lint": "eslint . --ext .ts",
|
|
28
|
-
"test": "
|
|
28
|
+
"test": "jest --passWithNoTests"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/Application.ts
CHANGED
|
@@ -11,7 +11,7 @@ export class Application extends Container implements IApplication {
|
|
|
11
11
|
private basePath: string
|
|
12
12
|
|
|
13
13
|
private providers: IServiceProvider[] = []
|
|
14
|
-
protected externalProviders: Array<new (_app:
|
|
14
|
+
protected externalProviders: Array<new (_app: Application) => IServiceProvider> = []
|
|
15
15
|
|
|
16
16
|
constructor(basePath: string) {
|
|
17
17
|
super()
|
|
@@ -63,7 +63,7 @@ export class Application extends Container implements IApplication {
|
|
|
63
63
|
* Minimal App: Loads only core, config, http, router by default.
|
|
64
64
|
* Full-Stack App: Installs database, mail, queue, cache → they self-register via their providers.
|
|
65
65
|
*/
|
|
66
|
-
protected async getConfiguredProviders (): Promise<Array<new (_app:
|
|
66
|
+
protected async getConfiguredProviders (): Promise<Array<new (_app: Application) => IServiceProvider>> {
|
|
67
67
|
return [
|
|
68
68
|
(await this.safeImport('@h3ravel/core')).AppServiceProvider,
|
|
69
69
|
(await this.safeImport('@h3ravel/http')).HttpServiceProvider,
|
|
@@ -79,12 +79,12 @@ export class Application extends Container implements IApplication {
|
|
|
79
79
|
]
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
protected async getAllProviders (): Promise<Array<new (_app:
|
|
82
|
+
protected async getAllProviders (): Promise<Array<new (_app: Application) => IServiceProvider>> {
|
|
83
83
|
const coreProviders = await this.getConfiguredProviders()
|
|
84
84
|
return [...coreProviders, ...this.externalProviders]
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
registerProviders (providers: Array<new (_app:
|
|
87
|
+
registerProviders (providers: Array<new (_app: Application) => IServiceProvider>): void {
|
|
88
88
|
this.externalProviders.push(...providers)
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -160,6 +160,6 @@ export class Application extends Container implements IApplication {
|
|
|
160
160
|
* @returns
|
|
161
161
|
*/
|
|
162
162
|
getVersion (key: 'app' | 'ts') {
|
|
163
|
-
return this.versions[key]?.replaceAll(
|
|
163
|
+
return this.versions[key]?.replaceAll(/\^|~/g, '')
|
|
164
164
|
}
|
|
165
165
|
}
|
package/src/Container.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// import { DotNestedKeys, DotNestedValue } from "@h3ravel/support";
|
|
2
|
-
import type { H3, serve } from
|
|
2
|
+
import type { H3, serve } from 'h3'
|
|
3
3
|
|
|
4
|
-
import type { Edge } from
|
|
5
|
-
import { IRouter } from
|
|
6
|
-
import { PathLoader } from
|
|
4
|
+
import type { Edge } from 'edge.js'
|
|
5
|
+
import { IRouter } from '@h3ravel/shared'
|
|
6
|
+
import { PathLoader } from '../Utils/PathLoader'
|
|
7
7
|
|
|
8
8
|
type RemoveIndexSignature<T> = {
|
|
9
9
|
[K in keyof T as string extends K
|
|
@@ -15,7 +15,7 @@ type RemoveIndexSignature<T> = {
|
|
|
15
15
|
|
|
16
16
|
export type Bindings = {
|
|
17
17
|
[key: string]: any;
|
|
18
|
-
env
|
|
18
|
+
env (): NodeJS.ProcessEnv
|
|
19
19
|
env<T extends string> (key: T, def?: any): any
|
|
20
20
|
view: Edge,
|
|
21
21
|
asset (key: string, def?: string): string,
|
package/src/Controller.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpContext,
|
|
1
|
+
import { HttpContext, IController } from '@h3ravel/shared'
|
|
2
2
|
|
|
3
3
|
import { Application } from '.'
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import { Application } from '.'
|
|
|
6
6
|
* Base controller class
|
|
7
7
|
*/
|
|
8
8
|
export abstract class Controller implements IController {
|
|
9
|
-
protected app:
|
|
9
|
+
protected app: Application
|
|
10
10
|
|
|
11
11
|
constructor(app: Application) {
|
|
12
12
|
this.app = app
|
package/src/Utils/PathLoader.ts
CHANGED