feat: keep dev server alive during HMR updates
This commit is contained in:
@@ -64,7 +64,7 @@ interface RunningServer {
|
||||
}
|
||||
```
|
||||
|
||||
In development, `startServer` also connects `app/db/migrations` (and `app/db/<name>/migrations`) and auto-applies migrations, then starts an in-process file watcher. CSS edits hot-swap live; any other server change triggers `process.exit(RESTART_EXIT_CODE)` so the dev supervisor (`@wrnexus/cli`) respawns the process with fresh modules.
|
||||
In development, `startServer` also connects `app/db/migrations` (and `app/db/<name>/migrations`) and auto-applies migrations, then starts an in-process file watcher. CSS edits hot-swap live. Page, component, layout, API, middleware, realtime, schema, locale, and public-asset edits invalidate only their cached modules, rescan routes where necessary, and morph fresh HTML through the existing HMR WebSocket. The server process and active gateway stay running.
|
||||
|
||||
### `createHandlers(deps)`
|
||||
|
||||
@@ -142,7 +142,7 @@ interface ProdOptions {
|
||||
|
||||
### `startGateway(opts)` — multi-app gateway
|
||||
|
||||
Serves several apps behind one port and routes each request to the right app by its `Host` header. Each app runs as its own child process (full isolation); the gateway is a thin host-based reverse proxy for HTTP and WebSocket. In development, the gateway supervises every child: editing a page, component, API, or middleware restarts only that app and the HMR client reconnects to display the latest page. Apps communicate at runtime via `@wrnexus/pubsub` (use the Redis driver so messages cross processes).
|
||||
Serves several apps behind one port and routes each request to the right app by its `Host` header. Each app runs as its own child process (full isolation); the gateway is a thin host-based reverse proxy for HTTP and WebSocket. In development, normal application edits are applied inside the existing child and sent through its existing HMR connection. The child supervisor remains as crash recovery rather than the normal update path. Apps communicate at runtime via `@wrnexus/pubsub` (use the Redis driver so messages cross processes).
|
||||
|
||||
```ts
|
||||
interface GatewayOptions {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wrnexus/dev-server",
|
||||
"version": "0.2.20",
|
||||
"version": "0.2.21",
|
||||
"type": "module",
|
||||
"description": "@wrnexus/dev-server — part of the WrNexus framework.",
|
||||
"license": "MIT",
|
||||
@@ -25,18 +25,18 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@wrnexus/core": "^0.2.20",
|
||||
"@wrnexus/router": "^0.2.20",
|
||||
"@wrnexus/ssr": "^0.2.20",
|
||||
"@wrnexus/csr": "^0.2.20",
|
||||
"@wrnexus/compiler": "^0.2.20",
|
||||
"@wrnexus/styles": "^0.2.20",
|
||||
"@wrnexus/ui": "^0.2.20",
|
||||
"@wrnexus/validation": "^0.2.20",
|
||||
"@wrnexus/i18n": "^0.2.20",
|
||||
"@wrnexus/db": "^0.2.20",
|
||||
"@wrnexus/pubsub": "^0.2.20",
|
||||
"@wrnexus/uploader": "^0.2.20"
|
||||
"@wrnexus/core": "^0.2.21",
|
||||
"@wrnexus/router": "^0.2.21",
|
||||
"@wrnexus/ssr": "^0.2.21",
|
||||
"@wrnexus/csr": "^0.2.21",
|
||||
"@wrnexus/compiler": "^0.2.21",
|
||||
"@wrnexus/styles": "^0.2.21",
|
||||
"@wrnexus/ui": "^0.2.21",
|
||||
"@wrnexus/validation": "^0.2.21",
|
||||
"@wrnexus/i18n": "^0.2.21",
|
||||
"@wrnexus/db": "^0.2.21",
|
||||
"@wrnexus/pubsub": "^0.2.21",
|
||||
"@wrnexus/uploader": "^0.2.21"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
|
||||
Reference in New Issue
Block a user