@superhero/core 4.0.0-beta.8 → 4.0.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 +2 -2
- package/index.js +15 -4
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -124,11 +124,11 @@ pass 4
|
|
|
124
124
|
---------------------------------------------------------------------------------------------------
|
|
125
125
|
file | line % | branch % | funcs % | uncovered lines
|
|
126
126
|
---------------------------------------------------------------------------------------------------
|
|
127
|
-
index.js | 74.
|
|
127
|
+
index.js | 74.21 | 67.03 | 74.51 | 19-24 97-100 121-123 131-136 139-141 185-190 201-2…
|
|
128
128
|
index.test.js | 100.00 | 100.00 | 100.00 |
|
|
129
129
|
worker.js | 100.00 | 100.00 | 100.00 |
|
|
130
130
|
---------------------------------------------------------------------------------------------------
|
|
131
|
-
all files | 77.
|
|
131
|
+
all files | 77.46 | 70.00 | 77.59 |
|
|
132
132
|
---------------------------------------------------------------------------------------------------
|
|
133
133
|
```
|
|
134
134
|
|
package/index.js
CHANGED
|
@@ -3,14 +3,25 @@ import cluster from 'node:cluster'
|
|
|
3
3
|
import EventEmitter from 'node:events'
|
|
4
4
|
import path from 'node:path'
|
|
5
5
|
import bootstrap from '@superhero/bootstrap'
|
|
6
|
-
import Config from '@superhero/config'
|
|
7
6
|
import Locate from '@superhero/locator'
|
|
8
7
|
import Log from '@superhero/log'
|
|
9
8
|
|
|
10
9
|
export default class Core
|
|
11
10
|
{
|
|
12
11
|
locate = new Locate
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
get config()
|
|
14
|
+
{
|
|
15
|
+
return this.locate.config
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
set config(_)
|
|
19
|
+
{
|
|
20
|
+
const error = new Error('Can not set the config (read-only) property')
|
|
21
|
+
error.code = 'E_CORE_CONFIG_SET'
|
|
22
|
+
error.cause = 'Alter the config instance through the bundled locator'
|
|
23
|
+
throw error
|
|
24
|
+
}
|
|
14
25
|
|
|
15
26
|
/**
|
|
16
27
|
* @param {string} branch The branch to use to add branch specific configurations.
|
|
@@ -19,7 +30,6 @@ export default class Core
|
|
|
19
30
|
{
|
|
20
31
|
this.branch = branch
|
|
21
32
|
this.basePath = this.locate.pathResolver.basePath // synchronize the base path.
|
|
22
|
-
this.locate.set('@superhero/config', this.config)
|
|
23
33
|
Core.#setupDestroyer(this)
|
|
24
34
|
}
|
|
25
35
|
|
|
@@ -214,8 +224,9 @@ export default class Core
|
|
|
214
224
|
|
|
215
225
|
// Forward the base path for the scoped path-resolver
|
|
216
226
|
// used by the locator and config services.
|
|
227
|
+
// OBS! this logic relies on that the locator and config
|
|
228
|
+
// services uses the same path-resolver.
|
|
217
229
|
this.locate.pathResolver.basePath = basePath
|
|
218
|
-
this.config.pathResolver.basePath = basePath
|
|
219
230
|
|
|
220
231
|
this.#eventlog.push({ type: 'basePath', basePath })
|
|
221
232
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superhero/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Core functionalities for the superhero framework.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,10 +9,8 @@
|
|
|
9
9
|
".": "./index.js"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@superhero/bootstrap": "^4.1.
|
|
13
|
-
"@superhero/
|
|
14
|
-
"@superhero/locator": "^4.2.0",
|
|
15
|
-
"@superhero/log": "^4.0.0"
|
|
12
|
+
"@superhero/bootstrap": "^4.1.1",
|
|
13
|
+
"@superhero/locator": "^4.2.2"
|
|
16
14
|
},
|
|
17
15
|
"scripts": {
|
|
18
16
|
"test": "node --trace-warnings --test --experimental-test-coverage"
|