@e-mc/file-manager 0.5.0 → 0.5.2
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/index.js +17 -19
- package/package.json +10 -10
package/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const util_1 = require("../request/util");
|
|
|
9
9
|
const asset_1 = require("../document/asset");
|
|
10
10
|
const util_2 = require("../document/util");
|
|
11
11
|
const types_1 = require("../types");
|
|
12
|
+
const core_1 = require("../core");
|
|
12
13
|
const request_1 = require("../request");
|
|
13
14
|
const document_1 = require("../document");
|
|
14
15
|
const task_1 = require("../task");
|
|
@@ -16,7 +17,6 @@ const image_1 = require("../image");
|
|
|
16
17
|
const watch_1 = require("../watch");
|
|
17
18
|
const compress_1 = require("../compress");
|
|
18
19
|
const cloud_1 = require("../cloud");
|
|
19
|
-
const core_1 = require("../core");
|
|
20
20
|
const kBaseDirectory = Symbol('baseDirectory');
|
|
21
21
|
const kIncremental = Symbol('incremental');
|
|
22
22
|
const kRestarting = Symbol('restarting');
|
|
@@ -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
|
-
|
|
686
|
-
this
|
|
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;
|
|
@@ -995,7 +993,7 @@ class FileManager extends core_1.Host {
|
|
|
995
993
|
else {
|
|
996
994
|
try {
|
|
997
995
|
const Handler = require(target);
|
|
998
|
-
if (isFunction(Handler) && Handler.prototype instanceof
|
|
996
|
+
if (isFunction(Handler) && Handler.prototype instanceof core_1.ClientDb) {
|
|
999
997
|
instance = new Handler(module, database);
|
|
1000
998
|
}
|
|
1001
999
|
else {
|
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2742
|
+
downloadable.set(item, download);
|
|
2745
2743
|
}
|
|
2746
|
-
if (
|
|
2747
|
-
for (const { url } of
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.5.2",
|
|
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.
|
|
24
|
-
"@e-mc/compress": "0.5.
|
|
25
|
-
"@e-mc/core": "0.5.
|
|
26
|
-
"@e-mc/document": "0.5.
|
|
27
|
-
"@e-mc/image": "0.5.
|
|
28
|
-
"@e-mc/request": "0.5.
|
|
29
|
-
"@e-mc/task": "0.5.
|
|
30
|
-
"@e-mc/types": "0.5.
|
|
31
|
-
"@e-mc/watch": "0.5.
|
|
23
|
+
"@e-mc/cloud": "0.5.2",
|
|
24
|
+
"@e-mc/compress": "0.5.2",
|
|
25
|
+
"@e-mc/core": "0.5.2",
|
|
26
|
+
"@e-mc/document": "0.5.2",
|
|
27
|
+
"@e-mc/image": "0.5.2",
|
|
28
|
+
"@e-mc/request": "0.5.2",
|
|
29
|
+
"@e-mc/task": "0.5.2",
|
|
30
|
+
"@e-mc/types": "0.5.2",
|
|
31
|
+
"@e-mc/watch": "0.5.2"
|
|
32
32
|
}
|
|
33
33
|
}
|