@e-mc/watch 0.7.1 → 0.8.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/LICENSE +10 -10
- package/filegroup/index.d.ts +5 -5
- package/index.d.ts +4 -4
- package/index.js +8 -8
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Copyright 2023 An Pham
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
-
|
|
7
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
1
|
+
Copyright 2023 An Pham
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
11
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/filegroup/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { FileGroupConstructor } from '../../types/lib/watch';
|
|
2
|
-
import type { ExternalAsset } from '../../types/lib/asset';
|
|
3
|
-
|
|
4
|
-
declare const FileGroup: FileGroupConstructor<ExternalAsset>;
|
|
5
|
-
|
|
1
|
+
import type { FileGroupConstructor } from '../../types/lib/watch';
|
|
2
|
+
import type { ExternalAsset } from '../../types/lib/asset';
|
|
3
|
+
|
|
4
|
+
declare const FileGroup: FileGroupConstructor<ExternalAsset>;
|
|
5
|
+
|
|
6
6
|
export = FileGroup;
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IFileManager, WatchConstructor } from '../types/lib';
|
|
2
|
-
|
|
3
|
-
declare const Watch: WatchConstructor<IFileManager>;
|
|
4
|
-
|
|
1
|
+
import type { IFileManager, WatchConstructor } from '../types/lib';
|
|
2
|
+
|
|
3
|
+
declare const Watch: WatchConstructor<IFileManager>;
|
|
4
|
+
|
|
5
5
|
export = Watch;
|
package/index.js
CHANGED
|
@@ -197,7 +197,7 @@ class Watch extends core_1.Client {
|
|
|
197
197
|
if (permission) {
|
|
198
198
|
this.permission = permission;
|
|
199
199
|
}
|
|
200
|
-
const
|
|
200
|
+
const settings = this.getUserSettings();
|
|
201
201
|
const destMap = Object.create(null);
|
|
202
202
|
for (const item of assets) {
|
|
203
203
|
if ((0, types_1.ignoreFlag)(item.flags)) {
|
|
@@ -217,7 +217,7 @@ class Watch extends core_1.Client {
|
|
|
217
217
|
continue;
|
|
218
218
|
}
|
|
219
219
|
let watchInterval, bundleMain;
|
|
220
|
-
if (dest
|
|
220
|
+
if (dest.startsWith(':')) {
|
|
221
221
|
items.sort((a, b) => a.bundleIndex - b.bundleIndex);
|
|
222
222
|
bundleMain = items[0];
|
|
223
223
|
dest = bundleMain.localUri;
|
|
@@ -269,8 +269,8 @@ class Watch extends core_1.Client {
|
|
|
269
269
|
}
|
|
270
270
|
return false;
|
|
271
271
|
};
|
|
272
|
-
let expires = 0, status = 0, wss = null, main, id, socketId, port, secure, hot, always, watched, message
|
|
273
|
-
if (watch === true &&
|
|
272
|
+
let expires = 0, status = 0, wss = null, main, id, socketId, port, secure, hot, always, watched, message;
|
|
273
|
+
if (watch === true && settings) {
|
|
274
274
|
const { uri, localUri, mimeType } = item;
|
|
275
275
|
watch = false;
|
|
276
276
|
if (uri && !(watch = settings[uri])) {
|
|
@@ -366,7 +366,7 @@ class Watch extends core_1.Client {
|
|
|
366
366
|
const timeout = { interval, retries: 0, aborted: false };
|
|
367
367
|
const target = { value: group, timeout, watcher: null };
|
|
368
368
|
const isMap = (value) => value ? value.size > 0 : false;
|
|
369
|
-
const
|
|
369
|
+
const wasAborted = (result, current) => result?.aborted && current.abortable && current.abort();
|
|
370
370
|
const checkPreceding = (map) => {
|
|
371
371
|
const data = map.get(uri);
|
|
372
372
|
if (!data) {
|
|
@@ -473,7 +473,7 @@ class Watch extends core_1.Client {
|
|
|
473
473
|
if (etag !== value.etag) {
|
|
474
474
|
value.etag = etag;
|
|
475
475
|
if (value.started) {
|
|
476
|
-
this.modified(value).then(result =>
|
|
476
|
+
this.modified(value).then(result => wasAborted(result, value));
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
}
|
|
@@ -482,7 +482,7 @@ class Watch extends core_1.Client {
|
|
|
482
482
|
if (lastModified !== value.lastModified) {
|
|
483
483
|
value.lastModified = lastModified;
|
|
484
484
|
if (value.started) {
|
|
485
|
-
this.modified(value).then(result =>
|
|
485
|
+
this.modified(value).then(result => wasAborted(result, value));
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
}
|
|
@@ -577,7 +577,7 @@ class Watch extends core_1.Client {
|
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
else if (value.started) {
|
|
580
|
-
this.modified(value).then(result =>
|
|
580
|
+
this.modified(value).then(result => wasAborted(result, value));
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
ptime = mtime + types_1.THRESHOLD.WATCH_CHANGE;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/watch",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Watch constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"license": "BSD 3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/core": "0.
|
|
24
|
-
"@e-mc/request": "0.
|
|
25
|
-
"@e-mc/types": "0.
|
|
23
|
+
"@e-mc/core": "0.8.0",
|
|
24
|
+
"@e-mc/request": "0.8.0",
|
|
25
|
+
"@e-mc/types": "0.8.0",
|
|
26
26
|
"picomatch": "^3.0.1",
|
|
27
|
-
"ws": "^8.
|
|
27
|
+
"ws": "^8.15.1"
|
|
28
28
|
}
|
|
29
29
|
}
|