@e-mc/file-manager 0.4.1 → 0.5.0
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 +29 -29
- package/package.json +10 -10
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
3
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
3
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const fs = require("fs");
|
|
@@ -640,7 +640,6 @@ class FileManager extends core_1.Host {
|
|
|
640
640
|
}
|
|
641
641
|
constructor(baseDirectory, config, permission, postFinalize) {
|
|
642
642
|
super(config);
|
|
643
|
-
this.archiving = false;
|
|
644
643
|
this.finalizeState = 0 /* FINALIZE_STATE.READY */;
|
|
645
644
|
this.processTimeout = PROCESS_TIMEOUT.filemanager;
|
|
646
645
|
this.Document = [];
|
|
@@ -665,20 +664,15 @@ class FileManager extends core_1.Host {
|
|
|
665
664
|
this.emptyDir = new Set();
|
|
666
665
|
this._moduleName = 'filemanager';
|
|
667
666
|
this._pendingResult = null;
|
|
668
|
-
this[_c] =
|
|
669
|
-
this[_d] =
|
|
670
|
-
this[_e] =
|
|
671
|
-
this[_f] =
|
|
672
|
-
this[_g] =
|
|
673
|
-
this[_h] =
|
|
674
|
-
this[_j] =
|
|
675
|
-
this[_k] =
|
|
676
|
-
|
|
677
|
-
if (typeof permission === 'boolean') {
|
|
678
|
-
this.archiving = permission;
|
|
679
|
-
permission = undefined;
|
|
680
|
-
}
|
|
681
|
-
else if (isFunction(permission)) {
|
|
667
|
+
this[_c] = false;
|
|
668
|
+
this[_d] = 0;
|
|
669
|
+
this[_e] = false;
|
|
670
|
+
this[_f] = null;
|
|
671
|
+
this[_g] = RECURSION_LIMIT;
|
|
672
|
+
this[_h] = {};
|
|
673
|
+
this[_j] = [[0, 0], [0, 0], [0, 0]];
|
|
674
|
+
this[_k] = {};
|
|
675
|
+
if (isFunction(permission)) {
|
|
682
676
|
postFinalize = permission;
|
|
683
677
|
permission = undefined;
|
|
684
678
|
}
|
|
@@ -691,7 +685,7 @@ class FileManager extends core_1.Host {
|
|
|
691
685
|
this[kBaseDirectory] = path.normalize(baseDirectory[baseDirectory.length - 1] === path.sep ? baseDirectory.substring(0, baseDirectory.length - 1) : baseDirectory);
|
|
692
686
|
this.permission = permission || core_1.Host.getPermissionFromSettings();
|
|
693
687
|
this.sessionId = (++SESSION_ID === SESSION_LIMIT ? SESSION_ID = 1 : SESSION_ID).toString();
|
|
694
|
-
const { assets = [], dataSource, timeout } = config;
|
|
688
|
+
const { assets = [], incremental, dataSource, timeout } = config;
|
|
695
689
|
let targeted;
|
|
696
690
|
for (let i = 0, length = assets.length; i < length; ++i) {
|
|
697
691
|
const item = assets[i];
|
|
@@ -722,6 +716,7 @@ class FileManager extends core_1.Host {
|
|
|
722
716
|
item.id || (item.id = ++ASSET_ID);
|
|
723
717
|
}
|
|
724
718
|
this._assets = assets.slice(0);
|
|
719
|
+
this[kIncremental] = incremental === 'staging' ? 'staging' : 'none';
|
|
725
720
|
if (targeted) {
|
|
726
721
|
this.using(...targeted);
|
|
727
722
|
}
|
|
@@ -758,7 +753,7 @@ class FileManager extends core_1.Host {
|
|
|
758
753
|
}
|
|
759
754
|
}
|
|
760
755
|
}
|
|
761
|
-
*[(_b = Symbol.toStringTag, _c =
|
|
756
|
+
*[(_b = Symbol.toStringTag, _c = kRestarting, _d = kDelayed, _e = kCleared, _f = KTimerMain, _g = kRecursionLimit, _h = kProcessTimeout, _j = kDownloadStats, _k = kReplaceMap, Symbol.iterator)]() {
|
|
762
757
|
for (const file of this.files) {
|
|
763
758
|
yield file;
|
|
764
759
|
}
|
|
@@ -2187,15 +2182,19 @@ class FileManager extends core_1.Host {
|
|
|
2187
2182
|
const bundling = {};
|
|
2188
2183
|
const originCount = {};
|
|
2189
2184
|
const emptied = [this.baseDirectory];
|
|
2185
|
+
const staging = this[kIncremental] === 'staging';
|
|
2190
2186
|
const incremental = this.config.incremental;
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2187
|
+
let cacheable = false, cacheOpen = false, cacheEtag = false;
|
|
2188
|
+
if (!staging) {
|
|
2189
|
+
if (cacheable = initial) {
|
|
2190
|
+
if (cacheOpen = hasIncremental(incremental)) {
|
|
2191
|
+
this[kIncremental] = incremental;
|
|
2192
|
+
}
|
|
2193
|
+
cacheEtag = incremental === 'etag';
|
|
2194
|
+
}
|
|
2195
|
+
else {
|
|
2196
|
+
this[kIncremental] = 'none';
|
|
2197
|
+
}
|
|
2199
2198
|
}
|
|
2200
2199
|
const targeting = this._usingObjects.size > 0;
|
|
2201
2200
|
const isCacheable = (file) => file.initialValue?.cacheable !== false;
|
|
@@ -2207,6 +2206,7 @@ class FileManager extends core_1.Host {
|
|
|
2207
2206
|
case false:
|
|
2208
2207
|
case 'none':
|
|
2209
2208
|
case 'exists':
|
|
2209
|
+
case 'staging':
|
|
2210
2210
|
return false;
|
|
2211
2211
|
case 'etag':
|
|
2212
2212
|
return true;
|
|
@@ -2234,14 +2234,14 @@ class FileManager extends core_1.Host {
|
|
|
2234
2234
|
}
|
|
2235
2235
|
};
|
|
2236
2236
|
const checkQueue = (file, localUri, pathname, content) => {
|
|
2237
|
-
var
|
|
2237
|
+
var _l;
|
|
2238
2238
|
if (!createFolder(file, pathname)) {
|
|
2239
2239
|
return true;
|
|
2240
2240
|
}
|
|
2241
2241
|
const { bundleId, bundleIndex = -1 } = file;
|
|
2242
2242
|
if (!(0, types_1.isEmpty)(bundleId) && bundleIndex >= 0) {
|
|
2243
2243
|
const items = appending[localUri] || (appending[localUri] = []);
|
|
2244
|
-
bundling[
|
|
2244
|
+
bundling[_l = file.uri] || (bundling[_l] = []);
|
|
2245
2245
|
if (bundleIndex > 0) {
|
|
2246
2246
|
items[bundleIndex - 1] = file;
|
|
2247
2247
|
const url = file.url;
|
|
@@ -2782,7 +2782,7 @@ class FileManager extends core_1.Host {
|
|
|
2782
2782
|
}
|
|
2783
2783
|
}
|
|
2784
2784
|
else if (uri = item.uri) {
|
|
2785
|
-
const checkDest = (src) =>
|
|
2785
|
+
const checkDest = (src) => staging || !(0, lib_v4_1.hasSameStat)(src, localUri);
|
|
2786
2786
|
const type = item.fetchType;
|
|
2787
2787
|
const bundleMain = !(0, types_1.isEmpty)(item.bundleId) && item.bundleIndex === 0;
|
|
2788
2788
|
let isHttp;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/file-manager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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.
|
|
24
|
-
"@e-mc/compress": "0.
|
|
25
|
-
"@e-mc/core": "0.
|
|
26
|
-
"@e-mc/document": "0.
|
|
27
|
-
"@e-mc/image": "0.
|
|
28
|
-
"@e-mc/request": "0.
|
|
29
|
-
"@e-mc/task": "0.
|
|
30
|
-
"@e-mc/types": "0.
|
|
31
|
-
"@e-mc/watch": "0.
|
|
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"
|
|
32
32
|
}
|
|
33
33
|
}
|