@volter/tabnode 0.5.0 → 0.5.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.
@@ -17595,10 +17595,17 @@ var implementation$1 = function bind2(that) {
17595
17595
  var implementation = implementation$1;
17596
17596
  var functionBind = Function.prototype.bind || implementation;
17597
17597
  var functionCall = Function.prototype.call;
17598
- var functionApply = Function.prototype.apply;
17598
+ var functionApply;
17599
+ var hasRequiredFunctionApply;
17600
+ function requireFunctionApply() {
17601
+ if (hasRequiredFunctionApply) return functionApply;
17602
+ hasRequiredFunctionApply = 1;
17603
+ functionApply = Function.prototype.apply;
17604
+ return functionApply;
17605
+ }
17599
17606
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
17600
17607
  var bind$2 = functionBind;
17601
- var $apply$1 = functionApply;
17608
+ var $apply$1 = requireFunctionApply();
17602
17609
  var $call$2 = functionCall;
17603
17610
  var $reflectApply = reflectApply;
17604
17611
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
@@ -17718,7 +17725,7 @@ var hasSymbols = requireHasSymbols()();
17718
17725
  var getProto = requireGetProto();
17719
17726
  var $ObjectGPO = requireObject_getPrototypeOf();
17720
17727
  var $ReflectGPO = requireReflect_getPrototypeOf();
17721
- var $apply = functionApply;
17728
+ var $apply = requireFunctionApply();
17722
17729
  var $call = functionCall;
17723
17730
  var needsEval = {};
17724
17731
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
@@ -18359,7 +18366,7 @@ function requireApplyBind() {
18359
18366
  if (hasRequiredApplyBind) return applyBind;
18360
18367
  hasRequiredApplyBind = 1;
18361
18368
  var bind3 = functionBind;
18362
- var $apply2 = functionApply;
18369
+ var $apply2 = requireFunctionApply();
18363
18370
  var actualApply$1 = actualApply;
18364
18371
  applyBind = function applyBind2() {
18365
18372
  return actualApply$1(bind3, $apply2, arguments);
package/dist/index.mjs CHANGED
@@ -17762,17 +17762,10 @@ var implementation$1 = function bind2(that) {
17762
17762
  var implementation = implementation$1;
17763
17763
  var functionBind = Function.prototype.bind || implementation;
17764
17764
  var functionCall = Function.prototype.call;
17765
- var functionApply;
17766
- var hasRequiredFunctionApply;
17767
- function requireFunctionApply() {
17768
- if (hasRequiredFunctionApply) return functionApply;
17769
- hasRequiredFunctionApply = 1;
17770
- functionApply = Function.prototype.apply;
17771
- return functionApply;
17772
- }
17765
+ var functionApply = Function.prototype.apply;
17773
17766
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
17774
17767
  var bind$2 = functionBind;
17775
- var $apply$1 = requireFunctionApply();
17768
+ var $apply$1 = functionApply;
17776
17769
  var $call$2 = functionCall;
17777
17770
  var $reflectApply = reflectApply;
17778
17771
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
@@ -17892,7 +17885,7 @@ var hasSymbols = requireHasSymbols()();
17892
17885
  var getProto = requireGetProto();
17893
17886
  var $ObjectGPO = requireObject_getPrototypeOf();
17894
17887
  var $ReflectGPO = requireReflect_getPrototypeOf();
17895
- var $apply = requireFunctionApply();
17888
+ var $apply = functionApply;
17896
17889
  var $call = functionCall;
17897
17890
  var needsEval = {};
17898
17891
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
@@ -18533,7 +18526,7 @@ function requireApplyBind() {
18533
18526
  if (hasRequiredApplyBind) return applyBind;
18534
18527
  hasRequiredApplyBind = 1;
18535
18528
  var bind3 = functionBind;
18536
- var $apply2 = requireFunctionApply();
18529
+ var $apply2 = functionApply;
18537
18530
  var actualApply$1 = actualApply;
18538
18531
  applyBind = function applyBind2() {
18539
18532
  return actualApply$1(bind3, $apply2, arguments);
@@ -35530,7 +35523,7 @@ class WorkerRuntime {
35530
35523
  this.worker = new Worker(
35531
35524
  new URL(
35532
35525
  /* @vite-ignore */
35533
- "/assets/runtime-worker-B9buriZs.js",
35526
+ "/assets/runtime-worker-DBZ2flHK.js",
35534
35527
  import.meta.url
35535
35528
  ),
35536
35529
  { type: "module" }
@@ -38262,9 +38255,14 @@ function createContainer(options) {
38262
38255
  // socket handler of its own, so a guest's `net.connect` reaches it: the
38263
38256
  // registry a connect consults is the `net` shim's, and a server of the
38264
38257
  // shim's own class is what registers in it. The call answers a disposer.
38258
+ // The listener is the page's, not a guest's: a handle opened outside any
38259
+ // run is otherwise charged to the run launched last, which then read the
38260
+ // page's port as its own server and ended when the page stopped listening.
38261
+ // Sockets it accepts take its owner, so they hold no guest open either.
38265
38262
  listenNet: (port, onConnection) => {
38266
38263
  const server = new Server(onConnection);
38267
38264
  server.listen(port);
38265
+ __adoptHandle(server._handle, null);
38268
38266
  return () => {
38269
38267
  server.close();
38270
38268
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/tabnode",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Node's own library, in a browser tab.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -54,6 +54,7 @@ import { PackageManager } from './npm';
54
54
  import { ServerBridge, getServerBridge } from './server-bridge';
55
55
  import { runCommand, registerRunStreams, releaseRunStreams, sendStdin } from './shims/child_process';
56
56
  import { Server as NetServer, __releaseOwnedHandles, type Socket as NetSocket } from './node-lib/net-module';
57
+ import { __adoptHandle, type OwnedHandle } from './node-lib/binding/handles';
57
58
 
58
59
  import { __currentProcessToken, __runFor, __stopOwnedProcess, runPid, processByPid } from './process-tokens';
59
60
  export { runPid, processByPid };
@@ -229,9 +230,14 @@ export function createContainer(options?: ContainerOptions): {
229
230
  // socket handler of its own, so a guest's `net.connect` reaches it: the
230
231
  // registry a connect consults is the `net` shim's, and a server of the
231
232
  // shim's own class is what registers in it. The call answers a disposer.
233
+ // The listener is the page's, not a guest's: a handle opened outside any
234
+ // run is otherwise charged to the run launched last, which then read the
235
+ // page's port as its own server and ended when the page stopped listening.
236
+ // Sockets it accepts take its owner, so they hold no guest open either.
232
237
  listenNet: (port: number, onConnection: (socket: NetSocket) => void) => {
233
238
  const server = new NetServer(onConnection);
234
239
  server.listen(port);
240
+ __adoptHandle((server as unknown as { _handle?: OwnedHandle | null })._handle, null);
235
241
  return () => { server.close(); };
236
242
  },
237
243
  createREPL: () => runtime.createREPL(),