@e-mc/file-manager 0.9.28 → 0.9.29
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 +1 -1
- package/README.md +10 -10
- package/index.js +11 -4
- package/package.json +10 -10
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
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.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.29/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
|
|
@@ -286,15 +286,15 @@ NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-
|
|
|
286
286
|
|
|
287
287
|
## References
|
|
288
288
|
|
|
289
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
290
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
291
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
292
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
293
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
294
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
295
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
296
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
297
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
289
|
+
- https://www.unpkg.com/@e-mc/types@0.9.29/lib/squared.d.ts
|
|
290
|
+
- https://www.unpkg.com/@e-mc/types@0.9.29/lib/asset.d.ts
|
|
291
|
+
- https://www.unpkg.com/@e-mc/types@0.9.29/lib/core.d.ts
|
|
292
|
+
- https://www.unpkg.com/@e-mc/types@0.9.29/lib/filemanager.d.ts
|
|
293
|
+
- https://www.unpkg.com/@e-mc/types@0.9.29/lib/logger.d.ts
|
|
294
|
+
- https://www.unpkg.com/@e-mc/types@0.9.29/lib/module.d.ts
|
|
295
|
+
- https://www.unpkg.com/@e-mc/types@0.9.29/lib/node.d.ts
|
|
296
|
+
- https://www.unpkg.com/@e-mc/types@0.9.29/lib/request.d.ts
|
|
297
|
+
- https://www.unpkg.com/@e-mc/types@0.9.29/lib/settings.d.ts
|
|
298
298
|
|
|
299
299
|
* https://www.npmjs.com/package/@types/node
|
|
300
300
|
|
package/index.js
CHANGED
|
@@ -326,6 +326,7 @@ const padStart = (value, char) => value > 9 ? value.toString() : char + value;
|
|
|
326
326
|
const checksumFile = (algorithm) => "checksum" + '.' + ((0, types_1.isString)(algorithm) ? algorithm.toLowerCase() : "sha256");
|
|
327
327
|
const checksumError = (algorithm) => new Error("Invalid parameters" + ` (${algorithm || "sha256"})`);
|
|
328
328
|
const getPmOptions = (value, dot = false) => ({ nocase: PLATFORM_WIN32, matchBase: value.startsWith('*') && !value.includes('/'), dot });
|
|
329
|
+
const isNoContent = (statusCode) => statusCode === 204 || statusCode === 304;
|
|
329
330
|
const isFunction = (value) => typeof value === 'function';
|
|
330
331
|
const ignoreAsset = (item, exists) => item.invalid || (0, types_1.hasBit)(item.flags, 1 | (!exists ? 128 : 0));
|
|
331
332
|
class Scheduler {
|
|
@@ -1027,8 +1028,7 @@ class FileManager extends core_1.Host {
|
|
|
1027
1028
|
if (LOG_TIMEPROCESS) {
|
|
1028
1029
|
core_1.Host.initCpuUsage(this);
|
|
1029
1030
|
}
|
|
1030
|
-
|
|
1031
|
-
this[kBaseDirectory] = path.normalize(baseDirectory[index] === path.sep ? baseDirectory.substring(0, index) : baseDirectory);
|
|
1031
|
+
this[kBaseDirectory] = path.normalize(PLATFORM_WIN32 ? baseDirectory.replace(/[\\/]+$/, '') : baseDirectory.replace(/\/+$/, ''));
|
|
1032
1032
|
this.permission = permission && core_1.Host.isPermission(permission) ? permission : core_1.Host.getPermissionFromSettings();
|
|
1033
1033
|
this.sessionId = (++SESSION_ID === SESSION_LIMIT ? SESSION_ID = 1 : SESSION_ID).toString();
|
|
1034
1034
|
const { assets = [], incremental, dataSource, timeout, threads } = config;
|
|
@@ -2582,7 +2582,11 @@ class FileManager extends core_1.Host {
|
|
|
2582
2582
|
(parent.bundleQueue ||= []).push(new Promise(resolve => {
|
|
2583
2583
|
this.Request.open(url, { method: 'HEAD', httpVersion: 1 })
|
|
2584
2584
|
.on('response', res => {
|
|
2585
|
-
|
|
2585
|
+
const statusCode = res.statusCode;
|
|
2586
|
+
if (isNoContent(statusCode)) {
|
|
2587
|
+
file.contentLength = 0;
|
|
2588
|
+
}
|
|
2589
|
+
else if (statusCode < 300) {
|
|
2586
2590
|
applyHeaders(file, res.headers);
|
|
2587
2591
|
}
|
|
2588
2592
|
resolve(file);
|
|
@@ -3246,7 +3250,10 @@ class FileManager extends core_1.Host {
|
|
|
3246
3250
|
(client = request.open(href, target))
|
|
3247
3251
|
.on('response', res => {
|
|
3248
3252
|
const statusCode = res.statusCode;
|
|
3249
|
-
if (statusCode
|
|
3253
|
+
if (isNoContent(statusCode)) {
|
|
3254
|
+
downloadUri(target, null);
|
|
3255
|
+
}
|
|
3256
|
+
else if (statusCode < 300) {
|
|
3250
3257
|
const etag = applyHeaders(item, res.headers, false, mainEtag);
|
|
3251
3258
|
let etagDir = '', tempDir;
|
|
3252
3259
|
if (etag) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/file-manager",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.29",
|
|
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.9.
|
|
24
|
-
"@e-mc/compress": "0.9.
|
|
25
|
-
"@e-mc/core": "0.9.
|
|
26
|
-
"@e-mc/document": "0.9.
|
|
27
|
-
"@e-mc/image": "0.9.
|
|
28
|
-
"@e-mc/request": "0.9.
|
|
29
|
-
"@e-mc/task": "0.9.
|
|
30
|
-
"@e-mc/types": "0.9.
|
|
31
|
-
"@e-mc/watch": "0.9.
|
|
23
|
+
"@e-mc/cloud": "0.9.29",
|
|
24
|
+
"@e-mc/compress": "0.9.29",
|
|
25
|
+
"@e-mc/core": "0.9.29",
|
|
26
|
+
"@e-mc/document": "0.9.29",
|
|
27
|
+
"@e-mc/image": "0.9.29",
|
|
28
|
+
"@e-mc/request": "0.9.29",
|
|
29
|
+
"@e-mc/task": "0.9.29",
|
|
30
|
+
"@e-mc/types": "0.9.29",
|
|
31
|
+
"@e-mc/watch": "0.9.29",
|
|
32
32
|
"chalk": "4.1.2",
|
|
33
33
|
"picomatch": "^4.0.3"
|
|
34
34
|
}
|