@platformatic/node 2.7.1-alpha.2 → 2.8.0-alpha.2
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/index.js +17 -18
- package/package.json +7 -7
- package/schema.json +1 -1
package/index.js
CHANGED
|
@@ -16,7 +16,6 @@ import { existsSync } from 'node:fs'
|
|
|
16
16
|
import { readFile } from 'node:fs/promises'
|
|
17
17
|
import { Server } from 'node:http'
|
|
18
18
|
import { resolve as pathResolve, resolve } from 'node:path'
|
|
19
|
-
import { pathToFileURL } from 'url'
|
|
20
19
|
import { packageJson, schema } from './lib/schema.js'
|
|
21
20
|
|
|
22
21
|
const validFields = [
|
|
@@ -86,13 +85,7 @@ export class NodeStackable extends BaseStackable {
|
|
|
86
85
|
? ensureTrailingSlash(cleanBasePath(config.application?.basePath))
|
|
87
86
|
: undefined
|
|
88
87
|
|
|
89
|
-
this.registerGlobals({
|
|
90
|
-
// Always use URL to avoid serialization problem in Windows
|
|
91
|
-
id: this.id,
|
|
92
|
-
root: pathToFileURL(this.root).toString(),
|
|
93
|
-
basePath: this.#basePath,
|
|
94
|
-
logLevel: this.logger.level
|
|
95
|
-
})
|
|
88
|
+
this.registerGlobals({ basePath: this.#basePath })
|
|
96
89
|
|
|
97
90
|
// The server promise must be created before requiring the entrypoint even if it's not going to be used
|
|
98
91
|
// at all. Otherwise there is chance we miss the listen event.
|
|
@@ -128,6 +121,10 @@ export class NodeStackable extends BaseStackable {
|
|
|
128
121
|
this.#server = this.#app
|
|
129
122
|
this.#dispatcher = this.#server.listeners('request')[0]
|
|
130
123
|
}
|
|
124
|
+
|
|
125
|
+
if (listen) {
|
|
126
|
+
await this._listen()
|
|
127
|
+
}
|
|
131
128
|
} else {
|
|
132
129
|
// User blackbox function, we wait for it to listen on a port
|
|
133
130
|
this.#server = await serverPromise
|
|
@@ -279,18 +276,20 @@ export class NodeStackable extends BaseStackable {
|
|
|
279
276
|
|
|
280
277
|
const { entrypoint, hadEntrypointField } = await getEntrypointInformation(this.root)
|
|
281
278
|
|
|
282
|
-
if (
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
279
|
+
if (typeof this.workerId === 'undefined' || this.workerId === 0) {
|
|
280
|
+
if (!entrypoint) {
|
|
281
|
+
this.logger.error(
|
|
282
|
+
`The service "${this.serviceId}" had no valid entrypoint defined in the package.json file and no valid entrypoint file was found.`
|
|
283
|
+
)
|
|
286
284
|
|
|
287
|
-
|
|
288
|
-
|
|
285
|
+
process.exit(1)
|
|
286
|
+
}
|
|
289
287
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
288
|
+
if (!hadEntrypointField) {
|
|
289
|
+
this.logger.warn(
|
|
290
|
+
`The service "${this.serviceId}" had no valid entrypoint defined in the package.json file. Falling back to the file "${entrypoint}".`
|
|
291
|
+
)
|
|
292
|
+
}
|
|
294
293
|
}
|
|
295
294
|
|
|
296
295
|
let root = this.root
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/node",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0-alpha.2",
|
|
4
4
|
"description": "Platformatic Node.js Stackable",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"light-my-request": "^6.0.0",
|
|
19
|
-
"@platformatic/basic": "2.
|
|
20
|
-
"@platformatic/config": "2.
|
|
21
|
-
"@platformatic/utils": "2.
|
|
22
|
-
"@platformatic/telemetry": "2.
|
|
19
|
+
"@platformatic/basic": "2.8.0-alpha.2",
|
|
20
|
+
"@platformatic/config": "2.8.0-alpha.2",
|
|
21
|
+
"@platformatic/utils": "2.8.0-alpha.2",
|
|
22
|
+
"@platformatic/telemetry": "2.8.0-alpha.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"borp": "^0.18.0",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"neostandard": "^0.11.1",
|
|
32
32
|
"tsx": "^4.19.0",
|
|
33
33
|
"typescript": "^5.5.4",
|
|
34
|
-
"@platformatic/
|
|
35
|
-
"@platformatic/
|
|
34
|
+
"@platformatic/service": "2.8.0-alpha.2",
|
|
35
|
+
"@platformatic/composer": "2.8.0-alpha.2"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"test": "npm run lint && borp --concurrency=1 --no-timeout",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/node/2.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/node/2.8.0-alpha.2.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Node.js Stackable",
|
|
5
5
|
"type": "object",
|