@e-mc/file-manager 0.8.29 → 0.8.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/README.md +10 -10
- 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
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
12
|
+
- https://www.unpkg.com/@e-mc/types@0.8.30/lib/index.d.ts
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
|
|
@@ -191,15 +191,15 @@ interface FileManagerConstructor extends HostConstructor {
|
|
|
191
191
|
|
|
192
192
|
## References
|
|
193
193
|
|
|
194
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
195
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
196
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
197
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
198
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
199
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
200
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
201
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
202
|
-
- https://www.unpkg.com/@e-mc/types@0.8.
|
|
194
|
+
- https://www.unpkg.com/@e-mc/types@0.8.30/lib/squared.d.ts
|
|
195
|
+
- https://www.unpkg.com/@e-mc/types@0.8.30/lib/asset.d.ts
|
|
196
|
+
- https://www.unpkg.com/@e-mc/types@0.8.30/lib/core.d.ts
|
|
197
|
+
- https://www.unpkg.com/@e-mc/types@0.8.30/lib/filemanager.d.ts
|
|
198
|
+
- https://www.unpkg.com/@e-mc/types@0.8.30/lib/logger.d.ts
|
|
199
|
+
- https://www.unpkg.com/@e-mc/types@0.8.30/lib/module.d.ts
|
|
200
|
+
- https://www.unpkg.com/@e-mc/types@0.8.30/lib/node.d.ts
|
|
201
|
+
- https://www.unpkg.com/@e-mc/types@0.8.30/lib/request.d.ts
|
|
202
|
+
- https://www.unpkg.com/@e-mc/types@0.8.30/lib/settings.d.ts
|
|
203
203
|
|
|
204
204
|
## LICENSE
|
|
205
205
|
|
package/index.js
CHANGED
|
@@ -287,6 +287,7 @@ function rejectModule(err, type, hint) {
|
|
|
287
287
|
}
|
|
288
288
|
const checksumFile = (algorithm) => "checksum" + '.' + ((0, types_1.isString)(algorithm) ? algorithm.toLowerCase() : "sha256");
|
|
289
289
|
const checksumError = (algorithm) => new Error("Invalid parameters" + ` (${algorithm || "sha256"})`);
|
|
290
|
+
const isNoContent = (statusCode) => statusCode === 204 || statusCode === 304;
|
|
290
291
|
const isFunction = (value) => typeof value === 'function';
|
|
291
292
|
const ignoreAsset = (item, exists) => item.invalid || (0, types_1.hasBit)(item.flags, 1 | (!exists ? 128 : 0));
|
|
292
293
|
class HttpDiskCache {
|
|
@@ -929,8 +930,7 @@ class FileManager extends core_1.Host {
|
|
|
929
930
|
if (LOG_TIMEPROCESS) {
|
|
930
931
|
setCpuUsage.call(this);
|
|
931
932
|
}
|
|
932
|
-
|
|
933
|
-
this[kBaseDirectory] = path.normalize(baseDirectory[index] === path.sep ? baseDirectory.substring(0, index) : baseDirectory);
|
|
933
|
+
this[kBaseDirectory] = path.normalize(PLATFORM_WIN32 ? baseDirectory.replace(/[\\/]+$/, '') : baseDirectory.replace(/\/+$/, ''));
|
|
934
934
|
this.permission = permission && core_1.Host.isPermission(permission) ? permission : core_1.Host.getPermissionFromSettings();
|
|
935
935
|
this.sessionId = (++SESSION_ID === SESSION_LIMIT ? SESSION_ID = 1 : SESSION_ID).toString();
|
|
936
936
|
const { assets = [], incremental, dataSource, timeout } = config;
|
|
@@ -2455,7 +2455,11 @@ class FileManager extends core_1.Host {
|
|
|
2455
2455
|
(parent.bundleQueue || (parent.bundleQueue = [])).push(new Promise(resolve => {
|
|
2456
2456
|
this.Request.open(url, { method: 'HEAD', httpVersion: 1 })
|
|
2457
2457
|
.on('response', res => {
|
|
2458
|
-
|
|
2458
|
+
const statusCode = res.statusCode;
|
|
2459
|
+
if (isNoContent(statusCode)) {
|
|
2460
|
+
file.contentLength = 0;
|
|
2461
|
+
}
|
|
2462
|
+
else if (statusCode < 300) {
|
|
2459
2463
|
applyHeaders(file, res.headers);
|
|
2460
2464
|
}
|
|
2461
2465
|
resolve(file);
|
|
@@ -3102,7 +3106,10 @@ class FileManager extends core_1.Host {
|
|
|
3102
3106
|
(client = request.open(href, target))
|
|
3103
3107
|
.on('response', res => {
|
|
3104
3108
|
const statusCode = res.statusCode;
|
|
3105
|
-
if (statusCode
|
|
3109
|
+
if (isNoContent(statusCode)) {
|
|
3110
|
+
downloadUri(target, null);
|
|
3111
|
+
}
|
|
3112
|
+
else if (statusCode < 300) {
|
|
3106
3113
|
const etag = applyHeaders(item, res.headers, false, mainEtag);
|
|
3107
3114
|
let tempDir, etagDir;
|
|
3108
3115
|
if (etag) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/file-manager",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.30",
|
|
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.8.
|
|
24
|
-
"@e-mc/compress": "0.8.
|
|
25
|
-
"@e-mc/core": "0.8.
|
|
26
|
-
"@e-mc/document": "0.8.
|
|
27
|
-
"@e-mc/image": "0.8.
|
|
28
|
-
"@e-mc/request": "0.8.
|
|
29
|
-
"@e-mc/task": "0.8.
|
|
30
|
-
"@e-mc/types": "0.8.
|
|
31
|
-
"@e-mc/watch": "0.8.
|
|
23
|
+
"@e-mc/cloud": "0.8.30",
|
|
24
|
+
"@e-mc/compress": "0.8.30",
|
|
25
|
+
"@e-mc/core": "0.8.30",
|
|
26
|
+
"@e-mc/document": "0.8.30",
|
|
27
|
+
"@e-mc/image": "0.8.30",
|
|
28
|
+
"@e-mc/request": "0.8.30",
|
|
29
|
+
"@e-mc/task": "0.8.30",
|
|
30
|
+
"@e-mc/types": "0.8.30",
|
|
31
|
+
"@e-mc/watch": "0.8.30",
|
|
32
32
|
"picomatch": "^3.0.1"
|
|
33
33
|
}
|
|
34
34
|
}
|