@platformatic/next 3.57.0 → 3.58.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
@@ -240,7 +240,7 @@ export interface PlatformaticNextJsConfig {
240
240
  reuseTcpPorts?: boolean;
241
241
  startTimeout?: number;
242
242
  restartOnError?: boolean | number;
243
- exitOnUnhandledErrors?: boolean;
243
+ exitOnUnhandledErrors?: boolean | number;
244
244
  gracefulShutdown?: {
245
245
  runtime: number | string;
246
246
  application: number | string;
@@ -262,6 +262,7 @@ export interface PlatformaticNextJsConfig {
262
262
  bufferPoolSize?: number | string;
263
263
  defaultHighWaterMark?: number | string;
264
264
  };
265
+ healthProbes?: boolean | string;
265
266
  undici?: {
266
267
  agentOptions?: {
267
268
  [k: string]: unknown;
@@ -215,14 +215,18 @@ export class CacheHandler {
215
215
  toDelete.add(key)
216
216
 
217
217
  // Batch full, execute it
218
- if (toDelete.length >= MAX_BATCH_SIZE) {
218
+ if (toDelete.size >= MAX_BATCH_SIZE) {
219
219
  await this.#store.del(...toDelete)
220
220
  toDelete.clear()
221
221
  }
222
222
  }
223
223
  }
224
224
 
225
- await this.#store.del(...toDelete)
225
+ // Spreading an empty Set would issue a DEL with no keys, which Valkey
226
+ // rejects. Only delete when there is something to delete.
227
+ if (toDelete.size) {
228
+ await this.#store.del(...toDelete)
229
+ }
226
230
  await this.#store.del(tagsKey)
227
231
  }
228
232
  } catch (e) {
@@ -254,7 +254,11 @@ export class CacheHandler {
254
254
  }
255
255
  }
256
256
 
257
- await this.#store.del(...toDelete)
257
+ // Spreading an empty Set would issue a DEL with no keys, which Valkey
258
+ // rejects. Only delete when there is something to delete.
259
+ if (toDelete.size) {
260
+ await this.#store.del(...toDelete)
261
+ }
258
262
  await this.#store.del(tagsKey)
259
263
  }
260
264
  } catch (e) {
package/lib/capability.js CHANGED
@@ -245,7 +245,7 @@ export class NextCapability extends BaseCapability {
245
245
  _: [this.root]
246
246
  }
247
247
 
248
- const httpsOptions = this.config.next?.https ?? {}
248
+ const httpsOptions = this.#getDevelopmentHTTPSOptions()
249
249
 
250
250
  if (httpsOptions.enabled) {
251
251
  devOptions['--experimental-https-key'] = true
@@ -265,8 +265,7 @@ export class NextCapability extends BaseCapability {
265
265
 
266
266
  await nextDev(devOptions)
267
267
  } else {
268
- const nextConfig = this.config.next ?? {}
269
- const httpsOptions = nextConfig.https ?? {}
268
+ const httpsOptions = this.#getDevelopmentHTTPSOptions()
270
269
 
271
270
  if (httpsOptions.enabled) {
272
271
  serverOptions.experimentalHttps = true
@@ -452,6 +451,41 @@ export class NextCapability extends BaseCapability {
452
451
  return scripts
453
452
  }
454
453
 
454
+ #getDevelopmentHTTPSOptions () {
455
+ const nextHTTPSOptions = this.config.next?.https
456
+ if (nextHTTPSOptions?.enabled) {
457
+ return nextHTTPSOptions
458
+ }
459
+
460
+ const serverHTTPSOptions = this.serverConfig?.https
461
+ if (!serverHTTPSOptions) {
462
+ return {}
463
+ }
464
+
465
+ return {
466
+ enabled: true,
467
+ key: this.#getHTTPSPath(serverHTTPSOptions.key),
468
+ cert: this.#getHTTPSPath(serverHTTPSOptions.cert),
469
+ ca: this.#getHTTPSPath(serverHTTPSOptions.ca)
470
+ }
471
+ }
472
+
473
+ #getHTTPSPath (value) {
474
+ if (!value) {
475
+ return undefined
476
+ }
477
+
478
+ if (typeof value === 'string') {
479
+ return value
480
+ }
481
+
482
+ if (Array.isArray(value)) {
483
+ return this.#getHTTPSPath(value[0])
484
+ }
485
+
486
+ return value.path
487
+ }
488
+
455
489
  // In development mode, Next.js starts the dev server using child_process.fork with stdio set to 'inherit'.
456
490
  // In order to capture the output, we need to ensure that the streams are pipeable and thus we perform a one-time
457
491
  // monkey-patch of the ChildProcess.prototype.spawn method to override stdio[1] and stdio[2] to 'pipe'.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/next",
3
- "version": "3.57.0",
3
+ "version": "3.58.0",
4
4
  "description": "Platformatic Next.js Capability",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,9 +25,9 @@
25
25
  "light-my-request": "^6.0.0",
26
26
  "msgpackr": "^1.11.2",
27
27
  "semver": "^7.6.3",
28
- "@platformatic/globals": "3.57.0",
29
- "@platformatic/foundation": "3.57.0",
30
- "@platformatic/basic": "3.57.0"
28
+ "@platformatic/basic": "3.58.0",
29
+ "@platformatic/globals": "3.58.0",
30
+ "@platformatic/foundation": "3.58.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@fastify/reply-from": "^12.0.0",
@@ -44,8 +44,8 @@
44
44
  "next": "^16.1.0",
45
45
  "typescript": "^5.5.4",
46
46
  "ws": "^8.18.0",
47
- "@platformatic/service": "3.57.0",
48
- "@platformatic/gateway": "3.57.0"
47
+ "@platformatic/service": "3.58.0",
48
+ "@platformatic/gateway": "3.58.0"
49
49
  },
50
50
  "engines": {
51
51
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/next/3.57.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/next/3.58.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Next.js Config",
5
5
  "type": "object",
@@ -1183,7 +1183,14 @@
1183
1183
  },
1184
1184
  "exitOnUnhandledErrors": {
1185
1185
  "default": true,
1186
- "type": "boolean"
1186
+ "anyOf": [
1187
+ {
1188
+ "type": "boolean"
1189
+ },
1190
+ {
1191
+ "type": "number"
1192
+ }
1193
+ ]
1187
1194
  },
1188
1195
  "gracefulShutdown": {
1189
1196
  "type": "object",
@@ -1365,6 +1372,17 @@
1365
1372
  },
1366
1373
  "additionalProperties": false
1367
1374
  },
1375
+ "healthProbes": {
1376
+ "anyOf": [
1377
+ {
1378
+ "type": "boolean"
1379
+ },
1380
+ {
1381
+ "type": "string"
1382
+ }
1383
+ ],
1384
+ "default": true
1385
+ },
1368
1386
  "undici": {
1369
1387
  "type": "object",
1370
1388
  "properties": {