@e-mc/watch 0.7.1 → 0.8.1

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.
Files changed (2) hide show
  1. package/index.js +8 -8
  2. package/package.json +5 -5
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 username = this.host?.username;
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[0] === ':') {
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, settings;
273
- if (watch === true && username && (settings = this.settings.users?.[username])) {
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 checkAborted = (result, current) => result?.aborted && current.abortable && current.abort();
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 => checkAborted(result, value));
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 => checkAborted(result, value));
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 => checkAborted(result, value));
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.7.1",
3
+ "version": "0.8.1",
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.7.1",
24
- "@e-mc/request": "0.7.1",
25
- "@e-mc/types": "0.7.1",
23
+ "@e-mc/core": "0.8.1",
24
+ "@e-mc/request": "0.8.1",
25
+ "@e-mc/types": "0.8.1",
26
26
  "picomatch": "^3.0.1",
27
- "ws": "^8.14.2"
27
+ "ws": "^8.16.0"
28
28
  }
29
29
  }