@e-mc/document 0.6.18 → 0.6.19
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/index.js +9 -3
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const CACHE_ETAG = {};
|
|
|
17
17
|
const CACHE_CODE = {};
|
|
18
18
|
const CACHE_HASH = {};
|
|
19
19
|
const CACHE_TEMPLATE = {};
|
|
20
|
+
const CACHE_VIEWENGINE = new Map();
|
|
20
21
|
const CACHE_EXTERNAL = {};
|
|
21
22
|
const CACHE_PICOMATCH = new Map();
|
|
22
23
|
let CACHE_TOTAL = 0;
|
|
@@ -64,6 +65,7 @@ class Document extends core_1.Client {
|
|
|
64
65
|
delete cache[name];
|
|
65
66
|
}
|
|
66
67
|
}
|
|
68
|
+
CACHE_VIEWENGINE.clear();
|
|
67
69
|
CACHE_PICOMATCH.clear();
|
|
68
70
|
CACHE_TOTAL = 0;
|
|
69
71
|
}
|
|
@@ -817,8 +819,12 @@ class Document extends core_1.Client {
|
|
|
817
819
|
const username = (_b = this.host) === null || _b === void 0 ? void 0 : _b.username;
|
|
818
820
|
const userConfig = username && ((_e = (_d = (_c = this.settings.users) === null || _c === void 0 ? void 0 : _c[username]) === null || _d === void 0 ? void 0 : _d.view_engine) === null || _e === void 0 ? void 0 : _e[viewEngine]);
|
|
819
821
|
if ((0, types_1.isPlainObject)(userConfig)) {
|
|
820
|
-
if (
|
|
821
|
-
|
|
822
|
+
if (CACHE_VIEWENGINE.has(userConfig)) {
|
|
823
|
+
target = CACHE_VIEWENGINE.get(userConfig);
|
|
824
|
+
}
|
|
825
|
+
else if ((0, types_1.isPlainObject)(target)) {
|
|
826
|
+
target = (0, types_1.cloneObject)(userConfig, { target: { ...target }, deep: true, preserve: true });
|
|
827
|
+
CACHE_VIEWENGINE.set(userConfig, target);
|
|
822
828
|
}
|
|
823
829
|
else {
|
|
824
830
|
target = userConfig;
|
|
@@ -829,7 +835,7 @@ class Document extends core_1.Client {
|
|
|
829
835
|
else {
|
|
830
836
|
target = viewEngine;
|
|
831
837
|
}
|
|
832
|
-
if (!((0, types_1.isPlainObject)(target) && target.name)) {
|
|
838
|
+
if (!((0, types_1.isPlainObject)(target) && (0, types_1.isString)(target.name))) {
|
|
833
839
|
this.abort('view_engine');
|
|
834
840
|
const from = typeof viewEngine === 'string' ? viewEngine : this.moduleName;
|
|
835
841
|
this.writeFail(["Unable to load configuration", from], (0, types_1.errorMessage)('view-engine', from, "Unknown"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/document",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.19",
|
|
4
4
|
"description": "Document constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/core": "0.6.
|
|
24
|
-
"@e-mc/db": "0.6.
|
|
25
|
-
"@e-mc/types": "0.6.
|
|
23
|
+
"@e-mc/core": "0.6.19",
|
|
24
|
+
"@e-mc/db": "0.6.19",
|
|
25
|
+
"@e-mc/types": "0.6.19",
|
|
26
26
|
"chalk": "4.1.2",
|
|
27
27
|
"domhandler": "^5.0.3",
|
|
28
28
|
"domutils": "^3.1.0",
|