@e-mc/document 0.7.24 → 0.7.25

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
  }
@@ -924,8 +923,8 @@ class Document extends core_1.Client {
924
923
  const config = this._transformConfig;
925
924
  const cacheData = config && options.cacheData;
926
925
  const cacheType = username && core_1.Client.enabled("memory.settings.users", username) ? true : this.cacheDir || core_1.Client.enabled("memory.settings.users");
927
- let formatKey, hashKey, excludeKey;
928
- 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)))) {
926
+ let formatKey, hashKey;
927
+ 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)))) {
929
928
  const { uri, etag } = cacheData;
930
929
  const encoding = (0, types_1.getEncoding)(cacheData.encoding);
931
930
  const algorithm = config.algorithm;
@@ -1009,7 +1008,7 @@ class Document extends core_1.Client {
1009
1008
  const imports = transform.imports || (transform.imports = {});
1010
1009
  const series = new transform_1.TransformSeries(type, code, options);
1011
1010
  series.init(this, __dirname);
1012
- let valid, excluded, userData, userImports, ignoreCache, storedLog, sourceFiles;
1011
+ let valid, userData, userImports, ignoreCache, storedLog, sourceFiles;
1013
1012
  if (username && (transform = (_d = (_c = this.settings.users) === null || _c === void 0 ? void 0 : _c[username]) === null || _d === void 0 ? void 0 : _d.transform)) {
1014
1013
  userData = transform[type];
1015
1014
  userImports = transform.imports;
@@ -1058,8 +1057,8 @@ class Document extends core_1.Client {
1058
1057
  }
1059
1058
  }
1060
1059
  }
1061
- if (!baseSettings) {
1062
- excluded = !includes(name);
1060
+ if (!baseSettings && !includes(name)) {
1061
+ ignoreCache = true;
1063
1062
  }
1064
1063
  outputConfig || (outputConfig = {});
1065
1064
  if (plugin && baseConfig) {
@@ -1200,9 +1199,6 @@ class Document extends core_1.Client {
1200
1199
  return;
1201
1200
  }
1202
1201
  series.close(this);
1203
- if (excluded && excludeKey) {
1204
- CACHE_EXTERNAL[excludeKey] = true;
1205
- }
1206
1202
  if (!valid) {
1207
1203
  return;
1208
1204
  }
@@ -1217,7 +1213,7 @@ class Document extends core_1.Client {
1217
1213
  if (sourceFiles) {
1218
1214
  output.sourceFiles = sourceFiles;
1219
1215
  }
1220
- if (formatKey && !excluded && !ignoreCache) {
1216
+ if (formatKey && !ignoreCache) {
1221
1217
  const { uri, etag } = cacheData;
1222
1218
  const formatData = { ...output, storedLog };
1223
1219
  const lastAccessed = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.7.24",
3
+ "version": "0.7.25",
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.7.24",
24
- "@e-mc/db": "0.7.24",
25
- "@e-mc/types": "0.7.24",
23
+ "@e-mc/core": "0.7.25",
24
+ "@e-mc/db": "0.7.25",
25
+ "@e-mc/types": "0.7.25",
26
26
  "chalk": "4.1.2",
27
27
  "domhandler": "^5.0.3",
28
28
  "domutils": "^3.1.0",