@bedrock/kms 10.2.0 → 10.3.0
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/CHANGELOG.md +5 -0
- package/lib/BedrockKmsModuleManager.js +8 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,11 +6,18 @@ import * as brPackageManager from '@bedrock/package-manager';
|
|
|
6
6
|
// load config defaults
|
|
7
7
|
import './config.js';
|
|
8
8
|
|
|
9
|
+
const importMap = new Map();
|
|
10
|
+
|
|
9
11
|
export class BedrockKmsModuleManager {
|
|
10
12
|
async get({id}) {
|
|
11
13
|
const {packageName} = brPackageManager.get(
|
|
12
14
|
{alias: id, type: 'webkms-module'});
|
|
13
|
-
|
|
15
|
+
let api = await importMap.get(packageName);
|
|
16
|
+
if(!api) {
|
|
17
|
+
const promise = import(packageName);
|
|
18
|
+
importMap.set(packageName, promise);
|
|
19
|
+
api = await promise;
|
|
20
|
+
}
|
|
14
21
|
return api.default || api;
|
|
15
22
|
}
|
|
16
23
|
}
|