@aeriajs/entrypoint 0.0.46 → 0.0.48

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/dist/index.js CHANGED
@@ -26,13 +26,14 @@ const internalGetCollections = async () => {
26
26
  const collections = entrypoint.collections
27
27
  ? entrypoint.collections
28
28
  : entrypoint.default.options.collections;
29
- return Object.assign({}, collections);
29
+ return collections;
30
30
  };
31
31
  const getCollections = async () => {
32
32
  if (collectionsMemo) {
33
- return Object.assign({}, collectionsMemo);
33
+ return collectionsMemo;
34
34
  }
35
35
  collectionsMemo = await internalGetCollections();
36
+ Object.freeze(collectionsMemo);
36
37
  return collectionsMemo;
37
38
  };
38
39
  exports.getCollections = getCollections;
@@ -41,11 +42,15 @@ const getCollection = async (collectionName) => {
41
42
  return collectionMemo[collectionName];
42
43
  }
43
44
  const collections = await (0, exports.getCollections)();
44
- const candidate = collections[collectionName];
45
+ const candidate = collectionName in collections
46
+ ? collections[collectionName]
47
+ : undefined;
45
48
  const collection = typeof candidate === 'function'
46
49
  ? candidate()
47
50
  : candidate;
48
- collectionsMemo[collectionName] = candidate;
51
+ if (collection) {
52
+ collectionMemo[collectionName] = collection;
53
+ }
49
54
  return collection;
50
55
  };
51
56
  exports.getCollection = getCollection;
package/dist/index.mjs CHANGED
@@ -20,13 +20,14 @@ export const getEntrypoint = async () => {
20
20
  const internalGetCollections = async () => {
21
21
  const entrypoint = await getEntrypoint();
22
22
  const collections = entrypoint.collections ? entrypoint.collections : entrypoint.default.options.collections;
23
- return Object.assign({}, collections);
23
+ return collections;
24
24
  };
25
25
  export const getCollections = async () => {
26
26
  if (collectionsMemo) {
27
- return Object.assign({}, collectionsMemo);
27
+ return collectionsMemo;
28
28
  }
29
29
  collectionsMemo = await internalGetCollections();
30
+ Object.freeze(collectionsMemo);
30
31
  return collectionsMemo;
31
32
  };
32
33
  export const getCollection = async (collectionName) => {
@@ -34,9 +35,11 @@ export const getCollection = async (collectionName) => {
34
35
  return collectionMemo[collectionName];
35
36
  }
36
37
  const collections = await getCollections();
37
- const candidate = collections[collectionName];
38
+ const candidate = collectionName in collections ? collections[collectionName] : void 0;
38
39
  const collection = typeof candidate === "function" ? candidate() : candidate;
39
- collectionsMemo[collectionName] = candidate;
40
+ if (collection) {
41
+ collectionMemo[collectionName] = collection;
42
+ }
40
43
  return collection;
41
44
  };
42
45
  export const getRouter = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/entrypoint",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -26,8 +26,8 @@
26
26
  "@aeriajs/types": "link:../types"
27
27
  },
28
28
  "peerDependencies": {
29
- "@aeriajs/common": "^0.0.46",
30
- "@aeriajs/types": "^0.0.43"
29
+ "@aeriajs/common": "^0.0.48",
30
+ "@aeriajs/types": "^0.0.45"
31
31
  },
32
32
  "scripts": {
33
33
  "test": "echo skipping",