@platformatic/next 3.24.0-alpha0 → 3.25.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
@@ -60,6 +60,10 @@ export interface PlatformaticNextJsConfig {
60
60
  server?: {
61
61
  hostname?: string;
62
62
  port?: number | string;
63
+ /**
64
+ * The maximum length of the queue of pending connections
65
+ */
66
+ backlog?: number;
63
67
  http2?: boolean;
64
68
  https?: {
65
69
  allowHTTP1?: boolean;
@@ -185,6 +189,10 @@ export interface PlatformaticNextJsConfig {
185
189
  server?: {
186
190
  hostname?: string;
187
191
  port?: number | string;
192
+ /**
193
+ * The maximum length of the queue of pending connections
194
+ */
195
+ backlog?: number;
188
196
  http2?: boolean;
189
197
  https?: {
190
198
  allowHTTP1?: boolean;
package/lib/capability.js CHANGED
@@ -16,6 +16,7 @@ import { dirname, resolve as resolvePath } from 'node:path'
16
16
  import { parse, satisfies } from 'semver'
17
17
  import { version } from './schema.js'
18
18
 
19
+ const kITC = Symbol.for('plt.runtime.itc')
19
20
  const supportedVersions = ['^14.0.0', '^15.0.0', '^16.0.0']
20
21
 
21
22
  export class NextCapability extends BaseCapability {
@@ -190,11 +191,7 @@ export class NextCapability extends BaseCapability {
190
191
 
191
192
  const context = await this.getChildManagerContext(this.#basePath)
192
193
 
193
- this.childManager = new ChildManager({
194
- loader: loaderUrl,
195
- context: { ...context, port: false },
196
- scripts: this.#getChildManagerScripts()
197
- })
194
+ this.childManager = this.#createChildManager(loaderUrl, { ...context, port: false }, this.#getChildManagerScripts())
198
195
 
199
196
  const promise = once(this.childManager, 'url')
200
197
  await this.#startDevelopmentNext(serverOptions)
@@ -250,11 +247,11 @@ export class NextCapability extends BaseCapability {
250
247
  return this.startWithCommand(command, loaderUrl, childManagerScripts)
251
248
  }
252
249
 
253
- this.childManager = new ChildManager({
254
- loader: loaderUrl,
255
- context: await this.getChildManagerContext(this.#basePath),
256
- scripts: this.#getChildManagerScripts()
257
- })
250
+ this.childManager = this.#createChildManager(
251
+ loaderUrl,
252
+ await this.getChildManagerContext(this.#basePath),
253
+ this.#getChildManagerScripts()
254
+ )
258
255
 
259
256
  this.verifyOutputDirectory(resolvePath(this.root, '.next'))
260
257
  await this.#startProductionNext()
@@ -266,7 +263,7 @@ export class NextCapability extends BaseCapability {
266
263
  await this.childManager.inject()
267
264
  const { nextStart } = await importFile(resolvePath(this.#next, './dist/cli/next-start.js'))
268
265
 
269
- const { hostname, port } = this.serverConfig ?? {}
266
+ const { hostname, port, backlog } = this.serverConfig ?? {}
270
267
  const serverOptions = {
271
268
  hostname: hostname || '127.0.0.1',
272
269
  port: port || 0
@@ -276,7 +273,8 @@ export class NextCapability extends BaseCapability {
276
273
 
277
274
  const serverPromise = createServerListener(
278
275
  (this.isEntrypoint ? serverOptions?.port : undefined) ?? true,
279
- (this.isEntrypoint ? serverOptions?.hostname : undefined) ?? true
276
+ (this.isEntrypoint ? serverOptions?.hostname : undefined) ?? true,
277
+ typeof backlog === 'number' ? { backlog } : {}
280
278
  )
281
279
 
282
280
  if (this.#nextVersion.major === 14 && this.#nextVersion.minor < 2) {
@@ -328,4 +326,19 @@ export class NextCapability extends BaseCapability {
328
326
  return originalSpawn.call(this, options)
329
327
  }
330
328
  }
329
+
330
+ #createChildManager (loader, context, scripts) {
331
+ const childManager = new ChildManager({
332
+ loader,
333
+ context,
334
+ scripts
335
+ })
336
+
337
+ childManager.on('event', event => {
338
+ globalThis[kITC].notify('event', event)
339
+ this.emit('application:worker:event:' + event.event, event.payload)
340
+ })
341
+
342
+ return childManager
343
+ }
331
344
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/next",
3
- "version": "3.24.0-alpha0",
3
+ "version": "3.25.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.24.0-alpha0",
27
- "@platformatic/foundation": "3.24.0-alpha0"
26
+ "@platformatic/basic": "3.25.0",
27
+ "@platformatic/foundation": "3.25.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@fastify/reply-from": "^12.0.0",
@@ -40,8 +40,8 @@
40
40
  "next": "^16.0.0",
41
41
  "typescript": "^5.5.4",
42
42
  "ws": "^8.18.0",
43
- "@platformatic/gateway": "3.24.0-alpha0",
44
- "@platformatic/service": "3.24.0-alpha0"
43
+ "@platformatic/gateway": "3.25.0",
44
+ "@platformatic/service": "3.25.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.24.0-alpha0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/next/3.25.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Next.js Config",
5
5
  "type": "object",
@@ -178,6 +178,10 @@
178
178
  }
179
179
  ]
180
180
  },
181
+ "backlog": {
182
+ "type": "integer",
183
+ "description": "The maximum length of the queue of pending connections"
184
+ },
181
185
  "http2": {
182
186
  "type": "boolean"
183
187
  },
@@ -907,6 +911,10 @@
907
911
  }
908
912
  ]
909
913
  },
914
+ "backlog": {
915
+ "type": "integer",
916
+ "description": "The maximum length of the queue of pending connections"
917
+ },
910
918
  "http2": {
911
919
  "type": "boolean"
912
920
  },