@e-mc/file-manager 0.7.7 → 0.7.9
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/LICENSE +6 -6
- package/README.md +4 -6
- package/index.d.ts +5 -5
- package/index.js +30 -39
- package/package.json +34 -34
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Copyright 2024 An Pham
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
1
|
+
Copyright 2024 An Pham
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
7
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { FileManagerConstructor } from '../types/lib';
|
|
2
|
-
import type { ExternalAsset } from '../types/lib/asset';
|
|
3
|
-
|
|
4
|
-
declare const FileManager: FileManagerConstructor<ExternalAsset>;
|
|
5
|
-
|
|
1
|
+
import type { FileManagerConstructor } from '../types/lib';
|
|
2
|
+
import type { ExternalAsset } from '../types/lib/asset';
|
|
3
|
+
|
|
4
|
+
declare const FileManager: FileManagerConstructor<ExternalAsset>;
|
|
5
|
+
|
|
6
6
|
export = FileManager;
|
package/index.js
CHANGED
|
@@ -1099,26 +1099,17 @@ class FileManager extends core_1.Host {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
switch (name) {
|
|
1101
1101
|
case 'cloud': {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
const instance = new watch_1.default(...args);
|
|
1110
|
-
instance.host = this;
|
|
1111
|
-
instance.init(this.config);
|
|
1112
|
-
observeFile.call(this, instance);
|
|
1113
|
-
return this.Watch = instance;
|
|
1114
|
-
}
|
|
1115
|
-
case 'compress': {
|
|
1116
|
-
const instance = new compress_1.default(args[0]);
|
|
1117
|
-
instance.host = this;
|
|
1118
|
-
instance.init();
|
|
1119
|
-
observeFile.call(this, instance);
|
|
1120
|
-
return this.Compress = instance;
|
|
1102
|
+
if ((0, types_1.isArray)(args[1])) {
|
|
1103
|
+
const instance = new cloud_1.default(args[0], args[1]);
|
|
1104
|
+
instance.host = this;
|
|
1105
|
+
instance.init(this.config);
|
|
1106
|
+
observeFile.call(this, instance);
|
|
1107
|
+
return this.Cloud = instance;
|
|
1108
|
+
}
|
|
1121
1109
|
}
|
|
1110
|
+
case 'watch':
|
|
1111
|
+
case 'compress':
|
|
1112
|
+
return this.install(name, ...args);
|
|
1122
1113
|
default:
|
|
1123
1114
|
return null;
|
|
1124
1115
|
}
|
|
@@ -1548,25 +1539,8 @@ class FileManager extends core_1.Host {
|
|
|
1548
1539
|
if (state === 0 && (this.cleared && this[kDelayed] <= 0 || override) || (this.aborted || state === 3) && override) {
|
|
1549
1540
|
this.clearProcessTimeout();
|
|
1550
1541
|
this[kDelayed] = Infinity;
|
|
1551
|
-
const resetState = () => {
|
|
1552
|
-
this.finalizeState = 2;
|
|
1553
|
-
this._pendingResult = null;
|
|
1554
|
-
};
|
|
1555
|
-
const aborted = (err) => {
|
|
1556
|
-
if (!this.restarting) {
|
|
1557
|
-
this.writeFail(["Transaction was not completed", this.baseDirectory], err);
|
|
1558
|
-
resetState();
|
|
1559
|
-
}
|
|
1560
|
-
else {
|
|
1561
|
-
this.finalizeState = 4;
|
|
1562
|
-
}
|
|
1563
|
-
this.emit('end', [], collectErrors.call(this), this.collectLog());
|
|
1564
|
-
if (!this.restarting) {
|
|
1565
|
-
this.done = true;
|
|
1566
|
-
}
|
|
1567
|
-
};
|
|
1568
1542
|
if (this.aborted) {
|
|
1569
|
-
|
|
1543
|
+
this.abortFinalize((0, types_1.createAbortError)());
|
|
1570
1544
|
return;
|
|
1571
1545
|
}
|
|
1572
1546
|
this.finalizeState = 1;
|
|
@@ -1586,7 +1560,7 @@ class FileManager extends core_1.Host {
|
|
|
1586
1560
|
if (LOG_TIMEELAPSED) {
|
|
1587
1561
|
this.writeTimeElapsed('END', this.baseDirectory, this.startTime, errors.length > 0 ? { failed: true, ...core_1.Host.LOG_STYLE_FAIL } : { ...core_1.Host.LOG_STYLE_SUCCESS });
|
|
1588
1562
|
}
|
|
1589
|
-
resetState();
|
|
1563
|
+
this.resetState();
|
|
1590
1564
|
const log = this.config.log;
|
|
1591
1565
|
let useNumeric = false, showSize = true;
|
|
1592
1566
|
if ((0, types_1.isPlainObject)(log)) {
|
|
@@ -1599,7 +1573,7 @@ class FileManager extends core_1.Host {
|
|
|
1599
1573
|
this.emit('end', items, errors, this.collectLog());
|
|
1600
1574
|
this.done = true;
|
|
1601
1575
|
})
|
|
1602
|
-
.catch(err =>
|
|
1576
|
+
.catch(err => this.abortFinalize(err));
|
|
1603
1577
|
}
|
|
1604
1578
|
}
|
|
1605
1579
|
hasDocument(instance, document) {
|
|
@@ -3543,6 +3517,23 @@ class FileManager extends core_1.Host {
|
|
|
3543
3517
|
close() {
|
|
3544
3518
|
this.Request.close();
|
|
3545
3519
|
}
|
|
3520
|
+
resetState() {
|
|
3521
|
+
this.finalizeState = 2;
|
|
3522
|
+
this._pendingResult = null;
|
|
3523
|
+
}
|
|
3524
|
+
abortFinalize(err) {
|
|
3525
|
+
if (!this.restarting) {
|
|
3526
|
+
this.writeFail(["Transaction was not completed", this.baseDirectory], err);
|
|
3527
|
+
this.resetState();
|
|
3528
|
+
}
|
|
3529
|
+
else {
|
|
3530
|
+
this.finalizeState = 4;
|
|
3531
|
+
}
|
|
3532
|
+
this.emit('end', [], collectErrors.call(this), this.collectLog());
|
|
3533
|
+
if (!this.restarting) {
|
|
3534
|
+
this.done = true;
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3546
3537
|
set restarting(value) {
|
|
3547
3538
|
this.finalizeState = (this[kRestarting] = value) ? 3 : 0;
|
|
3548
3539
|
}
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@e-mc/file-manager",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "FileManager constructor for E-mc.",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/anpham6/e-mc.git",
|
|
13
|
-
"directory": "src/file-manager"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"squared",
|
|
17
|
-
"squared-functions"
|
|
18
|
-
],
|
|
19
|
-
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "0.7.
|
|
24
|
-
"@e-mc/compress": "0.7.
|
|
25
|
-
"@e-mc/core": "0.7.
|
|
26
|
-
"@e-mc/document": "0.7.
|
|
27
|
-
"@e-mc/image": "0.7.
|
|
28
|
-
"@e-mc/request": "0.7.
|
|
29
|
-
"@e-mc/task": "0.7.
|
|
30
|
-
"@e-mc/types": "0.7.
|
|
31
|
-
"@e-mc/watch": "0.7.
|
|
32
|
-
"picomatch": "^3.0.1"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@e-mc/file-manager",
|
|
3
|
+
"version": "0.7.9",
|
|
4
|
+
"description": "FileManager constructor for E-mc.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/anpham6/e-mc.git",
|
|
13
|
+
"directory": "src/file-manager"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"squared",
|
|
17
|
+
"squared-functions"
|
|
18
|
+
],
|
|
19
|
+
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@e-mc/cloud": "0.7.9",
|
|
24
|
+
"@e-mc/compress": "0.7.9",
|
|
25
|
+
"@e-mc/core": "0.7.9",
|
|
26
|
+
"@e-mc/document": "0.7.9",
|
|
27
|
+
"@e-mc/image": "0.7.9",
|
|
28
|
+
"@e-mc/request": "0.7.9",
|
|
29
|
+
"@e-mc/task": "0.7.9",
|
|
30
|
+
"@e-mc/types": "0.7.9",
|
|
31
|
+
"@e-mc/watch": "0.7.9",
|
|
32
|
+
"picomatch": "^3.0.1"
|
|
33
|
+
}
|
|
34
|
+
}
|