@isoloop/runtime 0.0.0-next.62ef495 → 0.0.0-next.b8ffdcf

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/dist/bootstrap.js CHANGED
@@ -8,14 +8,14 @@ var __esmMin = (fn, res, err) => () => {
8
8
  throw err = [e], e;
9
9
  }
10
10
  };
11
- var __exportAll = (all, no_symbols) => {
12
- let target = {};
11
+ var __exportAll = (all, flags) => {
12
+ let target = Object.setPrototypeOf({}, null);
13
13
  for (var name in all) __defProp(target, name, {
14
14
  get: all[name],
15
15
  enumerable: true
16
16
  });
17
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- return target;
17
+ if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ return flags & 2 ? target : Object.preventExtensions(target);
19
19
  };
20
20
  // ../protocol/dist/index.js
21
21
  /**
@@ -38,6 +38,69 @@ function envelopeGuard(types) {
38
38
  function isSystemTopic(topic) {
39
39
  return topic.startsWith(SYSTEM_TOPIC_PREFIX);
40
40
  }
41
+ function createCommitter(o) {
42
+ const intervalMs = o.intervalMs ?? 100;
43
+ const half = Math.max(1, Math.floor((o.credit ?? 1e3) / 2));
44
+ /** Highest settled offset per topic, not yet sent. */
45
+ const offsets = /* @__PURE__ */ new Map();
46
+ /** Records settled per topic since its last send: the early send at half the credit. */
47
+ const counts = /* @__PURE__ */ new Map();
48
+ let timer;
49
+ let queued = false;
50
+ const take = () => {
51
+ if (timer !== void 0) {
52
+ clearTimeout(timer);
53
+ timer = void 0;
54
+ }
55
+ queued = false;
56
+ if (offsets.size === 0) return void 0;
57
+ const out = [];
58
+ for (const [topic, offset] of offsets) out.push({
59
+ topic,
60
+ offset
61
+ });
62
+ offsets.clear();
63
+ counts.clear();
64
+ return out;
65
+ };
66
+ const flush = () => {
67
+ const out = take();
68
+ if (out) o.send(out);
69
+ };
70
+ const schedule = () => {
71
+ if (intervalMs === 0) {
72
+ if (queued) return;
73
+ queued = true;
74
+ queueMicrotask(() => {
75
+ if (queued) flush();
76
+ });
77
+ return;
78
+ }
79
+ timer ??= setTimeout(flush, intervalMs);
80
+ };
81
+ return {
82
+ settle(topic, offset, records = 1) {
83
+ const prev = offsets.get(topic);
84
+ if (prev === void 0 || offset > prev) offsets.set(topic, offset);
85
+ const n = (counts.get(topic) ?? 0) + records;
86
+ counts.set(topic, n);
87
+ if (n >= half) flush();
88
+ else schedule();
89
+ },
90
+ flush,
91
+ take,
92
+ drop(topic) {
93
+ offsets.delete(topic);
94
+ counts.delete(topic);
95
+ },
96
+ pending: () => offsets,
97
+ dispose() {
98
+ if (timer !== void 0) clearTimeout(timer);
99
+ timer = void 0;
100
+ queued = false;
101
+ }
102
+ };
103
+ }
41
104
  /** Wraps a hand-written check as a Standard Schema that passes valid values through unchanged. */
42
105
  function systemSchema(check) {
43
106
  return { "~standard": {
@@ -198,35 +261,86 @@ const NAMES = [
198
261
  /**
199
262
  * Freezing a prototype makes its data properties read-only, and in strict
200
263
  * code assigning a property of the same name on an instance then throws (the
201
- * "override mistake": `this.name = 'MyError'`, `Foo.prototype.toString = …`).
202
- * As Hardened JS does, each data property becomes an accessor whose setter
203
- * defines the property on the instance instead, so overriding still works
204
- * while the prototype itself can't change.
264
+ * "override mistake": `this.name = 'MyError'`, `Foo.prototype.toString = …`,
265
+ * or `Object.assign({}, { constructor: x })`). As Hardened JS does, each data
266
+ * property becomes an accessor whose setter defines the property on the
267
+ * instance instead, so overriding still works while the prototype itself
268
+ * can't change.
269
+ *
270
+ * Except the properties V8 guards with "protectors": while they are still the
271
+ * original data properties, V8 keeps fast paths for iteration (`for…of`,
272
+ * spread, destructuring), species lookups and promise resolution. An accessor
273
+ * returning the same function is enough to turn a protector off for the whole
274
+ * worker: array iteration alone made a pool's app code 1.4–2.5× slower
275
+ * (docs/investigations/plant-one-pool.md). These stay plain frozen data, so
276
+ * overriding one of them on an instance throws in strict code instead
277
+ * (ADR 0001, "Override taming without the protected properties").
205
278
  */
279
+ const ITERATOR = Symbol.iterator;
280
+ /** The protected properties, per prototype, that are left as frozen data. */
281
+ function protectedProperties() {
282
+ const out = /* @__PURE__ */ new Map();
283
+ const add = (o, ...keys) => {
284
+ if (typeof o !== "object" && typeof o !== "function" || o === null) return;
285
+ out.set(o, /* @__PURE__ */ new Set([...out.get(o) ?? [], ...keys]));
286
+ };
287
+ const typedArrayCtor = Object.getPrototypeOf(Int8Array);
288
+ const typedArray = typeof typedArrayCtor === "function" ? Reflect.get(typedArrayCtor, "prototype") : void 0;
289
+ add(Array.prototype, ITERATOR, "constructor");
290
+ add(Object.getPrototypeOf([][Symbol.iterator]()), "next");
291
+ add(Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())), ITERATOR);
292
+ add(typedArray, ITERATOR, "constructor");
293
+ for (const c of [
294
+ Int8Array,
295
+ Uint8Array,
296
+ Uint8ClampedArray,
297
+ Int16Array,
298
+ Uint16Array,
299
+ Int32Array,
300
+ Uint32Array,
301
+ Float32Array,
302
+ Float64Array,
303
+ BigInt64Array,
304
+ BigUint64Array
305
+ ]) add(c.prototype, "constructor");
306
+ add(Map.prototype, ITERATOR);
307
+ add(Object.getPrototypeOf((/* @__PURE__ */ new Map())[Symbol.iterator]()), "next");
308
+ add(Set.prototype, ITERATOR);
309
+ add(Object.getPrototypeOf((/* @__PURE__ */ new Set())[Symbol.iterator]()), "next");
310
+ add(String.prototype, ...Reflect.ownKeys(String.prototype));
311
+ add(Object.getPrototypeOf(""[Symbol.iterator]()), "next");
312
+ add(Promise.prototype, "then", "constructor");
313
+ add(RegExp.prototype, ...Reflect.ownKeys(RegExp.prototype));
314
+ return out;
315
+ }
316
+ let skip;
206
317
  function tameOverrides(proto) {
207
- for (const key of Reflect.ownKeys(proto)) {
208
- const d = Object.getOwnPropertyDescriptor(proto, key);
209
- if (!d || !("value" in d) || !d.configurable) continue;
210
- const value = d.value;
211
- Object.defineProperty(proto, key, {
212
- get() {
213
- return value;
214
- },
215
- set(v) {
216
- if (this === proto) throw new TypeError(`Cannot assign to read only property '${String(key)}' of a frozen built-in`);
217
- if (typeof this !== "object" && typeof this !== "function") return;
218
- if (this === null) return;
219
- Object.defineProperty(this, key, {
220
- value: v,
221
- writable: true,
222
- enumerable: true,
223
- configurable: true
224
- });
225
- },
226
- enumerable: d.enumerable ?? false,
227
- configurable: false
228
- });
229
- }
318
+ skip ??= protectedProperties();
319
+ const keep = skip.get(proto);
320
+ for (const key of Reflect.ownKeys(proto)) if (!keep?.has(key)) tameOverride(proto, key);
321
+ }
322
+ function tameOverride(proto, key) {
323
+ const d = Object.getOwnPropertyDescriptor(proto, key);
324
+ if (!d || !("value" in d) || !d.configurable) return;
325
+ const value = d.value;
326
+ Object.defineProperty(proto, key, {
327
+ get() {
328
+ return value;
329
+ },
330
+ set(v) {
331
+ if (this === proto) throw new TypeError(`Cannot assign to read only property '${String(key)}' of a frozen built-in`);
332
+ if (typeof this !== "object" && typeof this !== "function") return;
333
+ if (this === null) return;
334
+ Object.defineProperty(this, key, {
335
+ value: v,
336
+ writable: true,
337
+ enumerable: true,
338
+ configurable: true
339
+ });
340
+ },
341
+ enumerable: d.enumerable ?? false,
342
+ configurable: false
343
+ });
230
344
  }
231
345
  function hardenProto(proto) {
232
346
  if (typeof proto !== "object" && typeof proto !== "function" || proto === null) return;
@@ -301,15 +415,19 @@ function createBusClient(first, o = {}) {
301
415
  send(withId);
302
416
  });
303
417
  };
418
+ const committer = createCommitter({
419
+ send: (offsets) => {
420
+ send({
421
+ v: 1,
422
+ t: "commits",
423
+ p: { offsets }
424
+ });
425
+ },
426
+ ...o.commitIntervalMs === void 0 ? {} : { intervalMs: o.commitIntervalMs },
427
+ ...o.credit === void 0 ? {} : { credit: o.credit }
428
+ });
304
429
  const commit = (topic, offset) => {
305
- send({
306
- v: 1,
307
- t: "commit",
308
- p: {
309
- topic,
310
- offset
311
- }
312
- });
430
+ committer.settle(topic, offset);
313
431
  };
314
432
  const drain = async (sub) => {
315
433
  if (sub.running) return;
@@ -319,7 +437,8 @@ function createBusClient(first, o = {}) {
319
437
  if (!r) break;
320
438
  topicOf.set(r, sub.topic);
321
439
  try {
322
- await sub.fn(r);
440
+ const done = sub.fn(r);
441
+ if (isThenable(done)) await done;
323
442
  } catch (err) {
324
443
  sub.stuck = true;
325
444
  o.onError?.(err);
@@ -370,6 +489,7 @@ function createBusClient(first, o = {}) {
370
489
  const sub = subs.get(msg.p.topic);
371
490
  if (!sub) return;
372
491
  sub.queue.length = 0;
492
+ committer.drop(msg.p.topic);
373
493
  try {
374
494
  sub.opts.onReset?.();
375
495
  } catch (err) {
@@ -418,6 +538,7 @@ function createBusClient(first, o = {}) {
418
538
  return () => {
419
539
  if (subs.get(topic.name) !== sub) return;
420
540
  subs.delete(topic.name);
541
+ committer.flush();
421
542
  send({
422
543
  v: 1,
423
544
  t: "unsubscribe",
@@ -493,14 +614,27 @@ function createBusClient(first, o = {}) {
493
614
  value: null
494
615
  });
495
616
  }
617
+ committer.take();
496
618
  for (const sub of subs.values()) {
497
619
  sub.queue.length = 0;
498
620
  sendSubscribe(sub);
499
621
  }
500
622
  for (const p of unanswered) if (p.msg.t !== "subscribe") send(p.msg);
623
+ },
624
+ async close() {
625
+ const offsets = committer.take();
626
+ committer.dispose();
627
+ if (offsets) await call({
628
+ v: 1,
629
+ t: "commits",
630
+ p: { offsets }
631
+ });
501
632
  }
502
633
  };
503
634
  }
635
+ function isThenable(x) {
636
+ return (typeof x === "object" || typeof x === "function") && x !== null && typeof x.then === "function";
637
+ }
504
638
  var randomEpoch, check, REQUEST_TIMEOUT_MS;
505
639
  var init_bus_client = __esmMin((() => {
506
640
  randomEpoch = () => crypto.getRandomValues(/* @__PURE__ */ new Uint32Array(1))[0] ?? 0;
@@ -1936,6 +2070,7 @@ function createVanillaIsolate(init, post, scope, pooled = false) {
1936
2070
  const awake = createKeepAwake();
1937
2071
  const bus = createBusClient(init.busPort, {
1938
2072
  ...init.wake ? { wake: true } : {},
2073
+ ...init.commitIntervalMs === void 0 ? {} : { commitIntervalMs: init.commitIntervalMs },
1939
2074
  onError: (err) => {
1940
2075
  post({
1941
2076
  v: 1,
@@ -2022,6 +2157,7 @@ function createVanillaIsolate(init, post, scope, pooled = false) {
2022
2157
  },
2023
2158
  async shutdown(reason) {
2024
2159
  await Promise.allSettled(onShutdown.map(async (fn) => fn(reason)));
2160
+ await bus.close();
2025
2161
  render?.flush();
2026
2162
  render?.dispose();
2027
2163
  }
package/dist/worker.js CHANGED
@@ -8,14 +8,14 @@ var __esmMin = (fn, res, err) => () => {
8
8
  throw err = [e], e;
9
9
  }
10
10
  };
11
- var __exportAll = (all, no_symbols) => {
12
- let target = {};
11
+ var __exportAll = (all, flags) => {
12
+ let target = Object.setPrototypeOf({}, null);
13
13
  for (var name in all) __defProp(target, name, {
14
14
  get: all[name],
15
15
  enumerable: true
16
16
  });
17
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- return target;
17
+ if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ return flags & 2 ? target : Object.preventExtensions(target);
19
19
  };
20
20
  // ../protocol/dist/index.js
21
21
  /**
@@ -38,6 +38,69 @@ function envelopeGuard(types) {
38
38
  function isSystemTopic(topic) {
39
39
  return topic.startsWith(SYSTEM_TOPIC_PREFIX);
40
40
  }
41
+ function createCommitter(o) {
42
+ const intervalMs = o.intervalMs ?? 100;
43
+ const half = Math.max(1, Math.floor((o.credit ?? 1e3) / 2));
44
+ /** Highest settled offset per topic, not yet sent. */
45
+ const offsets = /* @__PURE__ */ new Map();
46
+ /** Records settled per topic since its last send: the early send at half the credit. */
47
+ const counts = /* @__PURE__ */ new Map();
48
+ let timer;
49
+ let queued = false;
50
+ const take = () => {
51
+ if (timer !== void 0) {
52
+ clearTimeout(timer);
53
+ timer = void 0;
54
+ }
55
+ queued = false;
56
+ if (offsets.size === 0) return void 0;
57
+ const out = [];
58
+ for (const [topic, offset] of offsets) out.push({
59
+ topic,
60
+ offset
61
+ });
62
+ offsets.clear();
63
+ counts.clear();
64
+ return out;
65
+ };
66
+ const flush = () => {
67
+ const out = take();
68
+ if (out) o.send(out);
69
+ };
70
+ const schedule = () => {
71
+ if (intervalMs === 0) {
72
+ if (queued) return;
73
+ queued = true;
74
+ queueMicrotask(() => {
75
+ if (queued) flush();
76
+ });
77
+ return;
78
+ }
79
+ timer ??= setTimeout(flush, intervalMs);
80
+ };
81
+ return {
82
+ settle(topic, offset, records = 1) {
83
+ const prev = offsets.get(topic);
84
+ if (prev === void 0 || offset > prev) offsets.set(topic, offset);
85
+ const n = (counts.get(topic) ?? 0) + records;
86
+ counts.set(topic, n);
87
+ if (n >= half) flush();
88
+ else schedule();
89
+ },
90
+ flush,
91
+ take,
92
+ drop(topic) {
93
+ offsets.delete(topic);
94
+ counts.delete(topic);
95
+ },
96
+ pending: () => offsets,
97
+ dispose() {
98
+ if (timer !== void 0) clearTimeout(timer);
99
+ timer = void 0;
100
+ queued = false;
101
+ }
102
+ };
103
+ }
41
104
  /** Wraps a hand-written check as a Standard Schema that passes valid values through unchanged. */
42
105
  function systemSchema(check) {
43
106
  return { "~standard": {
@@ -153,38 +216,69 @@ var init_dist = __esmMin((() => {
153
216
  });
154
217
  }));
155
218
  // src/freeze.ts
156
- /**
157
- * Freezing a prototype makes its data properties read-only, and in strict
158
- * code assigning a property of the same name on an instance then throws (the
159
- * "override mistake": `this.name = 'MyError'`, `Foo.prototype.toString = …`).
160
- * As Hardened JS does, each data property becomes an accessor whose setter
161
- * defines the property on the instance instead, so overriding still works
162
- * while the prototype itself can't change.
163
- */
219
+ /** The protected properties, per prototype, that are left as frozen data. */
220
+ function protectedProperties() {
221
+ const out = /* @__PURE__ */ new Map();
222
+ const add = (o, ...keys) => {
223
+ if (typeof o !== "object" && typeof o !== "function" || o === null) return;
224
+ out.set(o, /* @__PURE__ */ new Set([...out.get(o) ?? [], ...keys]));
225
+ };
226
+ const typedArrayCtor = Object.getPrototypeOf(Int8Array);
227
+ const typedArray = typeof typedArrayCtor === "function" ? Reflect.get(typedArrayCtor, "prototype") : void 0;
228
+ add(Array.prototype, ITERATOR, "constructor");
229
+ add(Object.getPrototypeOf([][Symbol.iterator]()), "next");
230
+ add(Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())), ITERATOR);
231
+ add(typedArray, ITERATOR, "constructor");
232
+ for (const c of [
233
+ Int8Array,
234
+ Uint8Array,
235
+ Uint8ClampedArray,
236
+ Int16Array,
237
+ Uint16Array,
238
+ Int32Array,
239
+ Uint32Array,
240
+ Float32Array,
241
+ Float64Array,
242
+ BigInt64Array,
243
+ BigUint64Array
244
+ ]) add(c.prototype, "constructor");
245
+ add(Map.prototype, ITERATOR);
246
+ add(Object.getPrototypeOf((/* @__PURE__ */ new Map())[Symbol.iterator]()), "next");
247
+ add(Set.prototype, ITERATOR);
248
+ add(Object.getPrototypeOf((/* @__PURE__ */ new Set())[Symbol.iterator]()), "next");
249
+ add(String.prototype, ...Reflect.ownKeys(String.prototype));
250
+ add(Object.getPrototypeOf(""[Symbol.iterator]()), "next");
251
+ add(Promise.prototype, "then", "constructor");
252
+ add(RegExp.prototype, ...Reflect.ownKeys(RegExp.prototype));
253
+ return out;
254
+ }
164
255
  function tameOverrides(proto) {
165
- for (const key of Reflect.ownKeys(proto)) {
166
- const d = Object.getOwnPropertyDescriptor(proto, key);
167
- if (!d || !("value" in d) || !d.configurable) continue;
168
- const value = d.value;
169
- Object.defineProperty(proto, key, {
170
- get() {
171
- return value;
172
- },
173
- set(v) {
174
- if (this === proto) throw new TypeError(`Cannot assign to read only property '${String(key)}' of a frozen built-in`);
175
- if (typeof this !== "object" && typeof this !== "function") return;
176
- if (this === null) return;
177
- Object.defineProperty(this, key, {
178
- value: v,
179
- writable: true,
180
- enumerable: true,
181
- configurable: true
182
- });
183
- },
184
- enumerable: d.enumerable ?? false,
185
- configurable: false
186
- });
187
- }
256
+ skip ??= protectedProperties();
257
+ const keep = skip.get(proto);
258
+ for (const key of Reflect.ownKeys(proto)) if (!keep?.has(key)) tameOverride(proto, key);
259
+ }
260
+ function tameOverride(proto, key) {
261
+ const d = Object.getOwnPropertyDescriptor(proto, key);
262
+ if (!d || !("value" in d) || !d.configurable) return;
263
+ const value = d.value;
264
+ Object.defineProperty(proto, key, {
265
+ get() {
266
+ return value;
267
+ },
268
+ set(v) {
269
+ if (this === proto) throw new TypeError(`Cannot assign to read only property '${String(key)}' of a frozen built-in`);
270
+ if (typeof this !== "object" && typeof this !== "function") return;
271
+ if (this === null) return;
272
+ Object.defineProperty(this, key, {
273
+ value: v,
274
+ writable: true,
275
+ enumerable: true,
276
+ configurable: true
277
+ });
278
+ },
279
+ enumerable: d.enumerable ?? false,
280
+ configurable: false
281
+ });
188
282
  }
189
283
  function hardenProto(proto) {
190
284
  if (typeof proto !== "object" && typeof proto !== "function" || proto === null) return;
@@ -221,7 +315,7 @@ function freezeBuiltins() {
221
315
  Object.freeze(JSON);
222
316
  Object.freeze(Reflect);
223
317
  }
224
- var NAMES;
318
+ var NAMES, ITERATOR, skip;
225
319
  var init_freeze = __esmMin((() => {
226
320
  NAMES = [
227
321
  "Object",
@@ -263,6 +357,7 @@ var init_freeze = __esmMin((() => {
263
357
  "BigInt64Array",
264
358
  "BigUint64Array"
265
359
  ];
360
+ ITERATOR = Symbol.iterator;
266
361
  }));
267
362
  // src/bus-client.ts
268
363
  function createBusClient(first, o = {}) {
@@ -302,15 +397,19 @@ function createBusClient(first, o = {}) {
302
397
  send(withId);
303
398
  });
304
399
  };
400
+ const committer = createCommitter({
401
+ send: (offsets) => {
402
+ send({
403
+ v: 1,
404
+ t: "commits",
405
+ p: { offsets }
406
+ });
407
+ },
408
+ ...o.commitIntervalMs === void 0 ? {} : { intervalMs: o.commitIntervalMs },
409
+ ...o.credit === void 0 ? {} : { credit: o.credit }
410
+ });
305
411
  const commit = (topic, offset) => {
306
- send({
307
- v: 1,
308
- t: "commit",
309
- p: {
310
- topic,
311
- offset
312
- }
313
- });
412
+ committer.settle(topic, offset);
314
413
  };
315
414
  const drain = async (sub) => {
316
415
  if (sub.running) return;
@@ -320,7 +419,8 @@ function createBusClient(first, o = {}) {
320
419
  if (!r) break;
321
420
  topicOf.set(r, sub.topic);
322
421
  try {
323
- await sub.fn(r);
422
+ const done = sub.fn(r);
423
+ if (isThenable(done)) await done;
324
424
  } catch (err) {
325
425
  sub.stuck = true;
326
426
  o.onError?.(err);
@@ -371,6 +471,7 @@ function createBusClient(first, o = {}) {
371
471
  const sub = subs.get(msg.p.topic);
372
472
  if (!sub) return;
373
473
  sub.queue.length = 0;
474
+ committer.drop(msg.p.topic);
374
475
  try {
375
476
  sub.opts.onReset?.();
376
477
  } catch (err) {
@@ -419,6 +520,7 @@ function createBusClient(first, o = {}) {
419
520
  return () => {
420
521
  if (subs.get(topic.name) !== sub) return;
421
522
  subs.delete(topic.name);
523
+ committer.flush();
422
524
  send({
423
525
  v: 1,
424
526
  t: "unsubscribe",
@@ -494,14 +596,27 @@ function createBusClient(first, o = {}) {
494
596
  value: null
495
597
  });
496
598
  }
599
+ committer.take();
497
600
  for (const sub of subs.values()) {
498
601
  sub.queue.length = 0;
499
602
  sendSubscribe(sub);
500
603
  }
501
604
  for (const p of unanswered) if (p.msg.t !== "subscribe") send(p.msg);
605
+ },
606
+ async close() {
607
+ const offsets = committer.take();
608
+ committer.dispose();
609
+ if (offsets) await call({
610
+ v: 1,
611
+ t: "commits",
612
+ p: { offsets }
613
+ });
502
614
  }
503
615
  };
504
616
  }
617
+ function isThenable(x) {
618
+ return (typeof x === "object" || typeof x === "function") && x !== null && typeof x.then === "function";
619
+ }
505
620
  var randomEpoch, check, REQUEST_TIMEOUT_MS;
506
621
  var init_bus_client = __esmMin((() => {
507
622
  init_dist();
@@ -1938,6 +2053,7 @@ function createVanillaIsolate(init, post, scope, pooled = false) {
1938
2053
  const awake = createKeepAwake();
1939
2054
  const bus = createBusClient(init.busPort, {
1940
2055
  ...init.wake ? { wake: true } : {},
2056
+ ...init.commitIntervalMs === void 0 ? {} : { commitIntervalMs: init.commitIntervalMs },
1941
2057
  onError: (err) => {
1942
2058
  post({
1943
2059
  v: 1,
@@ -2024,6 +2140,7 @@ function createVanillaIsolate(init, post, scope, pooled = false) {
2024
2140
  },
2025
2141
  async shutdown(reason) {
2026
2142
  await Promise.allSettled(onShutdown.map(async (fn) => fn(reason)));
2143
+ await bus.close();
2027
2144
  render?.flush();
2028
2145
  render?.dispose();
2029
2146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoloop/runtime",
3
- "version": "0.0.0-next.62ef495",
3
+ "version": "0.0.0-next.b8ffdcf",
4
4
  "description": "Isolate-side runtime that runs inside each worker.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@isoloop/dom": "0.0.0-next.62ef495",
39
- "@isoloop/protocol": "0.0.0-next.62ef495"
38
+ "@isoloop/dom": "0.0.0-next.b8ffdcf",
39
+ "@isoloop/protocol": "0.0.0-next.b8ffdcf"
40
40
  },
41
41
  "devDependencies": {
42
42
  "typescript": "7.0.2"