@aeriajs/entrypoint 0.0.47 → 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 +7 -4
- package/dist/index.mjs +5 -4
- package/package.json +3 -3
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
|
|
29
|
+
return collections;
|
|
30
30
|
};
|
|
31
31
|
const getCollections = async () => {
|
|
32
32
|
if (collectionsMemo) {
|
|
33
|
-
return
|
|
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,12 +42,14 @@ const getCollection = async (collectionName) => {
|
|
|
41
42
|
return collectionMemo[collectionName];
|
|
42
43
|
}
|
|
43
44
|
const collections = await (0, exports.getCollections)();
|
|
44
|
-
const candidate = collections
|
|
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
51
|
if (collection) {
|
|
49
|
-
|
|
52
|
+
collectionMemo[collectionName] = collection;
|
|
50
53
|
}
|
|
51
54
|
return collection;
|
|
52
55
|
};
|
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
|
|
23
|
+
return collections;
|
|
24
24
|
};
|
|
25
25
|
export const getCollections = async () => {
|
|
26
26
|
if (collectionsMemo) {
|
|
27
|
-
return
|
|
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,10 +35,10 @@ 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
40
|
if (collection) {
|
|
40
|
-
|
|
41
|
+
collectionMemo[collectionName] = collection;
|
|
41
42
|
}
|
|
42
43
|
return collection;
|
|
43
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/entrypoint",
|
|
3
|
-
"version": "0.0.
|
|
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.
|
|
30
|
-
"@aeriajs/types": "^0.0.
|
|
29
|
+
"@aeriajs/common": "^0.0.48",
|
|
30
|
+
"@aeriajs/types": "^0.0.45"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"test": "echo skipping",
|