@platformatic/next 3.8.0 → 3.10.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 CHANGED
@@ -324,6 +324,7 @@ export interface PlatformaticNextJsConfig {
324
324
  };
325
325
  };
326
326
  plugins?: string[];
327
+ timeout?: number | string;
327
328
  };
328
329
  telemetry?: {
329
330
  enabled?: boolean | string;
@@ -412,6 +413,7 @@ export interface PlatformaticNextJsConfig {
412
413
  timeWindowSec?: number;
413
414
  cooldownSec?: number;
414
415
  scaleIntervalSec?: number;
416
+ gracePeriod?: number;
415
417
  };
416
418
  inspectorOptions?: {
417
419
  host?: string;
package/lib/capability.js CHANGED
@@ -28,6 +28,8 @@ export class NextCapability extends BaseCapability {
28
28
 
29
29
  constructor (root, config, context) {
30
30
  super('next', version, root, config, context)
31
+
32
+ this.exitOnUnhandledErrors = false
31
33
  }
32
34
 
33
35
  async init () {
@@ -281,7 +283,8 @@ export class NextCapability extends BaseCapability {
281
283
  port: port || 0
282
284
  }
283
285
 
284
- this.childManager.register()
286
+ await this.childManager.register()
287
+
285
288
  const serverPromise = createServerListener(
286
289
  (this.isEntrypoint ? serverOptions?.port : undefined) ?? true,
287
290
  (this.isEntrypoint ? serverOptions?.hostname : undefined) ?? true
@@ -29,7 +29,7 @@ function detectFormat (code) {
29
29
  return format
30
30
  }
31
31
 
32
- fsPromises.readFile = async function WTF (url, options) {
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
- // Keep in sync with https://github.com/vercel/next.js/blob/main/packages/next/src/shared/lib/constants.ts
154
- candidates = ['next.config.js', 'next.config.mjs'].map(c => new URL(c, realRoot).toString())
155
- basePath = data.basePath ?? ''
156
- config = data.config
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.8.0",
3
+ "version": "3.10.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.8.0",
27
- "@platformatic/foundation": "3.8.0"
26
+ "@platformatic/foundation": "3.10.0",
27
+ "@platformatic/basic": "3.10.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/service": "3.8.0",
44
- "@platformatic/gateway": "3.8.0"
43
+ "@platformatic/service": "3.10.0",
44
+ "@platformatic/gateway": "3.10.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.8.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/next/3.10.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Next.js Config",
5
5
  "type": "object",
@@ -585,6 +585,30 @@
585
585
  "nodeOptions": {
586
586
  "type": "string"
587
587
  },
588
+ "permissions": {
589
+ "type": "object",
590
+ "properties": {
591
+ "fs": {
592
+ "type": "object",
593
+ "properties": {
594
+ "read": {
595
+ "type": "array",
596
+ "items": {
597
+ "type": "string"
598
+ }
599
+ },
600
+ "write": {
601
+ "type": "array",
602
+ "items": {
603
+ "type": "string"
604
+ }
605
+ }
606
+ },
607
+ "additionalProperties": false
608
+ }
609
+ },
610
+ "additionalProperties": false
611
+ },
588
612
  "telemetry": {
589
613
  "type": "object",
590
614
  "properties": {
@@ -1395,6 +1419,17 @@
1395
1419
  }
1396
1420
  ]
1397
1421
  }
1422
+ },
1423
+ "timeout": {
1424
+ "anyOf": [
1425
+ {
1426
+ "type": "integer"
1427
+ },
1428
+ {
1429
+ "type": "string"
1430
+ }
1431
+ ],
1432
+ "default": 10000
1398
1433
  }
1399
1434
  },
1400
1435
  "additionalProperties": false
@@ -1576,6 +1611,10 @@
1576
1611
  "scaleIntervalSec": {
1577
1612
  "type": "number",
1578
1613
  "minimum": 0
1614
+ },
1615
+ "gracePeriod": {
1616
+ "type": "number",
1617
+ "minimum": 0
1579
1618
  }
1580
1619
  },
1581
1620
  "additionalProperties": false