@e-mc/file-manager 0.10.19 → 0.10.21

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