@nil-/xit 0.1.16 → 0.1.17

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/assets/index.js +37 -34
  2. package/package.json +1 -1
package/assets/index.js CHANGED
@@ -2,9 +2,9 @@ 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), $ = (i, e, n, a) => (C(i, e, "write to private field"), a ? a.call(i, n) : e.set(i, n), n), I = (i, e, n) => (C(i, e, "access private method"), 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, a) => (C(i, e, "write to private field"), a ? a.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, W, x, M, D, L, N, S, U;
7
+ var j, I, x, 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);
@@ -32,9 +32,9 @@ let Service$1 = (U = class {
32
32
  w(this, S) == null && w(this, x) !== 1 && w(this, x) !== 3 && ($(this, S, new WebSocket(`ws://${w(this, N)}`)), w(this, S).binaryType = "arraybuffer", w(this, S).onopen = () => {
33
33
  $(this, x, 1), w(this, M) && w(this, M).call(this, w(this, N));
34
34
  }, w(this, S).onclose = () => {
35
- w(this, x) === 1 && (w(this, D) && w(this, D).call(this, w(this, N)), $(this, x, 2), I(this, j, W).call(this));
35
+ w(this, x) === 1 && (w(this, D) && w(this, D).call(this, w(this, N)), $(this, x, 2), W(this, j, I).call(this));
36
36
  }, w(this, S).onerror = () => {
37
- w(this, x) !== 1 && w(this, x) !== 3 && ($(this, x, 2), I(this, j, W).call(this));
37
+ w(this, x) !== 1 && w(this, x) !== 3 && ($(this, x, 2), W(this, j, I).call(this));
38
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
  });
@@ -51,7 +51,7 @@ let Service$1 = (U = class {
51
51
  send(e, n) {
52
52
  e === w(this, N) && this.publish(n);
53
53
  }
54
- }, j = new WeakSet(), W = function() {
54
+ }, j = new WeakSet(), I = function() {
55
55
  w(this, S) != null && (w(this, S).close(), $(this, S, null)), setTimeout(() => this.start(), 1e3);
56
56
  }, x = new WeakMap(), M = new WeakMap(), D = new WeakMap(), L = new WeakMap(), N = new WeakMap(), S = new WeakMap(), U);
57
57
  const header = (i) => {
@@ -86,6 +86,14 @@ const header = (i) => {
86
86
  clearTimeout(a), n.publish(e), n.stop();
87
87
  }), n.start();
88
88
  };
89
+ function WorkerWrapper(i) {
90
+ return new Worker(
91
+ "/assets/bundler.js",
92
+ {
93
+ name: i == null ? void 0 : i.name
94
+ }
95
+ );
96
+ }
89
97
  var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
90
98
  function getDefaultExportFromCjs(i) {
91
99
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
@@ -2245,42 +2253,42 @@ function requireRoot() {
2245
2253
  if (!m)
2246
2254
  return f.asPromise(c, _, h, p);
2247
2255
  var v = m === r;
2248
- function y(q, A) {
2256
+ function y(q, k) {
2249
2257
  if (m) {
2250
2258
  if (v)
2251
2259
  throw q;
2252
- var k = m;
2253
- m = null, k(q, A);
2260
+ var A = m;
2261
+ m = null, A(q, k);
2254
2262
  }
2255
2263
  }
2256
2264
  function g(q) {
2257
- var A = q.lastIndexOf("google/protobuf/");
2258
- if (A > -1) {
2259
- var k = q.substring(A);
2260
- if (k in s) return k;
2265
+ var k = q.lastIndexOf("google/protobuf/");
2266
+ if (k > -1) {
2267
+ var A = q.substring(k);
2268
+ if (A in s) return A;
2261
2269
  }
2262
2270
  return null;
2263
2271
  }
2264
- function b(q, A) {
2272
+ function b(q, k) {
2265
2273
  try {
2266
- if (f.isString(A) && A.charAt(0) === "{" && (A = JSON.parse(A)), !f.isString(A))
2267
- _.setOptions(A.options).addJSON(A.nested);
2274
+ if (f.isString(k) && k.charAt(0) === "{" && (k = JSON.parse(k)), !f.isString(k))
2275
+ _.setOptions(k.options).addJSON(k.nested);
2268
2276
  else {
2269
2277
  t.filename = q;
2270
- var k = t(A, _, p), B, E = 0;
2271
- if (k.imports)
2272
- for (; E < k.imports.length; ++E)
2273
- (B = g(k.imports[E]) || _.resolvePath(q, k.imports[E])) && R(B);
2274
- if (k.weakImports)
2275
- for (E = 0; E < k.weakImports.length; ++E)
2276
- (B = g(k.weakImports[E]) || _.resolvePath(q, k.weakImports[E])) && R(B, !0);
2278
+ var A = t(k, _, p), B, E = 0;
2279
+ if (A.imports)
2280
+ for (; E < A.imports.length; ++E)
2281
+ (B = g(A.imports[E]) || _.resolvePath(q, A.imports[E])) && R(B);
2282
+ if (A.weakImports)
2283
+ for (E = 0; E < A.weakImports.length; ++E)
2284
+ (B = g(A.weakImports[E]) || _.resolvePath(q, A.weakImports[E])) && R(B, !0);
2277
2285
  }
2278
2286
  } catch (V) {
2279
2287
  y(V);
2280
2288
  }
2281
2289
  !v && !O && y(null, _);
2282
2290
  }
2283
- function R(q, A) {
2291
+ function R(q, k) {
2284
2292
  if (q = g(q) || q, !(_.files.indexOf(q) > -1)) {
2285
2293
  if (_.files.push(q), q in s) {
2286
2294
  v ? b(q, s[q]) : (++O, setTimeout(function() {
@@ -2289,19 +2297,19 @@ function requireRoot() {
2289
2297
  return;
2290
2298
  }
2291
2299
  if (v) {
2292
- var k;
2300
+ var A;
2293
2301
  try {
2294
- k = f.fs.readFileSync(q).toString("utf8");
2302
+ A = f.fs.readFileSync(q).toString("utf8");
2295
2303
  } catch (B) {
2296
- A || y(B);
2304
+ k || y(B);
2297
2305
  return;
2298
2306
  }
2299
- b(q, k);
2307
+ b(q, A);
2300
2308
  } else
2301
2309
  ++O, _.fetch(q, function(B, E) {
2302
2310
  if (--O, !!m) {
2303
2311
  if (B) {
2304
- A ? O || y(null, _) : y(B);
2312
+ k ? O || y(null, _) : y(B);
2305
2313
  return;
2306
2314
  }
2307
2315
  b(q, E);
@@ -2656,12 +2664,7 @@ var indexLightExports = indexLight.exports, light = indexLightExports;
2656
2664
  const protobufjs = /* @__PURE__ */ getDefaultExportFromCjs(light), proto_data = { options: { syntax: "proto3", optimize_for: "LITE_RUNTIME" }, nested: { nil: { nested: { xit: { nested: { proto: { nested: { MessageType: { values: { MessageType_FrameRequest: 0, MessageType_FrameResponse: 1, MessageType_FrameCache: 2, MessageType_FrameLoaded: 3, MessageType_FrameSubscribe: 4, MessageType_FrameUnsubscribe: 5, MessageType_ValueRequest: 6, MessageType_ValueResponse: 7, MessageType_ValueUpdate: 8, MessageType_SignalRequest: 9, MessageType_SignalResponse: 10, MessageType_SignalNotify: 11, MessageType_FileRequest: 12, MessageType_FileResponse: 13 } }, FrameRequest: { fields: { id: { type: "string", id: 1 } } }, FrameResponse: { oneofs: { value: { oneof: ["file", "content"] } }, fields: { id: { type: "string", id: 1 }, file: { type: "string", id: 2 }, content: { type: "string", id: 3 } } }, FrameCache: { fields: { id: { type: "string", id: 1 }, content: { type: "string", id: 2 }, files: { rule: "repeated", type: "FileInfo", id: 3 } } }, FrameLoaded: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, FrameSubscribe: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, FrameUnsubscribe: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, Value: { oneofs: { value: { oneof: ["value_boolean", "value_number", "value_double", "value_string", "value_buffer"] } }, fields: { id: { type: "string", id: 1 }, value_boolean: { type: "bool", id: 2 }, value_number: { type: "int64", id: 3 }, value_double: { type: "double", id: 4 }, value_string: { type: "string", id: 5 }, value_buffer: { type: "bytes", id: 6 } } }, ValueRequest: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, ValueResponse: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, values: { rule: "repeated", type: "Value", id: 3 } } }, ValueUpdate: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, value: { type: "Value", id: 3 } } }, SignalRequest: { fields: { id: { type: "string", id: 1 } } }, Signal: { oneofs: { _type: { oneof: ["type"] } }, fields: { id: { type: "string", id: 1 }, type: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, SignalResponse: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, signals: { rule: "repeated", type: "Signal", id: 3 } } }, SignalNotify: { oneofs: { _tag: { oneof: ["tag"] }, arg: { oneof: ["arg_boolean", "arg_number", "arg_double", "arg_string", "arg_buffer"] } }, fields: { frame_id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, signal_id: { type: "string", id: 3 }, arg_boolean: { type: "bool", id: 4 }, arg_number: { type: "int64", id: 5 }, arg_double: { type: "double", id: 6 }, arg_string: { type: "string", id: 7 }, arg_buffer: { type: "bytes", id: 8 } } }, FileRequest: { fields: { target: { type: "string", id: 1 } } }, FileResponse: { fields: { target: { type: "string", id: 1 }, content: { type: "string", id: 2 }, metadata: { type: "bytes", id: 3 } } }, FileInfo: { fields: { target: { type: "string", id: 1 }, metadata: { type: "bytes", id: 2 } } } } } } } } } } }, nil_xit_proto = protobufjs.Root.fromJSON(proto_data).lookup(
2657
2665
  "nil.xit.proto"
2658
2666
  ), bundle = async (i) => new Promise((e, n) => {
2659
- console.log(import.meta.url);
2660
- const a = new Worker(new URL(
2661
- /* @vite-ignore */
2662
- "./bundler.js",
2663
- import.meta.url
2664
- ), { type: "module" });
2667
+ const a = new WorkerWrapper();
2665
2668
  a.postMessage({ type: "init", host: i.host, id: i.id, cdn_url: i.cdn_url }), a.addEventListener("message", async (f) => {
2666
2669
  if (f.data.ok) {
2667
2670
  if (f.data.files) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nil-/xit",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",