websocket-text-relay 1.1.3 → 1.1.5

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/changelog.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.1.5 - 2025/09/05
2
+
3
+ Minor UI spacing fix
4
+
5
+ ## 1.1.4 - 2025/08/14
6
+
7
+ Fixed a crash that occurred when the status UI requests a file that doesn't exist.
8
+
1
9
  ## 1.1.3 - 2025/08/13
2
10
 
3
11
  This change consisted entirely of updating dependencies and cleaning up code. There should be no user facing changes with this version.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "websocket-text-relay",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "An LSP server for sending live file updates from your text editor to the front end via websockets.",
5
5
  "bin": {
6
6
  "websocket-text-relay": "./start.js"
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { JsonRpcInterface } from "./src/language-server/JsonRpcInterface.js"
2
- import { WebsocketInterface } from "./src/websocket-interface/WebsocketInterface.js"
1
+ import { JsonRpcInterface } from "./language-server/JsonRpcInterface.js"
2
+ import { WebsocketInterface } from "./websocket-interface/WebsocketInterface.js"
3
3
 
4
4
  const DEFAULT_WS_PORT = 38378
5
5
 
@@ -69,7 +69,7 @@ const drawRightAlignedSummaryValue = ({ x, y, label, circleClass, parentNode })
69
69
 
70
70
  const underlinePadding = 0.01
71
71
  const summaryCircleRadius = 0.014
72
- const summaryLeftPadding = 0.03
72
+ const summaryLeftPadding = 0.05
73
73
  const summaryValueSpacing = 0.065
74
74
  const editorSummaryPadding = 0.025
75
75
 
@@ -1,6 +1,7 @@
1
1
  import { createServer } from "node:http"
2
2
  import path from "node:path"
3
- import fs from "node:fs"
3
+ import { createReadStream } from "node:fs"
4
+ import fs from "node:fs/promises"
4
5
  import * as url from "node:url"
5
6
  import { isValidOrigin } from "./util.js"
6
7
  const parentDir = url.fileURLToPath(new URL("..", import.meta.url))
@@ -44,10 +45,18 @@ const requestHandler = (allowedHosts) => (req, res) => {
44
45
  res.end("NOT FOUND!")
45
46
  return
46
47
  }
47
- res.setHeader("Content-Type", contentType)
48
- res.writeHead(200)
49
- const fileStream = fs.createReadStream(filePath)
50
- fileStream.pipe(res)
48
+
49
+ fs.access(filePath, fs.constants.R_OK)
50
+ .then(() => {
51
+ res.setHeader("Content-Type", contentType)
52
+ res.writeHead(200)
53
+ const fileStream = createReadStream(filePath)
54
+ fileStream.pipe(res)
55
+ })
56
+ .catch((e) => {
57
+ res.writeHead(404)
58
+ res.end("NOT FOUND!")
59
+ })
51
60
  }
52
61
 
53
62
  export const createHttpServer = ({ port, allowedHosts, allowNetworkAccess }) => {