@e-mc/file-manager 0.13.10 → 0.13.11

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.
Files changed (3) hide show
  1. package/README.md +10 -10
  2. package/index.js +11 -3
  3. package/package.json +11 -11
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.13.10/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.13.11/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { ChecksumValue, DataSource, IncrementalMatch, TaskAction } from "./squared";
@@ -297,15 +297,15 @@ NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-
297
297
 
298
298
  ## References
299
299
 
300
- - https://www.unpkg.com/@e-mc/types@0.13.10/lib/squared.d.ts
301
- - https://www.unpkg.com/@e-mc/types@0.13.10/lib/asset.d.ts
302
- - https://www.unpkg.com/@e-mc/types@0.13.10/lib/core.d.ts
303
- - https://www.unpkg.com/@e-mc/types@0.13.10/lib/filemanager.d.ts
304
- - https://www.unpkg.com/@e-mc/types@0.13.10/lib/logger.d.ts
305
- - https://www.unpkg.com/@e-mc/types@0.13.10/lib/module.d.ts
306
- - https://www.unpkg.com/@e-mc/types@0.13.10/lib/node.d.ts
307
- - https://www.unpkg.com/@e-mc/types@0.13.10/lib/request.d.ts
308
- - https://www.unpkg.com/@e-mc/types@0.13.10/lib/settings.d.ts
300
+ - https://www.unpkg.com/@e-mc/types@0.13.11/lib/squared.d.ts
301
+ - https://www.unpkg.com/@e-mc/types@0.13.11/lib/asset.d.ts
302
+ - https://www.unpkg.com/@e-mc/types@0.13.11/lib/core.d.ts
303
+ - https://www.unpkg.com/@e-mc/types@0.13.11/lib/filemanager.d.ts
304
+ - https://www.unpkg.com/@e-mc/types@0.13.11/lib/logger.d.ts
305
+ - https://www.unpkg.com/@e-mc/types@0.13.11/lib/module.d.ts
306
+ - https://www.unpkg.com/@e-mc/types@0.13.11/lib/node.d.ts
307
+ - https://www.unpkg.com/@e-mc/types@0.13.11/lib/request.d.ts
308
+ - https://www.unpkg.com/@e-mc/types@0.13.11/lib/settings.d.ts
309
309
 
310
310
  * https://www.npmjs.com/package/@types/node
311
311
 
package/index.js CHANGED
@@ -482,6 +482,7 @@ const downloadStats = () => [[0, 0], [0, 0], [0, 0]];
482
482
  const isCacheable = (item) => item.initialValue?.cacheable !== false;
483
483
  const getPmOptions = (value, { matchBase = value.startsWith('*') && !value.includes('/'), dot = false } = {}) => ({ nocase: core_1.Host.PLATFORM_WIN32, matchBase, dot });
484
484
  const isDownloadAll = (type) => type === 4 || type === 0;
485
+ const isNoContent = (statusCode) => statusCode === 204 || statusCode === 304;
485
486
  const hasFiles = (type, uri) => type === 3 || type === 4 || type === 0 && request_1.isRclone(uri);
486
487
  const hasIncremental = (value) => value === "etag" || value === "exists";
487
488
  const matchPathname = (value) => core_1.Host.PLATFORM_WIN32 ? value.toLowerCase() : value;
@@ -878,7 +879,11 @@ class ProcessFile {
878
879
  (parent.bundleQueue ||= []).push(new Promise(resolve => {
879
880
  host.Request.open(url, { method: 'HEAD', httpVersion: 1 })
880
881
  .on('response', res => {
881
- if (res.statusCode < 300) {
882
+ const statusCode = res.statusCode;
883
+ if (isNoContent(statusCode)) {
884
+ file.contentLength = 0;
885
+ }
886
+ else if (statusCode < 300) {
882
887
  processHeaders(file, res.headers, false, false);
883
888
  }
884
889
  resolve(file);
@@ -1610,7 +1615,7 @@ class FileManager extends core_1.Host {
1610
1615
  if (LOG_TIMEPROCESS) {
1611
1616
  core_1.Host.initCpuUsage(this);
1612
1617
  }
1613
- this.#baseDirectory = path.normalize(baseDirectory.at(-1) === path.sep ? baseDirectory.slice(0, -1) : baseDirectory);
1618
+ this.#baseDirectory = path.normalize(core_1.Host.PLATFORM_WIN32 ? baseDirectory.replace(/[\\/]+$/, '') : baseDirectory.replace(/\/+$/, ''));
1614
1619
  this.permission = permission && core_1.Host.isPermission(permission) ? permission : core_1.Host.getPermissionFromSettings();
1615
1620
  this.sessionId = FileManager.generateSessionId();
1616
1621
  this.supports('permission', false, true);
@@ -3517,7 +3522,10 @@ class FileManager extends core_1.Host {
3517
3522
  .on('response', res => {
3518
3523
  --processTask.pending;
3519
3524
  const statusCode = res.statusCode;
3520
- if (statusCode < 300) {
3525
+ if (isNoContent(statusCode)) {
3526
+ downloadUri(opts, null);
3527
+ }
3528
+ else if (statusCode < 300) {
3521
3529
  const etag = processHeaders(item, res.headers, false, mainEtag);
3522
3530
  let etagDir = null, tempDir;
3523
3531
  if (etag) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.13.10",
3
+ "version": "0.13.11",
4
4
  "description": "FileManager constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -19,17 +19,17 @@
19
19
  "license": "BSD-3-Clause",
20
20
  "homepage": "https://github.com/anpham6/e-mc#readme",
21
21
  "dependencies": {
22
- "@e-mc/cloud": "0.13.10",
23
- "@e-mc/compress": "0.13.10",
24
- "@e-mc/core": "0.13.10",
25
- "@e-mc/document": "0.13.10",
26
- "@e-mc/image": "0.13.10",
27
- "@e-mc/request": "0.13.10",
28
- "@e-mc/task": "0.13.10",
29
- "@e-mc/types": "0.13.10",
30
- "@e-mc/watch": "0.13.10",
22
+ "@e-mc/cloud": "0.13.11",
23
+ "@e-mc/compress": "0.13.11",
24
+ "@e-mc/core": "0.13.11",
25
+ "@e-mc/document": "0.13.11",
26
+ "@e-mc/image": "0.13.11",
27
+ "@e-mc/request": "0.13.11",
28
+ "@e-mc/task": "0.13.11",
29
+ "@e-mc/types": "0.13.11",
30
+ "@e-mc/watch": "0.13.11",
31
31
  "chalk": "4.1.2",
32
- "diff": "^8.0.3",
32
+ "diff": "^8.0.4",
33
33
  "picomatch": "^4.0.4"
34
34
  }
35
35
  }