@platformatic/node 3.25.0 → 3.26.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/config.d.ts +57 -0
- package/lib/capability.js +19 -3
- package/lib/schema.js +4 -0
- package/package.json +6 -6
- package/schema.json +263 -1
package/config.d.ts
CHANGED
|
@@ -525,6 +525,62 @@ export interface PlatformaticNodeJsConfig {
|
|
|
525
525
|
[k: string]: string | [string, ...string[]];
|
|
526
526
|
};
|
|
527
527
|
};
|
|
528
|
+
application?: {
|
|
529
|
+
reuseTcpPorts?: boolean;
|
|
530
|
+
workers?:
|
|
531
|
+
| number
|
|
532
|
+
| string
|
|
533
|
+
| {
|
|
534
|
+
static?: number;
|
|
535
|
+
minimum?: number;
|
|
536
|
+
maximum?: number;
|
|
537
|
+
[k: string]: unknown;
|
|
538
|
+
};
|
|
539
|
+
health?: {
|
|
540
|
+
enabled?: boolean | string;
|
|
541
|
+
interval?: number | string;
|
|
542
|
+
gracePeriod?: number | string;
|
|
543
|
+
maxUnhealthyChecks?: number | string;
|
|
544
|
+
maxELU?: number | string;
|
|
545
|
+
maxHeapUsed?: number | string;
|
|
546
|
+
maxHeapTotal?: number | string;
|
|
547
|
+
maxYoungGeneration?: number | string;
|
|
548
|
+
codeRangeSize?: number | string;
|
|
549
|
+
};
|
|
550
|
+
arguments?: string[];
|
|
551
|
+
env?: {
|
|
552
|
+
[k: string]: string;
|
|
553
|
+
};
|
|
554
|
+
envfile?: string;
|
|
555
|
+
sourceMaps?: boolean;
|
|
556
|
+
packageManager?: "npm" | "pnpm" | "yarn";
|
|
557
|
+
preload?: string | string[];
|
|
558
|
+
nodeOptions?: string;
|
|
559
|
+
execArgv?: string[];
|
|
560
|
+
permissions?: {
|
|
561
|
+
fs?: {
|
|
562
|
+
read?: string[];
|
|
563
|
+
write?: string[];
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
telemetry?: {
|
|
567
|
+
/**
|
|
568
|
+
* An array of instrumentations loaded if telemetry is enabled
|
|
569
|
+
*/
|
|
570
|
+
instrumentations?: (
|
|
571
|
+
| string
|
|
572
|
+
| {
|
|
573
|
+
package: string;
|
|
574
|
+
exportName?: string;
|
|
575
|
+
options?: {
|
|
576
|
+
[k: string]: unknown;
|
|
577
|
+
};
|
|
578
|
+
[k: string]: unknown;
|
|
579
|
+
}
|
|
580
|
+
)[];
|
|
581
|
+
[k: string]: unknown;
|
|
582
|
+
};
|
|
583
|
+
};
|
|
528
584
|
};
|
|
529
585
|
node?: {
|
|
530
586
|
main?: string;
|
|
@@ -534,6 +590,7 @@ export interface PlatformaticNodeJsConfig {
|
|
|
534
590
|
absoluteUrl?: boolean;
|
|
535
591
|
dispatchViaHttp?: boolean;
|
|
536
592
|
disablePlatformaticInBuild?: boolean;
|
|
593
|
+
disableBuildInDevelopment?: boolean;
|
|
537
594
|
hasServer?: boolean;
|
|
538
595
|
};
|
|
539
596
|
}
|
package/lib/capability.js
CHANGED
|
@@ -13,7 +13,8 @@ import { once } from 'node:events'
|
|
|
13
13
|
import { existsSync } from 'node:fs'
|
|
14
14
|
import { readFile } from 'node:fs/promises'
|
|
15
15
|
import { Server } from 'node:http'
|
|
16
|
-
import {
|
|
16
|
+
import { createRequire } from 'node:module'
|
|
17
|
+
import { dirname, resolve as resolvePath } from 'node:path'
|
|
17
18
|
import { version } from './schema.js'
|
|
18
19
|
import { getTsconfig, ignoreDirs, isApplicationBuildable } from './utils.js'
|
|
19
20
|
|
|
@@ -121,7 +122,11 @@ export class NodeCapability extends BaseCapability {
|
|
|
121
122
|
|
|
122
123
|
const config = this.config
|
|
123
124
|
|
|
124
|
-
if (
|
|
125
|
+
if (
|
|
126
|
+
!this.isProduction &&
|
|
127
|
+
config.node?.disableBuildInDevelopment !== true &&
|
|
128
|
+
(await isApplicationBuildable(this.root, config))
|
|
129
|
+
) {
|
|
125
130
|
this.logger.info(`Building application "${this.applicationId}" before starting in development mode ...`)
|
|
126
131
|
try {
|
|
127
132
|
await this.build()
|
|
@@ -160,7 +165,18 @@ export class NodeCapability extends BaseCapability {
|
|
|
160
165
|
typeof serverOptions?.backlog === 'number' ? { backlog: serverOptions.backlog } : {}
|
|
161
166
|
)
|
|
162
167
|
|
|
163
|
-
|
|
168
|
+
try {
|
|
169
|
+
const require = createRequire(dirname(finalEntrypoint))
|
|
170
|
+
this.#module = require(finalEntrypoint)
|
|
171
|
+
} catch (e) {
|
|
172
|
+
// If there is top-leve await or unsupported TS syntax, we try to import the file instead
|
|
173
|
+
if (e.code !== 'ERR_REQUIRE_ASYNC_MODULE' && e.code !== 'ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX') {
|
|
174
|
+
throw e
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
this.#module = await importFile(finalEntrypoint)
|
|
178
|
+
}
|
|
179
|
+
|
|
164
180
|
this.#module = this.#module.default || this.#module
|
|
165
181
|
|
|
166
182
|
// Deal with application
|
package/lib/schema.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/node",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0",
|
|
4
4
|
"description": "Platformatic Node.js Capability",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"@watchable/unpromise": "^1.0.2",
|
|
19
19
|
"json5": "^2.2.3",
|
|
20
20
|
"light-my-request": "^6.0.0",
|
|
21
|
-
"@platformatic/basic": "3.
|
|
22
|
-
"@platformatic/
|
|
23
|
-
"@platformatic/
|
|
21
|
+
"@platformatic/basic": "3.26.0",
|
|
22
|
+
"@platformatic/generators": "3.26.0",
|
|
23
|
+
"@platformatic/foundation": "3.26.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"cleaner-spec-reporter": "^0.5.0",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"neostandard": "^0.12.0",
|
|
33
33
|
"tsx": "^4.19.0",
|
|
34
34
|
"typescript": "^5.5.4",
|
|
35
|
-
"@platformatic/gateway": "3.
|
|
36
|
-
"@platformatic/service": "3.
|
|
35
|
+
"@platformatic/gateway": "3.26.0",
|
|
36
|
+
"@platformatic/service": "3.26.0"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/node/3.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/node/3.26.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Node.js Config",
|
|
5
5
|
"type": "object",
|
|
@@ -619,6 +619,12 @@
|
|
|
619
619
|
"nodeOptions": {
|
|
620
620
|
"type": "string"
|
|
621
621
|
},
|
|
622
|
+
"execArgv": {
|
|
623
|
+
"type": "array",
|
|
624
|
+
"items": {
|
|
625
|
+
"type": "string"
|
|
626
|
+
}
|
|
627
|
+
},
|
|
622
628
|
"permissions": {
|
|
623
629
|
"type": "object",
|
|
624
630
|
"properties": {
|
|
@@ -1926,6 +1932,258 @@
|
|
|
1926
1932
|
"deny"
|
|
1927
1933
|
],
|
|
1928
1934
|
"additionalProperties": false
|
|
1935
|
+
},
|
|
1936
|
+
"application": {
|
|
1937
|
+
"type": "object",
|
|
1938
|
+
"properties": {
|
|
1939
|
+
"reuseTcpPorts": {
|
|
1940
|
+
"type": "boolean",
|
|
1941
|
+
"default": true
|
|
1942
|
+
},
|
|
1943
|
+
"workers": {
|
|
1944
|
+
"anyOf": [
|
|
1945
|
+
{
|
|
1946
|
+
"type": "number"
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
"type": "string"
|
|
1950
|
+
},
|
|
1951
|
+
{
|
|
1952
|
+
"type": "object",
|
|
1953
|
+
"properties": {
|
|
1954
|
+
"static": {
|
|
1955
|
+
"type": "number",
|
|
1956
|
+
"minimum": 1
|
|
1957
|
+
},
|
|
1958
|
+
"minimum": {
|
|
1959
|
+
"type": "number",
|
|
1960
|
+
"minimum": 1
|
|
1961
|
+
},
|
|
1962
|
+
"maximum": {
|
|
1963
|
+
"type": "number",
|
|
1964
|
+
"minimum": 0
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
]
|
|
1969
|
+
},
|
|
1970
|
+
"health": {
|
|
1971
|
+
"type": "object",
|
|
1972
|
+
"default": {},
|
|
1973
|
+
"properties": {
|
|
1974
|
+
"enabled": {
|
|
1975
|
+
"anyOf": [
|
|
1976
|
+
{
|
|
1977
|
+
"type": "boolean"
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
"type": "string"
|
|
1981
|
+
}
|
|
1982
|
+
]
|
|
1983
|
+
},
|
|
1984
|
+
"interval": {
|
|
1985
|
+
"anyOf": [
|
|
1986
|
+
{
|
|
1987
|
+
"type": "number",
|
|
1988
|
+
"minimum": 0
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
"type": "string"
|
|
1992
|
+
}
|
|
1993
|
+
]
|
|
1994
|
+
},
|
|
1995
|
+
"gracePeriod": {
|
|
1996
|
+
"anyOf": [
|
|
1997
|
+
{
|
|
1998
|
+
"type": "number",
|
|
1999
|
+
"minimum": 0
|
|
2000
|
+
},
|
|
2001
|
+
{
|
|
2002
|
+
"type": "string"
|
|
2003
|
+
}
|
|
2004
|
+
]
|
|
2005
|
+
},
|
|
2006
|
+
"maxUnhealthyChecks": {
|
|
2007
|
+
"anyOf": [
|
|
2008
|
+
{
|
|
2009
|
+
"type": "number",
|
|
2010
|
+
"minimum": 1
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
"type": "string"
|
|
2014
|
+
}
|
|
2015
|
+
]
|
|
2016
|
+
},
|
|
2017
|
+
"maxELU": {
|
|
2018
|
+
"anyOf": [
|
|
2019
|
+
{
|
|
2020
|
+
"type": "number",
|
|
2021
|
+
"minimum": 0,
|
|
2022
|
+
"maximum": 1
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
"type": "string"
|
|
2026
|
+
}
|
|
2027
|
+
]
|
|
2028
|
+
},
|
|
2029
|
+
"maxHeapUsed": {
|
|
2030
|
+
"anyOf": [
|
|
2031
|
+
{
|
|
2032
|
+
"type": "number",
|
|
2033
|
+
"minimum": 0,
|
|
2034
|
+
"maximum": 1
|
|
2035
|
+
},
|
|
2036
|
+
{
|
|
2037
|
+
"type": "string"
|
|
2038
|
+
}
|
|
2039
|
+
]
|
|
2040
|
+
},
|
|
2041
|
+
"maxHeapTotal": {
|
|
2042
|
+
"anyOf": [
|
|
2043
|
+
{
|
|
2044
|
+
"type": "number",
|
|
2045
|
+
"minimum": 0
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
"type": "string"
|
|
2049
|
+
}
|
|
2050
|
+
]
|
|
2051
|
+
},
|
|
2052
|
+
"maxYoungGeneration": {
|
|
2053
|
+
"anyOf": [
|
|
2054
|
+
{
|
|
2055
|
+
"type": "number",
|
|
2056
|
+
"minimum": 0
|
|
2057
|
+
},
|
|
2058
|
+
{
|
|
2059
|
+
"type": "string"
|
|
2060
|
+
}
|
|
2061
|
+
]
|
|
2062
|
+
},
|
|
2063
|
+
"codeRangeSize": {
|
|
2064
|
+
"anyOf": [
|
|
2065
|
+
{
|
|
2066
|
+
"type": "number",
|
|
2067
|
+
"minimum": 0
|
|
2068
|
+
},
|
|
2069
|
+
{
|
|
2070
|
+
"type": "string"
|
|
2071
|
+
}
|
|
2072
|
+
]
|
|
2073
|
+
}
|
|
2074
|
+
},
|
|
2075
|
+
"additionalProperties": false
|
|
2076
|
+
},
|
|
2077
|
+
"arguments": {
|
|
2078
|
+
"type": "array",
|
|
2079
|
+
"items": {
|
|
2080
|
+
"type": "string"
|
|
2081
|
+
}
|
|
2082
|
+
},
|
|
2083
|
+
"env": {
|
|
2084
|
+
"type": "object",
|
|
2085
|
+
"additionalProperties": {
|
|
2086
|
+
"type": "string"
|
|
2087
|
+
}
|
|
2088
|
+
},
|
|
2089
|
+
"envfile": {
|
|
2090
|
+
"type": "string"
|
|
2091
|
+
},
|
|
2092
|
+
"sourceMaps": {
|
|
2093
|
+
"type": "boolean"
|
|
2094
|
+
},
|
|
2095
|
+
"packageManager": {
|
|
2096
|
+
"type": "string",
|
|
2097
|
+
"enum": [
|
|
2098
|
+
"npm",
|
|
2099
|
+
"pnpm",
|
|
2100
|
+
"yarn"
|
|
2101
|
+
]
|
|
2102
|
+
},
|
|
2103
|
+
"preload": {
|
|
2104
|
+
"anyOf": [
|
|
2105
|
+
{
|
|
2106
|
+
"type": "string",
|
|
2107
|
+
"resolvePath": true
|
|
2108
|
+
},
|
|
2109
|
+
{
|
|
2110
|
+
"type": "array",
|
|
2111
|
+
"items": {
|
|
2112
|
+
"type": "string",
|
|
2113
|
+
"resolvePath": true
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
]
|
|
2117
|
+
},
|
|
2118
|
+
"nodeOptions": {
|
|
2119
|
+
"type": "string"
|
|
2120
|
+
},
|
|
2121
|
+
"execArgv": {
|
|
2122
|
+
"type": "array",
|
|
2123
|
+
"items": {
|
|
2124
|
+
"type": "string"
|
|
2125
|
+
}
|
|
2126
|
+
},
|
|
2127
|
+
"permissions": {
|
|
2128
|
+
"type": "object",
|
|
2129
|
+
"properties": {
|
|
2130
|
+
"fs": {
|
|
2131
|
+
"type": "object",
|
|
2132
|
+
"properties": {
|
|
2133
|
+
"read": {
|
|
2134
|
+
"type": "array",
|
|
2135
|
+
"items": {
|
|
2136
|
+
"type": "string"
|
|
2137
|
+
}
|
|
2138
|
+
},
|
|
2139
|
+
"write": {
|
|
2140
|
+
"type": "array",
|
|
2141
|
+
"items": {
|
|
2142
|
+
"type": "string"
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
},
|
|
2146
|
+
"additionalProperties": false
|
|
2147
|
+
}
|
|
2148
|
+
},
|
|
2149
|
+
"additionalProperties": false
|
|
2150
|
+
},
|
|
2151
|
+
"telemetry": {
|
|
2152
|
+
"type": "object",
|
|
2153
|
+
"properties": {
|
|
2154
|
+
"instrumentations": {
|
|
2155
|
+
"type": "array",
|
|
2156
|
+
"description": "An array of instrumentations loaded if telemetry is enabled",
|
|
2157
|
+
"items": {
|
|
2158
|
+
"oneOf": [
|
|
2159
|
+
{
|
|
2160
|
+
"type": "string"
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
"type": "object",
|
|
2164
|
+
"properties": {
|
|
2165
|
+
"package": {
|
|
2166
|
+
"type": "string"
|
|
2167
|
+
},
|
|
2168
|
+
"exportName": {
|
|
2169
|
+
"type": "string"
|
|
2170
|
+
},
|
|
2171
|
+
"options": {
|
|
2172
|
+
"type": "object",
|
|
2173
|
+
"additionalProperties": true
|
|
2174
|
+
}
|
|
2175
|
+
},
|
|
2176
|
+
"required": [
|
|
2177
|
+
"package"
|
|
2178
|
+
]
|
|
2179
|
+
}
|
|
2180
|
+
]
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
},
|
|
2186
|
+
"additionalProperties": false
|
|
1929
2187
|
}
|
|
1930
2188
|
},
|
|
1931
2189
|
"additionalProperties": false
|
|
@@ -1949,6 +2207,10 @@
|
|
|
1949
2207
|
"type": "boolean",
|
|
1950
2208
|
"default": false
|
|
1951
2209
|
},
|
|
2210
|
+
"disableBuildInDevelopment": {
|
|
2211
|
+
"type": "boolean",
|
|
2212
|
+
"default": false
|
|
2213
|
+
},
|
|
1952
2214
|
"hasServer": {
|
|
1953
2215
|
"type": "boolean",
|
|
1954
2216
|
"default": true
|