@h3ravel/config 1.2.0 → 1.3.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/package.json CHANGED
@@ -1,10 +1,21 @@
1
1
  {
2
2
  "name": "@h3ravel/config",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Environment/config loading and management system for H3ravel.",
5
5
  "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "module": "./dist/index.js",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
8
19
  "publishConfig": {
9
20
  "access": "public"
10
21
  },
@@ -24,19 +35,13 @@
24
35
  "typescript",
25
36
  "laravel"
26
37
  ],
27
- "exports": {
28
- ".": {
29
- "import": "./dist/index.js",
30
- "types": "./dist/index.d.ts"
31
- }
32
- },
33
38
  "dependencies": {
34
- "@h3ravel/support": "^0.7.5",
35
- "@h3ravel/shared": "^0.15.4"
39
+ "@h3ravel/shared": "^0.16.1",
40
+ "@h3ravel/support": "^0.8.1"
36
41
  },
37
42
  "devDependencies": {
38
43
  "typescript": "^5.4.0",
39
- "@h3ravel/core": "^1.3.0"
44
+ "@h3ravel/core": "^1.4.1"
40
45
  },
41
46
  "scripts": {
42
47
  "barrel": "barrelsby --directory src --delete --singleQuotes",
package/CHANGELOG.md DELETED
@@ -1,238 +0,0 @@
1
- # @h3ravel/config
2
-
3
- ## 1.2.0
4
-
5
- ### Minor Changes
6
-
7
- - feat: implement full IoC container resolution
8
-
9
- ### Patch Changes
10
-
11
- - Updated dependencies
12
- - @h3ravel/shared@0.15.4
13
-
14
- ## 1.1.7
15
-
16
- ### Patch Changes
17
-
18
- - feat: add homepage and repository to all packages.
19
- - Updated dependencies
20
- - @h3ravel/shared@0.15.2
21
- - @h3ravel/support@0.7.5
22
-
23
- ## 1.1.6
24
-
25
- ### Patch Changes
26
-
27
- - chore: update readme accros all packages
28
- - Updated dependencies
29
- - @h3ravel/shared@0.15.1
30
- - @h3ravel/support@0.7.4
31
-
32
- ## 1.1.5
33
-
34
- ### Patch Changes
35
-
36
- - Updated dependencies [d07ff49]
37
- - @h3ravel/shared@0.15.0
38
- - @h3ravel/support@0.7.3
39
-
40
- ## 1.1.4
41
-
42
- ### Patch Changes
43
-
44
- - db0dd70: chore: revert to old workspace core dependency
45
-
46
- ## 1.1.3
47
-
48
- ### Patch Changes
49
-
50
- - fix dependency.
51
-
52
- ## 1.1.2
53
-
54
- ### Patch Changes
55
-
56
- - chore: require the latest dependencies from the framework
57
- - Updated dependencies
58
- - @h3ravel/support@0.7.3
59
- - @h3ravel/core@1.1.2
60
-
61
- ## 1.1.1
62
-
63
- ### Patch Changes
64
-
65
- - Updated dependencies
66
- - @h3ravel/shared@0.14.0
67
- - @h3ravel/core@1.1.1
68
- - @h3ravel/support@0.7.2
69
-
70
- ## 1.1.0
71
-
72
- ### Minor Changes
73
-
74
- - 6e249fe: feat: bind view as a self contained method to render views
75
-
76
- ### Patch Changes
77
-
78
- - Updated dependencies [6e249fe]
79
- - @h3ravel/shared@0.13.0
80
- - @h3ravel/core@1.1.0
81
- - @h3ravel/support@0.7.2
82
-
83
- ## 1.0.9
84
-
85
- ### Patch Changes
86
-
87
- - chore: regularize all interfaces.
88
- - Updated dependencies
89
- - @h3ravel/core@1.0.9
90
- - @h3ravel/shared@0.12.1
91
- - @h3ravel/support@0.7.2
92
-
93
- ## 1.0.8
94
-
95
- ### Patch Changes
96
-
97
- - Updated dependencies
98
- - @h3ravel/shared@0.12.0
99
- - @h3ravel/core@1.0.8
100
- - @h3ravel/support@0.7.1
101
-
102
- ## 1.0.7
103
-
104
- ### Patch Changes
105
-
106
- - Updated dependencies
107
- - @h3ravel/shared@0.11.0
108
- - @h3ravel/core@1.0.7
109
- - @h3ravel/support@0.7.1
110
-
111
- ## 1.0.6
112
-
113
- ### Patch Changes
114
-
115
- - Updated dependencies
116
- - @h3ravel/shared@0.10.0
117
- - @h3ravel/core@1.0.6
118
- - @h3ravel/support@0.7.1
119
-
120
- ## 1.0.5
121
-
122
- ### Patch Changes
123
-
124
- - Updated dependencies
125
- - @h3ravel/shared@0.9.0
126
- - @h3ravel/core@1.0.5
127
- - @h3ravel/support@0.7.1
128
-
129
- ## 1.0.4
130
-
131
- ### Patch Changes
132
-
133
- - Updated dependencies
134
- - @h3ravel/shared@0.8.0
135
- - @h3ravel/core@1.0.4
136
- - @h3ravel/support@0.7.1
137
-
138
- ## 1.0.3
139
-
140
- ### Patch Changes
141
-
142
- - chore: add download count to readme
143
- - Updated dependencies
144
- - @h3ravel/core@1.0.3
145
- - @h3ravel/shared@0.7.1
146
- - @h3ravel/support@0.7.1
147
-
148
- ## 1.0.2
149
-
150
- ### Patch Changes
151
-
152
- - Updated dependencies [b0d1b7c]
153
- - Updated dependencies [ce51a92]
154
- - @h3ravel/support@0.7.0
155
- - @h3ravel/shared@0.7.0
156
- - @h3ravel/core@1.0.2
157
-
158
- ## 1.0.0
159
-
160
- ### Major Changes
161
-
162
- - b40caeb: feat: make service providers sortable and unique while only loading the core providers by default.
163
- Service providers are no longer loaded by default, asides the ones provided by @h3ravel/core
164
- Service provides are sorted by an optional order and priority property.
165
-
166
- ### Patch Changes
167
-
168
- - Updated dependencies [b40caeb]
169
- - @h3ravel/core@1.0.0
170
- - @h3ravel/shared@0.6.0
171
- - @h3ravel/support@0.6.0
172
-
173
- ## 0.5.2
174
-
175
- ### Patch Changes
176
-
177
- - dynamically import dotenv
178
-
179
- ## 0.5.1
180
-
181
- ### Patch Changes
182
-
183
- - feat: hide all dotenv debug info
184
-
185
- ## 0.5.0
186
-
187
- ### Minor Changes
188
-
189
- - rebuild all dependencies
190
-
191
- ### Patch Changes
192
-
193
- - Updated dependencies
194
- - @h3ravel/core@0.5.0
195
- - @h3ravel/shared@0.5.0
196
- - @h3ravel/support@0.5.0
197
-
198
- ## 0.4.0
199
-
200
- ### Minor Changes
201
-
202
- - 8ceb2c1: implement the Application class directly since it already implements the IClass contract
203
-
204
- ### Patch Changes
205
-
206
- - a27f452: chore: fix all linting issues.
207
- - c906050: chore: migrate tests suite to jest
208
- - Updated dependencies [8ceb2c1]
209
- - Updated dependencies [a27f452]
210
- - Updated dependencies [c906050]
211
- - @h3ravel/core@0.4.0
212
- - @h3ravel/shared@0.4.0
213
- - @h3ravel/support@0.4.0
214
-
215
- ## 0.3.0
216
-
217
- ### Minor Changes
218
-
219
- - 3ff97bf: refactor: add a shared package to be extended by others to avoid cyclic dependency issues.
220
-
221
- ### Patch Changes
222
-
223
- - Updated dependencies [3ff97bf]
224
- - @h3ravel/core@0.3.0
225
- - @h3ravel/shared@0.3.0
226
- - @h3ravel/support@0.3.0
227
-
228
- ## 0.2.0
229
-
230
- ### Minor Changes
231
-
232
- - aea734f: Fix all known bugs and improved interdependecy between packages.
233
-
234
- ### Patch Changes
235
-
236
- - Updated dependencies [aea734f]
237
- - @h3ravel/core@0.2.0
238
- - @h3ravel/support@0.2.0
@@ -1,52 +0,0 @@
1
- import { DotNestedKeys, DotNestedValue, safeDot, setNested } from '@h3ravel/support'
2
-
3
- import { Application } from '@h3ravel/core'
4
- import path from 'node:path'
5
- import { readdir } from 'node:fs/promises'
6
-
7
- export class ConfigRepository {
8
- private loaded: boolean = false
9
- private configs: Record<string, Record<string, any>> = {}
10
-
11
- constructor(protected app: Application) { }
12
-
13
- // get<X extends Record<string, any>> (): X
14
- // get<X extends Record<string, any>, T extends Extract<keyof X, string>> (key: T): X[T]
15
-
16
- /**
17
- * Get the defined configurations
18
- */
19
- get<X extends Record<string, any>> (): X
20
- get<X extends Record<string, any>, K extends DotNestedKeys<X>> (key: K, def?: any): DotNestedValue<X, K>
21
- get<X extends Record<string, any>, K extends DotNestedKeys<X>> (key?: K, def?: any): any {
22
- return safeDot(this.configs, key) ?? def
23
- }
24
-
25
- /**
26
- * Modify the defined configurations
27
- */
28
- set<T extends string> (key: T, value: any): void {
29
- setNested(this.configs, key, value)
30
- }
31
-
32
- async load () {
33
- if (!this.loaded) {
34
- const configPath = this.app.getPath('config')
35
-
36
- const files = (await readdir(configPath)).filter((e) => {
37
- return !e.includes('.d.ts') && !e.includes('.map')
38
- })
39
-
40
- for (let i = 0; i < files.length; i++) {
41
- const configModule = await import(path.join(configPath, files[i]))
42
- const name = files[i].replaceAll(/\.ts|\.js/g, '')
43
- if (typeof configModule.default === 'function') {
44
- this.configs[name] = configModule.default(this.app)
45
- }
46
- }
47
-
48
- this.loaded = true
49
- }
50
- return this
51
- }
52
- }
File without changes
package/src/EnvLoader.ts DELETED
@@ -1,16 +0,0 @@
1
- import { DotNestedKeys, DotNestedValue, safeDot } from '@h3ravel/support'
2
-
3
- import { Application } from '@h3ravel/core'
4
-
5
- export class EnvLoader {
6
- constructor(protected _app: Application) { }
7
-
8
- /**
9
- * Get the defined environment vars
10
- */
11
- get<X extends NodeJS.ProcessEnv> (): X
12
- get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>> (key: K, def?: any): DotNestedValue<X, K>
13
- get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>> (key?: K, def?: any): any {
14
- return safeDot(process.env, key) ?? def
15
- }
16
- }
package/src/Helpers.ts DELETED
@@ -1 +0,0 @@
1
- export default class { }
@@ -1,46 +0,0 @@
1
- import { ConfigRepository, EnvLoader } from '..'
2
-
3
- import { Bindings } from '@h3ravel/shared';
4
- import { ServiceProvider } from '@h3ravel/core'
5
-
6
- /**
7
- * Loads configuration and environment files.
8
- *
9
- * Load .env and merge with config files.
10
- * Bind ConfigRepository to the container.
11
- *
12
- * Auto-Registered
13
- */
14
- export class ConfigServiceProvider extends ServiceProvider {
15
- public static priority = 998;
16
- // public static order = 'before:AppServiceProvider';
17
-
18
- async register () {
19
- /**
20
- * Create singleton to load env
21
- */
22
- this.app.singleton('env', () => {
23
- return new EnvLoader(this.app).get
24
- })
25
-
26
- /**
27
- * Initialize the configuration through the repository
28
- */
29
- const repo = new ConfigRepository(this.app)
30
- await repo.load()
31
-
32
- /**
33
- * Create singleton to load configurations
34
- */
35
- this.app.singleton('config', () => {
36
- return {
37
- get: (key, def) => repo.get(key as any, def),
38
- set: repo.set
39
- } as Bindings['config']
40
- })
41
-
42
- this.app.make('http.app').use(e => {
43
- repo.set('app.url', e.url.origin)
44
- })
45
- }
46
- }
package/src/index.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * @file Automatically generated by barrelsby.
3
- */
4
-
5
- export * from './ConfigRepository';
6
- export * from './EnvLoader';
7
- export * from './Helpers';
8
- export * from './Providers/ConfigServiceProvider';
package/tests/.gitkeep DELETED
File without changes
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../shared/tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist"
5
- },
6
- "include": ["src"],
7
- "exclude": ["dist", "node_modules"]
8
- }