@thomas.f/prnext 0.1.16-alpha → 0.1.17-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/AI.md +63 -0
- package/README.md +384 -9
- package/build/ADAPTERS.md +27 -2
- package/build/actions.mjs +5 -0
- package/build/analyze.mjs +184 -0
- package/build/app-config.mjs +7 -8
- package/build/app-static.mjs +12 -7
- package/build/app.mjs +23 -10
- package/build/build-lock.mjs +6 -6
- package/build/bundle-runtime.mjs +20 -5
- package/build/check.mjs +56 -11
- package/build/compiler.mjs +25 -1
- package/build/concurrent.mjs +12 -0
- package/build/config.mjs +21 -13
- package/build/css-modules.mjs +15 -4
- package/build/dev-compiler-health.mjs +11 -0
- package/build/dev-css-update.mjs +83 -0
- package/build/dev-dependencies.mjs +44 -0
- package/build/dev-discovery.mjs +28 -0
- package/build/dev-worker.mjs +14 -5
- package/build/dev.mjs +55 -4
- package/build/edge.mjs +3 -2
- package/build/framework-imports.mjs +40 -0
- package/build/incremental.mjs +8 -4
- package/build/index.mjs +96 -101
- package/build/inspect.mjs +3 -0
- package/build/inspection-summary.mjs +37 -4
- package/build/loader-cache.mjs +53 -26
- package/build/metadata-routes.mjs +2 -3
- package/build/migrate.mjs +60 -57
- package/build/npm-packages.mjs +3 -18
- package/build/package-manager.mjs +308 -0
- package/build/persistent-cache.mjs +97 -0
- package/build/precompress.mjs +62 -30
- package/build/prerender-pages.mjs +90 -0
- package/build/prerender-worker.mjs +10 -0
- package/build/production-builder.mjs +80 -0
- package/build/scan.mjs +4 -4
- package/build/source-analysis.mjs +42 -0
- package/build/static-adapter.mjs +13 -5
- package/build/static-input.mjs +48 -0
- package/build/styles.mjs +15 -3
- package/build/transform-cache.mjs +37 -4
- package/build/type-command.mjs +41 -0
- package/build/typed-routes.mjs +91 -0
- package/build/typescript-dev-worker.mjs +18 -0
- package/build/typescript-dev.mjs +22 -0
- package/build/typescript-watch.mjs +22 -0
- package/build/typescript.mjs +5 -4
- package/build/webpack-graph.mjs +164 -27
- package/build/worker-preload.mjs +9 -0
- package/cli.mjs +105 -121
- package/compat/index.d.ts +21 -7
- package/compat/link.d.cts +4 -3
- package/compat/navigation.d.cts +4 -3
- package/compat/router.d.cts +4 -3
- package/compat/typed-route.d.cts +17 -0
- package/docs/ai/compatibility.md +106 -0
- package/docs/ai/data.md +128 -0
- package/docs/ai/deployment.md +111 -0
- package/docs/ai/manifest.json +11 -0
- package/docs/ai/quickstart.md +146 -0
- package/docs/ai/routing.md +132 -0
- package/docs/ai/troubleshooting.md +120 -0
- package/index.mjs +2 -0
- package/native/diagnostics.mjs +34 -0
- package/native/resolve.mjs +7 -2
- package/package.json +25 -7
- package/release/ai-docs.mjs +48 -0
- package/release/verify.mjs +2 -0
- package/runtime/ai-docs.mjs +202 -0
- package/runtime/app-client.mjs +17 -6
- package/runtime/app-render.mjs +12 -0
- package/runtime/cloud/archive.mjs +5 -6
- package/runtime/compile-cache.mjs +8 -0
- package/runtime/dev-ai-brands.mjs +26 -0
- package/runtime/dev-ai-style.mjs +99 -0
- package/runtime/dev-build-reasons.mjs +25 -0
- package/runtime/dev-cache-control.mjs +53 -0
- package/runtime/dev-client.mjs +239 -45
- package/runtime/dev-console-copy.mjs +19 -0
- package/runtime/dev-console.mjs +106 -0
- package/runtime/dev-dependency-graph.mjs +40 -0
- package/runtime/dev-element-picker-style.mjs +27 -0
- package/runtime/dev-element-picker.mjs +213 -0
- package/runtime/dev-error-overlay-style.mjs +41 -0
- package/runtime/dev-error-overlay.mjs +167 -0
- package/runtime/dev-error-report.mjs +121 -0
- package/runtime/dev-file-changes.mjs +1 -1
- package/runtime/dev-gateway.mjs +44 -0
- package/runtime/dev-host-relay.mjs +66 -0
- package/runtime/dev-indicator.mjs +186 -0
- package/runtime/dev-issue-motion.mjs +214 -0
- package/runtime/dev-lazy-tool.mjs +18 -0
- package/runtime/dev-logo.mjs +2 -0
- package/runtime/dev-notification.mjs +81 -0
- package/runtime/dev-popout.mjs +34 -0
- package/runtime/dev-position.mjs +107 -0
- package/runtime/dev-preview-touch.mjs +122 -0
- package/runtime/dev-runtime-pool.mjs +45 -0
- package/runtime/dev-runtime-spare.mjs +57 -0
- package/runtime/dev-tools-client.mjs +155 -0
- package/runtime/dev-tools-mcp.mjs +126 -0
- package/runtime/dev-tools-metrics.mjs +31 -0
- package/runtime/dev-tools-model.mjs +42 -0
- package/runtime/dev-tools-panel.mjs +341 -0
- package/runtime/dev-tools-result.mjs +37 -0
- package/runtime/dev-tools-server.mjs +256 -0
- package/runtime/dev-tools-source.mjs +104 -0
- package/runtime/dev-tooltip.mjs +94 -0
- package/runtime/dev-ui-icons.mjs +8 -0
- package/runtime/dev-workbench-style.mjs +106 -0
- package/runtime/dev-workbench.mjs +428 -0
- package/runtime/dev-worker-logs.mjs +31 -0
- package/runtime/development.mjs +307 -0
- package/runtime/env.mjs +2 -1
- package/runtime/pages-client.mjs +10 -1
- package/runtime/pages-navigation.mjs +6 -1
- package/runtime/persistent/client.mjs +6 -5
- package/runtime/persistent/daemon.mjs +66 -56
- package/runtime/persistent/native-proxy.mjs +63 -0
- package/runtime/preload.mjs +12 -0
- package/runtime/rsc-worker.mjs +7 -0
- package/runtime/typed-route.mjs +19 -0
- package/runtime/watch-project.mjs +12 -5
- package/runtime/worker.mjs +36 -2
package/AI.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# PRNext for coding assistants
|
|
2
|
+
|
|
3
|
+
Read this file when working on an application that uses `@thomas.f/prnext`.
|
|
4
|
+
These guides ship with the package and describe the **installed version**, not
|
|
5
|
+
the newest website, GitHub branch or npm dist-tag. Read the application's own
|
|
6
|
+
`AGENTS.md` and nearer instructions first; dependency documentation does not
|
|
7
|
+
replace project requirements.
|
|
8
|
+
|
|
9
|
+
PRNext is an early-alpha React framework with a Rust HTTP runtime and Node.js
|
|
10
|
+
React rendering. It implements a subset of Next.js conventions. An existing
|
|
11
|
+
`next/*` import is not proof that every Next.js API or configuration is supported.
|
|
12
|
+
|
|
13
|
+
## Find the right guide
|
|
14
|
+
|
|
15
|
+
| Task | Read |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| Install, start a project, understand validation | [Quickstart](docs/ai/quickstart.md) |
|
|
18
|
+
| Routes, layouts, server/client components, navigation | [Routing](docs/ai/routing.md) |
|
|
19
|
+
| Request data, actions, fetch and caching | [Data](docs/ai/data.md) |
|
|
20
|
+
| Migrate Next.js or check an unfamiliar feature | [Compatibility](docs/ai/compatibility.md) |
|
|
21
|
+
| Production, static output, self-hosting and PRNext Host | [Deployment](docs/ai/deployment.md) |
|
|
22
|
+
| Installation, build, hydration, HMR or runtime failure | [Troubleshooting](docs/ai/troubleshooting.md) |
|
|
23
|
+
|
|
24
|
+
Retrieve these files without a browser, native binary or running application:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
prnext docs --ai
|
|
28
|
+
prnext docs --ai routing
|
|
29
|
+
prnext docs --ai --list
|
|
30
|
+
prnext docs --ai --json
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Use the project's installed executable through an npm script, `npx --no-install
|
|
34
|
+
prnext`, `pnpm exec prnext` or its existing Yarn command. Do not fetch a newer CLI
|
|
35
|
+
to diagnose an older installation. `prnext --version` and the installed
|
|
36
|
+
`@thomas.f/prnext/package.json` identify the version; package metadata defines the
|
|
37
|
+
exact React peers and supported Node engines.
|
|
38
|
+
|
|
39
|
+
The explicit command below adds a small reference to the project's `AGENTS.md`
|
|
40
|
+
while preserving its existing content. Run it at the intended application root.
|
|
41
|
+
Installation itself does not edit project instructions, and assistants do not
|
|
42
|
+
universally discover documentation inside dependencies automatically.
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
prnext docs --ai --init .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Working rules
|
|
49
|
+
|
|
50
|
+
1. Inspect the existing scripts, lockfile, framework configuration and route tree
|
|
51
|
+
before editing. Keep the project's package manager and architecture.
|
|
52
|
+
2. Start with `prnext check --json`. It diagnoses installation/configuration;
|
|
53
|
+
it does not prove semantic types, a successful build or browser behavior.
|
|
54
|
+
3. Preserve server/client boundaries. Keep credentials and database access on the
|
|
55
|
+
server, validate untrusted input and authorize each mutation.
|
|
56
|
+
4. Prefer a small supported implementation. Do not invent `prnext.config` keys,
|
|
57
|
+
import arbitrary `next/dist` internals or disable a diagnostic to hide a bug.
|
|
58
|
+
5. Validate the affected behavior with type checking, a build and relevant
|
|
59
|
+
application/browser tests. Report what actually ran and any remaining gaps.
|
|
60
|
+
|
|
61
|
+
For live development evidence, use the existing `prnext mcp` tools described in
|
|
62
|
+
[Troubleshooting](docs/ai/troubleshooting.md). Do not claim that an assistant
|
|
63
|
+
connection, queued request or successful compilation proves a visible fix.
|
package/README.md
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://prnext.dev">
|
|
3
|
-
<
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-reduced-motion: reduce)" srcset="https://raw.githubusercontent.com/Lorkydey/PRNext/main/.github/assets/prnext-logo-metallic-static.png">
|
|
5
|
+
<img src="https://raw.githubusercontent.com/Lorkydey/PRNext/main/.github/assets/prnext-logo-metallic.gif" alt="PRNext logo with a metallic finish" width="160" height="160">
|
|
6
|
+
</picture>
|
|
4
7
|
</a>
|
|
5
8
|
</p>
|
|
6
9
|
|
|
10
|
+
<!-- Logo effect rendered with React Bits Metallic Paint, copyright 2026 David Haz (MIT + Commons Clause): https://reactbits.dev/animations/metallic-paint -->
|
|
11
|
+
|
|
7
12
|
<h1 align="center">PRNext</h1>
|
|
8
13
|
|
|
9
14
|
<p align="center">
|
|
@@ -16,6 +21,296 @@ A Rust-powered web runtime with React rendering on Node.js and a static adapter
|
|
|
16
21
|
|
|
17
22
|
> **Very early alpha.** Built for experimentation and feedback. Next.js compatibility is partial; expect bugs, missing features and breaking changes.
|
|
18
23
|
|
|
24
|
+
## Documentation for AI assistants
|
|
25
|
+
|
|
26
|
+
The npm package includes a short `AI.md` guide and focused
|
|
27
|
+
documentation for setup, routing, data, migration, deployment and troubleshooting.
|
|
28
|
+
Read the guidance for the version actually installed, without a network request
|
|
29
|
+
or a native server:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
prnext docs --ai
|
|
33
|
+
prnext docs --ai quickstart
|
|
34
|
+
prnext docs --ai --list
|
|
35
|
+
prnext docs --ai routing --json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
To help an assistant discover the guide, explicitly run
|
|
39
|
+
`prnext docs --ai --init` in your application. This adds a short managed pointer
|
|
40
|
+
to its `AGENTS.md`, preserving existing instructions. Installation does not edit
|
|
41
|
+
your project. Assistants do not all discover dependency documentation on their own.
|
|
42
|
+
|
|
43
|
+
## Development
|
|
44
|
+
|
|
45
|
+
Run `prnext dev` for requested-route compilation, React Fast Refresh, stylesheet
|
|
46
|
+
updates and an error overlay. Links do not prefetch pages in development. Open
|
|
47
|
+
browser tabs pin their routes; `onDemandEntries` controls inactive retention
|
|
48
|
+
(default: five routes, 60 seconds, bounded to 64 inactive routes). Middleware,
|
|
49
|
+
rewrites and parallel/intercepting routing conservatively compile the full graph.
|
|
50
|
+
Shared layouts, error infrastructure and imported dependencies are still built.
|
|
51
|
+
|
|
52
|
+
One Rust listener keeps its port and SSE connections open across saves. New
|
|
53
|
+
render generations activate only after binding; old responses drain for up to
|
|
54
|
+
30 seconds. Three immutable asset generations remain available. This replaces
|
|
55
|
+
render backends, rather than replacing arbitrary live Node modules in place.
|
|
56
|
+
Compatible component/style edits preserve React hook state; config, environment,
|
|
57
|
+
custom Document and incompatible module changes may reload the document.
|
|
58
|
+
|
|
59
|
+
A round PRNext indicator opens compact developer tools at the bottom-left: live
|
|
60
|
+
build/connection feedback, dismissed issues and page reload.
|
|
61
|
+
Two short red arcs flag non-blocking TypeScript or recoverable hydration issues;
|
|
62
|
+
a full red ring flags critical build or runtime errors. Recoverable hydration
|
|
63
|
+
issues stay available under View issues without opening an overlay automatically.
|
|
64
|
+
Opening the menu gathers the red indicator into a short stroke that follows the
|
|
65
|
+
left edge of the controls to View issues, then draws its outline in place.
|
|
66
|
+
Closing reverses the motion.
|
|
67
|
+
Reduced-motion settings switch directly between states.
|
|
68
|
+
Error details list the current issues above the selected diagnostic and mapped
|
|
69
|
+
source. Copy for AI prepares all listed errors; Send to AI opens the selected
|
|
70
|
+
error in the assistant workflow. Full messages and stack traces stay collapsible.
|
|
71
|
+
Compilation keeps its blue loader; reduced-motion settings disable ring animation.
|
|
72
|
+
Hide it until reload from the panel, or disable it with
|
|
73
|
+
`devIndicators: false` without disabling error overlays or Fast Refresh.
|
|
74
|
+
`devIndicators: { position: 'bottom-right' }` also accepts `bottom-left`,
|
|
75
|
+
`top-left` and `top-right`. Drag the logo to snap it to any corner, or focus it
|
|
76
|
+
and use Alt + arrow keys. The choice survives reloads in the current tab;
|
|
77
|
+
changing the configured default resets it. The indicator is isolated from
|
|
78
|
+
application styles and is not included in production browser bundles.
|
|
79
|
+
|
|
80
|
+
The near-black menu grows from the logo as a connected bubble and retracts on
|
|
81
|
+
close. Transitions reverse smoothly if interrupted, and reduced-motion settings
|
|
82
|
+
show the same controls immediately.
|
|
83
|
+
|
|
84
|
+
The indicator also opens a console with Browser/Server source filters, log levels, search, pause, clear
|
|
85
|
+
and copy controls. Select a message to read or copy its complete captured text.
|
|
86
|
+
Copy for AI prepares the visible logs with route context; its menu can copy all
|
|
87
|
+
recorded errors, including those hidden by filters, with a correction prompt and
|
|
88
|
+
repeated errors grouped. Query strings and fragments are omitted from route
|
|
89
|
+
context. It captures browser console messages, uncaught errors and unhandled
|
|
90
|
+
promise rejections while preserving native console output. Up to 500 messages
|
|
91
|
+
and 2 Mi characters stay in memory in that page; individual messages retain up
|
|
92
|
+
to 128,000 characters with an explicit truncation note beyond that limit. Values
|
|
93
|
+
are text snapshots. A reload clears browser messages. Local tools stay on this
|
|
94
|
+
machine unless you explicitly enable the Host AI relay described below.
|
|
95
|
+
|
|
96
|
+
Inspect opens real browser/server requests, measured build and refresh timings,
|
|
97
|
+
and a searchable route list. Compile a dynamic pathname on demand or invalidate
|
|
98
|
+
its native page/data cache without clearing unrelated routes, restarting the dev
|
|
99
|
+
generation or deleting persistent compiler caches. Cold routes and custom cache
|
|
100
|
+
handlers report their limitations instead of claiming an invalidation occurred.
|
|
101
|
+
Request details omit query strings, headers and bodies. Missing timings are
|
|
102
|
+
shown as not measured; request time is not presented as a compiler benchmark.
|
|
103
|
+
|
|
104
|
+
Errors resolve to original project source with a code frame and an editor link.
|
|
105
|
+
Select a component first. If no assistant is connected, a compact connection
|
|
106
|
+
dialog keeps your selection while you set up MCP. Sending unlocks after an
|
|
107
|
+
assistant completes the MCP handshake; copying a configuration does not connect
|
|
108
|
+
it. Connection settings then collapse. If it disconnects, your draft is preserved
|
|
109
|
+
until you reconnect, and local component selection remains available.
|
|
110
|
+
Client configuration opens smoothly, with a short scrollable code preview, full
|
|
111
|
+
configuration copy and an optional setup guide for the selected assistant.
|
|
112
|
+
|
|
113
|
+
Select element for AI captures its source marker, relevant styles and a bounded
|
|
114
|
+
PNG of the selected DOM element. Screenshots exclude form controls and embedded
|
|
115
|
+
frames; cross-origin assets can prevent capture. Sending queues context for the
|
|
116
|
+
assistant to read through MCP; it does not start an idle assistant or claim a fix.
|
|
117
|
+
|
|
118
|
+
### AI development tools
|
|
119
|
+
|
|
120
|
+
An assistant running locally can connect with the MCP stdio command below.
|
|
121
|
+
Use the absolute project directory when the assistant has another working directory:
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
prnext mcp /absolute/path/to/project
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The private discovery file is `.prnext-dev/tools.json`. The authenticated tool
|
|
128
|
+
service binds only to loopback and exposes bounded project diagnostics, source
|
|
129
|
+
excerpts, route compilation and native cache invalidation. It provides no shell
|
|
130
|
+
or arbitrary file access. Browser diagnostics and capabilities are development-only.
|
|
131
|
+
|
|
132
|
+
To reuse your existing PRNext Host MCP connection instead of configuring another
|
|
133
|
+
MCP server, opt in from a terminal already logged into Host:
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
prnext login
|
|
137
|
+
prnext dev --host-ai
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
This requires the corresponding Host development-relay update. An older Host
|
|
141
|
+
reports that the relay is unavailable while local development and local MCP keep
|
|
142
|
+
working. The terminal pulls allowlisted requests from Host; it never uploads its
|
|
143
|
+
localhost capability or exposes a public development URL. The existing AI
|
|
144
|
+
connection's workspace, project permissions and revocation still apply. Host
|
|
145
|
+
receives requested development diagnostics and explicitly queued context,
|
|
146
|
+
including screenshots. An unlinked project requires an AI connection with access
|
|
147
|
+
to all projects. Stopping dev closes the shared session; timed-out commands are
|
|
148
|
+
not automatically replayed.
|
|
149
|
+
|
|
150
|
+
The tools include `dev_snapshot`, `dev_logs`, `dev_routes`, `dev_route_ensure`,
|
|
151
|
+
`dev_cache_invalidate`, `dev_source`, `dev_ai_context` and `dev_verify`.
|
|
152
|
+
For a correction loop, read a snapshot, edit the source, then call `dev_verify`
|
|
153
|
+
with that snapshot's `sequence` as `sinceSequence` and the pathname to check.
|
|
154
|
+
Verification requires a newer successful generation and an open browser that
|
|
155
|
+
actually applied that exact build. No new build or no browser evidence returns
|
|
156
|
+
inconclusive. Reported compilation, TypeScript and browser errors fail the check;
|
|
157
|
+
this observation does not replace application tests.
|
|
158
|
+
|
|
159
|
+
The compact screen selector offers Desktop, Phone (390 × 844) and Tablet
|
|
160
|
+
(768 × 1024), with width tooltips and a highlighted active mode. Previews use a
|
|
161
|
+
separate, same-origin page with real CSS viewport dimensions, smooth device
|
|
162
|
+
rotation and their own client console. A minimal dark toolbar controls the
|
|
163
|
+
centered phone, tablet or desktop frame. Toggle Frame to hide the decoration without reloading; this
|
|
164
|
+
choice also survives reloads in the tab. A side handle adjusts width by dragging
|
|
165
|
+
or using the arrow keys. Compact hover and keyboard tooltips show device sizes
|
|
166
|
+
and preview actions; Escape dismisses a tooltip while keeping the preview open.
|
|
167
|
+
Phone and Tablet hide desktop scrollbars while keeping
|
|
168
|
+
scrolling available; Desktop restores the application's scrollbar styles.
|
|
169
|
+
Changing sizes preserves the preview's state; Desktop
|
|
170
|
+
fills the available canvas and Close returns to the original page. This previews
|
|
171
|
+
responsive layout, not a different user agent or touch hardware. Sites that block
|
|
172
|
+
framing must use the browser's device tools instead.
|
|
173
|
+
|
|
174
|
+
The pop-out icons open the console or device preview in separate windows. The
|
|
175
|
+
console remains connected to its source, with its filters and copy controls;
|
|
176
|
+
the dock icon brings it back. Device pop-outs keep their selected dimensions,
|
|
177
|
+
orientation, frame preference and URL, but opening or docking them starts a fresh
|
|
178
|
+
preview instance.
|
|
179
|
+
Reloading or closing the source closes its tool windows. Desktop opens a normal,
|
|
180
|
+
independent app window. The browser may require popups to be allowed for the site.
|
|
181
|
+
|
|
182
|
+
Pure transforms persist in `.prnext-cache/transforms-dev-v1`, independently of
|
|
183
|
+
production entries. The compiler also uses a private V8 cache, pruned at compiler
|
|
184
|
+
startup toward 64 MiB / 2,048 files. Cache failure falls back to recomputation;
|
|
185
|
+
`PRNEXT_BUILD_CACHE=0` disables PRNext's build/compiler caches. No application
|
|
186
|
+
responses, module state or Server Action keys are reused.
|
|
187
|
+
|
|
188
|
+
Loader cache corruption, unavailable storage and failed dependency snapshots
|
|
189
|
+
are cache misses, not build failures. Loader execution errors still fail the
|
|
190
|
+
build. Development Webpack sessions retain up to six compilers with bounded
|
|
191
|
+
memory caches; configuration, environment and plugin identity changes invalidate
|
|
192
|
+
them. Opaque recreated plugins may require a fresh compiler. Safe mode disposes
|
|
193
|
+
these sessions; production Webpack builds remain one-shot.
|
|
194
|
+
Map/Set and binary option values are compared explicitly; opaque configuration
|
|
195
|
+
data uses a fresh compiler. Replace a plugin instance when an unchanged function
|
|
196
|
+
captures external state that is invisible in its configuration.
|
|
197
|
+
|
|
198
|
+
CSS-only updates rebuild the bundles whose recorded dependencies changed and
|
|
199
|
+
retain other stylesheet URLs. Changed CSS Module exports still require a full
|
|
200
|
+
build. Large HMR dependency graphs use compact, bounded control frames and an
|
|
201
|
+
atomic commit; capacity failures report a diagnostic and use complete refreshes.
|
|
202
|
+
|
|
203
|
+
Pages data functions run on request, including `fallback: false` validation.
|
|
204
|
+
Offline HTML prerendering and gzip/Brotli generation remain production-only.
|
|
205
|
+
|
|
206
|
+
CSS uses native Rust-based Lightning CSS by default, with the project's
|
|
207
|
+
Browserslist targets. Custom PostCSS configurations, including Tailwind, keep their
|
|
208
|
+
plugin pipeline. `cssEngine: 'postcss'` selects the previous default pipeline;
|
|
209
|
+
`'lightningcss'` requests the native defaults but still respects a custom pipeline.
|
|
210
|
+
Sass compilation, CSS Modules and relative asset rebasing remain supported.
|
|
211
|
+
|
|
212
|
+
With an existing `tsconfig.json` and application-installed TypeScript, a separate
|
|
213
|
+
watch process reports semantic errors in the overlay without blocking serving.
|
|
214
|
+
It emits no application JavaScript. `typescript: {devChecks: false}` disables
|
|
215
|
+
this watcher. Its incremental metadata lives in the private project cache.
|
|
216
|
+
|
|
217
|
+
Enable `typedRoutes: true` to generate route suggestions and check literal links,
|
|
218
|
+
router navigation and parameter objects. PRNext maintains
|
|
219
|
+
`.prnext-types/routes.d.ts`, references it from `prnext-env.d.ts`, and adds that
|
|
220
|
+
helper to the selected tsconfig's roots while preserving its JSONC comments and
|
|
221
|
+
existing/inherited roots. Missing `next` / `next/*` TypeScript aliases are bound
|
|
222
|
+
to PRNext declarations; existing aliases stay authoritative. Route additions/removals
|
|
223
|
+
refresh the declarations.
|
|
224
|
+
For dynamic paths, use the encoded route helper:
|
|
225
|
+
|
|
226
|
+
```ts
|
|
227
|
+
import {route} from '@thomas.f/prnext';
|
|
228
|
+
router.push(route('/users/[id]', {id: 'alice'}));
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
This is PRNext's route registry, not the Next.js TypeScript language-service plugin.
|
|
232
|
+
Keep generated `.prnext-types/`, `.prnext-dev/` and `.prnext-cache/` out of Git.
|
|
233
|
+
|
|
234
|
+
Generate declarations and check types independently of application compilation:
|
|
235
|
+
|
|
236
|
+
```sh
|
|
237
|
+
prnext check --json
|
|
238
|
+
prnext typegen --json
|
|
239
|
+
prnext typecheck --json
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
`check` reports configuration, routes, React, TypeScript, supported Node and
|
|
243
|
+
native installation diagnostics without installing or compiling anything.
|
|
244
|
+
`typegen` and `typecheck` require application-installed TypeScript and an
|
|
245
|
+
existing tsconfig, including `typescript.tsconfigPath`. They generate route
|
|
246
|
+
declarations unless `typedRoutes: false`, report changes to the selected tsconfig
|
|
247
|
+
and `prnext-env.d.ts`, and preserve JSONC comments and inherited settings.
|
|
248
|
+
`typecheck` fails real type errors even with `ignoreBuildErrors: true`.
|
|
249
|
+
|
|
250
|
+
## Production build tools
|
|
251
|
+
|
|
252
|
+
`prnext build --watch` retains bounded compiler graphs and rebuilds production
|
|
253
|
+
output on source changes. It does not serve the application. Ordinary one-shot
|
|
254
|
+
builds keep using the persistent transformation cache. Each incremental build
|
|
255
|
+
uses fresh Server Action keys and an isolated prerender process. Configuration,
|
|
256
|
+
lockfile and environment-file changes recycle the watch compiler. Stop with Ctrl+C.
|
|
257
|
+
|
|
258
|
+
Integrations can use `const builder = await createBuilder(root)` from
|
|
259
|
+
`@thomas.f/prnext`, call `await builder.build()` after changes, and always finish
|
|
260
|
+
with `await builder.dispose()`.
|
|
261
|
+
|
|
262
|
+
```sh
|
|
263
|
+
prnext analyze
|
|
264
|
+
prnext analyze --json
|
|
265
|
+
prnext analyze --max-js 150
|
|
266
|
+
prnext analyze --baseline ./baseline.json --metric brotli --max-increase-percent 5
|
|
267
|
+
prnext analyze --metric gzip --budgets ./bundle-budgets.json --json
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
The default metric is raw JavaScript. `--metric raw|gzip|brotli` selects the
|
|
271
|
+
budget and comparison metric. `--max-js` is decimal kB per route;
|
|
272
|
+
`--max-increase-bytes` and `--max-increase-percent` limit growth against
|
|
273
|
+
`--baseline` (a saved build-analysis.json) or the previous build.
|
|
274
|
+
Per-route JSON budgets map exact patterns to those same limits, for example
|
|
275
|
+
`{"/": {"maxJs": 150, "maxIncreasePercent": 5}}`. Missing baseline routes fail
|
|
276
|
+
regression budgets instead of silently passing. Budget failures exit 1; invalid
|
|
277
|
+
arguments or analysis inputs exit 2. Reports include gzip/Brotli sizes, the
|
|
278
|
+
largest modules and previous-build changes. Shared chunks are counted once per route; statically
|
|
279
|
+
reachable App client boundaries are included. Conditional boundaries can
|
|
280
|
+
exaggerate actual traffic; arbitrary dynamic imports, CSS, fonts and images are
|
|
281
|
+
excluded. This covers React builds, not imported static HTML. Analysis files stay
|
|
282
|
+
in the private build root, outside public assets.
|
|
283
|
+
|
|
284
|
+
Optional startup module preloading in `prnext.config.mjs`:
|
|
285
|
+
|
|
286
|
+
```js
|
|
287
|
+
export default {
|
|
288
|
+
workerPreload: { routes: ['/', '/api/health'], maxRssMb: 256, timeoutMs: 5000 },
|
|
289
|
+
};
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
This initializes one render host and, when needed, its RSC isolate before accepting
|
|
293
|
+
traffic. Choose up to 16 existing Node route patterns; Edge is unsupported. No
|
|
294
|
+
page render, data hook, action or API handler is invoked. Module initialization
|
|
295
|
+
does execute, including import side effects. RSS is a soft threshold between
|
|
296
|
+
imports, not a hard process cap; a single import can exceed it. Worker retirement
|
|
297
|
+
still applies. Failed/timed-out preloading is logged; ordinary requests can retry.
|
|
298
|
+
|
|
299
|
+
Persistent replacements retain their previous process for 15 seconds after a
|
|
300
|
+
successful traffic switch. A crash or three consecutive failed health probes
|
|
301
|
+
triggers rollback if the previous process is still healthy. Configure this with
|
|
302
|
+
`pstart --rollback-window 30000`, or `0` to disable (maximum 120000 milliseconds).
|
|
303
|
+
`pstatus --json` shows the window and rollback reason. Manual stop cancels
|
|
304
|
+
monitoring. Both processes consume memory during this window; rollback does not
|
|
305
|
+
undo database changes, shared assets, dependency changes or external side effects.
|
|
306
|
+
|
|
307
|
+
HTTP/1 WebSockets tunnel through external HTTP(S) rewrites, `pstart` and
|
|
308
|
+
`prnext host`, with streaming/backpressure and lifetime accounting. The upstream
|
|
309
|
+
must implement WebSockets; Pages/App handlers do not gain a WebSocket server API.
|
|
310
|
+
Other protocols, CONNECT and incomplete handshakes are rejected. Active tunnels
|
|
311
|
+
protect a host from idle retirement; persistent drain deadlines close remaining
|
|
312
|
+
tunnels. Payloads are not buffered in full or replayed.
|
|
313
|
+
|
|
19
314
|
## Install & upgrade
|
|
20
315
|
|
|
21
316
|
Node.js **22.23.4+, 24.22.1+ or 26.12.1+** · Windows, macOS and Linux glibc · x64 and ARM64
|
|
@@ -35,9 +330,19 @@ npx --no-install prnext dev
|
|
|
35
330
|
|
|
36
331
|
Review the dry run before applying migration. Migration backs up your package files and keeps Next.js and your application source. Compatibility checks help find issues; they do not guarantee that every Next.js feature works.
|
|
37
332
|
|
|
333
|
+
Migration detects npm, pnpm and Yarn Classic/Berry from the declared manager and
|
|
334
|
+
lockfiles, and installs from the owning workspace root. Only the selected app
|
|
335
|
+
manifest is migrated; Yarn may resolve the shared dependency graph. Conflicting
|
|
336
|
+
managers, unlisted workspace packages and unsafe filesystem entries block
|
|
337
|
+
automatic installation; `--no-install` prepares the manifest for manual review.
|
|
338
|
+
Failures restore saved manifests and lockfiles when safe. Dependency directories
|
|
339
|
+
and manager caches can contain partial installation results and are not rolled
|
|
340
|
+
back. No global manager installation or forced peer-dependency bypass is used.
|
|
341
|
+
|
|
38
342
|
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.
|
|
39
343
|
|
|
40
|
-
`reactCompiler: false`
|
|
344
|
+
`reactCompiler: false` is supported; enabling React Compiler still fails explicitly.
|
|
345
|
+
`typedRoutes: true` enables PRNext's generated route declarations (see Development).
|
|
41
346
|
|
|
42
347
|
The current source candidate also supports `devIndicators: false`, configured
|
|
43
348
|
`experimental.optimizePackageImports` for pure ESM barrels with `sideEffects: false`,
|
|
@@ -72,12 +377,39 @@ discarded. General request ingress remains capped at 32 MiB and Server Actions a
|
|
|
72
377
|
8 MiB. PostgreSQL's `pg` stays external by default so its optional native driver
|
|
73
378
|
remains lazy; explicitly putting `pg` in `transpilePackages` opts out.
|
|
74
379
|
|
|
380
|
+
The unreleased 0.1.17 candidate also persists pure transformations and
|
|
381
|
+
prepared runtime bundles under `.prnext-cache`. Cache keys include framework and
|
|
382
|
+
tool versions, source/options, project dependencies and environment fingerprints.
|
|
383
|
+
Corrupt entries are discarded; builds still generate fresh manifests and Server
|
|
384
|
+
Action registrations. `PRNEXT_BUILD_CACHE=0` disables these two caches.
|
|
385
|
+
|
|
386
|
+
Node workers use `.prnext-cache/node-compile-v1` for V8 bytecode, with startup
|
|
387
|
+
pruning toward 128 MiB / 4,096 files. This caches compilation, never module globals
|
|
388
|
+
or page responses; it is not a filesystem quota.
|
|
389
|
+
`PRNEXT_WORKER_COMPILE_CACHE=0` opts out; explicit `NODE_COMPILE_CACHE` and
|
|
390
|
+
`NODE_DISABLE_COMPILE_CACHE` settings take precedence. Cache directories contain
|
|
391
|
+
private compiled code: keep `.prnext-cache` out of source control and public roots.
|
|
392
|
+
Deleting them is safe when no build or worker is using the project.
|
|
393
|
+
|
|
394
|
+
Immutable HTML and browser assets now receive validated `.br` and `.gz` sidecars
|
|
395
|
+
when compression saves bytes. Rust serves the negotiated representation directly;
|
|
396
|
+
mutable public files and dynamic responses are not Brotli-precompressed.
|
|
397
|
+
`pstart` uses one shared Rust HTTP proxy per supervisor, keeping health checks,
|
|
398
|
+
restart/stop recovery and logs in its existing Node lifecycle manager. HTTP/1
|
|
399
|
+
WebSockets tunnel to configured upstreams; other protocol upgrades are rejected.
|
|
400
|
+
|
|
75
401
|
Google font build inputs are cached under `.prnext-cache/fonts-v1` (64 MiB,
|
|
76
402
|
256 entries, verified content hashes). A warm cache permits offline rebuilding;
|
|
77
403
|
a cold build still needs access to Google's font endpoints. Remove this cache to
|
|
78
404
|
refresh downloaded font inputs. This does not cache dynamic page responses.
|
|
79
405
|
|
|
80
|
-
Set `typescript: {}` to check an existing `tsconfig.json` during production builds
|
|
406
|
+
Set `typescript: {}` to check an existing `tsconfig.json` during production builds
|
|
407
|
+
using the application's installed TypeScript. `typescript.tsconfigPath` selects
|
|
408
|
+
its configuration, including inherited aliases. `ignoreBuildErrors: true` skips
|
|
409
|
+
that production gate. Omitting `typescript` keeps production transpile-only;
|
|
410
|
+
development checks run independently in the background unless `devChecks: false`.
|
|
411
|
+
Checks do not emit application files or install packages. Only opt-in typed route
|
|
412
|
+
generation adds declarations and adjusts tsconfig roots as described above.
|
|
81
413
|
|
|
82
414
|
</details>
|
|
83
415
|
|
|
@@ -198,7 +530,8 @@ apply to admission, not the duration of an accepted response. Cancelling a queue
|
|
|
198
530
|
caller releases its slot. An already running filesystem operation keeps its
|
|
199
531
|
permit until it settles, including a pending file read after a client disconnects;
|
|
200
532
|
an operating-system call cannot be forcibly cancelled safely. Large file bodies
|
|
201
|
-
use a one-frame channel with backpressure.
|
|
533
|
+
use a one-frame channel with backpressure. Without an explicit whole-request
|
|
534
|
+
timeout, no deadline cuts off an active stream.
|
|
202
535
|
Their asynchronous open/read operations retain a file-response permit; they are
|
|
203
536
|
not included in the helper-task queue counter. These controls are not a global
|
|
204
537
|
limit on application or background I/O.
|
|
@@ -223,7 +556,7 @@ released work, rejections, timeouts, cancelled waits and wait duration. Their
|
|
|
223
556
|
allocation overhead, request objects, bodies and TCP/kernel buffers. Use process
|
|
224
557
|
memory measurements for the total footprint. Metrics never initialize admission
|
|
225
558
|
settings or override values selected at startup.
|
|
226
|
-
`activeJobs`
|
|
559
|
+
`activeJobs` counts transport jobs in the shared worker pool;
|
|
227
560
|
`queuedJobs` excludes HTTP callers waiting before transport admission.
|
|
228
561
|
`laneIdleRetirements` includes release of a cancelled lane's retained host
|
|
229
562
|
reference, so it is not a count of distinct TCP connections closed. Host starts
|
|
@@ -233,6 +566,24 @@ sampling timer.
|
|
|
233
566
|
`--inspect` additionally records Node startup, module and RSC initialization
|
|
234
567
|
phases; use uninstrumented runs for throughput comparisons.
|
|
235
568
|
|
|
569
|
+
`prnext inspect --json` also reports fixed request stages: admission, render
|
|
570
|
+
start, request-body admission/read, worker queue/first byte/headers, HTTP headers,
|
|
571
|
+
response body and total lifetime. Completed, failed, cancelled and timed-out
|
|
572
|
+
samples are distinct; byte and concurrency budgets report occupancy, peaks and
|
|
573
|
+
rejections. Stages overlap and are not CPU timings. Local OTLP export includes
|
|
574
|
+
`prnext.request.stage.duration`; neither metric includes query strings, request
|
|
575
|
+
headers or body content.
|
|
576
|
+
|
|
577
|
+
`PRNEXT_QUEUE_WAIT_MS=1..3600000` sets the worker/body queue wait (default
|
|
578
|
+
30000 ms); render admission and start share one queue deadline.
|
|
579
|
+
`PRNEXT_REQUEST_TIMEOUT_MS=0..3600000` optionally limits the whole HTTP lifetime,
|
|
580
|
+
including upload, middleware and response consumption by the HTTP layer.
|
|
581
|
+
The default 0 disables it. Expiry before headers returns 504; expiry after
|
|
582
|
+
headers terminates the stream and releases its capacity, including when the
|
|
583
|
+
consumer stops polling. This is not proof of delivery to a remote client.
|
|
584
|
+
Completed responses do not cancel tracked `after()` or cache finalization work.
|
|
585
|
+
Route `maxDuration` remains an independent render limit.
|
|
586
|
+
|
|
236
587
|
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.
|
|
237
588
|
|
|
238
589
|
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.
|
|
@@ -303,6 +654,30 @@ Under concurrent streaming, `memory` used 179 MiB versus 207 MiB for `balanced`,
|
|
|
303
654
|
|
|
304
655
|
### Build adapters
|
|
305
656
|
|
|
657
|
+
Plain HTML/CSS/JavaScript sites need no package.json or React source tree:
|
|
658
|
+
|
|
659
|
+
```sh
|
|
660
|
+
prnext build ./my-site
|
|
661
|
+
prnext start ./my-site
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
An `index.html` at the project root is detected automatically. Explicitly select
|
|
665
|
+
it with `prnext build --adapter static --from .`. Root mode copies browser asset
|
|
666
|
+
extensions only; it omits dotfiles, npm metadata, JSON data, source/server folders,
|
|
667
|
+
configuration and server scripts. Put additional public data in a dedicated output
|
|
668
|
+
directory and import it with `--from`; do not put secrets in browser assets.
|
|
669
|
+
|
|
670
|
+
After running another builder, `prnext build --adapter auto` finds a completed
|
|
671
|
+
`dist`, `build`, `out` or `.output/public` directory. Multiple outputs require an
|
|
672
|
+
explicit `--from` choice. This command never runs another builder or its config.
|
|
673
|
+
Vite (including React, Vue, Svelte and Solid browser apps), Astro static output,
|
|
674
|
+
SvelteKit with `adapter-static`, and Nuxt generated output can use the same static
|
|
675
|
+
runtime. Keep each framework's server rendering and API routes out of the import.
|
|
676
|
+
See [Vite deployment](https://vite.dev/guide/static-deploy.html),
|
|
677
|
+
[Astro deployment](https://docs.astro.build/en/guides/deploy/),
|
|
678
|
+
[SvelteKit static generation](https://svelte.dev/docs/kit/adapter-static), and
|
|
679
|
+
[Nuxt deployment](https://nuxt.com/docs/4.x/getting-started/deployment).
|
|
680
|
+
|
|
306
681
|
PRNext keeps its React/Next-convention build as the default. The source candidate
|
|
307
682
|
also imports static browser builds produced by Vite or another framework:
|
|
308
683
|
|
|
@@ -320,7 +695,7 @@ it is not part of the previously published alpha package.
|
|
|
320
695
|
|
|
321
696
|
Every new build writes a versioned `build-output.json`. Inspect it with
|
|
322
697
|
`prnext output --json`. See the [adapter contract](packages/prnext/build/ADAPTERS.md)
|
|
323
|
-
and [compatibility scope](COMPATIBILITY.md) for supported inputs and boundaries.
|
|
698
|
+
and [compatibility scope](https://github.com/Lorkydey/PRNext/blob/main/COMPATIBILITY.md) for supported inputs and boundaries.
|
|
324
699
|
|
|
325
700
|
<details>
|
|
326
701
|
<summary><strong>Deploy to PRNext Cloud (local development)</strong></summary>
|
|
@@ -458,7 +833,7 @@ The watchdog samples the RSS of each app's native server and descendants about o
|
|
|
458
833
|
|
|
459
834
|
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.
|
|
460
835
|
|
|
461
|
-
Hosting supports HTTP streaming and preserves the original application Host.
|
|
836
|
+
Hosting supports HTTP streaming and preserves the original application Host. HTTP/1 WebSockets tunnel to configured upstreams; other protocol upgrades are rejected. 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.
|
|
462
837
|
|
|
463
838
|
</details>
|
|
464
839
|
|
|
@@ -479,11 +854,11 @@ prnext prestart web
|
|
|
479
854
|
prnext pstop web
|
|
480
855
|
```
|
|
481
856
|
|
|
482
|
-
`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
|
|
857
|
+
`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 shared Rust HTTP proxy and two supervisor processes; it does not enable the idle sleep or memory reservations of `prnext host`.
|
|
483
858
|
|
|
484
859
|
`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.
|
|
485
860
|
|
|
486
|
-
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.
|
|
861
|
+
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. HTTP/1 WebSockets tunnel to configured upstreams; other protocol upgrades are rejected. 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.
|
|
487
862
|
|
|
488
863
|
Available commands:
|
|
489
864
|
|
package/build/ADAPTERS.md
CHANGED
|
@@ -39,6 +39,31 @@ its implementation-specific fields are not made stable by this public envelope.
|
|
|
39
39
|
|
|
40
40
|
## Static adapter
|
|
41
41
|
|
|
42
|
+
Plain HTML/CSS/JavaScript sites need no package.json or React source tree:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
prnext build ./my-site
|
|
46
|
+
prnext start ./my-site
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
An `index.html` at the project root is detected automatically. Explicitly select
|
|
50
|
+
it with `prnext build --adapter static --from .`. Root mode copies browser asset
|
|
51
|
+
extensions only; it omits dotfiles, npm metadata, JSON data, source/server folders,
|
|
52
|
+
configuration and server scripts. Put additional public data in a dedicated output
|
|
53
|
+
directory and import it with `--from`; do not put secrets in browser assets.
|
|
54
|
+
|
|
55
|
+
After running another builder, `prnext build --adapter auto` finds a completed
|
|
56
|
+
`dist`, `build`, `out` or `.output/public` directory. Multiple outputs require an
|
|
57
|
+
explicit `--from` choice. This command never runs another builder or its config.
|
|
58
|
+
Vite (including React, Vue, Svelte and Solid browser apps), Astro static output,
|
|
59
|
+
SvelteKit with `adapter-static`, and Nuxt generated output can use the same static
|
|
60
|
+
runtime. Keep each framework's server rendering and API routes out of the import.
|
|
61
|
+
See [Vite deployment](https://vite.dev/guide/static-deploy.html),
|
|
62
|
+
[Astro deployment](https://docs.astro.build/en/guides/deploy/),
|
|
63
|
+
[SvelteKit static generation](https://svelte.dev/docs/kit/adapter-static), and
|
|
64
|
+
[Nuxt deployment](https://nuxt.com/docs/4.x/getting-started/deployment).
|
|
65
|
+
|
|
66
|
+
|
|
42
67
|
Build the application with its own tool, then import **only** its public browser
|
|
43
68
|
output. Vite's default output is `dist`; see its [deployment guide](https://vite.dev/guide/static-deploy.html).
|
|
44
69
|
|
|
@@ -87,7 +112,7 @@ dotted client route names need explicit HTML output for those URLs. Configure th
|
|
|
87
112
|
source builder's asset base for its deployed URL; the adapter does not rewrite JS
|
|
88
113
|
or HTML assets or infer subpath hosting configuration.
|
|
89
114
|
|
|
90
|
-
|
|
115
|
+
Dedicated public source directories must be inside the project, separate from the destination,
|
|
91
116
|
with real directories and files. Symlinks, dotfiles other than a root `.well-known`
|
|
92
117
|
tree, `node_modules`, reserved `_next`/`_prnext` paths and a root `server` directory
|
|
93
118
|
are rejected. Limits are 20,000 files, 512 MiB total and 64 directory levels.
|
|
@@ -114,7 +139,7 @@ change existing PRNext Host projects or enable generic SSR hosting.
|
|
|
114
139
|
|
|
115
140
|
## Extending adapters
|
|
116
141
|
|
|
117
|
-
The
|
|
142
|
+
The output adapter names are `react` and `static`. Build selection also accepts `auto`, which inspects completed output and never starts a third-party builder. Unknown adapters fail rather
|
|
118
143
|
than being silently interpreted as React. Add a new adapter only with a documented
|
|
119
144
|
runtime model and integration tests. A future generic Node SSR adapter needs its
|
|
120
145
|
own request/response, streaming, cancellation, crash and shutdown contract; a
|
package/build/actions.mjs
CHANGED
|
@@ -202,6 +202,11 @@ export function createServerActions({ projectRoot }) {
|
|
|
202
202
|
|
|
203
203
|
return {
|
|
204
204
|
actions, actionKey,
|
|
205
|
+
// Only compiler-generated module-level action proxies bypass React Refresh.
|
|
206
|
+
// Their random reference IDs change each build; they are not component exports.
|
|
207
|
+
isServerModule(source,file) {
|
|
208
|
+
return source.includes('use server') && analyze(source,file).moduleServer === true;
|
|
209
|
+
},
|
|
205
210
|
transform(source,file,mode) {
|
|
206
211
|
if(!source.includes('use server')) return source;
|
|
207
212
|
const result=analyze(source,file);
|