@platformatic/node 3.6.0 → 3.7.1
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/capability.js +16 -3
- package/package.json +6 -6
- package/schema.json +1 -1
package/lib/capability.js
CHANGED
|
@@ -96,6 +96,7 @@ export class NodeCapability extends BaseCapability {
|
|
|
96
96
|
#dispatcher
|
|
97
97
|
#isFastify
|
|
98
98
|
#isKoa
|
|
99
|
+
#appClose
|
|
99
100
|
#useHttpForDispatch
|
|
100
101
|
|
|
101
102
|
constructor (root, config, context) {
|
|
@@ -158,8 +159,9 @@ export class NodeCapability extends BaseCapability {
|
|
|
158
159
|
|
|
159
160
|
// Deal with application
|
|
160
161
|
const factory = ['build', 'create'].find(f => typeof this.#module[f] === 'function')
|
|
162
|
+
this.#appClose = this.#module['close']
|
|
161
163
|
|
|
162
|
-
if (
|
|
164
|
+
if (this.#hasServer()) {
|
|
163
165
|
if (factory) {
|
|
164
166
|
// We have build function, this Capability will not use HTTP unless it is the entrypoint
|
|
165
167
|
serverPromise.cancel()
|
|
@@ -193,13 +195,24 @@ export class NodeCapability extends BaseCapability {
|
|
|
193
195
|
return this.url
|
|
194
196
|
}
|
|
195
197
|
|
|
198
|
+
#hasServer () {
|
|
199
|
+
return this.config.node?.hasServer !== false && this.#module.hasServer !== false
|
|
200
|
+
}
|
|
201
|
+
|
|
196
202
|
async stop () {
|
|
197
203
|
await super.stop()
|
|
198
204
|
|
|
199
205
|
if (this.childManager) {
|
|
200
206
|
return this.stopCommand()
|
|
201
|
-
|
|
202
|
-
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// for no-server apps, we support custom close method
|
|
210
|
+
if (this.#appClose && !this.#hasServer()) {
|
|
211
|
+
return this.#appClose()
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// This is needed if the capability was subclassed
|
|
215
|
+
if (!this.#server && !this.#app) {
|
|
203
216
|
return
|
|
204
217
|
}
|
|
205
218
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/node",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.1",
|
|
4
4
|
"description": "Platformatic Node.js Capability",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"json5": "^2.2.3",
|
|
19
19
|
"light-my-request": "^6.0.0",
|
|
20
|
-
"@platformatic/basic": "3.
|
|
21
|
-
"@platformatic/generators": "3.
|
|
22
|
-
"@platformatic/foundation": "3.
|
|
20
|
+
"@platformatic/basic": "3.7.1",
|
|
21
|
+
"@platformatic/generators": "3.7.1",
|
|
22
|
+
"@platformatic/foundation": "3.7.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"cleaner-spec-reporter": "^0.5.0",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"neostandard": "^0.12.0",
|
|
32
32
|
"tsx": "^4.19.0",
|
|
33
33
|
"typescript": "^5.5.4",
|
|
34
|
-
"@platformatic/gateway": "3.
|
|
35
|
-
"@platformatic/service": "3.
|
|
34
|
+
"@platformatic/gateway": "3.7.1",
|
|
35
|
+
"@platformatic/service": "3.7.1"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED