@toa.io/boot 0.20.0-dev.24 → 0.20.0-dev.29

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/boot",
3
- "version": "0.20.0-dev.24",
3
+ "version": "0.20.0-dev.29",
4
4
  "description": "Toa Boot",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -20,13 +20,13 @@
20
20
  "test": "echo \"Error: run tests from root\" && exit 1"
21
21
  },
22
22
  "dependencies": {
23
- "@toa.io/core": "0.20.0-dev.24",
24
- "@toa.io/filesystem": "0.20.0-dev.24",
25
- "@toa.io/generic": "0.20.0-dev.24",
26
- "@toa.io/norm": "0.20.0-dev.24",
27
- "@toa.io/schema": "0.20.0-dev.24",
23
+ "@toa.io/core": "0.20.0-dev.29",
24
+ "@toa.io/filesystem": "0.20.0-dev.29",
25
+ "@toa.io/generic": "0.20.0-dev.29",
26
+ "@toa.io/norm": "0.20.0-dev.29",
27
+ "@toa.io/schema": "0.20.0-dev.29",
28
28
  "clone-deep": "4.0.1",
29
29
  "dotenv": "16.1.1"
30
30
  },
31
- "gitHead": "8e5e12c2cb181dbec7509fdaa0a51e8512ce2529"
31
+ "gitHead": "dfc890657c2bfca1aa837e481dd959db5d20c724"
32
32
  }
package/src/manifest.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
+ const clone = require('clone-deep')
3
4
  const { merge } = require('@toa.io/generic')
4
5
  const { component: load } = require('@toa.io/norm')
5
6
  const { Locator } = require('@toa.io/core')
@@ -8,7 +9,7 @@ const { Locator } = require('@toa.io/core')
8
9
  * @type {toa.boot.Manifest}
9
10
  */
10
11
  const manifest = async (path, options = {}) => {
11
- merge(options, DEFAULTS)
12
+ options = merge(clone(options), DEFAULTS)
12
13
 
13
14
  const manifest = await load(path)
14
15
 
@@ -31,8 +32,9 @@ const manifest = async (path, options = {}) => {
31
32
  }
32
33
  }
33
34
 
34
- if (!('extensions' in manifest)) manifest.extensions = {}
35
+ if (manifest.extensions === undefined) manifest.extensions = {}
35
36
 
37
+ // add `null` manifests
36
38
  for (const extension of options.extensions) {
37
39
  if (!(extension in manifest.extensions)) manifest.extensions[extension] = null
38
40
  }
@@ -44,9 +46,8 @@ const manifest = async (path, options = {}) => {
44
46
  return manifest
45
47
  }
46
48
 
47
- /** @type {toa.boot.composition.Options} */
48
49
  const DEFAULTS = {
49
- extensions: ['@toa.io/extensions.sampling', '@toa.io/extensions.state']
50
+ extensions: ['@toa.io/extensions.sampling']
50
51
  }
51
52
 
52
53
  exports.manifest = manifest
@@ -0,0 +1,23 @@
1
+ 'use strict'
2
+
3
+ const { generate } = require('randomstring')
4
+
5
+ jest.mock('@toa.io/norm', () => ({
6
+ component: () => mockComponent()
7
+ }))
8
+
9
+ const { manifest } = require('./manifest')
10
+
11
+ const path = generate()
12
+
13
+ it('should not modify options', async () => {
14
+ const options = { extensions: ['foo', 'bar'] }
15
+
16
+ await manifest(path, options)
17
+
18
+ expect(options.extensions.length).toStrictEqual(2)
19
+ })
20
+
21
+ function mockComponent () {
22
+ return { name: generate(), namespace: generate() }
23
+ }