@logux/server 0.10.6 → 0.10.7
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/base-server/index.js +2 -2
- package/package.json +7 -8
- package/server/index.js +11 -12
package/base-server/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ServerConnection, MemoryStore, Log, parseId } from '@logux/core'
|
|
2
2
|
import { LoguxNotFoundError } from '@logux/actions'
|
|
3
3
|
import { createNanoEvents } from 'nanoevents'
|
|
4
|
+
import { WebSocketServer } from 'ws'
|
|
4
5
|
import { promises as fs } from 'fs'
|
|
5
6
|
import { fileURLToPath } from 'url'
|
|
6
7
|
import { join, dirname } from 'path'
|
|
7
8
|
import UrlPattern from 'url-pattern'
|
|
8
9
|
import { nanoid } from 'nanoid'
|
|
9
|
-
import WebSocket from 'ws'
|
|
10
10
|
|
|
11
11
|
import { bindControlServer } from '../bind-control-server/index.js'
|
|
12
12
|
import { bindBackendProxy } from '../bind-backend-proxy/index.js'
|
|
@@ -379,7 +379,7 @@ export class BaseServer {
|
|
|
379
379
|
throw new Error('You must set authentication callback by server.auth()')
|
|
380
380
|
}
|
|
381
381
|
this.httpServer = await createHttpServer(this.options)
|
|
382
|
-
this.ws = new
|
|
382
|
+
this.ws = new WebSocketServer({ server: this.httpServer })
|
|
383
383
|
if (!this.options.server) {
|
|
384
384
|
await new Promise((resolve, reject) => {
|
|
385
385
|
this.ws.on('error', reject)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logux/server",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "Build own Logux server or make proxy between WebSocket and HTTP backend on any language",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logux",
|
|
@@ -29,22 +29,21 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@logux/actions": "^0.2.1",
|
|
31
31
|
"@logux/core": "^0.7.2",
|
|
32
|
-
"@types/node-fetch": "^2.5.10",
|
|
33
32
|
"JSONStream": "^1.3.5",
|
|
34
33
|
"cookie": "^0.4.1",
|
|
35
34
|
"dotenv": "^10.0.0",
|
|
36
|
-
"
|
|
35
|
+
"fast-glob": "^3.2.7",
|
|
37
36
|
"ip": "^1.1.5",
|
|
38
|
-
"nanodelay": "^2.0.
|
|
39
|
-
"nanoevents": "^6.0.
|
|
40
|
-
"nanoid": "^3.1.
|
|
37
|
+
"nanodelay": "^2.0.2",
|
|
38
|
+
"nanoevents": "^6.0.2",
|
|
39
|
+
"nanoid": "^3.1.30",
|
|
41
40
|
"node-fetch": "^2.6.1",
|
|
42
|
-
"picocolors": "^0.
|
|
41
|
+
"picocolors": "^1.0.0",
|
|
43
42
|
"pino": "^6.13.3",
|
|
44
43
|
"semver": "^7.3.5",
|
|
45
44
|
"strip-ansi": "^7.0.1",
|
|
46
45
|
"url-pattern": "^1.0.3",
|
|
47
|
-
"ws": "^
|
|
46
|
+
"ws": "^8.2.3",
|
|
48
47
|
"yyyy-mm-dd": "^1.0.2"
|
|
49
48
|
}
|
|
50
49
|
}
|
package/server/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join, relative } from 'path'
|
|
2
|
-
import globby from 'globby'
|
|
3
2
|
import pico from 'picocolors'
|
|
3
|
+
import glob from 'fast-glob'
|
|
4
4
|
|
|
5
5
|
import { createReporter } from '../create-reporter/index.js'
|
|
6
6
|
import { BaseServer } from '../base-server/index.js'
|
|
@@ -63,16 +63,15 @@ export class Server extends BaseServer {
|
|
|
63
63
|
)
|
|
64
64
|
if (help) {
|
|
65
65
|
process.stdout.write(help + '\n')
|
|
66
|
-
process.exit(0)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
66
|
+
return process.exit(0)
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
return Object.assign(defaults, options)
|
|
70
|
+
} catch (e) {
|
|
71
|
+
process.stderr.write(
|
|
72
|
+
`${pico.bgRed(pico.black(' FATAL '))} ${e.message}\n`
|
|
73
|
+
)
|
|
74
|
+
return process.exit(1)
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
|
|
@@ -135,7 +134,7 @@ export class Server extends BaseServer {
|
|
|
135
134
|
async autoloadModules(
|
|
136
135
|
files = ['modules/*/index.js', 'modules/*.js', '!**/*.{test,spec}.js']
|
|
137
136
|
) {
|
|
138
|
-
let matches = await
|
|
137
|
+
let matches = await glob(files, {
|
|
139
138
|
cwd: this.options.root,
|
|
140
139
|
absolute: true,
|
|
141
140
|
onlyFiles: true
|