@thomas.f/prnext 0.1.11-alpha → 0.1.13-alpha
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/README.md +395 -29
- package/build/actions.mjs +4 -0
- package/build/app-config.mjs +2 -0
- package/build/app.mjs +20 -5
- package/build/bundle-runtime.mjs +82 -0
- package/build/cache-handlers.mjs +4 -1
- package/build/compiler.mjs +4 -1
- package/build/config.mjs +20 -2
- package/build/font-cache.mjs +50 -0
- package/build/font-files.mjs +5 -3
- package/build/fonts.mjs +1 -1
- package/build/index.mjs +12 -1
- package/build/metadata-conflicts.mjs +13 -0
- package/build/metadata-images.mjs +3 -3
- package/build/metadata-routes.mjs +3 -3
- package/build/native-packages.mjs +5 -1
- package/build/npm-packages.mjs +14 -2
- package/build/optimize-imports.mjs +112 -0
- package/build/proxy-body-config.mjs +10 -0
- package/build/runtime-contract.mjs +16 -0
- package/build/scan.mjs +9 -7
- package/build/typescript-check.mjs +20 -0
- package/build/typescript.mjs +49 -0
- package/build/worker-retirement.mjs +14 -0
- package/cli.mjs +17 -0
- package/compat/after.cjs +51 -0
- package/compat/index.d.ts +13 -1
- package/compat/server.cjs +2 -1
- package/compat/server.d.cts +2 -0
- package/native/launch.mjs +19 -0
- package/package.json +25 -9
- package/release/verify.mjs +9 -0
- package/runtime/api.mjs +15 -5
- package/runtime/app-render.mjs +164 -53
- package/runtime/app-route-plan.mjs +45 -0
- package/runtime/app-routing-state.mjs +101 -21
- package/runtime/app-routing.mjs +37 -18
- package/runtime/app-segments.mjs +25 -11
- package/runtime/app-static.mjs +1 -1
- package/runtime/app-stream-html.mjs +3 -53
- package/runtime/cache-request.mjs +10 -2
- package/runtime/cloud/archive.mjs +316 -0
- package/runtime/cloud/client.mjs +658 -0
- package/runtime/cloud/environment.mjs +60 -0
- package/runtime/cloud/state.mjs +141 -0
- package/runtime/cloud/upload.mjs +48 -0
- package/runtime/html-envelope.mjs +136 -0
- package/runtime/http.mjs +9 -6
- package/runtime/middleware.mjs +3 -3
- package/runtime/profiles.json +13 -8
- package/runtime/request-transport.mjs +1 -1
- package/runtime/request-work.mjs +2 -2
- package/runtime/route-static.mjs +1 -1
- package/runtime/rsc-lifecycle.mjs +119 -0
- package/runtime/rsc-work-watchdog.mjs +75 -0
- package/runtime/rsc-worker.mjs +36 -9
- package/runtime/stream-utils.mjs +22 -3
- package/runtime/transport.mjs +89 -53
- package/runtime/worker-metadata.mjs +23 -0
- package/runtime/worker.mjs +119 -27
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# PRNext
|
|
4
4
|
|
|
5
|
-
[Website](https://prnext.dev) · [npm](https://www.npmjs.com/package/@thomas.f/prnext) · [GitHub](https://github.com/Lorkydey/PRNext) · [Report an issue](https://github.com/Lorkydey/PRNext/issues)
|
|
5
|
+
[Website](https://prnext.dev) · [npm](https://www.npmjs.com/package/@thomas.f/prnext) · [GitHub](https://github.com/Lorkydey/PRNext) · [X / @PRNextdev](https://x.com/PRNextdev) · [Report an issue](https://github.com/Lorkydey/PRNext/issues)
|
|
6
6
|
|
|
7
7
|
A Rust-powered runtime for Next.js projects, with React and npm modules running on Node.js.
|
|
8
8
|
|
|
@@ -10,6 +10,18 @@ A Rust-powered runtime for Next.js projects, with React and npm modules running
|
|
|
10
10
|
|
|
11
11
|
## Latest update
|
|
12
12
|
|
|
13
|
+
**0.1.13-alpha — worker lifecycle, streaming and routing.** Lower Linux production-launcher overhead, parent-death containment for Linux workers, and earlier release of completed RSC response resources while background cache work remains supervised. Streaming API and middleware responses reuse their inactivity timer, preserving timeout and cancellation behavior. Ready response producers yield after bounded batches, including empty chunks, so network events and cancellation timers can run. Profile admission, V8 and idle policies remain distinct; see the runtime profile notes below.
|
|
14
|
+
|
|
15
|
+
The source candidate reuses immutable production App Router routing plans, decodes the destination pathname once per request and reduces temporary segment arrays. Component exports and configuration remain live; dynamic output and request parameters are not cached. Rebuild to enable these plans; older/mutable routing trees and development retain the compatible live traversal. These changes do not establish a general HTTP performance advantage over Next.js.
|
|
16
|
+
|
|
17
|
+
Client cancellations retain healthy Node hosts; worker retirement protects tracked finalization; filesystem and proxy overload return explicit, noncacheable 503 responses. Clean installs and runtime/native/build consistency checks remain part of the release path. Rebuild dynamic applications with `prnext build` after upgrading, then restart them.
|
|
18
|
+
|
|
19
|
+
Shutdown now drains tracked worker and ISR work before closing private cache services. Standalone service shutdown shares a 30-second deadline between HTTP responses and background work. Ordinary Host sleep and capacity eviction allow up to 300 seconds of tracked work, covering the supported `maxDuration` range, followed by process cleanup. Global Host shutdown remains bounded to 35 seconds; memory-budget violations retain their shorter enforced stop. Monitoring continues while applications drain. This protects supported `after()` callbacks, not arbitrary timers or durable jobs.
|
|
20
|
+
|
|
21
|
+
The October 15 comparison of a frozen local candidate with Next.js 16.4.1 measured `balanced` SSR at 365 vs 281 req/s on Windows and 218 vs 158 on Linux, with cumulative server RSS of 182 vs 362 MiB and 149 vs 247 MiB respectively. Production, one server CPU, 64 connections, five 30-second runs after 10-second warmups, the same 100-row application, no dynamic page cache. These measurements precede the final shutdown fix and are not final-package performance certification. TanStack Start was faster on the App Router-equivalent SSR, streaming and JSON workloads; PRNext does not claim a universal performance lead. See the [release methodology and limits](https://github.com/Lorkydey/PRNext/blob/main/RELEASE.md#performance-evidence).
|
|
22
|
+
|
|
23
|
+
The experimental eight-app `balanced`/1 GiB Windows commit configuration with `NODE_OPTIONS=--max-semi-space-size=1` still has a reproduced allocation-failure regression relative to V5. It is not a supported density target and is not fixed. Defaults remain `start=balanced` and `host=memory`. Compatibility remains partial, including the compiler and TypeScript limits below.
|
|
24
|
+
|
|
13
25
|
<details>
|
|
14
26
|
<summary><strong>0.1.1-alpha · October 8, 2026 · Features & fixes</strong></summary>
|
|
15
27
|
|
|
@@ -55,12 +67,54 @@ Review the dry run before applying migration. Migration backs up your package fi
|
|
|
55
67
|
|
|
56
68
|
Install only `@thomas.f/prnext`. Keep optional dependencies enabled: npm installs the matching native component automatically. Rust is not required to use a published release.
|
|
57
69
|
|
|
70
|
+
`reactCompiler: false` and `typedRoutes: false` are supported. Enabling either option fails with an explicit diagnostic: PRNext does not yet run React Compiler or generate and validate typed route declarations. Keep builds that require these features on Next.js.
|
|
71
|
+
|
|
72
|
+
The current source candidate also supports `devIndicators: false`, configured
|
|
73
|
+
`experimental.optimizePackageImports` for pure ESM barrels with `sideEffects: false`,
|
|
74
|
+
and App Router `maxDuration` values from 1 to 300 seconds. Import optimization
|
|
75
|
+
preserves client/server boundaries and falls back to normal bundling when a barrel
|
|
76
|
+
cannot be safely expanded. Duplicate App convention files follow `pageExtensions`
|
|
77
|
+
priority and emit a warning. Identical public/App metadata files are accepted;
|
|
78
|
+
conflicting content still fails explicitly. Route Handlers can call shared
|
|
79
|
+
`use server` functions directly; pages retain their Flight/Server Action
|
|
80
|
+
registrations. Mixed npm component exports preserve the real React server
|
|
81
|
+
instance without requiring unused client hooks to exist in that environment.
|
|
82
|
+
|
|
83
|
+
Node Route Handlers and Server Actions can use `after()` from `next/server`. Callbacks run after the
|
|
84
|
+
response finishes or disconnects, including error responses, and retain their
|
|
85
|
+
request context. Tracked work prevents idle worker retirement without blocking the
|
|
86
|
+
next HTTP request. There are at most 128 tasks per request, within `maxDuration`
|
|
87
|
+
(25 seconds by default, including the response's running time). Cookie reads are supported;
|
|
88
|
+
post-response cookie writes are rejected. Server Actions wait for the HTTP response
|
|
89
|
+
to finish, not just their intermediate Flight render. Server Component and Edge
|
|
90
|
+
`after()` lifecycles are not implemented and fail explicitly. `revalidateTag`,
|
|
91
|
+
`revalidatePath` and `updateTag` are also rejected inside an `after()` callback;
|
|
92
|
+
perform supported invalidation in the Route Handler or Server Action before
|
|
93
|
+
returning. This differs from the full Next.js lifecycle. During service shutdown,
|
|
94
|
+
the 30-second standalone drain (35 seconds for global Host shutdown) can shorten a route's larger `maxDuration`. Ordinary sleep/eviction instead allows a 300-second drain. Forced
|
|
95
|
+
termination, a memory-budget violation or a machine failure can still interrupt
|
|
96
|
+
work; use durable external job storage for tasks that must survive these events.
|
|
97
|
+
|
|
98
|
+
`experimental.proxyClientMaxBodySize` accepts a byte count or a size such as
|
|
99
|
+
`'25mb'`, up to 32 MiB (default 10 MiB). Like Next's body clone, overflow retains
|
|
100
|
+
only complete chunks before the limit and warns; a chunk crossing the limit is
|
|
101
|
+
discarded. General request ingress remains capped at 32 MiB and Server Actions at
|
|
102
|
+
8 MiB. PostgreSQL's `pg` stays external by default so its optional native driver
|
|
103
|
+
remains lazy; explicitly putting `pg` in `transpilePackages` opts out.
|
|
104
|
+
|
|
105
|
+
Google font build inputs are cached under `.prnext-cache/fonts-v1` (64 MiB,
|
|
106
|
+
256 entries, verified content hashes). A warm cache permits offline rebuilding;
|
|
107
|
+
a cold build still needs access to Google's font endpoints. Remove this cache to
|
|
108
|
+
refresh downloaded font inputs. This does not cache dynamic page responses.
|
|
109
|
+
|
|
110
|
+
Set `typescript: {}` to check an existing `tsconfig.json` during production builds using the application's installed `typescript` package. `typescript.tsconfigPath` selects a custom configuration for type checking and compilation, including its inherited path aliases. `typescript.ignoreBuildErrors: true` explicitly skips the production check; development builds also skip it. Checks run in a temporary child process without emitting files or editing the configuration. Unlike Next.js, omitting `typescript` preserves PRNext's existing transpile-only behavior. PRNext does not install TypeScript, create `next-env.d.ts`, generate Next.js route types, or implement the Next.js TypeScript language-service plugin; retain the project's type declarations and run separate editor checks as needed. See the [Next.js option definitions](https://nextjs.org/docs/app/api-reference/config/next-config-js/typescript).
|
|
111
|
+
|
|
58
112
|
</details>
|
|
59
113
|
|
|
60
114
|
<details>
|
|
61
115
|
<summary><strong>Upgrade · update an existing PRNext project</strong></summary>
|
|
62
116
|
|
|
63
|
-
Stop your development or production process before changing dependencies. If you use `pstart`, follow the [persistent app upgrade guide](
|
|
117
|
+
Stop your development or production process before changing dependencies. If you use `pstart`, follow the [persistent app upgrade guide](#upgrade-persistent-apps) first.
|
|
64
118
|
|
|
65
119
|
```sh
|
|
66
120
|
npm install @thomas.f/prnext@alpha react@19.3.0 react-dom@19.3.0 react-server-dom-webpack@19.3.0
|
|
@@ -113,71 +167,383 @@ Balanced is the default. Set a profile when starting the production server:
|
|
|
113
167
|
| Memory | `npx --no-install prnext start --profile memory` | Lower memory usage |
|
|
114
168
|
| Classic | `npx --no-install prnext start --profile classic` | Original runtime settings |
|
|
115
169
|
|
|
116
|
-
|
|
170
|
+
|
|
171
|
+
Worker retirement can be configured in `next.config.mjs` (PRNext extension):
|
|
172
|
+
|
|
173
|
+
```js
|
|
174
|
+
export default {
|
|
175
|
+
workerRetirement: { idleSeconds: 300, laneIdleSeconds: 30, keepWarm: false },
|
|
176
|
+
};
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Values are resolved **per field**: CLI > process environment > built configuration > profile.
|
|
180
|
+
The CLI options are `--worker-idle-seconds`, `--lane-idle-seconds`, and
|
|
181
|
+
`--keep-warm [true|false]` (a bare flag means true). The corresponding environment
|
|
182
|
+
variables are `PRNEXT_WORKER_IDLE_SECONDS`, `PRNEXT_LANE_IDLE_SECONDS`, and
|
|
183
|
+
`PRNEXT_KEEP_WARM` (`true`/`false` or `1`/`0`). Seconds must be integers from 0 to
|
|
184
|
+
604800; invalid supplied values fail even when a higher-priority value exists.
|
|
185
|
+
Configuration-file changes require a new build; CLI/environment changes require
|
|
186
|
+
restarting the server.
|
|
187
|
+
|
|
188
|
+
`idleSeconds: 0` disables host idle retirement. `laneIdleSeconds: 0` disables
|
|
189
|
+
early retirement of surplus lanes; the host deadline still applies to those
|
|
190
|
+
lanes. Set both to zero to disable all idle retirement. `keepWarm: true` overrides
|
|
191
|
+
the resolved host deadline and retains one primary lane per used host, while
|
|
192
|
+
surplus lanes still retire. It creates no workers or artificial requests before
|
|
193
|
+
real traffic. To restore a shorter CLI deadline when a lower-priority source sets
|
|
194
|
+
`keepWarm: true`, also pass `--keep-warm false`. Active requests across **all**
|
|
195
|
+
lanes reset the host deadline; streams and tracked post-response work remain
|
|
196
|
+
protected. Keeping a host warm trades retained memory for lower wake latency;
|
|
197
|
+
it does not change the profile's response, buffer or V8 limits.
|
|
198
|
+
|
|
199
|
+
New builds include `runtime-contract.json`, separately declaring transport and
|
|
200
|
+
lifecycle versions and fingerprints of the runtime modules. `start` and
|
|
201
|
+
`host --check` reject missing, incompatible, future or mixed dynamic runtimes
|
|
202
|
+
before accepting traffic and print `prnext build <project>`. Rebuild and restart after
|
|
203
|
+
updating PRNext. Keep the selected production build immutable while it is in
|
|
204
|
+
use; this is a startup check, not a continuous file watcher. A copied metadata file cannot upgrade old runtime modules;
|
|
205
|
+
`--worker` must remain inside the verified build runtime directory. This is
|
|
206
|
+
artifact consistency checking, not a signature or a sandbox. Legacy builds
|
|
207
|
+
without any worker routes or middleware can still serve files without Node.
|
|
208
|
+
The multi-app `host` supervisor's whole-application `idleSeconds`/memory policy
|
|
209
|
+
is separate: keeping a Node worker warm does not override application sleep,
|
|
210
|
+
shutdown or resource-budget termination.
|
|
211
|
+
|
|
212
|
+
`prnext start` sizes Tokio's blocking I/O pool to four times the larger of its
|
|
213
|
+
runtime thread count and requested render workers (minimum 4, maximum 256).
|
|
214
|
+
`PRNEXT_BLOCKING_THREADS=1..1024` explicitly overrides it. This bounds threads,
|
|
215
|
+
not the number of incoming HTTP connections. Filesystem admission separately
|
|
216
|
+
bounds submitted blocking work and file response bodies, including slow clients:
|
|
217
|
+
|
|
218
|
+
| Environment variable | Default | Accepted range | Scope per server process |
|
|
219
|
+
|---|---:|---:|---|
|
|
220
|
+
| `PRNEXT_FILE_CONCURRENCY` | 64 | 1–4096 | File preparation and live file source bodies |
|
|
221
|
+
| `PRNEXT_FILE_WORK_CONCURRENCY` | 16 | 1–1024 | Submitted static/path/cache helper tasks, queued or running |
|
|
222
|
+
| `PRNEXT_FILE_QUEUE` | 128 | 0–4096 | Waiting callers at each admission gate; 0 rejects immediately |
|
|
223
|
+
| `PRNEXT_FILE_WAIT_MS` | 2000 | 1–60000 | Maximum admission wait at each gate |
|
|
224
|
+
|
|
225
|
+
Invalid values fail startup before listening. Full queues and admission timeouts
|
|
226
|
+
return HTTP 503 with `Retry-After: 1` and `Cache-Control: no-store`. These deadlines
|
|
227
|
+
apply to admission, not the duration of an accepted response. Cancelling a queued
|
|
228
|
+
caller releases its slot. An already running filesystem operation keeps its
|
|
229
|
+
permit until it settles, including a pending file read after a client disconnects;
|
|
230
|
+
an operating-system call cannot be forcibly cancelled safely. Large file bodies
|
|
231
|
+
use a one-frame channel with backpressure. No deadline cuts off an active stream.
|
|
232
|
+
Their asynchronous open/read operations retain a file-response permit; they are
|
|
233
|
+
not included in the helper-task queue counter. These controls are not a global
|
|
234
|
+
limit on application or background I/O.
|
|
235
|
+
The limits do not bound TCP/kernel buffers or all HTTP connections, and an
|
|
236
|
+
unresponsive disk can occupy the bounded capacity until its operation returns.
|
|
237
|
+
Pages cache lookups use the same bounded filesystem admission. Their overload
|
|
238
|
+
follows the existing page-capacity 503 path, including Pages JSON requests;
|
|
239
|
+
it does not invoke error-page generation or regenerate a valid cached page.
|
|
240
|
+
|
|
241
|
+
File operations stay off the async runtime threads; HTTP validators, range
|
|
242
|
+
handling and path confinement are unchanged. The multi-app supervisor retains
|
|
243
|
+
its existing pool sizing because
|
|
244
|
+
its long-lived child-output readers have different requirements.
|
|
245
|
+
|
|
246
|
+
For local diagnosis only, `PRNEXT_METRICS_FILE=<path>` adds one observer thread
|
|
247
|
+
and cumulative counters once per second (file wraps at 16 MiB). It reports
|
|
248
|
+
Tokio threads, instrumented filesystem tasks/queues and worker events. Nested
|
|
249
|
+
filesystem timings are wall time, not CPU, and must not be added together.
|
|
250
|
+
`fileAdmission` and `fileWorkAdmission` report occupancy, peaks, submitted and
|
|
251
|
+
released work, rejections, timeouts, cancelled waits and wait duration. Their
|
|
252
|
+
`waitingHeaderBytes` estimate counts URI and header content only; it excludes
|
|
253
|
+
allocation overhead, request objects, bodies and TCP/kernel buffers. Use process
|
|
254
|
+
memory measurements for the total footprint. Metrics never initialize admission
|
|
255
|
+
settings or override values selected at startup.
|
|
256
|
+
`activeJobs` sums transport jobs across the separate render/API pools;
|
|
257
|
+
`queuedJobs` excludes HTTP callers waiting before transport admission.
|
|
258
|
+
`laneIdleRetirements` includes release of a cancelled lane's retained host
|
|
259
|
+
reference, so it is not a count of distinct TCP connections closed. Host starts
|
|
260
|
+
and watchdog kills are separate events; RSC isolate restarts do not have an
|
|
261
|
+
independent cumulative counter. Normal operation has no observer thread or
|
|
262
|
+
sampling timer.
|
|
263
|
+
`--inspect` additionally records Node startup, module and RSC initialization
|
|
264
|
+
phases; use uninstrumented runs for throughput comparisons.
|
|
265
|
+
|
|
266
|
+
Render workers start on demand. Idle connection lanes retire after 30 seconds in `memory` and legacy `compact`. `balanced` keeps each host's primary lane warm for 300 seconds and retires surplus lanes after 30 seconds; `speed` and `classic` keep primary lanes warm and retire surplus lanes after 30 seconds. Retirement waits on idle deadlines rather than polling. Active responses and streams retain their lanes, and tracked application work keeps its Node host available even after the last lane retires. New requests can reuse that host while cache finalization continues. Once the work settles, the existing heartbeat releases this retention within one second. Releasing idle workers lowers retained memory but adds worker startup and module loading to the next request.
|
|
267
|
+
|
|
268
|
+
Client disconnections release response permits and close incomplete transport lanes while retaining a healthy shared Node process. A lane whose terminal frame was fully validated can be reused. App Router cancellation pressure pauses new admission until abandoned work settles, with bounded queues and the original request deadlines; it does not immediately terminate unrelated responses. Successful response completion ends the RSC response deadline, while cache writes remain tracked until settlement. During this post-response work only, a shared watchdog probes the RSC isolate every five seconds and retires it if an acknowledgement takes more than 30 seconds. This measures responsiveness, not the total duration of asynchronous cache work; no RSC watchdog timer runs when that work is absent. Existing limits on cancelled requests and other API or middleware background work still apply.
|
|
269
|
+
|
|
270
|
+
Explicit disposal of a worker pool starts a separate graceful shutdown: tracked work has up to 30 seconds to drain before Rust terminates and reaps the process, including a blocked JavaScript event loop. This shutdown grace does not limit normal idle cache finalization. Arbitrary detached tasks are outside the tracked lifecycle; applications that rely on them or long-lived in-process state should use `speed` or `classic` to keep their primary host warm. Such tasks are still not preserved across shutdown or worker failure.
|
|
271
|
+
|
|
272
|
+
Each profile keeps its own admission, buffering and idle policy. Limits below are per worker host; render starts and live responses are separate budgets.
|
|
273
|
+
|
|
274
|
+
| Profile | Render starts | Live responses | API concurrency | Response buffer | Primary idle deadline |
|
|
275
|
+
|---|---:|---:|---:|---:|---|
|
|
276
|
+
| `balanced` | 16 | 32 | 256 | 4 MiB | 300 seconds |
|
|
277
|
+
| `speed` | 32 | 128 | 512 | 16 MiB | Keep warm |
|
|
278
|
+
| `memory` | 8 | 28 | 64 | 1 MiB | 30 seconds |
|
|
279
|
+
| `classic` | 16 | 32 | 512 | 8 MiB | Keep warm |
|
|
280
|
+
|
|
281
|
+
On Linux with Node's `process.execve` available (Node 22.15+/23.11+), production `prnext start` replaces its CLI process with the native server. This removes a resident Node launcher from every profile without shrinking render or response budgets. Rust handles SIGINT, SIGTERM and SIGHUP gracefully; Linux also kills Node workers if their native parent dies, including when JavaScript is blocked. Explicit `--shutdown-on-stdin-eof` remains supported. Windows, macOS, older Node versions, IPC callers and Node instrumentation keep the supervised launch path. Only heap-sizing Node flags are eligible for replacement; other flags and `NODE_V8_COVERAGE` conservatively retain supervision. Node still labels `process.execve` experimental. This change does not remove the supervisors used by `pstart`, or change `host` and development mode.
|
|
282
|
+
|
|
283
|
+
`balanced` keeps its 4 MiB V8 semi-space without `--optimize-for-size`. `speed` keeps its 16 MiB semi-space, larger concurrency and buffers, and warm hosts. `memory` keeps V8's size policy and early retirement; `classic` preserves its original V8 settings. Node heap flags can take precedence over the RSC isolate's young-generation resource limit: these settings are not total RSS caps. The earlier Windows V6 validation includes three 30-second measurements per scenario and a one-hour mixed endurance run; it predates this launcher change and is not an endurance result for this candidate. Workload and platform affect the CPU/RSS trade-off; a comparable Linux Nginx benchmark remains pending.
|
|
284
|
+
|
|
285
|
+
An explicit `NODE_OPTIONS="--max-semi-space-size=4"` (including Node's underscore spelling) overrides the profile's nursery policy. PRNext also omits `--optimize-for-size` in that case: on Node 24.19.0, V8 otherwise replaces the explicit value with 1 MiB. This opts out of V8's broader size policy as well, so CPU and memory consumption can change; measure the chosen value for your workload. It does not add an old-generation heap limit or change the profile's admission, response buffers or idle retirement. Without an explicit override, PRNext uses the defaults of the selected profile.
|
|
286
|
+
|
|
287
|
+
The V6 multi-application campaign keeps `start` on `balanced` and `host` on
|
|
288
|
+
`memory`. With one shared CPU on Windows, `memory` completed both short trials
|
|
289
|
+
at four applications / 512 MiB and eight applications / 1 GiB without allocation
|
|
290
|
+
limit events. Its one-hour validation used four applications / 1 GiB, not those
|
|
291
|
+
lowest budgets: 1,626,564 useful responses and 960 intentional cancellations,
|
|
292
|
+
with no HTTP or validation errors. `balanced` gave lower neighbouring-application
|
|
293
|
+
tail latency when the larger memory budget was available. These are independent
|
|
294
|
+
`start` instances, not a benchmark of the hosting proxy. Windows commit limits,
|
|
295
|
+
an active pagefile and process RSS sums are not Linux cgroup/PSS measurements;
|
|
296
|
+
equivalent Linux density and endurance measurements remain pending. The local V6 report retains failures,
|
|
297
|
+
variability and the small-static throughput cost of bounded admission.
|
|
298
|
+
|
|
299
|
+
The filesystem work limit remains 16, the setting validated under overload and
|
|
300
|
+
throughout the final endurance run. An explicit `PRNEXT_FILE_WORK_CONCURRENCY=64`
|
|
301
|
+
improved small-file throughput by about 5% in two short configuration trials,
|
|
302
|
+
but allows four times as many submitted helper tasks. It has not received the
|
|
303
|
+
same endurance validation and is not a universal profile improvement.
|
|
304
|
+
|
|
305
|
+
Results depend on your workload; see the [benchmark and its methodology](#early-benchmarks-against-nextjs).
|
|
306
|
+
|
|
307
|
+
</details>
|
|
308
|
+
|
|
309
|
+
## Early benchmarks against Next.js
|
|
310
|
+
|
|
311
|
+
Dynamic streaming with 128 concurrent clients and a deterministic local backend delayed by 40 ms:
|
|
312
|
+
|
|
313
|
+
| Configuration | RAM | CPU load¹ | CPU/response | Throughput |
|
|
314
|
+
|---|---:|---:|---:|---:|
|
|
315
|
+
| Next.js | 605 MiB | 164% | 2.442 ms | 673 req/s |
|
|
316
|
+
| **Balanced** | **207 MiB** | 124% | 1.704 ms | 726 req/s |
|
|
317
|
+
| **Speed** | 496 MiB | 250% | **0.926 ms** | **2,698 req/s** |
|
|
318
|
+
| **Memory** | **179 MiB** | **75%** | 2.067 ms | 362 req/s |
|
|
319
|
+
| **Classic** | 303 MiB | 90% | 1.241 ms | 723 req/s |
|
|
320
|
+
|
|
321
|
+
<details>
|
|
322
|
+
<summary><strong>Benchmark methodology & trade-offs</strong></summary>
|
|
323
|
+
|
|
324
|
+
¹ 100% CPU = one fully utilized CPU core. RAM is measured under load.
|
|
325
|
+
|
|
326
|
+
Measured September 27, 2026, on Apple M4 against Next.js 15.5.12. Values are medians of three six-second runs using identical application sources. This table covers one streaming scenario, not an overall average or guaranteed gains. Functional parity was checked before benchmarking.
|
|
327
|
+
|
|
328
|
+
Under concurrent streaming, `memory` used 179 MiB versus 207 MiB for `balanced`, but served 362 versus 726 responses/s. On concurrent SSR, it used slightly more memory than `balanced`. The lowest-memory profile is workload-dependent.
|
|
117
329
|
|
|
118
330
|
</details>
|
|
119
331
|
|
|
120
332
|
## Guides
|
|
121
333
|
|
|
122
334
|
<details>
|
|
123
|
-
<summary><strong>
|
|
335
|
+
<summary><strong>Deploy to PRNext Cloud (local development)</strong></summary>
|
|
336
|
+
|
|
337
|
+
### Deploy to PRNext Cloud
|
|
338
|
+
|
|
339
|
+
The local CLI now supports browser login and source deployments. This feature is
|
|
340
|
+
not yet included in a published npm release or deployed to the public Cloud app.
|
|
341
|
+
|
|
342
|
+
```sh
|
|
343
|
+
prn login
|
|
344
|
+
prn deploy ./my-app
|
|
345
|
+
prn update ./my-app
|
|
346
|
+
prn whoami
|
|
347
|
+
prn logout
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
`prnext` accepts the same commands. Login opens the browser and reuses its session,
|
|
351
|
+
or returns to terminal approval after web sign-in. Confirm the code shown in your
|
|
352
|
+
terminal. `--no-browser` prints the URL for manual authorization.
|
|
353
|
+
|
|
354
|
+
`deploy` creates an upload project and saves its link in the ignored
|
|
355
|
+
`.prnext-cloud/project.json`; `update` sends changes to that same project.
|
|
356
|
+
`deploy --project ID` links an existing upload project. `--dry-run` lists source
|
|
357
|
+
files without connecting or uploading; `--no-wait` returns after queueing.
|
|
358
|
+
`--timeout SECONDS` controls waiting (default 600). After interruption or
|
|
359
|
+
`--no-wait`, `update` resumes the recorded request first; run it again to deploy
|
|
360
|
+
further changes. Server-side request IDs prevent duplicate queued builds.
|
|
361
|
+
|
|
362
|
+
Archives exclude `.env*`, credentials, `node_modules`, `.git`, generated
|
|
363
|
+
`.next`/`.prnext*` output and `.local`. Root `.gitignore` and `.prnextignore`
|
|
364
|
+
support additional glob exclusions and `!` rules; nested/global Git ignore files
|
|
365
|
+
are not read. Mandatory exclusions cannot be re-included. Nonexcluded symbolic
|
|
366
|
+
links are refused. On a compatible Host server: 100 MiB ZIP, 500 MiB expanded,
|
|
367
|
+
15,000 files and 64 MiB per file. Transfers use resumable 4 MiB chunks on the VPS;
|
|
368
|
+
legacy servers retain their 7 MiB upload limit. No object storage is required.
|
|
369
|
+
|
|
370
|
+
When production `.env` files are detected, `deploy` and `update` ask before
|
|
371
|
+
importing variables (default: no). `--with-env` explicitly opts in;
|
|
372
|
+
`--without-env` skips the prompt. Noninteractive commands skip import unless
|
|
373
|
+
`--with-env` is set. Variables travel through the encrypted environment API,
|
|
374
|
+
never inside the source ZIP or project link. Matching remote keys are replaced;
|
|
375
|
+
other keys remain. `NEXT_PUBLIC_` values may be exposed in the browser bundle.
|
|
376
|
+
This feature requires the updated Host API and remains unpublished.
|
|
377
|
+
Use project environment settings for secrets; inspect `--dry-run` for other
|
|
378
|
+
sensitive files in your own source tree.
|
|
379
|
+
|
|
380
|
+
Credentials stay under `~/.prnext/cloud/` (or private `PRNEXT_CLOUD_HOME`, outside
|
|
381
|
+
the source directory). Tokens are scoped to project reads/uploads/deployments,
|
|
382
|
+
expire after 30 days, and can be revoked with `logout` or in workspace settings.
|
|
383
|
+
Browser sign-out does not revoke authorized terminals.
|
|
384
|
+
|
|
385
|
+
For a local Cloud server, use `--server http://127.0.0.1:3003` or
|
|
386
|
+
`PRNEXT_CLOUD_URL`. From this checkout, run
|
|
387
|
+
`node packages/prnext/cli.mjs login --server http://127.0.0.1:3003`.
|
|
388
|
+
Production defaults to `https://app.prnext.dev`; credentials are isolated by origin.
|
|
389
|
+
|
|
390
|
+
A configured isolated Linux worker is required to deploy. A local Windows panel
|
|
391
|
+
supports login and dry runs, but reports unavailable hosting explicitly.
|
|
392
|
+
Approved offline dependencies, runtime network isolation and current Cloud quotas
|
|
393
|
+
still apply; these commands do not bypass the hosting worker or configure DNS/TLS.
|
|
394
|
+
|
|
395
|
+
</details>
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
<details>
|
|
399
|
+
<summary><strong>Check a migration before switching</strong></summary>
|
|
124
400
|
|
|
125
|
-
###
|
|
401
|
+
### Check a migration before switching
|
|
126
402
|
|
|
127
403
|
```sh
|
|
404
|
+
prnext migrate ./my-app --check
|
|
128
405
|
prnext migrate ./my-app --check --json
|
|
129
406
|
prnext migrate ./my-app --check --against http://localhost:3000 --candidate http://localhost:3001 --routes paths.json
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
The source audit reports unsupported Next imports with file and line numbers, client/server import conflicts, dependency versions and scripts requiring manual changes. It leaves sources, package files and builds untouched. Configuration files are evaluated by the existing preflight; installed dependencies and custom loaders still require a build. Warnings are distinct from blocking errors. A failed audit or response comparison exits with code 1.
|
|
410
|
+
|
|
411
|
+
For comparison, start the existing Next application and the PRNext candidate separately. `paths.json` is a JSON array such as `["/", "/products/123", "/api/catalog"]`; without it, the command selects non-parameterized page routes from the audit. It sends GET requests without authentication, follows no redirects, and compares status, content type, redirect destinations and bodies. JSON object key order is ignored; HTML compares text with scripts/styles removed. This verifies response samples, not hydration, styling, interactive behavior or every dynamic path. Timing observations are not controlled performance benchmarks. `--timeout 10000` sets each response's deadline in milliseconds.
|
|
412
|
+
|
|
413
|
+
</details>
|
|
414
|
+
|
|
415
|
+
<details>
|
|
416
|
+
<summary><strong>Inspect routes, cache and timings</strong></summary>
|
|
417
|
+
|
|
418
|
+
### Inspect routes, cache and timings
|
|
419
|
+
|
|
420
|
+
```sh
|
|
421
|
+
prnext build ./my-app
|
|
130
422
|
prnext start ./my-app --inspect
|
|
423
|
+
# In another terminal, after visiting the application:
|
|
424
|
+
prnext inspect ./my-app
|
|
131
425
|
prnext inspect ./my-app --json
|
|
132
|
-
prnext host prnext.host.json --check
|
|
133
|
-
prnext host prnext.host.json
|
|
134
|
-
prnext host prnext.host.json --status --json
|
|
135
426
|
```
|
|
136
427
|
|
|
137
|
-
The
|
|
428
|
+
The inspector explains static, dynamic and partially prerendered routes using build metadata, including observed App prerendering bailouts and Pages data hooks. Opt-in measurements show native HTTP timings, fetch destinations and timings, native data cache hits/misses/stale reads, bypass reasons and successful tag/path invalidations. A custom cache handler is identified as a delegation; its internal hit rate is not inferred. Native page-file cache decisions and client router caching are not counted as data-cache hits.
|
|
429
|
+
|
|
430
|
+
Timings end when headers are ready, so streaming body time is excluded. Samples are bounded, can span process sessions, and are written under the app's `.prnext-cache/inspect` directory. Request bodies, headers, cookies, URL queries and credentials are omitted; runtime tag/path identifiers are hashed consistently. Logs retain at most 1 MiB per segment plus a previous segment, with old process sessions pruned. Under load, diagnostics may drop samples. `--inspect` also works with `prnext dev`; standalone/native launches can set `PRNEXT_INSPECT_DIR` explicitly. No public diagnostic endpoint is added.
|
|
431
|
+
|
|
432
|
+
</details>
|
|
433
|
+
|
|
434
|
+
<details>
|
|
435
|
+
<summary><strong>Host several applications</strong></summary>
|
|
436
|
+
|
|
437
|
+
### Host several applications
|
|
438
|
+
|
|
439
|
+
```sh
|
|
440
|
+
npm run build -- examples/basic
|
|
441
|
+
npm run build -- examples/app
|
|
442
|
+
node packages/prnext/cli.mjs host examples/hosting/prnext.host.json --check
|
|
443
|
+
node packages/prnext/cli.mjs host examples/hosting/prnext.host.json
|
|
444
|
+
# In another terminal:
|
|
445
|
+
node packages/prnext/cli.mjs host examples/hosting/prnext.host.json --status
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
The example routes `basic.localhost:8080` and `app.localhost:8080` to separate applications. Resolve those hostnames to the listener address, or supply their exact `Host` header when testing. Installed packages use `prnext host config.json`. Configuration roots are relative to the JSON file. Each app has a unique name, root and exact hostname list, with optional `memoryMb`, `idleSeconds`, `workers`, `profile`, `env` and `inspect` settings. `--status --json` reads the local status snapshot beside the configuration, including its age; it does not connect to a live admin endpoint. Restart the host to apply configuration or build changes.
|
|
138
449
|
|
|
139
|
-
The
|
|
450
|
+
The native gateway keeps each application asleep until requested. A waking app reserves its configured memory budget; if capacity is full, inactive apps can release theirs, while busy requests receive 503 rather than starting an unbudgeted app. Requests and streaming responses hold their reservation until completion or cancellation. Idle apps begin stopping after `idleSeconds` and wake on the next request. Sleep and capacity eviction retain the memory reservation while the child drains supported `after()` and ISR work, allowing up to 300 seconds plus five seconds for process cleanup. A wake waiting for that capacity can take longer. Status shows `draining` with the process still present; monitoring and memory-budget enforcement continue. Global Host shutdown shortens outstanding retirement to its own 35-second deadline. Persistent caches remain on disk; in-process state and untracked background jobs do not survive sleep. Apps receive their configured environment and a small platform environment allowlist, then load their own `.env` files.
|
|
140
451
|
|
|
141
|
-
The
|
|
452
|
+
The watchdog samples the RSS of each app's native server and descendants about once per second. Exceeding `memoryMb` stops that process tree, can interrupt its in-flight requests, and imposes a 30-second cooldown. V8 also receives an initial heap guard unless the app config supplies `NODE_OPTIONS`. These are sampled operating budgets, not kernel-enforced hard limits; allow extra RAM for the gateway, the OS and sampling overshoot. Process separation isolates caches, environment and ordinary failures, but apps run as the same OS user: host only trusted applications. Use separate users or containers for untrusted tenants.
|
|
142
453
|
|
|
143
|
-
|
|
454
|
+
The 0.1.12-alpha Windows host check used four applications sharing one CPU and a 1 GiB Job commit budget. Two 30-second mixed SSR/stream/API trials measured about 333 requests/s through `host` versus 361 directly with the same V8 heap guard (about 8% gateway cost in this fixture). The matching direct controls followed the host trials; these short runs are not a general capacity guarantee. Three sleep/resume cycles per trial used `idleSeconds: 3` to exercise retirement: 32 simultaneous arrivals completed in 1.92–2.35 seconds, with one startup per application and no failures. The default whole-app deadline remains 300 seconds. The gateway keeps its one-second status/RSS monitor running while apps sleep; idle CPU is not zero. No host endurance or Linux performance result is claimed.
|
|
144
455
|
|
|
145
|
-
|
|
456
|
+
Hosting supports HTTP streaming and preserves the original application Host. Protocol upgrades such as WebSockets return 501. Put a TLS reverse proxy in front for public hosting; this command does not configure DNS, TLS, OS services or deploy to a VPS. Windows, macOS and Linux use the same JSON format and CLI.
|
|
146
457
|
|
|
147
458
|
</details>
|
|
148
459
|
|
|
149
460
|
<details>
|
|
150
|
-
<summary><strong>
|
|
461
|
+
<summary><strong>Keep production apps running</strong></summary>
|
|
462
|
+
|
|
463
|
+
### Keep production apps running
|
|
464
|
+
|
|
465
|
+
`prnext start` keeps its normal foreground behavior. Use the separate persistent commands when an app should survive closing the terminal:
|
|
466
|
+
|
|
467
|
+
```sh
|
|
468
|
+
prnext build ./my-app
|
|
469
|
+
prnext pstart ./my-app --name web --port 3000
|
|
470
|
+
prnext pstatus
|
|
471
|
+
prnext plogs web --follow
|
|
472
|
+
# After rebuilding the app:
|
|
473
|
+
prnext prestart web
|
|
474
|
+
prnext pstop web
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
`pstart` starts a detached supervisor and returns once the app passes its health check. Applications restart after a crash with increasing delays; ten failures within five minutes stop retries until `prestart`. A separate watchdog restarts the supervisor after a crash or an unresponsive event loop. Each app has a stable HTTP listener and its own native server and workers. This mode adds a Node HTTP proxy and two supervisor processes; it does not enable the idle sleep or memory reservations of `prnext host`.
|
|
478
|
+
|
|
479
|
+
`prestart` copies the current production build, starts a replacement on a private port, and sends a GET to `--health-path` (default `/`). A 2xx or 3xx response must arrive within `--health-timeout 15000` milliseconds. Only then does new traffic switch to the replacement. If startup or the health check fails, the existing healthy instance keeps serving. Existing HTTP streams can finish for up to `--drain-timeout 30000` milliseconds, after which remaining requests are closed. Choose a health route that checks the dependencies your application needs. Two generations temporarily use memory and disk space during replacement.
|
|
480
|
+
|
|
481
|
+
Build copies live under the project's ignored `.prnext-persistent` directory and are removed after their processes stop. Rebuilding does not replace the active generation's compiled files. Project dependencies, `public` files and persistent caches remain shared; avoid changing dependencies or deleting public assets while old requests still need them. HTTP streaming, original Host headers and multiple cookies are preserved. WebSocket/protocol upgrades return 501. A supervisor crash can interrupt requests; health-checked replacement is not a guarantee against machine failures or incompatible application changes. A TLS reverse proxy can sit in front of the persistent listener.
|
|
151
482
|
|
|
152
|
-
|
|
483
|
+
Available commands:
|
|
153
484
|
|
|
154
|
-
|
|
485
|
+
| Command | Behavior |
|
|
486
|
+
| --- | --- |
|
|
487
|
+
| `prnext pstart [directory] --name NAME` | Start or restore an app; identical repeated starts are idempotent |
|
|
488
|
+
| `prnext prestart [name] [--all]` | Load the current build through a health-checked replacement |
|
|
489
|
+
| `prnext pstop [name] [--all]` | Stop apps and keep them stopped across supervisor restarts |
|
|
490
|
+
| `prnext pdelete [name] [--all]` | Stop apps and remove their saved configuration; retain logs |
|
|
491
|
+
| `prnext pstatus [name] [--json]` / `prnext plist` | Show status, PIDs, build IDs, starts and active requests |
|
|
492
|
+
| `prnext plogs [name] --lines 100 --follow` | Read/tail app output; `--supervisor` selects supervisor logs |
|
|
493
|
+
| `prnext pdown` | Stop the supervisor and apps, retaining enabled flags for their next launch |
|
|
494
|
+
| `prnext pstartup [--remove]` | Enable/remove automatic restoration at user login |
|
|
155
495
|
|
|
156
|
-
|
|
496
|
+
Without a name, `prestart`, `pstop`, `pdelete` and `plogs` select the app registered for the current directory. `pstart` accepts `--hostname`, `--port`, `--workers`, `--profile`, `--inspect`, `--health-path`, `--health-timeout` and `--drain-timeout`; see `prnext pstart --help`. Change saved listener/settings with `pdelete`, then `pstart`. Applications load their project `.env` files; arbitrary caller-shell variables and secrets are not copied into the saved registry. The state directory defaults to `~/.prnext/processes`; set `PRNEXT_PM_HOME` consistently for a separate supervisor. Keep that directory private: it contains local control credentials and application logs. Logs rotate at 10 MiB with three retained segments per app and for the supervisor. App output can contain whatever the application logs.
|
|
157
497
|
|
|
158
|
-
|
|
498
|
+
`pstartup` is opt-in and enables restoration on the **next user login**. On Windows it registers a hidden scheduled task for the current account; on macOS it writes a user LaunchAgent; on Linux it enables a systemd user service. These definitions restart a failed watchdog once managed by the OS. Windows and macOS user startup do not run before login. A Linux administrator can enable user lingering separately for boot-time operation without an interactive login. No OS startup settings change just by running `pstart`, and the command does not install a Windows system service or alter other accounts. Run `pstartup` again after moving or upgrading Node or the PRNext package. Platform references: [Windows scheduled tasks](https://learn.microsoft.com/en-us/powershell/module/scheduledtasks/new-scheduledtasksettingsset), [Apple launch agents](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html), [systemd user lingering](https://www.freedesktop.org/software/systemd/man/252/loginctl.html).
|
|
159
499
|
|
|
160
|
-
|
|
500
|
+
### Upgrade persistent apps
|
|
501
|
+
|
|
502
|
+
The supervisor may be shared by several projects. Use the same user and `PRNEXT_PM_HOME` throughout, and record the applications and their settings first:
|
|
503
|
+
|
|
504
|
+
```sh
|
|
505
|
+
npx --no-install prnext pstatus --json
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Before changing package files, stop the apps and supervisor using the **old installation**. These commands affect **all apps managed by that supervisor**, so schedule the interruption accordingly:
|
|
509
|
+
|
|
510
|
+
```sh
|
|
511
|
+
npx --no-install prnext pstop --all
|
|
512
|
+
npx --no-install prnext pdown
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
Install the update and rebuild each affected project as described under [Install & upgrade](#install--upgrade). Using the new CLI, restart each app with its original name, port and other options. For example:
|
|
516
|
+
|
|
517
|
+
```sh
|
|
518
|
+
npx --no-install prnext pstart --name web --port 3000
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
If the saved Node or native executable path changed, remove that app's saved entry with `prnext pdelete NAME`, then register it again with `prnext pstart` and its recorded options. This removes saved settings but retains logs. If login startup was enabled, re-run `prnext pstartup` to refresh its paths.
|
|
522
|
+
|
|
523
|
+
`pdown` alone keeps apps enabled for restoration; stop them first to prevent an old configuration from restarting during the upgrade.
|
|
161
524
|
|
|
162
525
|
</details>
|
|
163
526
|
|
|
164
527
|
<details>
|
|
165
|
-
<summary><strong>
|
|
528
|
+
<summary><strong>Develop from this repository</strong></summary>
|
|
166
529
|
|
|
167
|
-
###
|
|
530
|
+
### Develop from this repository
|
|
168
531
|
|
|
169
|
-
|
|
532
|
+
Install Node.js 22+ and Rust with rustup, then run:
|
|
170
533
|
|
|
171
|
-
|
|
534
|
+
```sh
|
|
535
|
+
npm ci
|
|
536
|
+
npm run build:native
|
|
537
|
+
npm run dev -- examples/app
|
|
538
|
+
```
|
|
172
539
|
|
|
173
|
-
|
|
540
|
+
These commands also work in PowerShell and Command Prompt. On Windows, source builds require Visual Studio Build Tools with the Desktop development with C++ workload and a Windows SDK, plus NASM on x64. Rustup selects the repository's Rust 1.98 toolchain. Linux source builds need a C/C++ toolchain, NASM and pkg-config; macOS needs Xcode command line tools and NASM.
|
|
174
541
|
|
|
175
|
-
|
|
542
|
+
For production locally, run `npm run build -- examples/app`, then `npm run start -- examples/app`. Standalone output runs with `node server.js` on its build OS and architecture, including Windows. Published native packages remove the Rust/C++ build requirement for consumers. Keep the framework and platform components on matching release versions.
|
|
176
543
|
|
|
177
|
-
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
- Questions and suggestions: [contact@heythomas.dev](mailto:contact@heythomas.dev)
|
|
544
|
+
For source builds, `cargo build --release --locked --features gzip-zlib-rs` enables an experimental alternative gzip/deflate backend. Ubuntu x64 trials reduced JSON API CPU cost but increased cumulative streaming RSS, so this option is disabled by default. It also changes the Rust PNG/TIFF codecs; runtime profiles and Node heap settings remain unchanged. Compare CPU, response size and memory on your workload before choosing it.
|
|
545
|
+
|
|
546
|
+
</details>
|
|
181
547
|
|
|
182
548
|
<details>
|
|
183
549
|
<summary><strong>License & credits</strong></summary>
|
package/build/actions.mjs
CHANGED
|
@@ -205,6 +205,10 @@ export function createServerActions({ projectRoot }) {
|
|
|
205
205
|
transform(source,file,mode) {
|
|
206
206
|
if(!source.includes('use server')) return source;
|
|
207
207
|
const result=analyze(source,file);
|
|
208
|
+
// A Route Handler invokes the implementation as ordinary server code.
|
|
209
|
+
// It does not serialize functions through Flight or manufacture proxies.
|
|
210
|
+
// Analyze first to preserve validation and the shared action registry.
|
|
211
|
+
if(mode==='route') return source;
|
|
208
212
|
if(mode==='rsc') return result.server;
|
|
209
213
|
if(result.moduleServer) return `import {createServerReference} from 'prnext-internal:action-${mode==='browser'?'client':'ssr'}';\n`+result.declared.map((item,index)=>`const action${index}=createServerReference(${JSON.stringify(item.id)});export {action${index} as ${JSON.stringify(item.name)}};`).join('\n');
|
|
210
214
|
if(result.inline) throw new Error(`Inline Server Actions cannot be imported into the client graph (${file}); move the action to a module marked 'use server'.`);
|
package/build/app-config.mjs
CHANGED
|
@@ -79,6 +79,7 @@ export async function validateAppConfig(file) {
|
|
|
79
79
|
config.generateStaticParams = true;
|
|
80
80
|
continue;
|
|
81
81
|
}
|
|
82
|
+
if (item.name === 'maxDuration' && Number.isSafeInteger(value) && value >= 1 && value <= 300) { config.maxDuration = value; continue; }
|
|
82
83
|
if (allowed.includes(value) || (item.name === 'revalidate' && Number.isSafeInteger(value) && value >= 0)) { config[item.name] = value; continue; }
|
|
83
84
|
throw new Error(`App Router export ${item.name} in ${file} is not supported with this value.${allowed.length ? ` Supported literal values: ${allowed.map(value => JSON.stringify(value)).join(', ')}${item.name === 'revalidate' ? ', or a nonnegative integer' : ''}.` : ''}`);
|
|
84
85
|
}
|
|
@@ -105,6 +106,7 @@ export function mergeAppConfig(configs) {
|
|
|
105
106
|
}
|
|
106
107
|
let forceDynamic = false;
|
|
107
108
|
for (const config of configs) {
|
|
109
|
+
if (config.maxDuration !== undefined) merged.maxDuration = config.maxDuration;
|
|
108
110
|
if (config.runtime === 'edge') merged.runtime = 'edge';
|
|
109
111
|
else if (config.runtime === 'nodejs') delete merged.runtime;
|
|
110
112
|
// The first explicit ancestor decides whether a blocking route is allowed.
|