From ab0560de006180ae1fb40dfc2c5888511d7d2523 Mon Sep 17 00:00:00 2001 From: Dorian Date: Thu, 12 Feb 2026 13:25:58 +0000 Subject: [PATCH] Add WebSocket support and update dependencies - Introduced WebSocket polyfill for Node.js in seed-activity.ts and seed-profiles.ts to support applesauce-relay and RxJS. - Updated package.json and package-lock.json to include 'ws' version 8.19.0 and '@types/ws' version 8.18.1 as dependencies. Co-authored-by: Cursor --- package-lock.json | 35 ++++++++++++++++++++++++++++++++++- package.json | 4 +++- scripts/seed-activity.ts | 6 ++++++ scripts/seed-profiles.ts | 6 ++++++ 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0926388..1b73262 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,10 +19,12 @@ "nostr-tools": "^2.23.0", "pinia": "^3.0.4", "vue": "^3.5.24", - "vue-router": "^4.6.3" + "vue-router": "^4.6.3", + "ws": "^8.19.0" }, "devDependencies": { "@types/node": "^24.10.0", + "@types/ws": "^8.18.1", "@vitejs/plugin-vue": "^6.0.1", "@vue/tsconfig": "^0.8.1", "autoprefixer": "^10.4.22", @@ -3336,6 +3338,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@vitejs/plugin-vue": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.4.tgz", @@ -9073,6 +9085,27 @@ "node": ">=8" } }, + "node_modules/ws": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz", + "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", diff --git a/package.json b/package.json index 47dd689..d6f63fe 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,12 @@ "nostr-tools": "^2.23.0", "pinia": "^3.0.4", "vue": "^3.5.24", - "vue-router": "^4.6.3" + "vue-router": "^4.6.3", + "ws": "^8.19.0" }, "devDependencies": { "@types/node": "^24.10.0", + "@types/ws": "^8.18.1", "@vitejs/plugin-vue": "^6.0.1", "@vue/tsconfig": "^0.8.1", "autoprefixer": "^10.4.22", diff --git a/scripts/seed-activity.ts b/scripts/seed-activity.ts index 271d099..998272e 100644 --- a/scripts/seed-activity.ts +++ b/scripts/seed-activity.ts @@ -4,6 +4,12 @@ * * Run after seed-profiles.ts and with the relay already running. */ +// Polyfill WebSocket for Node.js (required by applesauce-relay / RxJS) +import WebSocket from 'ws' +if (!globalThis.WebSocket) { + ;(globalThis as unknown as Record).WebSocket = WebSocket +} + import { Relay } from 'applesauce-relay' import { PrivateKeySigner } from 'applesauce-signers/signers/private-key-signer' import { diff --git a/scripts/seed-profiles.ts b/scripts/seed-profiles.ts index 3002b5c..068949f 100644 --- a/scripts/seed-profiles.ts +++ b/scripts/seed-profiles.ts @@ -1,3 +1,9 @@ +// Polyfill WebSocket for Node.js (required by applesauce-relay / RxJS) +import WebSocket from 'ws' +if (!globalThis.WebSocket) { + ;(globalThis as unknown as Record).WebSocket = WebSocket +} + import { Relay } from 'applesauce-relay' import { PrivateKeySigner } from 'applesauce-signers/signers/private-key-signer' import {