@miniflare/web-sockets
Advanced tools
Comparing version 2.0.0-rc.4 to 2.0.0-rc.5
import { InputGatedEventTarget } from '@miniflare/shared'; | ||
import { kWrapListener } from '@miniflare/shared'; | ||
import { Plugin } from '@miniflare/shared'; | ||
@@ -55,2 +56,3 @@ import { PluginContext } from '@miniflare/shared'; | ||
[kClosed]: boolean; | ||
protected [kWrapListener]<Type extends keyof WebSocketEventMap>(listener: (event: WebSocketEventMap[Type]) => void): (event: WebSocketEventMap[Type]) => void; | ||
accept(): void; | ||
@@ -57,0 +59,0 @@ send(message: ArrayBuffer | string): void; |
@@ -40,2 +40,3 @@ var __create = Object.create; | ||
var import_core = __toModule(require("@miniflare/core")); | ||
var import_shared3 = __toModule(require("@miniflare/shared")); | ||
var import_ws2 = __toModule(require("ws")); | ||
@@ -86,2 +87,17 @@ | ||
[kClosed] = false; | ||
[import_shared.kWrapListener](listener) { | ||
const wrappedListener = super[import_shared.kWrapListener](listener); | ||
const addListenerCtx = (0, import_shared.getRequestContext)(); | ||
return (event) => { | ||
if (addListenerCtx?.durableObject || addListenerCtx === void 0) { | ||
const ctx = new import_shared.RequestContext({ | ||
requestDepth: addListenerCtx?.requestDepth, | ||
pipelineDepth: addListenerCtx?.pipelineDepth | ||
}); | ||
ctx.runWith(() => wrappedListener(event)); | ||
} else { | ||
addListenerCtx.runWith(() => wrappedListener(event)); | ||
} | ||
}; | ||
} | ||
accept() { | ||
@@ -213,2 +229,3 @@ if (this[kCoupled]) { | ||
if (request.method === "GET" && request.headers.get("upgrade") === "websocket") { | ||
(0, import_shared3.getRequestContext)()?.incrementSubrequests(); | ||
const url = new import_url.URL(request.url); | ||
@@ -245,5 +262,5 @@ if (url.protocol !== "http:" && url.protocol !== "https:") { | ||
var import_core2 = __toModule(require("@miniflare/core")); | ||
var import_shared3 = __toModule(require("@miniflare/shared")); | ||
var import_shared4 = __toModule(require("@miniflare/shared")); | ||
var constructError = "Failed to construct 'WebSocket': the constructor is not implemented."; | ||
var WebSocketPlugin = class extends import_shared3.Plugin { | ||
var WebSocketPlugin = class extends import_shared4.Plugin { | ||
#webSockets = new Set(); | ||
@@ -253,3 +270,3 @@ #upgradingFetch; | ||
super(ctx); | ||
this.#upgradingFetch = (0, import_core2.createCompatFetch)(ctx.log, ctx.compat, upgradingFetch); | ||
this.#upgradingFetch = (0, import_core2.createCompatFetch)(ctx, upgradingFetch); | ||
} | ||
@@ -256,0 +273,0 @@ setup() { |
{ | ||
"name": "@miniflare/web-sockets", | ||
"version": "2.0.0-rc.4", | ||
"version": "2.0.0-rc.5", | ||
"description": "WebSocket module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers", | ||
@@ -38,4 +38,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@miniflare/core": "2.0.0-rc.4", | ||
"@miniflare/shared": "2.0.0-rc.4", | ||
"@miniflare/core": "2.0.0-rc.5", | ||
"@miniflare/shared": "2.0.0-rc.5", | ||
"ws": "^8.2.2", | ||
@@ -45,5 +45,5 @@ "undici": "^4.11.1" | ||
"devDependencies": { | ||
"@miniflare/shared-test": "2.0.0-rc.4", | ||
"@miniflare/shared-test": "2.0.0-rc.5", | ||
"@types/ws": "^8.2.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19424
378
+ Added@miniflare/core@2.0.0-rc.5(transitive)
+ Added@miniflare/shared@2.0.0-rc.5(transitive)
- Removed@miniflare/core@2.0.0-rc.4(transitive)
- Removed@miniflare/shared@2.0.0-rc.4(transitive)
Updated@miniflare/core@2.0.0-rc.5
Updated@miniflare/shared@2.0.0-rc.5