@e-mc/document 0.10.20 → 0.10.22

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.10.20/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.10.22/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, ViewEngine } from "./squared";
@@ -183,14 +183,14 @@ NOTE: **@e-mc/document** is an abstract base class and cannot be instantiated. *
183
183
 
184
184
  ## References
185
185
 
186
- - https://www.unpkg.com/@e-mc/types@0.10.20/lib/squared.d.ts
187
- - https://www.unpkg.com/@e-mc/types@0.10.20/lib/asset.d.ts
188
- - https://www.unpkg.com/@e-mc/types@0.10.20/lib/core.d.ts
189
- - https://www.unpkg.com/@e-mc/types@0.10.20/lib/document.d.ts
190
- - https://www.unpkg.com/@e-mc/types@0.10.20/lib/filemanager.d.ts
191
- - https://www.unpkg.com/@e-mc/types@0.10.20/lib/logger.d.ts
192
- - https://www.unpkg.com/@e-mc/types@0.10.20/lib/settings.d.ts
193
- - https://www.unpkg.com/@e-mc/types@0.10.20/lib/watch.d.ts
186
+ - https://www.unpkg.com/@e-mc/types@0.10.22/lib/squared.d.ts
187
+ - https://www.unpkg.com/@e-mc/types@0.10.22/lib/asset.d.ts
188
+ - https://www.unpkg.com/@e-mc/types@0.10.22/lib/core.d.ts
189
+ - https://www.unpkg.com/@e-mc/types@0.10.22/lib/document.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.10.22/lib/filemanager.d.ts
191
+ - https://www.unpkg.com/@e-mc/types@0.10.22/lib/logger.d.ts
192
+ - https://www.unpkg.com/@e-mc/types@0.10.22/lib/settings.d.ts
193
+ - https://www.unpkg.com/@e-mc/types@0.10.22/lib/watch.d.ts
194
194
 
195
195
  ## LICENSE
196
196
 
package/index.js CHANGED
@@ -17,7 +17,6 @@ const CACHE_CODE = {};
17
17
  const CACHE_HASH = {};
18
18
  const CACHE_TEMPLATE = {};
19
19
  const CACHE_VIEWENGINE = new Map();
20
- const CACHE_EXTERNAL = {};
21
20
  const CACHE_PICOMATCH = new Map();
22
21
  let CACHE_TOTAL = 0;
23
22
  function deleteTransform(map, key, timeout) {
@@ -232,7 +231,7 @@ class TransformConfig {
232
231
  value = 0;
233
232
  }
234
233
  else if ((value = (0, types_1.formatSize)(limit)) === 0) {
235
- return;
234
+ return false;
236
235
  }
237
236
  }
238
237
  else {
@@ -344,7 +343,7 @@ class Document extends core_1.Client {
344
343
  delete cache[name];
345
344
  }
346
345
  }
347
- for (const cache of [CACHE_PACKAGE, CACHE_REQUIRE, CACHE_EXTERNAL, CACHE_TEMPLATE]) {
346
+ for (const cache of [CACHE_PACKAGE, CACHE_REQUIRE, CACHE_TEMPLATE]) {
348
347
  for (const name in cache) {
349
348
  delete cache[name];
350
349
  }
@@ -1191,10 +1190,10 @@ class Document extends core_1.Client {
1191
1190
  const username = this.host?.username || '';
1192
1191
  const config = this._transformConfig;
1193
1192
  const cacheData = config && options.cacheData;
1194
- let cache = null, cacheDir = false, excludeKey;
1193
+ let cache = null, cacheDir = false;
1195
1194
  if (cacheData) {
1196
1195
  cacheDir = username && core_1.Client.enabled("memory.settings.users", username) ? true : this.cacheDir || core_1.Client.enabled("memory.settings.users");
1197
- if (cacheDir && !CACHE_EXTERNAL[excludeKey = this.moduleName + '_' + type + '_' + format] && config.valid(type, format)) {
1196
+ if (cacheDir && config.valid(type, format)) {
1198
1197
  const { uri, etag } = cacheData;
1199
1198
  const encoding = (0, types_1.getEncoding)(cacheData.encoding);
1200
1199
  const hashOpts = core_1.Client.asString(options.external) + core_1.Client.asString(options.metadata);
@@ -1224,7 +1223,7 @@ class Document extends core_1.Client {
1224
1223
  const imports = transform.imports ||= {};
1225
1224
  const series = new transform_1.TransformSeries(type, code, options);
1226
1225
  series.init(this, __dirname);
1227
- let valid, excluded, userData, userImports, ignoreCache, storedLog, sourceFiles;
1226
+ let valid, userData, userImports, ignoreCache, storedLog, sourceFiles;
1228
1227
  if (username && (0, types_1.isObject)(transform = this.getUserSettings()?.transform)) {
1229
1228
  userData = transform[type];
1230
1229
  if (!(0, types_1.isObject)(userData)) {
@@ -1269,8 +1268,8 @@ class Document extends core_1.Client {
1269
1268
  }
1270
1269
  }
1271
1270
  }
1272
- if (!baseSettings) {
1273
- excluded = isExcluded(type, name, config, cacheData);
1271
+ if (!baseSettings && isExcluded(type, name, config, cacheData)) {
1272
+ ignoreCache = true;
1274
1273
  }
1275
1274
  outputConfig ||= {};
1276
1275
  if (plugin && baseConfig) {
@@ -1438,9 +1437,6 @@ class Document extends core_1.Client {
1438
1437
  return;
1439
1438
  }
1440
1439
  series.close(this);
1441
- if (excluded && excludeKey) {
1442
- CACHE_EXTERNAL[excludeKey] = true;
1443
- }
1444
1440
  if (!valid) {
1445
1441
  return;
1446
1442
  }
@@ -1455,7 +1451,7 @@ class Document extends core_1.Client {
1455
1451
  if (sourceFiles) {
1456
1452
  output.sourceFiles = sourceFiles;
1457
1453
  }
1458
- if (!excluded && !ignoreCache && cache?.formatType) {
1454
+ if (!ignoreCache && cache?.formatType) {
1459
1455
  void cache.finalize(type, code, { ...output, log: storedLog });
1460
1456
  }
1461
1457
  return output;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.10.20",
3
+ "version": "0.10.22",
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.10.20",
24
- "@e-mc/db": "0.10.20",
25
- "@e-mc/types": "0.10.20",
23
+ "@e-mc/core": "0.10.22",
24
+ "@e-mc/db": "0.10.22",
25
+ "@e-mc/types": "0.10.22",
26
26
  "chalk": "4.1.2",
27
27
  "domhandler": "^5.0.3",
28
28
  "domutils": "^3.2.2",