@e-mc/document 0.12.17 → 0.12.18

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.12.17/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.12.18/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, ViewEngine } from "./squared";
@@ -187,14 +187,14 @@ NOTE: **@e-mc/document** is an abstract base class and cannot be instantiated. *
187
187
 
188
188
  ## References
189
189
 
190
- - https://www.unpkg.com/@e-mc/types@0.12.17/lib/squared.d.ts
191
- - https://www.unpkg.com/@e-mc/types@0.12.17/lib/asset.d.ts
192
- - https://www.unpkg.com/@e-mc/types@0.12.17/lib/core.d.ts
193
- - https://www.unpkg.com/@e-mc/types@0.12.17/lib/document.d.ts
194
- - https://www.unpkg.com/@e-mc/types@0.12.17/lib/filemanager.d.ts
195
- - https://www.unpkg.com/@e-mc/types@0.12.17/lib/logger.d.ts
196
- - https://www.unpkg.com/@e-mc/types@0.12.17/lib/settings.d.ts
197
- - https://www.unpkg.com/@e-mc/types@0.12.17/lib/watch.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/squared.d.ts
191
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/asset.d.ts
192
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/core.d.ts
193
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/document.d.ts
194
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/filemanager.d.ts
195
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/logger.d.ts
196
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/settings.d.ts
197
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/watch.d.ts
198
198
 
199
199
  ## LICENSE
200
200
 
package/index.js CHANGED
@@ -15,7 +15,6 @@ const kDocument = Symbol.for('document:constructor');
15
15
  const CACHE_PACKAGE = {};
16
16
  const CACHE_TEMPLATE = {};
17
17
  const CACHE_VIEWENGINE = new Map();
18
- const CACHE_EXTERNAL = {};
19
18
  const CACHE_ETAG = {};
20
19
  const CACHE_CODE = {};
21
20
  const CACHE_HASH = {};
@@ -237,7 +236,7 @@ class TransformConfig {
237
236
  value = 0;
238
237
  }
239
238
  else if ((value = (0, types_1.formatSize)(limit)) === 0) {
240
- return;
239
+ return false;
241
240
  }
242
241
  }
243
242
  else {
@@ -350,7 +349,7 @@ class Document extends core_1.Client {
350
349
  delete cache[name];
351
350
  }
352
351
  }
353
- for (const cache of [CACHE_PACKAGE, CACHE_EXTERNAL, CACHE_TEMPLATE]) {
352
+ for (const cache of [CACHE_PACKAGE, CACHE_TEMPLATE]) {
354
353
  for (const name in cache) {
355
354
  delete cache[name];
356
355
  }
@@ -1206,10 +1205,10 @@ class Document extends core_1.Client {
1206
1205
  const username = this.host?.username || '';
1207
1206
  const config = this._transformConfig;
1208
1207
  const cacheData = config && options.cacheData;
1209
- let cache = null, excludeKey;
1208
+ let cache = null;
1210
1209
  if (cacheData) {
1211
1210
  const cacheDir = this.hasPermission('memory.user') || this.cacheDir || this.hasPermission('memory');
1212
- if (cacheDir && !CACHE_EXTERNAL[excludeKey = this.moduleName + '_' + type + '_' + format] && config.valid(type, format)) {
1211
+ if (cacheDir && config.valid(type, format)) {
1213
1212
  const { uri, etag } = cacheData;
1214
1213
  const encoding = (0, types_1.getEncoding)(cacheData.encoding);
1215
1214
  const hashOpts = core_1.Client.asString(options.external) + core_1.Client.asString(options.metadata);
@@ -1239,7 +1238,7 @@ class Document extends core_1.Client {
1239
1238
  const imports = transform.imports ||= {};
1240
1239
  const series = new transform_1.TransformSeries(type, code, options);
1241
1240
  series.init(this, __dirname);
1242
- let valid = false, excluded = false, userData, userImports, ignoreCache = false, storedLog, sourceFiles;
1241
+ let valid = false, userData, userImports, ignoreCache = false, storedLog, sourceFiles;
1243
1242
  if (username && (0, types_1.isObject)(transform = this.getUserSettings()?.transform)) {
1244
1243
  if ((0, types_1.isObject)(transform[type])) {
1245
1244
  userData = transform[type];
@@ -1280,8 +1279,8 @@ class Document extends core_1.Client {
1280
1279
  }
1281
1280
  }
1282
1281
  }
1283
- if (!baseSettings) {
1284
- excluded = isExcluded(type, name, config, cacheData);
1282
+ if (!baseSettings && isExcluded(type, name, config, cacheData)) {
1283
+ ignoreCache = true;
1285
1284
  }
1286
1285
  outputConfig ||= {};
1287
1286
  if (plugin && baseConfig) {
@@ -1449,9 +1448,6 @@ class Document extends core_1.Client {
1449
1448
  return;
1450
1449
  }
1451
1450
  series.close(this);
1452
- if (excluded && excludeKey) {
1453
- CACHE_EXTERNAL[excludeKey] = true;
1454
- }
1455
1451
  if (!valid) {
1456
1452
  return;
1457
1453
  }
@@ -1466,7 +1462,7 @@ class Document extends core_1.Client {
1466
1462
  if (sourceFiles) {
1467
1463
  output.sourceFiles = sourceFiles;
1468
1464
  }
1469
- if (!excluded && !ignoreCache && cache?.formatType) {
1465
+ if (!ignoreCache && cache?.formatType) {
1470
1466
  void cache.finalize(type, code, { ...output, log: storedLog });
1471
1467
  }
1472
1468
  return output;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.12.17",
3
+ "version": "0.12.18",
4
4
  "description": "Document constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -19,9 +19,9 @@
19
19
  "license": "MIT",
20
20
  "homepage": "https://github.com/anpham6/e-mc#readme",
21
21
  "dependencies": {
22
- "@e-mc/core": "0.12.17",
23
- "@e-mc/db": "0.12.17",
24
- "@e-mc/types": "0.12.17",
22
+ "@e-mc/core": "0.12.18",
23
+ "@e-mc/db": "0.12.18",
24
+ "@e-mc/types": "0.12.18",
25
25
  "chalk": "4.1.2",
26
26
  "domhandler": "^5.0.3",
27
27
  "domutils": "^3.2.2",