@endge/computation-sandbox 0.1.12 → 0.1.16

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.
@@ -161970,7 +161970,7 @@ function Tz(Ge, Bt, $e = /* @__PURE__ */ new Set()) {
161970
161970
  if (Ge === null || typeof Ge == "string" || typeof Ge == "boolean" || typeof Ge == "number" && Number.isFinite(Ge))
161971
161971
  return;
161972
161972
  if (typeof Ge != "object")
161973
- throw new Error(`Computation ${Bt} must be JSON-compatible.`);
161973
+ throw new TypeError(`Computation ${Bt} must be JSON-compatible.`);
161974
161974
  if ($e.has(Ge))
161975
161975
  throw new Error(`Computation ${Bt} must be JSON-compatible.`);
161976
161976
  $e.add(Ge);
@@ -19,16 +19,19 @@ class c {
19
19
  }
20
20
  dispose() {
21
21
  this.disposed = !0;
22
- for (const e of this.queue) e.reject(new Error("Computation sandbox is disposed."));
22
+ for (const e of this.queue)
23
+ e.reject(new Error("Computation sandbox is disposed."));
23
24
  this.queue.splice(0);
24
- for (const e of this.workers) e.dispose();
25
+ for (const e of this.workers)
26
+ e.dispose();
25
27
  }
26
28
  flush() {
27
29
  if (this.scheduled = !1, this.disposed || !this.queue.length)
28
30
  return;
29
31
  const e = Array.from({ length: this.workers.length }, () => []);
30
32
  let t = 0;
31
- for (; this.queue.length; ) e[t++ % e.length].push(this.queue.shift());
33
+ for (; this.queue.length; )
34
+ e[t++ % e.length].push(this.queue.shift());
32
35
  e.forEach((r, i) => {
33
36
  r.length && this.workers[i].execute(r);
34
37
  });
@@ -46,15 +49,19 @@ class l {
46
49
  }
47
50
  execute(e) {
48
51
  if (this.disposed) {
49
- for (const t of e) t.reject(new Error("Computation Worker was disposed."));
52
+ for (const t of e)
53
+ t.reject(new Error("Computation Worker was disposed."));
50
54
  return;
51
55
  }
52
56
  this.queued.push(e), this.pump();
53
57
  }
54
58
  dispose() {
55
59
  this.disposed = !0, this.timer && clearTimeout(this.timer), this.timer = null, this.worker.terminate();
56
- for (const e of this.active ?? []) e.reject(new Error("Computation Worker was disposed."));
57
- for (const e of this.queued) for (const t of e) t.reject(new Error("Computation Worker was disposed."));
60
+ for (const e of this.active ?? [])
61
+ e.reject(new Error("Computation Worker was disposed."));
62
+ for (const e of this.queued)
63
+ for (const t of e)
64
+ t.reject(new Error("Computation Worker was disposed."));
58
65
  this.active = null, this.queued.splice(0), this.busy = !1;
59
66
  }
60
67
  pump() {
@@ -64,7 +71,8 @@ class l {
64
71
  const e = this.queued.shift();
65
72
  this.active = e, this.timer = setTimeout(() => {
66
73
  this.worker.terminate(), this.worker = this.createWorker();
67
- for (const t of e) t.reject(new Error(`Computation Worker exceeded ${this.watchdogMs} ms watchdog.`));
74
+ for (const t of e)
75
+ t.reject(new Error(`Computation Worker exceeded ${this.watchdogMs} ms watchdog.`));
68
76
  this.active = null, this.timer = null, this.busy = !1, this.pump();
69
77
  }, this.watchdogMs), this.worker.onmessage = (t) => {
70
78
  this.timer && clearTimeout(this.timer), this.timer = null;
@@ -76,7 +84,8 @@ class l {
76
84
  this.active = null, this.busy = !1, this.pump();
77
85
  }, this.worker.onerror = (t) => {
78
86
  this.timer && clearTimeout(this.timer), this.timer = null;
79
- for (const r of e) r.reject(new Error(t.message || "Computation Worker failed."));
87
+ for (const r of e)
88
+ r.reject(new Error(t.message || "Computation Worker failed."));
80
89
  this.worker.terminate(), this.worker = this.createWorker(), this.active = null, this.busy = !1, this.pump();
81
90
  }, this.worker.postMessage({
82
91
  type: "execute-batch",
@@ -86,7 +95,7 @@ class l {
86
95
  createWorker() {
87
96
  return new Worker(new URL(
88
97
  /* @vite-ignore */
89
- "" + new URL("assets/computation-sandbox.worker-DWFleMLd.js", import.meta.url).href,
98
+ "" + new URL("assets/computation-sandbox.worker-D1PJv1Tp.js", import.meta.url).href,
90
99
  import.meta.url
91
100
  ), { type: "module" });
92
101
  }
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@endge/computation-sandbox",
3
- "version": "0.1.12",
3
+ "type": "module",
4
+ "version": "0.1.16",
4
5
  "private": false,
5
6
  "license": "Apache-2.0",
6
- "type": "module",
7
- "main": "./dist/computation-sandbox.js",
8
- "module": "./dist/computation-sandbox.js",
9
- "types": "./dist/main.d.ts",
10
7
  "exports": {
11
8
  ".": {
12
9
  "types": "./dist/main.d.ts",
13
10
  "import": "./dist/computation-sandbox.js"
14
11
  }
15
12
  },
13
+ "main": "./dist/computation-sandbox.js",
14
+ "module": "./dist/computation-sandbox.js",
15
+ "types": "./dist/main.d.ts",
16
16
  "files": [
17
17
  "dist"
18
18
  ],
@@ -20,20 +20,24 @@
20
20
  "dev": "vite build --watch",
21
21
  "build": "vite build",
22
22
  "test": "vitest",
23
- "typecheck": "tsc --noEmit"
23
+ "typecheck": "tsc --noEmit",
24
+ "lint-check": "eslint . --cache",
25
+ "lint-fix": "eslint . --fix --cache"
26
+ },
27
+ "peerDependencies": {
28
+ "@endge/core": "^3.0.1 || ^4.0.0"
24
29
  },
25
30
  "dependencies": {
26
31
  "@jitl/quickjs-ng-wasmfile-release-sync": "^0.32.0",
27
32
  "quickjs-emscripten-core": "^0.32.0",
28
33
  "typescript": "~6.0.3"
29
34
  },
30
- "peerDependencies": {
31
- "@endge/core": "^3.0.1"
32
- },
33
35
  "devDependencies": {
34
- "@endge/core": "^3.0.1",
36
+ "@antfu/eslint-config": "9.3.0",
37
+ "@endge/core": "^4.0.0",
35
38
  "@endge/raph": "^3.0.11",
36
- "@endge/utils": "^0.24.13",
39
+ "@endge/utils": "^0.25.0",
40
+ "eslint": "10.9.1",
37
41
  "rimraf": "^6.0.1",
38
42
  "unplugin-dts": "^1.0.3",
39
43
  "vite": "^6.1.0",