@e-mc/document 0.9.28 → 0.9.30

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.
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2025 An Pham
1
+ Copyright 2024 An Pham
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
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.9.28/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.9.30/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.9.28/lib/squared.d.ts
187
- - https://www.unpkg.com/@e-mc/types@0.9.28/lib/asset.d.ts
188
- - https://www.unpkg.com/@e-mc/types@0.9.28/lib/core.d.ts
189
- - https://www.unpkg.com/@e-mc/types@0.9.28/lib/document.d.ts
190
- - https://www.unpkg.com/@e-mc/types@0.9.28/lib/filemanager.d.ts
191
- - https://www.unpkg.com/@e-mc/types@0.9.28/lib/logger.d.ts
192
- - https://www.unpkg.com/@e-mc/types@0.9.28/lib/settings.d.ts
193
- - https://www.unpkg.com/@e-mc/types@0.9.28/lib/watch.d.ts
186
+ - https://www.unpkg.com/@e-mc/types@0.9.30/lib/squared.d.ts
187
+ - https://www.unpkg.com/@e-mc/types@0.9.30/lib/asset.d.ts
188
+ - https://www.unpkg.com/@e-mc/types@0.9.30/lib/core.d.ts
189
+ - https://www.unpkg.com/@e-mc/types@0.9.30/lib/document.d.ts
190
+ - https://www.unpkg.com/@e-mc/types@0.9.30/lib/filemanager.d.ts
191
+ - https://www.unpkg.com/@e-mc/types@0.9.30/lib/logger.d.ts
192
+ - https://www.unpkg.com/@e-mc/types@0.9.30/lib/settings.d.ts
193
+ - https://www.unpkg.com/@e-mc/types@0.9.30/lib/watch.d.ts
194
194
 
195
195
  ## LICENSE
196
196
 
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) {
@@ -102,7 +101,7 @@ class Document extends core_1.Client {
102
101
  delete cache[name];
103
102
  }
104
103
  }
105
- for (const cache of [CACHE_PACKAGE, CACHE_REQUIRE, CACHE_EXTERNAL, CACHE_TEMPLATE]) {
104
+ for (const cache of [CACHE_PACKAGE, CACHE_REQUIRE, CACHE_TEMPLATE]) {
106
105
  for (const name in cache) {
107
106
  delete cache[name];
108
107
  }
@@ -1018,8 +1017,8 @@ class Document extends core_1.Client {
1018
1017
  const config = this._transformConfig;
1019
1018
  const cacheData = config && options.cacheData;
1020
1019
  const cacheDir = username && core_1.Client.enabled("memory.settings.users", username) ? true : this.cacheDir || core_1.Client.enabled("memory.settings.users");
1021
- let formatKey = '', hashKey, excludeKey;
1022
- if (cacheData && cacheDir && !CACHE_EXTERNAL[excludeKey = this.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)))) {
1020
+ let formatKey = '', hashKey;
1021
+ if (cacheData && cacheDir && (!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)))) {
1023
1022
  const { uri, etag } = cacheData;
1024
1023
  const encoding = (0, types_1.getEncoding)(cacheData.encoding);
1025
1024
  const algorithm = config.algorithm;
@@ -1081,7 +1080,7 @@ class Document extends core_1.Client {
1081
1080
  const imports = transform.imports ||= {};
1082
1081
  const series = new transform_1.TransformSeries(type, code, options);
1083
1082
  series.init(this, __dirname);
1084
- let valid, excluded, userData, userImports, ignoreCache, storedLog, sourceFiles;
1083
+ let valid, userData, userImports, ignoreCache, storedLog, sourceFiles;
1085
1084
  if (username && (transform = this.settings.users?.[username]?.transform)) {
1086
1085
  userData = transform[type];
1087
1086
  userImports = transform.imports;
@@ -1122,8 +1121,8 @@ class Document extends core_1.Client {
1122
1121
  }
1123
1122
  }
1124
1123
  }
1125
- if (!baseSettings) {
1126
- excluded = !hasTransformType(config, type, name, cacheData);
1124
+ if (!baseSettings && !hasTransformType(config, type, name, cacheData)) {
1125
+ ignoreCache = true;
1127
1126
  }
1128
1127
  outputConfig ||= {};
1129
1128
  if (plugin && baseConfig) {
@@ -1263,9 +1262,6 @@ class Document extends core_1.Client {
1263
1262
  return;
1264
1263
  }
1265
1264
  series.close(this);
1266
- if (excluded && excludeKey) {
1267
- CACHE_EXTERNAL[excludeKey] = true;
1268
- }
1269
1265
  if (!valid) {
1270
1266
  return;
1271
1267
  }
@@ -1280,7 +1276,7 @@ class Document extends core_1.Client {
1280
1276
  if (sourceFiles) {
1281
1277
  output.sourceFiles = sourceFiles;
1282
1278
  }
1283
- if (formatKey && !excluded && !ignoreCache) {
1279
+ if (formatKey && !ignoreCache) {
1284
1280
  const { uri, etag } = cacheData;
1285
1281
  const formatData = { ...output, storedLog };
1286
1282
  const lastAccessed = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/document",
3
- "version": "0.9.28",
3
+ "version": "0.9.30",
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.9.28",
24
- "@e-mc/db": "0.9.28",
25
- "@e-mc/types": "0.9.28",
23
+ "@e-mc/core": "0.9.30",
24
+ "@e-mc/db": "0.9.30",
25
+ "@e-mc/types": "0.9.30",
26
26
  "chalk": "4.1.2",
27
27
  "domhandler": "^5.0.3",
28
28
  "domutils": "^3.2.2",