@e-mc/watch 0.4.0 → 0.4.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.
- package/filegroup/index.js +22 -6
- package/index.js +6 -12
- package/package.json +4 -4
package/filegroup/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c, _d;
|
|
2
|
+
var _a, _b, _c, _d, _e;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
5
|
const core_1 = require("../../core");
|
|
6
6
|
const kPaused = Symbol('paused');
|
|
7
7
|
const kServer = Symbol('server');
|
|
8
|
+
const kAssets = Symbol('assets');
|
|
9
|
+
const kSockets = Symbol('sockets');
|
|
10
|
+
const kStartTime = Symbol('startTime');
|
|
11
|
+
const kUri = Symbol('uri');
|
|
8
12
|
const kEtag = Symbol('etag');
|
|
9
13
|
const kLastModified = Symbol('lastModified');
|
|
10
14
|
class SocketRequest {
|
|
@@ -38,20 +42,20 @@ class FileGroup extends core_1.AbortComponent {
|
|
|
38
42
|
}
|
|
39
43
|
constructor(uri, assets, startTime, abortable) {
|
|
40
44
|
super();
|
|
41
|
-
this.uri = uri;
|
|
42
|
-
this.assets = assets;
|
|
43
45
|
this.captured = false;
|
|
44
46
|
this.port = NaN;
|
|
45
47
|
this.secure = false;
|
|
46
48
|
this.hot = false;
|
|
47
49
|
this.always = false;
|
|
48
|
-
this.sockets = [];
|
|
49
50
|
this._related = [];
|
|
50
51
|
this._abortable = false;
|
|
51
52
|
this[_a] = null;
|
|
52
53
|
this[_b] = false;
|
|
53
54
|
this[_c] = '';
|
|
54
55
|
this[_d] = '';
|
|
56
|
+
this[_e] = [];
|
|
57
|
+
this[kUri] = uri;
|
|
58
|
+
this[kAssets] = assets;
|
|
55
59
|
if (typeof startTime === 'boolean') {
|
|
56
60
|
abortable = startTime;
|
|
57
61
|
startTime = undefined;
|
|
@@ -59,7 +63,7 @@ class FileGroup extends core_1.AbortComponent {
|
|
|
59
63
|
if (typeof abortable === 'boolean') {
|
|
60
64
|
this._abortable = abortable;
|
|
61
65
|
}
|
|
62
|
-
this
|
|
66
|
+
this[kStartTime] = startTime || Date.now();
|
|
63
67
|
}
|
|
64
68
|
connection(server, port = 0, secure = false) {
|
|
65
69
|
this[kServer] = server;
|
|
@@ -113,6 +117,18 @@ class FileGroup extends core_1.AbortComponent {
|
|
|
113
117
|
get server() {
|
|
114
118
|
return this[kServer];
|
|
115
119
|
}
|
|
120
|
+
get uri() {
|
|
121
|
+
return this[kUri];
|
|
122
|
+
}
|
|
123
|
+
get sockets() {
|
|
124
|
+
return this[kSockets];
|
|
125
|
+
}
|
|
126
|
+
get startTime() {
|
|
127
|
+
return this[kStartTime];
|
|
128
|
+
}
|
|
129
|
+
get assets() {
|
|
130
|
+
return this[kAssets];
|
|
131
|
+
}
|
|
116
132
|
set related(value) {
|
|
117
133
|
this._related = value.map(item => {
|
|
118
134
|
item = FileGroup.cloneAsset(item);
|
|
@@ -170,7 +186,7 @@ class FileGroup extends core_1.AbortComponent {
|
|
|
170
186
|
return this._abortable;
|
|
171
187
|
}
|
|
172
188
|
}
|
|
173
|
-
_a = kServer, _b = kPaused, _c = kEtag, _d = kLastModified;
|
|
189
|
+
_a = kServer, _b = kPaused, _c = kEtag, _d = kLastModified, _e = kSockets;
|
|
174
190
|
FileGroup.CONNECTION_TIMEOUT = 10 * 60000 /* TIME.m */;
|
|
175
191
|
FileGroup.CLIENT_SESSION = new Map();
|
|
176
192
|
exports.default = FileGroup;
|
package/index.js
CHANGED
|
@@ -168,15 +168,9 @@ class Watch extends core_1.Client {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if ((port = (0, util_1.asInt)(port)) > 0) {
|
|
175
|
-
this.port = port;
|
|
176
|
-
}
|
|
177
|
-
if ((securePort = (0, util_1.asInt)(securePort)) > 0) {
|
|
178
|
-
this.securePort = securePort;
|
|
179
|
-
}
|
|
171
|
+
this.interval = (0, util_1.asInt)(interval);
|
|
172
|
+
this.port = (0, util_1.asInt)(port);
|
|
173
|
+
this.securePort = (0, util_1.asInt)(securePort);
|
|
180
174
|
if ((0, types_1.isArray)(extensions)) {
|
|
181
175
|
this.module.extensions = extensions;
|
|
182
176
|
}
|
|
@@ -793,7 +787,7 @@ class Watch extends core_1.Client {
|
|
|
793
787
|
return this._assets;
|
|
794
788
|
}
|
|
795
789
|
set interval(value) {
|
|
796
|
-
if (value > 0) {
|
|
790
|
+
if ((value = Math.trunc(value)) > 0) {
|
|
797
791
|
this[kInterval] = value;
|
|
798
792
|
}
|
|
799
793
|
}
|
|
@@ -801,7 +795,7 @@ class Watch extends core_1.Client {
|
|
|
801
795
|
return this[kInterval];
|
|
802
796
|
}
|
|
803
797
|
set port(value) {
|
|
804
|
-
if (value > 0) {
|
|
798
|
+
if ((value = Math.trunc(value)) > 0) {
|
|
805
799
|
this[kPort] = value;
|
|
806
800
|
}
|
|
807
801
|
}
|
|
@@ -809,7 +803,7 @@ class Watch extends core_1.Client {
|
|
|
809
803
|
return this[kPort];
|
|
810
804
|
}
|
|
811
805
|
set securePort(value) {
|
|
812
|
-
if (value > 0) {
|
|
806
|
+
if ((value = Math.trunc(value)) > 0) {
|
|
813
807
|
this[kSecurePort] = value;
|
|
814
808
|
}
|
|
815
809
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/watch",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
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.4.
|
|
24
|
-
"@e-mc/request": "0.4.
|
|
25
|
-
"@e-mc/types": "0.4.
|
|
23
|
+
"@e-mc/core": "0.4.1",
|
|
24
|
+
"@e-mc/request": "0.4.1",
|
|
25
|
+
"@e-mc/types": "0.4.1",
|
|
26
26
|
"picomatch": "^2.3.1",
|
|
27
27
|
"ws": "^8.13.0"
|
|
28
28
|
}
|