@e-mc/document 0.12.16 → 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.
- package/LICENSE +4 -8
- package/README.md +10 -10
- package/index.js +8 -12
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2025 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
|
|
|
5
|
-
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
11
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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.
|
|
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,15 +187,15 @@ 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.
|
|
191
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
192
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
193
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
194
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
195
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
196
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
197
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
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
|
|
|
201
|
-
|
|
201
|
+
MIT
|
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,
|
|
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
|
|
1208
|
+
let cache = null;
|
|
1210
1209
|
if (cacheData) {
|
|
1211
1210
|
const cacheDir = this.hasPermission('memory.user') || this.cacheDir || this.hasPermission('memory');
|
|
1212
|
-
if (cacheDir &&
|
|
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,
|
|
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
|
-
|
|
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 (!
|
|
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.
|
|
3
|
+
"version": "0.12.18",
|
|
4
4
|
"description": "Document constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"squared"
|
|
17
17
|
],
|
|
18
18
|
"author": "An Pham <anpham6@gmail.com>",
|
|
19
|
-
"license": "
|
|
19
|
+
"license": "MIT",
|
|
20
20
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@e-mc/core": "0.12.
|
|
23
|
-
"@e-mc/db": "0.12.
|
|
24
|
-
"@e-mc/types": "0.12.
|
|
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",
|