@e-mc/document 0.6.19 → 0.6.21

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 (2) hide show
  1. package/index.js +7 -11
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -18,7 +18,6 @@ const CACHE_CODE = {};
18
18
  const CACHE_HASH = {};
19
19
  const CACHE_TEMPLATE = {};
20
20
  const CACHE_VIEWENGINE = new Map();
21
- const CACHE_EXTERNAL = {};
22
21
  const CACHE_PICOMATCH = new Map();
23
22
  let CACHE_TOTAL = 0;
24
23
  function renewTransform(map, key, expires) {
@@ -60,7 +59,7 @@ class Document extends core_1.Client {
60
59
  delete cache[name];
61
60
  }
62
61
  }
63
- for (const cache of [CACHE_PACKAGE, CACHE_REQUIRE, CACHE_EXTERNAL, CACHE_TEMPLATE]) {
62
+ for (const cache of [CACHE_PACKAGE, CACHE_REQUIRE, CACHE_TEMPLATE]) {
64
63
  for (const name in cache) {
65
64
  delete cache[name];
66
65
  }
@@ -911,8 +910,8 @@ class Document extends core_1.Client {
911
910
  const config = this._transformConfig;
912
911
  const cacheData = config && options.cacheData;
913
912
  const cacheType = username && core_1.Client.enabled("memory.settings.users", username) ? true : this.cacheDir || core_1.Client.enabled("memory.settings.users");
914
- let formatKey, hashKey, excludeKey;
915
- if (cacheData && cacheType && !CACHE_EXTERNAL[excludeKey = moduleName + '_' + type + '_' + format] && (!config.exclude[type] || Array.isArray(config.exclude[type]) && !format.some(value => config.exclude[type].includes(value)) || Array.isArray(config.include[type]) && format.every(value => config.include[type].includes(value)))) {
913
+ let formatKey, hashKey;
914
+ if (cacheData && cacheType && (!config.exclude[type] || Array.isArray(config.exclude[type]) && !format.some(value => config.exclude[type].includes(value)) || Array.isArray(config.include[type]) && format.every(value => config.include[type].includes(value)))) {
916
915
  const { uri, etag } = cacheData;
917
916
  const encoding = (0, types_1.getEncoding)(cacheData.encoding);
918
917
  const algorithm = config.algorithm;
@@ -996,7 +995,7 @@ class Document extends core_1.Client {
996
995
  const imports = transform.imports || (transform.imports = {});
997
996
  const series = new transform_1.TransformSeries(type, code, options);
998
997
  series.init(this, __dirname);
999
- let valid, excluded, userData, userImports, ignoreCache, storedLog, sourceFiles;
998
+ let valid, userData, userImports, ignoreCache, storedLog, sourceFiles;
1000
999
  if (username && (transform = (_d = (_c = this.settings.users) === null || _c === void 0 ? void 0 : _c[username]) === null || _d === void 0 ? void 0 : _d.transform)) {
1001
1000
  userData = transform[type];
1002
1001
  userImports = transform.imports;
@@ -1045,8 +1044,8 @@ class Document extends core_1.Client {
1045
1044
  }
1046
1045
  }
1047
1046
  }
1048
- if (!baseSettings) {
1049
- excluded = !includes(name);
1047
+ if (!baseSettings && !includes(name)) {
1048
+ ignoreCache = true;
1050
1049
  }
1051
1050
  outputConfig || (outputConfig = {});
1052
1051
  if (plugin && baseConfig) {
@@ -1187,9 +1186,6 @@ class Document extends core_1.Client {
1187
1186
  return;
1188
1187
  }
1189
1188
  series.close(this);
1190
- if (excluded && excludeKey) {
1191
- CACHE_EXTERNAL[excludeKey] = true;
1192
- }
1193
1189
  if (!valid) {
1194
1190
  return;
1195
1191
  }
@@ -1204,7 +1200,7 @@ class Document extends core_1.Client {
1204
1200
  if (sourceFiles) {
1205
1201
  output.sourceFiles = sourceFiles;
1206
1202
  }
1207
- if (formatKey && !excluded && !ignoreCache) {
1203
+ if (formatKey && !ignoreCache) {
1208
1204
  const { uri, etag } = cacheData;
1209
1205
  const formatData = { ...output, storedLog };
1210
1206
  const lastAccessed = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.6.19",
3
+ "version": "0.6.21",
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.19",
24
- "@e-mc/db": "0.6.19",
25
- "@e-mc/types": "0.6.19",
23
+ "@e-mc/core": "0.6.21",
24
+ "@e-mc/db": "0.6.21",
25
+ "@e-mc/types": "0.6.21",
26
26
  "chalk": "4.1.2",
27
27
  "domhandler": "^5.0.3",
28
28
  "domutils": "^3.1.0",