@nil-/xit 0.1.22 → 0.1.23
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/assets/bundler.js +5 -5
- package/assets/index.js +49 -47
- package/index.d.ts +3 -1
- package/package.json +1 -1
package/assets/index.js
CHANGED
|
@@ -2,58 +2,58 @@ var P = (i) => {
|
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
4
|
var C = (i, e, n) => e.has(i) || P("Cannot " + n);
|
|
5
|
-
var w = (i, e, n) => (C(i, e, "read from private field"), n ? n.call(i) : e.get(i)), F = (i, e, n) => e.has(i) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, n),
|
|
5
|
+
var w = (i, e, n) => (C(i, e, "read from private field"), n ? n.call(i) : e.get(i)), F = (i, e, n) => e.has(i) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, n), $ = (i, e, n, f) => (C(i, e, "write to private field"), f ? f.call(i, n) : e.set(i, n), n), W = (i, e, n) => (C(i, e, "access private method"), n);
|
|
6
6
|
import { w as writable, g as get } from "./svelte/store.js";
|
|
7
|
-
var j, I,
|
|
7
|
+
var j, I, k, M, D, L, N, S, U;
|
|
8
8
|
let Service$1 = (U = class {
|
|
9
9
|
constructor({ host: e, port: n }) {
|
|
10
10
|
F(this, j);
|
|
11
|
-
F(this,
|
|
11
|
+
F(this, k);
|
|
12
12
|
// 0 idle, 1 has connected, 2 keep reconnecting, 3 stopped
|
|
13
13
|
F(this, M);
|
|
14
14
|
F(this, D);
|
|
15
15
|
F(this, L);
|
|
16
16
|
F(this, N);
|
|
17
|
-
F(this,
|
|
18
|
-
|
|
17
|
+
F(this, S);
|
|
18
|
+
$(this, N, `${e ?? "localhost"}${n != null ? `:${n}` : ""}`), $(this, k, 0), $(this, M, null), $(this, D, null), $(this, L, null), $(this, S, null);
|
|
19
19
|
}
|
|
20
20
|
on_message(e) {
|
|
21
|
-
|
|
21
|
+
$(this, L, e);
|
|
22
22
|
}
|
|
23
23
|
on_connect(e) {
|
|
24
|
-
|
|
24
|
+
$(this, M, e);
|
|
25
25
|
}
|
|
26
26
|
on_disconnect(e) {
|
|
27
|
-
|
|
27
|
+
$(this, D, e);
|
|
28
28
|
}
|
|
29
29
|
// non-blocking (run is blocking in c++)
|
|
30
30
|
// calling it again should not do anything
|
|
31
31
|
start() {
|
|
32
|
-
w(this,
|
|
33
|
-
|
|
34
|
-
}, w(this,
|
|
35
|
-
w(this,
|
|
36
|
-
}, w(this,
|
|
37
|
-
w(this,
|
|
38
|
-
}, w(this,
|
|
32
|
+
w(this, S) == null && w(this, k) !== 1 && w(this, k) !== 3 && ($(this, S, new WebSocket(`ws://${w(this, N)}`)), w(this, S).binaryType = "arraybuffer", w(this, S).onopen = () => {
|
|
33
|
+
w(this, k) == 3 ? this.stop() : ($(this, k, 1), w(this, M) && w(this, M).call(this, w(this, N)));
|
|
34
|
+
}, w(this, S).onclose = () => {
|
|
35
|
+
w(this, k) === 1 && (w(this, D) && w(this, D).call(this, w(this, N)), $(this, k, 2), W(this, j, I).call(this));
|
|
36
|
+
}, w(this, S).onerror = () => {
|
|
37
|
+
w(this, k) !== 1 && w(this, k) !== 3 ? ($(this, k, 2), W(this, j, I).call(this)) : w(this, k) === 3 && this.stop();
|
|
38
|
+
}, w(this, S).onmessage = (e) => {
|
|
39
39
|
w(this, L) && w(this, L).call(this, w(this, N), new Uint8Array(e.data));
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
stop() {
|
|
43
|
-
|
|
43
|
+
$(this, k, 3), w(this, S) != null && w(this, S).readyState !== WebSocket.CONNECTING && (w(this, S).close(), $(this, S, null));
|
|
44
44
|
}
|
|
45
45
|
restart() {
|
|
46
|
-
|
|
46
|
+
$(this, k, 0);
|
|
47
47
|
}
|
|
48
48
|
publish(e) {
|
|
49
|
-
w(this,
|
|
49
|
+
w(this, S) != null && w(this, k) == 1 && w(this, S).send(e);
|
|
50
50
|
}
|
|
51
51
|
send(e, n) {
|
|
52
52
|
e === w(this, N) && this.publish(n);
|
|
53
53
|
}
|
|
54
54
|
}, j = new WeakSet(), I = function() {
|
|
55
|
-
w(this,
|
|
56
|
-
},
|
|
55
|
+
w(this, S) != null && (w(this, S).close(), $(this, S, null)), setTimeout(() => this.start(), 1e3);
|
|
56
|
+
}, k = new WeakMap(), M = new WeakMap(), D = new WeakMap(), L = new WeakMap(), N = new WeakMap(), S = new WeakMap(), U);
|
|
57
57
|
const header = (i) => {
|
|
58
58
|
const e = new Uint8Array(4);
|
|
59
59
|
return new DataView(e.buffer).setUint32(0, i, !1), e;
|
|
@@ -68,7 +68,7 @@ const header = (i) => {
|
|
|
68
68
|
f.stop(), n("connection failed... stopping");
|
|
69
69
|
}, 2500);
|
|
70
70
|
f.on_connect(() => {
|
|
71
|
-
|
|
71
|
+
clearTimeout(u), f.stop(), e();
|
|
72
72
|
}), f.start();
|
|
73
73
|
}), service_fetch = async (i, e, n) => new Promise((f, u) => {
|
|
74
74
|
const a = new Service$1(i), t = setTimeout(() => {
|
|
@@ -2253,42 +2253,42 @@ function requireRoot() {
|
|
|
2253
2253
|
if (!y)
|
|
2254
2254
|
return u.asPromise(h, _, c, p);
|
|
2255
2255
|
var v = y === r;
|
|
2256
|
-
function m(q,
|
|
2256
|
+
function m(q, A) {
|
|
2257
2257
|
if (y) {
|
|
2258
2258
|
if (v)
|
|
2259
2259
|
throw q;
|
|
2260
|
-
var
|
|
2261
|
-
y = null,
|
|
2260
|
+
var x = y;
|
|
2261
|
+
y = null, x(q, A);
|
|
2262
2262
|
}
|
|
2263
2263
|
}
|
|
2264
2264
|
function g(q) {
|
|
2265
|
-
var
|
|
2266
|
-
if (
|
|
2267
|
-
var
|
|
2268
|
-
if (
|
|
2265
|
+
var A = q.lastIndexOf("google/protobuf/");
|
|
2266
|
+
if (A > -1) {
|
|
2267
|
+
var x = q.substring(A);
|
|
2268
|
+
if (x in s) return x;
|
|
2269
2269
|
}
|
|
2270
2270
|
return null;
|
|
2271
2271
|
}
|
|
2272
|
-
function b(q,
|
|
2272
|
+
function b(q, A) {
|
|
2273
2273
|
try {
|
|
2274
|
-
if (u.isString(
|
|
2275
|
-
_.setOptions(
|
|
2274
|
+
if (u.isString(A) && A.charAt(0) === "{" && (A = JSON.parse(A)), !u.isString(A))
|
|
2275
|
+
_.setOptions(A.options).addJSON(A.nested);
|
|
2276
2276
|
else {
|
|
2277
2277
|
t.filename = q;
|
|
2278
|
-
var
|
|
2279
|
-
if (
|
|
2280
|
-
for (; E <
|
|
2281
|
-
(B = g(
|
|
2282
|
-
if (
|
|
2283
|
-
for (E = 0; E <
|
|
2284
|
-
(B = g(
|
|
2278
|
+
var x = t(A, _, p), B, E = 0;
|
|
2279
|
+
if (x.imports)
|
|
2280
|
+
for (; E < x.imports.length; ++E)
|
|
2281
|
+
(B = g(x.imports[E]) || _.resolvePath(q, x.imports[E])) && R(B);
|
|
2282
|
+
if (x.weakImports)
|
|
2283
|
+
for (E = 0; E < x.weakImports.length; ++E)
|
|
2284
|
+
(B = g(x.weakImports[E]) || _.resolvePath(q, x.weakImports[E])) && R(B, !0);
|
|
2285
2285
|
}
|
|
2286
2286
|
} catch (V) {
|
|
2287
2287
|
m(V);
|
|
2288
2288
|
}
|
|
2289
2289
|
!v && !O && m(null, _);
|
|
2290
2290
|
}
|
|
2291
|
-
function R(q,
|
|
2291
|
+
function R(q, A) {
|
|
2292
2292
|
if (q = g(q) || q, !(_.files.indexOf(q) > -1)) {
|
|
2293
2293
|
if (_.files.push(q), q in s) {
|
|
2294
2294
|
v ? b(q, s[q]) : (++O, setTimeout(function() {
|
|
@@ -2297,19 +2297,19 @@ function requireRoot() {
|
|
|
2297
2297
|
return;
|
|
2298
2298
|
}
|
|
2299
2299
|
if (v) {
|
|
2300
|
-
var
|
|
2300
|
+
var x;
|
|
2301
2301
|
try {
|
|
2302
|
-
|
|
2302
|
+
x = u.fs.readFileSync(q).toString("utf8");
|
|
2303
2303
|
} catch (B) {
|
|
2304
|
-
|
|
2304
|
+
A || m(B);
|
|
2305
2305
|
return;
|
|
2306
2306
|
}
|
|
2307
|
-
b(q,
|
|
2307
|
+
b(q, x);
|
|
2308
2308
|
} else
|
|
2309
2309
|
++O, _.fetch(q, function(B, E) {
|
|
2310
2310
|
if (--O, !!y) {
|
|
2311
2311
|
if (B) {
|
|
2312
|
-
|
|
2312
|
+
A ? O || m(null, _) : m(B);
|
|
2313
2313
|
return;
|
|
2314
2314
|
}
|
|
2315
2315
|
b(q, E);
|
|
@@ -2882,9 +2882,11 @@ const protobufjs = /* @__PURE__ */ getDefaultExportFromCjs(light), proto_data =
|
|
|
2882
2882
|
resub: () => s.start(),
|
|
2883
2883
|
unsub: () => s.stop()
|
|
2884
2884
|
});
|
|
2885
|
-
const v = c(y, _);
|
|
2886
|
-
return
|
|
2887
|
-
|
|
2885
|
+
const { destroy: v } = c(y, _);
|
|
2886
|
+
return {
|
|
2887
|
+
destroy: () => {
|
|
2888
|
+
s.stop(), v();
|
|
2889
|
+
}
|
|
2888
2890
|
};
|
|
2889
2891
|
};
|
|
2890
2892
|
}, create_frame = async ({
|
package/index.d.ts
CHANGED