@volter/tabnode 0.5.14 → 0.5.15

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/index.mjs CHANGED
@@ -37932,7 +37932,7 @@ const _ServerBridge = class _ServerBridge extends EventEmitter {
37932
37932
  const virtualServer = this.servers.get(port);
37933
37933
  if (!virtualServer) return false;
37934
37934
  const bodyBuffer = body ? Buffer$9.from(new Uint8Array(body)) : void 0;
37935
- if (virtualServer.server === null) {
37935
+ if (virtualServer.server === null || this.guestServers.has(virtualServer.server)) {
37936
37936
  const named = Object.keys(headers).some((name) => name.toLowerCase() === "host");
37937
37937
  const authority = `${virtualServer.hostname && virtualServer.hostname !== "0.0.0.0" && virtualServer.hostname !== "::" ? virtualServer.hostname : "127.0.0.1"}:${port}`;
37938
37938
  await __streamOverLoopback(
@@ -37983,7 +37983,7 @@ const _ServerBridge = class _ServerBridge extends EventEmitter {
37983
37983
  (_b2 = this.messageChannel) == null ? void 0 : _b2.port1.postMessage({ type: "stream-end", id });
37984
37984
  return;
37985
37985
  }
37986
- if (virtualServer.server === null) {
37986
+ if (virtualServer.server === null || this.guestServers.has(virtualServer.server)) {
37987
37987
  const bodyBuffer = body ? Buffer$9.from(new Uint8Array(body)) : void 0;
37988
37988
  const named = Object.keys(headers).some((name) => name.toLowerCase() === "host");
37989
37989
  const authority = `${virtualServer.hostname && virtualServer.hostname !== "0.0.0.0" && virtualServer.hostname !== "::" ? virtualServer.hostname : "127.0.0.1"}:${port}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/tabnode",
3
- "version": "0.5.14",
3
+ "version": "0.5.15",
4
4
  "description": "Node's own library, in a browser tab.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -774,7 +774,9 @@ export class ServerBridge extends EventEmitter {
774
774
  const virtualServer = this.servers.get(port);
775
775
  if (!virtualServer) return false;
776
776
  const bodyBuffer = body ? Buffer.from(new Uint8Array(body)) : undefined;
777
- if (virtualServer.server === null) {
777
+ // A guest's listener (the old null sentinel, now a request adapter) is
778
+ // streamed off its connection; its adapter would answer whole.
779
+ if (virtualServer.server === null || this.guestServers.has(virtualServer.server)) {
778
780
  const named = Object.keys(headers).some((name) => name.toLowerCase() === 'host');
779
781
  const authority = `${virtualServer.hostname && virtualServer.hostname !== '0.0.0.0' && virtualServer.hostname !== '::' ? virtualServer.hostname : '127.0.0.1'}:${port}`;
780
782
  await __streamOverLoopback(
@@ -839,7 +841,7 @@ export class ServerBridge extends EventEmitter {
839
841
 
840
842
  // A guest's server is a port: its answer is streamed off the connection
841
843
  // as it arrives, which is what the page reads chunk by chunk.
842
- if (virtualServer.server === null) {
844
+ if (virtualServer.server === null || this.guestServers.has(virtualServer.server)) {
843
845
  const bodyBuffer = body ? Buffer.from(new Uint8Array(body)) : undefined;
844
846
  const named = Object.keys(headers).some((name) => name.toLowerCase() === 'host');
845
847
  const authority = `${virtualServer.hostname && virtualServer.hostname !== '0.0.0.0' && virtualServer.hostname !== '::' ? virtualServer.hostname : '127.0.0.1'}:${port}`;