@e-mc/file-manager 0.5.0 → 0.5.1

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 (2) hide show
  1. package/index.js +15 -17
  2. package/package.json +10 -10
package/index.js CHANGED
@@ -676,14 +676,12 @@ class FileManager extends core_1.Host {
676
676
  postFinalize = permission;
677
677
  permission = undefined;
678
678
  }
679
- else if (!core_1.Host.isPermission(permission)) {
680
- permission = undefined;
681
- }
682
679
  if (LOG_TIMEPROCESS) {
683
680
  setCpuUsage.call(this);
684
681
  }
685
- this[kBaseDirectory] = path.normalize(baseDirectory[baseDirectory.length - 1] === path.sep ? baseDirectory.substring(0, baseDirectory.length - 1) : baseDirectory);
686
- this.permission = permission || core_1.Host.getPermissionFromSettings();
682
+ const index = baseDirectory.length - 1;
683
+ this[kBaseDirectory] = path.normalize(baseDirectory[index] === path.sep ? baseDirectory.substring(0, index) : baseDirectory);
684
+ this.permission = permission && core_1.Host.isPermission(permission) ? permission : core_1.Host.getPermissionFromSettings();
687
685
  this.sessionId = (++SESSION_ID === SESSION_LIMIT ? SESSION_ID = 1 : SESSION_ID).toString();
688
686
  const { assets = [], incremental, dataSource, timeout } = config;
689
687
  let targeted;
@@ -2173,20 +2171,20 @@ class FileManager extends core_1.Host {
2173
2171
  }, types_1.THRESHOLD.FILEMANAGER_INTERVAL);
2174
2172
  const hasIncremental = (value) => value === 'etag' || value === 'exists';
2175
2173
  const { assets, cacheToDisk, cacheToMemory, fetchedAssets, Watch: watch } = this;
2176
- const initial = this[kRecursionLimit] === RECURSION_LIMIT;
2177
- const downloadble = new Map();
2174
+ const downloadable = new Map();
2178
2175
  const completed = Object.create(null);
2179
2176
  const processing = Object.create(null);
2180
2177
  const downloading = Object.create(null);
2181
- const appending = {};
2182
- const bundling = {};
2183
- const originCount = {};
2178
+ const appending = Object.create(null);
2179
+ const bundling = Object.create(null);
2180
+ const originCount = Object.create(null);
2184
2181
  const emptied = [this.baseDirectory];
2185
2182
  const staging = this[kIncremental] === 'staging';
2186
2183
  const incremental = this.config.incremental;
2187
2184
  let cacheable = false, cacheOpen = false, cacheEtag = false;
2188
2185
  if (!staging) {
2189
- if (cacheable = initial) {
2186
+ cacheable = this[kRecursionLimit] === RECURSION_LIMIT;
2187
+ if (cacheable) {
2190
2188
  if (cacheOpen = hasIncremental(incremental)) {
2191
2189
  this[kIncremental] = incremental;
2192
2190
  }
@@ -2668,7 +2666,7 @@ class FileManager extends core_1.Host {
2668
2666
  item.invalid = true;
2669
2667
  }
2670
2668
  else if (target.localUri) {
2671
- downloadble.set(item, download);
2669
+ downloadable.set(item, download);
2672
2670
  }
2673
2671
  else {
2674
2672
  childDownload = download;
@@ -2706,7 +2704,7 @@ class FileManager extends core_1.Host {
2706
2704
  }
2707
2705
  }
2708
2706
  else if (childBundle) {
2709
- downloadble.set(childBundle, childDownload);
2707
+ downloadable.set(childBundle, childDownload);
2710
2708
  }
2711
2709
  else if (cached) {
2712
2710
  try {
@@ -2741,16 +2739,16 @@ class FileManager extends core_1.Host {
2741
2739
  }
2742
2740
  }
2743
2741
  }
2744
- downloadble.set(item, download);
2742
+ downloadable.set(item, download);
2745
2743
  }
2746
- if (downloadble.size > 1 && this.Request.httpVersion !== 1) {
2747
- for (const { url } of downloadble.keys()) {
2744
+ if (downloadable.size > 1 && this.Request.httpVersion !== 1) {
2745
+ for (const { url } of downloadable.keys()) {
2748
2746
  if (url?.protocol === 'https:') {
2749
2747
  originCount[url.origin] = (originCount[url.origin] || 0) + 1;
2750
2748
  }
2751
2749
  }
2752
2750
  }
2753
- for (const [item, download] of downloadble) {
2751
+ for (const [item, download] of downloadable) {
2754
2752
  if (this.aborted) {
2755
2753
  break;
2756
2754
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "FileManager constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,14 +20,14 @@
20
20
  "license": "BSD 3-Clause",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/cloud": "0.5.0",
24
- "@e-mc/compress": "0.5.0",
25
- "@e-mc/core": "0.5.0",
26
- "@e-mc/document": "0.5.0",
27
- "@e-mc/image": "0.5.0",
28
- "@e-mc/request": "0.5.0",
29
- "@e-mc/task": "0.5.0",
30
- "@e-mc/types": "0.5.0",
31
- "@e-mc/watch": "0.5.0"
23
+ "@e-mc/cloud": "0.5.1",
24
+ "@e-mc/compress": "0.5.1",
25
+ "@e-mc/core": "0.5.1",
26
+ "@e-mc/document": "0.5.1",
27
+ "@e-mc/image": "0.5.1",
28
+ "@e-mc/request": "0.5.1",
29
+ "@e-mc/task": "0.5.1",
30
+ "@e-mc/types": "0.5.1",
31
+ "@e-mc/watch": "0.5.1"
32
32
  }
33
33
  }