@platformatic/basic 2.2.1 → 2.3.0
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/lib/base.js +3 -3
- package/lib/worker/child-process.js +14 -2
- package/lib/worker/listeners.js +6 -4
- package/package.json +8 -8
- package/schema.json +1 -1
package/lib/base.js
CHANGED
|
@@ -44,7 +44,7 @@ export class BaseStackable {
|
|
|
44
44
|
this.registerGlobals({
|
|
45
45
|
setOpenapiSchema: this.setOpenapiSchema.bind(this),
|
|
46
46
|
setGraphqlSchema: this.setGraphqlSchema.bind(this),
|
|
47
|
-
|
|
47
|
+
setBasePath: this.setBasePath.bind(this)
|
|
48
48
|
})
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -104,8 +104,8 @@ export class BaseStackable {
|
|
|
104
104
|
this.graphqlSchema = schema
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
this.
|
|
107
|
+
setBasePath (basePath) {
|
|
108
|
+
this.basePath = basePath
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
async log ({ message, level }) {
|
|
@@ -176,6 +176,11 @@ export class ChildProcess extends ITC {
|
|
|
176
176
|
#setupServer () {
|
|
177
177
|
const subscribers = {
|
|
178
178
|
asyncStart ({ options }) {
|
|
179
|
+
// Unix socket, do nothing
|
|
180
|
+
if (options.path) {
|
|
181
|
+
return
|
|
182
|
+
}
|
|
183
|
+
|
|
179
184
|
const port = globalThis.platformatic.port
|
|
180
185
|
const host = globalThis.platformatic.host
|
|
181
186
|
|
|
@@ -189,8 +194,15 @@ export class ChildProcess extends ITC {
|
|
|
189
194
|
asyncEnd: ({ server }) => {
|
|
190
195
|
tracingChannel('net.server.listen').unsubscribe(subscribers)
|
|
191
196
|
|
|
192
|
-
const
|
|
193
|
-
|
|
197
|
+
const address = server.address()
|
|
198
|
+
|
|
199
|
+
// Unix socket, do nothing
|
|
200
|
+
if (typeof address === 'string') {
|
|
201
|
+
return
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const { family, address: host, port } = address
|
|
205
|
+
const url = new URL(family === 'IPv6' ? `http://[${host}]:${port}` : `http://${host}:${port}`).origin
|
|
194
206
|
|
|
195
207
|
this.notify('url', url)
|
|
196
208
|
},
|
package/lib/worker/listeners.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { withResolvers } from '@platformatic/utils'
|
|
2
2
|
import { subscribe, tracingChannel, unsubscribe } from 'node:diagnostics_channel'
|
|
3
3
|
|
|
4
|
-
export function createServerListener (
|
|
5
|
-
overridePort = true,
|
|
6
|
-
overrideHost = true
|
|
7
|
-
) {
|
|
4
|
+
export function createServerListener (overridePort = true, overrideHost = true) {
|
|
8
5
|
const { promise, resolve, reject } = withResolvers()
|
|
9
6
|
|
|
10
7
|
const subscribers = {
|
|
11
8
|
asyncStart ({ options }) {
|
|
9
|
+
// Unix socket, do nothing
|
|
10
|
+
if (options.path) {
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
|
|
12
14
|
if (overridePort !== false) {
|
|
13
15
|
options.port = typeof overridePort === 'number' ? overridePort : 0
|
|
14
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/basic",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"split2": "^4.2.0",
|
|
24
24
|
"undici": "^6.19.5",
|
|
25
25
|
"ws": "^8.18.0",
|
|
26
|
-
"@platformatic/
|
|
27
|
-
"@platformatic/
|
|
28
|
-
"@platformatic/
|
|
29
|
-
"@platformatic/
|
|
26
|
+
"@platformatic/config": "2.3.0",
|
|
27
|
+
"@platformatic/itc": "2.3.0",
|
|
28
|
+
"@platformatic/telemetry": "2.3.0",
|
|
29
|
+
"@platformatic/utils": "2.3.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"borp": "^0.17.0",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"react": "^18.3.1",
|
|
40
40
|
"react-dom": "^18.3.1",
|
|
41
41
|
"typescript": "^5.5.4",
|
|
42
|
-
"vite": "^5.4.0"
|
|
43
|
-
"@platformatic/composer": "2.2.1",
|
|
44
|
-
"@platformatic/service": "2.2.1"
|
|
42
|
+
"vite": "^5.4.0"
|
|
45
43
|
},
|
|
46
44
|
"scripts": {
|
|
45
|
+
"test": "npm run lint && borp --concurrency=1 --no-timeout",
|
|
46
|
+
"coverage": "npm run lint && borp -C -X test -X test/fixtures --concurrency=1 --no-timeout",
|
|
47
47
|
"gen-schema": "node lib/schema.js > schema.json",
|
|
48
48
|
"gen-types": "json2ts > config.d.ts < schema.json",
|
|
49
49
|
"build": "pnpm run gen-schema && pnpm run gen-types",
|
package/schema.json
CHANGED