@platformatic/next 3.7.1 → 3.9.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 +12 -0
- package/lib/capability.js +2 -0
- package/lib/loader-next-15.cjs +3 -2
- package/lib/loader.js +12 -4
- package/package.json +5 -5
- package/schema.json +51 -3
package/config.d.ts
CHANGED
|
@@ -401,6 +401,18 @@ export interface PlatformaticNextJsConfig {
|
|
|
401
401
|
[k: string]: unknown;
|
|
402
402
|
};
|
|
403
403
|
};
|
|
404
|
+
verticalScaler?: {
|
|
405
|
+
enabled?: boolean;
|
|
406
|
+
maxTotalWorkers?: number;
|
|
407
|
+
minWorkers?: number;
|
|
408
|
+
maxWorkers?: number;
|
|
409
|
+
scaleUpELU?: number;
|
|
410
|
+
scaleDownELU?: number;
|
|
411
|
+
minELUDiff?: number;
|
|
412
|
+
timeWindowSec?: number;
|
|
413
|
+
cooldownSec?: number;
|
|
414
|
+
scaleIntervalSec?: number;
|
|
415
|
+
};
|
|
404
416
|
inspectorOptions?: {
|
|
405
417
|
host?: string;
|
|
406
418
|
port?: number;
|
package/lib/capability.js
CHANGED
package/lib/loader-next-15.cjs
CHANGED
|
@@ -29,7 +29,7 @@ function detectFormat (code) {
|
|
|
29
29
|
return format
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
fsPromises.readFile = async function
|
|
32
|
+
fsPromises.readFile = async function readAndPatchNextConfigTS (url, options) {
|
|
33
33
|
if (url.startsWith('file://')) {
|
|
34
34
|
url = fileURLToPath(url)
|
|
35
35
|
}
|
|
@@ -42,7 +42,8 @@ fsPromises.readFile = async function WTF (url, options) {
|
|
|
42
42
|
|
|
43
43
|
const { code } = transformSync(contents.toString('utf-8'), { mode: 'strip-only' })
|
|
44
44
|
|
|
45
|
-
const { transformESM, transformCJS } = await import('./loader.js')
|
|
45
|
+
const { transformESM, transformCJS, setLoaderData } = await import('./loader.js')
|
|
46
|
+
setLoaderData({ basePath: globalThis.platformatic.basePath, config: globalThis.platformatic.config })
|
|
46
47
|
const transformer = detectFormat(code) === 'esm' ? transformESM : transformCJS
|
|
47
48
|
const transformed = transformer(code)
|
|
48
49
|
|
package/lib/loader.js
CHANGED
|
@@ -143,6 +143,12 @@ export function transformESM (source) {
|
|
|
143
143
|
return generate.default(ast).code
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
export function setLoaderData (data) {
|
|
147
|
+
candidates = data.candidates
|
|
148
|
+
basePath = data.basePath ?? ''
|
|
149
|
+
config = data.config
|
|
150
|
+
}
|
|
151
|
+
|
|
146
152
|
export async function initialize (data) {
|
|
147
153
|
const realRoot = pathToFileURL(await realpath(fileURLToPath(data.root)))
|
|
148
154
|
|
|
@@ -150,10 +156,12 @@ export async function initialize (data) {
|
|
|
150
156
|
realRoot.pathname += '/'
|
|
151
157
|
}
|
|
152
158
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
setLoaderData({
|
|
160
|
+
// Keep in sync with https://github.com/vercel/next.js/blob/main/packages/next/src/shared/lib/constants.ts
|
|
161
|
+
candidates: ['next.config.js', 'next.config.mjs'].map(c => new URL(c, realRoot).toString()),
|
|
162
|
+
basePath: data.basePath ?? '',
|
|
163
|
+
config: data.config
|
|
164
|
+
})
|
|
157
165
|
}
|
|
158
166
|
|
|
159
167
|
export async function load (url, context, nextLoad) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/next",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Platformatic Next.js Capability",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"iovalkey": "^0.3.0",
|
|
24
24
|
"msgpackr": "^1.11.2",
|
|
25
25
|
"semver": "^7.6.3",
|
|
26
|
-
"@platformatic/basic": "3.
|
|
27
|
-
"@platformatic/foundation": "3.
|
|
26
|
+
"@platformatic/basic": "3.9.0",
|
|
27
|
+
"@platformatic/foundation": "3.9.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@fastify/reply-from": "^12.0.0",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"next": "^15.0.0",
|
|
41
41
|
"typescript": "^5.5.4",
|
|
42
42
|
"ws": "^8.18.0",
|
|
43
|
-
"@platformatic/gateway": "3.
|
|
44
|
-
"@platformatic/service": "3.
|
|
43
|
+
"@platformatic/gateway": "3.9.0",
|
|
44
|
+
"@platformatic/service": "3.9.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/next/3.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/next/3.9.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Next.js Config",
|
|
5
5
|
"type": "object",
|
|
@@ -631,8 +631,7 @@
|
|
|
631
631
|
{
|
|
632
632
|
"type": "string"
|
|
633
633
|
}
|
|
634
|
-
]
|
|
635
|
-
"default": 1
|
|
634
|
+
]
|
|
636
635
|
},
|
|
637
636
|
"workersRestartDelay": {
|
|
638
637
|
"anyOf": [
|
|
@@ -1532,6 +1531,55 @@
|
|
|
1532
1531
|
],
|
|
1533
1532
|
"additionalProperties": false
|
|
1534
1533
|
},
|
|
1534
|
+
"verticalScaler": {
|
|
1535
|
+
"type": "object",
|
|
1536
|
+
"properties": {
|
|
1537
|
+
"enabled": {
|
|
1538
|
+
"type": "boolean",
|
|
1539
|
+
"default": true
|
|
1540
|
+
},
|
|
1541
|
+
"maxTotalWorkers": {
|
|
1542
|
+
"type": "number",
|
|
1543
|
+
"minimum": 1
|
|
1544
|
+
},
|
|
1545
|
+
"minWorkers": {
|
|
1546
|
+
"type": "number",
|
|
1547
|
+
"minimum": 1
|
|
1548
|
+
},
|
|
1549
|
+
"maxWorkers": {
|
|
1550
|
+
"type": "number",
|
|
1551
|
+
"minimum": 1
|
|
1552
|
+
},
|
|
1553
|
+
"scaleUpELU": {
|
|
1554
|
+
"type": "number",
|
|
1555
|
+
"minimum": 0,
|
|
1556
|
+
"maximum": 1
|
|
1557
|
+
},
|
|
1558
|
+
"scaleDownELU": {
|
|
1559
|
+
"type": "number",
|
|
1560
|
+
"minimum": 0,
|
|
1561
|
+
"maximum": 1
|
|
1562
|
+
},
|
|
1563
|
+
"minELUDiff": {
|
|
1564
|
+
"type": "number",
|
|
1565
|
+
"minimum": 0,
|
|
1566
|
+
"maximum": 1
|
|
1567
|
+
},
|
|
1568
|
+
"timeWindowSec": {
|
|
1569
|
+
"type": "number",
|
|
1570
|
+
"minimum": 0
|
|
1571
|
+
},
|
|
1572
|
+
"cooldownSec": {
|
|
1573
|
+
"type": "number",
|
|
1574
|
+
"minimum": 0
|
|
1575
|
+
},
|
|
1576
|
+
"scaleIntervalSec": {
|
|
1577
|
+
"type": "number",
|
|
1578
|
+
"minimum": 0
|
|
1579
|
+
}
|
|
1580
|
+
},
|
|
1581
|
+
"additionalProperties": false
|
|
1582
|
+
},
|
|
1535
1583
|
"inspectorOptions": {
|
|
1536
1584
|
"type": "object",
|
|
1537
1585
|
"properties": {
|