@e-mc/document 0.8.26 → 0.8.27

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.
Files changed (3) hide show
  1. package/README.md +9 -9
  2. package/index.js +9 -3
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- - https://www.unpkg.com/@e-mc/types@0.8.26/lib/index.d.ts
12
+ - https://www.unpkg.com/@e-mc/types@0.8.27/lib/index.d.ts
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, ViewEngine } from "./squared";
@@ -85,14 +85,14 @@ interface DocumentConstructor extends ModuleConstructor {
85
85
 
86
86
  ## References
87
87
 
88
- - https://www.unpkg.com/@e-mc/types@0.8.26/lib/squared.d.ts
89
- - https://www.unpkg.com/@e-mc/types@0.8.26/lib/asset.d.ts
90
- - https://www.unpkg.com/@e-mc/types@0.8.26/lib/core.d.ts
91
- - https://www.unpkg.com/@e-mc/types@0.8.26/lib/document.d.ts
92
- - https://www.unpkg.com/@e-mc/types@0.8.26/lib/filemanager.d.ts
93
- - https://www.unpkg.com/@e-mc/types@0.8.26/lib/logger.d.ts
94
- - https://www.unpkg.com/@e-mc/types@0.8.26/lib/settings.d.ts
95
- - https://www.unpkg.com/@e-mc/types@0.8.26/lib/watch.d.ts
88
+ - https://www.unpkg.com/@e-mc/types@0.8.27/lib/squared.d.ts
89
+ - https://www.unpkg.com/@e-mc/types@0.8.27/lib/asset.d.ts
90
+ - https://www.unpkg.com/@e-mc/types@0.8.27/lib/core.d.ts
91
+ - https://www.unpkg.com/@e-mc/types@0.8.27/lib/document.d.ts
92
+ - https://www.unpkg.com/@e-mc/types@0.8.27/lib/filemanager.d.ts
93
+ - https://www.unpkg.com/@e-mc/types@0.8.27/lib/logger.d.ts
94
+ - https://www.unpkg.com/@e-mc/types@0.8.27/lib/settings.d.ts
95
+ - https://www.unpkg.com/@e-mc/types@0.8.27/lib/watch.d.ts
96
96
 
97
97
  ## LICENSE
98
98
 
package/index.js CHANGED
@@ -18,6 +18,7 @@ const CACHE_ETAG = {};
18
18
  const CACHE_CODE = {};
19
19
  const CACHE_HASH = {};
20
20
  const CACHE_TEMPLATE = {};
21
+ const CACHE_VIEWENGINE = new Map();
21
22
  const CACHE_EXTERNAL = {};
22
23
  const CACHE_PICOMATCH = new Map();
23
24
  let CACHE_TOTAL = 0;
@@ -65,6 +66,7 @@ class Document extends core_1.Client {
65
66
  delete cache[name];
66
67
  }
67
68
  }
69
+ CACHE_VIEWENGINE.clear();
68
70
  CACHE_PICOMATCH.clear();
69
71
  CACHE_TOTAL = 0;
70
72
  }
@@ -896,8 +898,12 @@ class Document extends core_1.Client {
896
898
  target = (_a = this.settings.view_engine) === null || _a === void 0 ? void 0 : _a[viewEngine];
897
899
  const userConfig = (_c = (_b = this.getUserSettings()) === null || _b === void 0 ? void 0 : _b.view_engine) === null || _c === void 0 ? void 0 : _c[viewEngine];
898
900
  if ((0, types_1.isPlainObject)(userConfig)) {
899
- if ((0, types_1.isPlainObject)(target)) {
900
- (0, types_1.cloneObject)(userConfig, { target, deep: true, preserve: true });
901
+ if (CACHE_VIEWENGINE.has(userConfig)) {
902
+ target = CACHE_VIEWENGINE.get(userConfig);
903
+ }
904
+ else if ((0, types_1.isPlainObject)(target)) {
905
+ target = (0, types_1.cloneObject)(userConfig, { target: { ...target }, deep: true, preserve: true });
906
+ CACHE_VIEWENGINE.set(userConfig, target);
901
907
  }
902
908
  else {
903
909
  target = userConfig;
@@ -908,7 +914,7 @@ class Document extends core_1.Client {
908
914
  else {
909
915
  target = viewEngine;
910
916
  }
911
- if (!((0, types_1.isPlainObject)(target) && target.name)) {
917
+ if (!((0, types_1.isPlainObject)(target) && (0, types_1.isString)(target.name))) {
912
918
  this.abort('view_engine');
913
919
  const from = typeof viewEngine === 'string' ? viewEngine : this.moduleName;
914
920
  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.8.26",
3
+ "version": "0.8.27",
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.8.26",
24
- "@e-mc/db": "0.8.26",
25
- "@e-mc/types": "0.8.26",
23
+ "@e-mc/core": "0.8.27",
24
+ "@e-mc/db": "0.8.27",
25
+ "@e-mc/types": "0.8.27",
26
26
  "chalk": "4.1.2",
27
27
  "domhandler": "^5.0.3",
28
28
  "domutils": "^3.1.0",