@e-mc/document 0.5.22 → 0.5.23

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
@@ -36,7 +36,6 @@ const CACHE_CODE = {};
36
36
  const CACHE_HASH = {};
37
37
  const CACHE_TEMPLATE = {};
38
38
  const CACHE_VIEWENGINE = new Map();
39
- const CACHE_EXTERNAL = {};
40
39
  const CACHE_PICOMATCH = new Map();
41
40
  let CACHE_TOTAL = 0;
42
41
  function renewTransform(map, key, expires) {
@@ -78,7 +77,7 @@ class Document extends core_1.Client {
78
77
  delete cache[name];
79
78
  }
80
79
  }
81
- for (const cache of [CACHE_PACKAGE, CACHE_REQUIRE, CACHE_EXTERNAL, CACHE_TEMPLATE]) {
80
+ for (const cache of [CACHE_PACKAGE, CACHE_REQUIRE, CACHE_TEMPLATE]) {
82
81
  for (const name in cache) {
83
82
  delete cache[name];
84
83
  }
@@ -927,8 +926,8 @@ class Document extends core_1.Client {
927
926
  const config = this._transformConfig;
928
927
  const cacheData = config && options.cacheData;
929
928
  const cacheType = username && core_1.Client.enabled("memory.settings.users", username) ? true : this.cacheDir || core_1.Client.enabled("memory.settings.users");
930
- let formatKey, hashKey, excludeKey;
931
- 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)))) {
929
+ let formatKey, hashKey;
930
+ 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)))) {
932
931
  const { uri, etag } = cacheData;
933
932
  const encoding = (0, types_1.getEncoding)(cacheData.encoding);
934
933
  const algorithm = config.algorithm;
@@ -1012,7 +1011,7 @@ class Document extends core_1.Client {
1012
1011
  const imports = (_e = transform).imports || (_e.imports = {});
1013
1012
  const series = new transform_1.TransformSeries(type, code, options);
1014
1013
  series.init(this, __dirname);
1015
- let valid, excluded, userData, userImports, ignoreCache, storedLog, sourceFiles;
1014
+ let valid, userData, userImports, ignoreCache, storedLog, sourceFiles;
1016
1015
  if (username && (transform = (_d = (_c = this.settings.users) === null || _c === void 0 ? void 0 : _c[username]) === null || _d === void 0 ? void 0 : _d.transform)) {
1017
1016
  userData = transform[type];
1018
1017
  userImports = transform.imports;
@@ -1061,8 +1060,8 @@ class Document extends core_1.Client {
1061
1060
  }
1062
1061
  }
1063
1062
  }
1064
- if (!baseSettings) {
1065
- excluded = !includes(name);
1063
+ if (!baseSettings && !includes(name)) {
1064
+ ignoreCache = true;
1066
1065
  }
1067
1066
  outputConfig || (outputConfig = {});
1068
1067
  if (plugin && baseConfig) {
@@ -1202,9 +1201,6 @@ class Document extends core_1.Client {
1202
1201
  return;
1203
1202
  }
1204
1203
  series.close(this);
1205
- if (excluded && excludeKey) {
1206
- CACHE_EXTERNAL[excludeKey] = true;
1207
- }
1208
1204
  if (!valid) {
1209
1205
  return;
1210
1206
  }
@@ -1219,7 +1215,7 @@ class Document extends core_1.Client {
1219
1215
  if (sourceFiles) {
1220
1216
  output.sourceFiles = sourceFiles;
1221
1217
  }
1222
- if (formatKey && !excluded && !ignoreCache) {
1218
+ if (formatKey && !ignoreCache) {
1223
1219
  const { uri, etag } = cacheData;
1224
1220
  const formatData = { ...output, storedLog };
1225
1221
  const lastAccessed = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.5.22",
3
+ "version": "0.5.23",
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.5.22",
24
- "@e-mc/db": "0.5.22",
25
- "@e-mc/types": "0.5.22",
23
+ "@e-mc/core": "0.5.23",
24
+ "@e-mc/db": "0.5.23",
25
+ "@e-mc/types": "0.5.23",
26
26
  "chalk": "4.1.2",
27
27
  "htmlparser2": "^9.1.0",
28
28
  "js-yaml": "^4.1.0",