@e-mc/file-manager 0.11.17 → 0.11.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/README.md +11 -11
- package/index.js +11 -4
- package/package.json +10 -10
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.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.11.18/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
|
|
@@ -306,18 +306,18 @@ NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-
|
|
|
306
306
|
|
|
307
307
|
## References
|
|
308
308
|
|
|
309
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
310
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
311
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
312
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
313
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
314
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
315
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
316
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
317
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
309
|
+
- https://www.unpkg.com/@e-mc/types@0.11.18/lib/squared.d.ts
|
|
310
|
+
- https://www.unpkg.com/@e-mc/types@0.11.18/lib/asset.d.ts
|
|
311
|
+
- https://www.unpkg.com/@e-mc/types@0.11.18/lib/core.d.ts
|
|
312
|
+
- https://www.unpkg.com/@e-mc/types@0.11.18/lib/filemanager.d.ts
|
|
313
|
+
- https://www.unpkg.com/@e-mc/types@0.11.18/lib/logger.d.ts
|
|
314
|
+
- https://www.unpkg.com/@e-mc/types@0.11.18/lib/module.d.ts
|
|
315
|
+
- https://www.unpkg.com/@e-mc/types@0.11.18/lib/node.d.ts
|
|
316
|
+
- https://www.unpkg.com/@e-mc/types@0.11.18/lib/request.d.ts
|
|
317
|
+
- https://www.unpkg.com/@e-mc/types@0.11.18/lib/settings.d.ts
|
|
318
318
|
|
|
319
319
|
* https://www.npmjs.com/package/@types/node
|
|
320
320
|
|
|
321
321
|
## LICENSE
|
|
322
322
|
|
|
323
|
-
|
|
323
|
+
MIT
|
package/index.js
CHANGED
|
@@ -681,6 +681,7 @@ function setLogMinWidth() {
|
|
|
681
681
|
const closeResponse = (client) => client?.destroy();
|
|
682
682
|
const isCacheable = (item) => item.initialValue?.cacheable !== false;
|
|
683
683
|
const getPmOptions = (value, { matchBase = value.startsWith('*') && !value.includes('/'), dot = false } = {}) => ({ matchBase, nocase: core_1.Host.PLATFORM_WIN32, dot });
|
|
684
|
+
const isNoContent = (statusCode) => statusCode === 204 || statusCode === 304;
|
|
684
685
|
const hasIncremental = (value) => value === "etag" || value === "exists";
|
|
685
686
|
const matchPathname = (value) => core_1.Host.PLATFORM_WIN32 ? value.toLowerCase() : value;
|
|
686
687
|
const mapLower = (values) => core_1.Host.PLATFORM_WIN32 ? values.map(value => value.toLowerCase()) : values;
|
|
@@ -1057,7 +1058,11 @@ class ProcessFile {
|
|
|
1057
1058
|
(parent.bundleQueue ||= []).push(new Promise(resolve => {
|
|
1058
1059
|
host.Request.open(url, { method: 'HEAD', httpVersion: 1 })
|
|
1059
1060
|
.on('response', res => {
|
|
1060
|
-
|
|
1061
|
+
const statusCode = res.statusCode;
|
|
1062
|
+
if (isNoContent(statusCode)) {
|
|
1063
|
+
file.contentLength = 0;
|
|
1064
|
+
}
|
|
1065
|
+
else if (statusCode < 300) {
|
|
1061
1066
|
processHeaders(file, res.headers, false, false);
|
|
1062
1067
|
}
|
|
1063
1068
|
resolve(file);
|
|
@@ -1738,8 +1743,7 @@ class FileManager extends core_1.Host {
|
|
|
1738
1743
|
if (LOG_TIMEPROCESS) {
|
|
1739
1744
|
core_1.Host.initCpuUsage(this);
|
|
1740
1745
|
}
|
|
1741
|
-
|
|
1742
|
-
this[kBaseDirectory] = path.normalize(baseDirectory[index] === path.sep ? baseDirectory.substring(0, index) : baseDirectory);
|
|
1746
|
+
this[kBaseDirectory] = path.normalize(core_1.Host.PLATFORM_WIN32 ? baseDirectory.replace(/[\\/]+$/, '') : baseDirectory.replace(/\/+$/, ''));
|
|
1743
1747
|
this.permission = permission && core_1.Host.isPermission(permission) ? permission : core_1.Host.getPermissionFromSettings();
|
|
1744
1748
|
this.sessionId = (++SESSION_ID === SESSION_LIMIT ? SESSION_ID = 1 : SESSION_ID).toString();
|
|
1745
1749
|
const assets = config.assets || [];
|
|
@@ -3583,7 +3587,10 @@ class FileManager extends core_1.Host {
|
|
|
3583
3587
|
.on('response', res => {
|
|
3584
3588
|
--processTask.pending;
|
|
3585
3589
|
const statusCode = res.statusCode;
|
|
3586
|
-
if (statusCode
|
|
3590
|
+
if (isNoContent(statusCode)) {
|
|
3591
|
+
downloadUri(opts, null);
|
|
3592
|
+
}
|
|
3593
|
+
else if (statusCode < 300) {
|
|
3587
3594
|
const etag = processHeaders(item, res.headers, false, mainEtag);
|
|
3588
3595
|
let etagDir = null, tempDir;
|
|
3589
3596
|
if (etag) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/file-manager",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.18",
|
|
4
4
|
"description": "FileManager constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "0.11.
|
|
24
|
-
"@e-mc/compress": "0.11.
|
|
25
|
-
"@e-mc/core": "0.11.
|
|
26
|
-
"@e-mc/document": "0.11.
|
|
27
|
-
"@e-mc/image": "0.11.
|
|
28
|
-
"@e-mc/request": "0.11.
|
|
29
|
-
"@e-mc/task": "0.11.
|
|
30
|
-
"@e-mc/types": "0.11.
|
|
31
|
-
"@e-mc/watch": "0.11.
|
|
23
|
+
"@e-mc/cloud": "0.11.18",
|
|
24
|
+
"@e-mc/compress": "0.11.18",
|
|
25
|
+
"@e-mc/core": "0.11.18",
|
|
26
|
+
"@e-mc/document": "0.11.18",
|
|
27
|
+
"@e-mc/image": "0.11.18",
|
|
28
|
+
"@e-mc/request": "0.11.18",
|
|
29
|
+
"@e-mc/task": "0.11.18",
|
|
30
|
+
"@e-mc/types": "0.11.18",
|
|
31
|
+
"@e-mc/watch": "0.11.18",
|
|
32
32
|
"chalk": "4.1.2",
|
|
33
33
|
"diff": "^7.0.0",
|
|
34
34
|
"picomatch": "^4.0.4"
|