@e-mc/watch 0.10.5 → 0.10.7
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/README.md +6 -6
- package/index.js +14 -10
- package/package.json +4 -4
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.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.7/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { IFileManager, ModuleConstructor } from "./index";
|
|
@@ -106,11 +106,11 @@ instance.start(assets, { disk_read: ["/path/workspace/output/**"] });
|
|
|
106
106
|
|
|
107
107
|
## References
|
|
108
108
|
|
|
109
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
110
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
111
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
112
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
113
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
109
|
+
- https://www.unpkg.com/@e-mc/types@0.10.7/lib/asset.d.ts
|
|
110
|
+
- https://www.unpkg.com/@e-mc/types@0.10.7/lib/core.d.ts
|
|
111
|
+
- https://www.unpkg.com/@e-mc/types@0.10.7/lib/filemanager.d.ts
|
|
112
|
+
- https://www.unpkg.com/@e-mc/types@0.10.7/lib/settings.d.ts
|
|
113
|
+
- https://www.unpkg.com/@e-mc/types@0.10.7/lib/watch.d.ts
|
|
114
114
|
|
|
115
115
|
* https://www.npmjs.com/package/@types/ws
|
|
116
116
|
|
package/index.js
CHANGED
|
@@ -84,11 +84,11 @@ function fatalError(instance, map, target, err) {
|
|
|
84
84
|
abortTimeout(target);
|
|
85
85
|
instance.writeFail(["Unable to watch file", uri], err, 16);
|
|
86
86
|
}
|
|
87
|
-
function getErrorMessage(item, status
|
|
87
|
+
function getErrorMessage(item, status) {
|
|
88
88
|
switch (status) {
|
|
89
89
|
case 1:
|
|
90
90
|
if ((0, types_1.existsFlag)(item.flags)) {
|
|
91
|
-
return
|
|
91
|
+
return;
|
|
92
92
|
}
|
|
93
93
|
return "ETag not supported";
|
|
94
94
|
case 2:
|
|
@@ -449,8 +449,9 @@ class Watch extends core_1.Client {
|
|
|
449
449
|
if (!group.etag && !group.lastModified) {
|
|
450
450
|
return 1;
|
|
451
451
|
}
|
|
452
|
-
|
|
453
|
-
|
|
452
|
+
const pre = checkPreceding(HTTP_MAP);
|
|
453
|
+
if (pre !== undefined) {
|
|
454
|
+
return pre;
|
|
454
455
|
}
|
|
455
456
|
const url = group.url ||= new URL(uri);
|
|
456
457
|
const request = this.host?.Request || new request_1();
|
|
@@ -564,8 +565,9 @@ class Watch extends core_1.Client {
|
|
|
564
565
|
HTTP_MAP.set(uri, new Map([[dest, target]]));
|
|
565
566
|
}
|
|
566
567
|
else if (esm || path.isAbsolute(uri = core_1.Client.resolveFile(uri)) && this.canRead(uri, { hostPermissionOnly: !!this.host })) {
|
|
567
|
-
|
|
568
|
-
|
|
568
|
+
const pre = checkPreceding(DISK_MAP);
|
|
569
|
+
if (pre !== undefined) {
|
|
570
|
+
return pre;
|
|
569
571
|
}
|
|
570
572
|
let ptime = 0;
|
|
571
573
|
target.watcher = fs.watch(uri, (event, filename) => {
|
|
@@ -639,11 +641,13 @@ class Watch extends core_1.Client {
|
|
|
639
641
|
else {
|
|
640
642
|
continue;
|
|
641
643
|
}
|
|
642
|
-
if (status
|
|
643
|
-
|
|
644
|
+
if (status > 0) {
|
|
645
|
+
if (message ||= getErrorMessage(item, status)) {
|
|
646
|
+
this.formatFail((16 | (status === 2 ? 8192 : 0)), 'WATCH', ["Unable to watch file", watched && path.basename(watched)], (0, types_1.errorValue)(message, watched));
|
|
647
|
+
}
|
|
644
648
|
}
|
|
645
|
-
else
|
|
646
|
-
this.
|
|
649
|
+
else {
|
|
650
|
+
this.formatMessage(16, 'WATCH', ['Start', interval + 'ms ' + (expires ? formatDate(expires) : 'never')], watched, { titleColor: 'blue' });
|
|
647
651
|
}
|
|
648
652
|
}
|
|
649
653
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/watch",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "Watch constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"license": "BSD-3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/core": "0.10.
|
|
24
|
-
"@e-mc/request": "0.10.
|
|
25
|
-
"@e-mc/types": "0.10.
|
|
23
|
+
"@e-mc/core": "0.10.7",
|
|
24
|
+
"@e-mc/request": "0.10.7",
|
|
25
|
+
"@e-mc/types": "0.10.7",
|
|
26
26
|
"picomatch": "^4.0.2",
|
|
27
27
|
"ws": "^8.18.0"
|
|
28
28
|
}
|