@e-mc/document 0.11.18 → 0.11.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.
Files changed (3) hide show
  1. package/README.md +9 -9
  2. package/index.js +8 -12
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.11.18/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.11.19/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, ViewEngine } from "./squared";
@@ -185,14 +185,14 @@ NOTE: **@e-mc/document** is an abstract base class and cannot be instantiated. *
185
185
 
186
186
  ## References
187
187
 
188
- - https://www.unpkg.com/@e-mc/types@0.11.18/lib/squared.d.ts
189
- - https://www.unpkg.com/@e-mc/types@0.11.18/lib/asset.d.ts
190
- - https://www.unpkg.com/@e-mc/types@0.11.18/lib/core.d.ts
191
- - https://www.unpkg.com/@e-mc/types@0.11.18/lib/document.d.ts
192
- - https://www.unpkg.com/@e-mc/types@0.11.18/lib/filemanager.d.ts
193
- - https://www.unpkg.com/@e-mc/types@0.11.18/lib/logger.d.ts
194
- - https://www.unpkg.com/@e-mc/types@0.11.18/lib/settings.d.ts
195
- - https://www.unpkg.com/@e-mc/types@0.11.18/lib/watch.d.ts
188
+ - https://www.unpkg.com/@e-mc/types@0.11.19/lib/squared.d.ts
189
+ - https://www.unpkg.com/@e-mc/types@0.11.19/lib/asset.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.11.19/lib/core.d.ts
191
+ - https://www.unpkg.com/@e-mc/types@0.11.19/lib/document.d.ts
192
+ - https://www.unpkg.com/@e-mc/types@0.11.19/lib/filemanager.d.ts
193
+ - https://www.unpkg.com/@e-mc/types@0.11.19/lib/logger.d.ts
194
+ - https://www.unpkg.com/@e-mc/types@0.11.19/lib/settings.d.ts
195
+ - https://www.unpkg.com/@e-mc/types@0.11.19/lib/watch.d.ts
196
196
 
197
197
  ## LICENSE
198
198
 
package/index.js CHANGED
@@ -14,7 +14,6 @@ const util_1 = require("@e-mc/document/util");
14
14
  const CACHE_PACKAGE = {};
15
15
  const CACHE_TEMPLATE = {};
16
16
  const CACHE_VIEWENGINE = new Map();
17
- const CACHE_EXTERNAL = {};
18
17
  const CACHE_ETAG = {};
19
18
  const CACHE_CODE = {};
20
19
  const CACHE_HASH = {};
@@ -231,7 +230,7 @@ class TransformConfig {
231
230
  value = 0;
232
231
  }
233
232
  else if ((value = (0, types_1.formatSize)(limit)) === 0) {
234
- return;
233
+ return false;
235
234
  }
236
235
  }
237
236
  else {
@@ -343,7 +342,7 @@ class Document extends core_1.Client {
343
342
  delete cache[name];
344
343
  }
345
344
  }
346
- for (const cache of [CACHE_PACKAGE, CACHE_EXTERNAL, CACHE_TEMPLATE]) {
345
+ for (const cache of [CACHE_PACKAGE, CACHE_TEMPLATE]) {
347
346
  for (const name in cache) {
348
347
  delete cache[name];
349
348
  }
@@ -1195,10 +1194,10 @@ class Document extends core_1.Client {
1195
1194
  const username = this.host?.username || '';
1196
1195
  const config = this._transformConfig;
1197
1196
  const cacheData = config && options.cacheData;
1198
- let cache = null, excludeKey;
1197
+ let cache = null;
1199
1198
  if (cacheData) {
1200
1199
  const cacheDir = username && core_1.Client.enabled("memory.settings.users", username) ? true : this.cacheDir || core_1.Client.enabled("memory.settings.users");
1201
- if (cacheDir && !CACHE_EXTERNAL[excludeKey = this.moduleName + '_' + type + '_' + format] && config.valid(type, format)) {
1200
+ if (cacheDir && config.valid(type, format)) {
1202
1201
  const { uri, etag } = cacheData;
1203
1202
  const encoding = (0, types_1.getEncoding)(cacheData.encoding);
1204
1203
  const hashOpts = core_1.Client.asString(options.external) + core_1.Client.asString(options.metadata);
@@ -1228,7 +1227,7 @@ class Document extends core_1.Client {
1228
1227
  const imports = transform.imports ||= {};
1229
1228
  const series = new transform_1.TransformSeries(type, code, options);
1230
1229
  series.init(this, __dirname);
1231
- let valid = false, excluded = false, userData, userImports, ignoreCache = false, storedLog, sourceFiles;
1230
+ let valid = false, userData, userImports, ignoreCache = false, storedLog, sourceFiles;
1232
1231
  if (username && (0, types_1.isObject)(transform = this.getUserSettings()?.transform)) {
1233
1232
  userData = transform[type];
1234
1233
  if (!(0, types_1.isObject)(userData)) {
@@ -1273,8 +1272,8 @@ class Document extends core_1.Client {
1273
1272
  }
1274
1273
  }
1275
1274
  }
1276
- if (!baseSettings) {
1277
- excluded = isExcluded(type, name, config, cacheData);
1275
+ if (!baseSettings && isExcluded(type, name, config, cacheData)) {
1276
+ ignoreCache = true;
1278
1277
  }
1279
1278
  outputConfig ||= {};
1280
1279
  if (plugin && baseConfig) {
@@ -1442,9 +1441,6 @@ class Document extends core_1.Client {
1442
1441
  return;
1443
1442
  }
1444
1443
  series.close(this);
1445
- if (excluded && excludeKey) {
1446
- CACHE_EXTERNAL[excludeKey] = true;
1447
- }
1448
1444
  if (!valid) {
1449
1445
  return;
1450
1446
  }
@@ -1459,7 +1455,7 @@ class Document extends core_1.Client {
1459
1455
  if (sourceFiles) {
1460
1456
  output.sourceFiles = sourceFiles;
1461
1457
  }
1462
- if (!excluded && !ignoreCache && cache?.formatType) {
1458
+ if (!ignoreCache && cache?.formatType) {
1463
1459
  void cache.finalize(type, code, { ...output, log: storedLog });
1464
1460
  }
1465
1461
  return output;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.11.18",
3
+ "version": "0.11.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.11.18",
24
- "@e-mc/db": "0.11.18",
25
- "@e-mc/types": "0.11.18",
23
+ "@e-mc/core": "0.11.19",
24
+ "@e-mc/db": "0.11.19",
25
+ "@e-mc/types": "0.11.19",
26
26
  "chalk": "4.1.2",
27
27
  "domhandler": "^5.0.3",
28
28
  "domutils": "^3.2.2",