@kiln-js/adapter-node 0.4.2 → 0.4.3

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.
Files changed (2) hide show
  1. package/README.md +46 -62
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,62 +1,46 @@
1
- # @kiln-js/adapter-node
2
-
3
- [![npm](https://img.shields.io/npm/v/%40kiln-js%2Fadapter-node)](https://www.npmjs.com/package/@kiln-js%2Fadapter-node)
4
- [![license](https://img.shields.io/npm/l/%40kiln-js%2Fadapter-node)](LICENSE)
5
-
6
- Node.js standalone server output for the Kiln framework
7
-
8
- Part of [Kiln](https://github.com/kiln-js/kiln), a file-based server-side rendering framework for React and Vite.
9
-
10
- ## Install
11
-
12
- ```bash
13
- bun add -d @kiln-js/adapter-node
14
- ```
15
-
16
- ## Usage
17
-
18
- ```ts
19
- import { adaptNode } from "@kiln-js/adapter-node";
20
-
21
- await adaptNode({
22
- root: process.cwd(),
23
- clientOut: "dist/client",
24
- serverOut: "dist/server",
25
- clientRel: "app/client.tsx",
26
- port: 3000,
27
- });
28
- ```
29
-
30
- Then start the generated server:
31
-
32
- ```bash
33
- node dist/node/server.mjs
34
- ```
35
-
36
- `adaptNode` writes `dist/node/server.mjs`, which serves static assets from `clientOut` (with immutable caching for hashed `assets/` files, `ETag` / `304` support, and level-1 `gzip` compression for compressible responses over 1 KB) and delegates remaining requests to `createHandler` from `serverOut/server.js`.
37
-
38
- ### Port precedence and configuration
39
-
40
- When `dist/node/server.mjs` is executed directly, the listening port resolves in order:
41
-
42
- 1. `process.env.PORT`
43
- 2. `server.port` in `.kiln/kiln.config.cjs` (if present)
44
- 3. The `port` option passed to `adaptNode` (defaults to `3000`)
45
-
46
- You can also import `start(port?)` from `dist/node/server.mjs` to start the server programmatically and receive the underlying `http.Server` instance.
47
-
48
- ## Requirements
49
-
50
- Node.js at runtime (with `node:http`, `node:fs`, `node:path`, `node:zlib`, `node:url`, and `node:module` support) and a Vite client manifest at `<clientOut>/.vite/manifest.json` alongside a built `<serverOut>/server.js` exporting `createHandler`.
51
-
52
- ## Documentation
53
-
54
- See the [Kiln repository](https://github.com/kiln-js/kiln) for the full API reference and guides.
55
-
56
- ## Development
57
-
58
- This repository is generated from the Kiln monorepo. Make changes there, then run `scripts/publish-repo.ps1` to publish them here. Report issues in this repository, and send pull requests to the monorepo.
59
-
60
- ## License
61
-
62
- MIT
1
+ # @kiln-js/adapter-node
2
+
3
+ [![npm](https://img.shields.io/npm/v/%40kiln-js%2Fadapter-node)](https://www.npmjs.com/package/@kiln-js/adapter-node)
4
+ [![license](https://img.shields.io/npm/l/%40kiln-js%2Fadapter-node)](LICENSE)
5
+
6
+ Node.js production server for the Kiln framework
7
+
8
+ Part of [Kiln](https://github.com/kiln-js/kiln), a file-based server-side rendering framework for React and Vite.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ bun add -d @kiln-js/adapter-node
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```ts
19
+ import { adaptNode } from "@kiln-js/adapter-node";
20
+
21
+ await adaptNode({
22
+ root: process.cwd(),
23
+ clientOut: "dist/client",
24
+ serverOut: "dist/server",
25
+ clientRel: "app/client.tsx",
26
+ port: 3000,
27
+ });
28
+ ```
29
+
30
+ ## Running the server
31
+
32
+ Start the generated server with `node dist/node/server.mjs`, or import `start(port?)` to run it programmatically.
33
+ Static assets are served from `clientOut` with `ETag`/`304` handling, immutable caching for hashed `assets/` files, and level-1 `gzip` compression for compressible payloads over 1 KB.
34
+ Port precedence is `process.env.PORT`, `server.port` in `.kiln/kiln.config.cjs`, then the `port` option (default `3000`).
35
+
36
+ ## Documentation
37
+
38
+ See the [Kiln repository](https://github.com/kiln-js/kiln) for the full API reference and guides.
39
+
40
+ ## Development
41
+
42
+ This repository is generated from the Kiln monorepo. Make changes there, then run `scripts/publish-repo.ps1` to publish them here. Report issues in this repository, and send pull requests to the monorepo.
43
+
44
+ ## License
45
+
46
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiln-js/adapter-node",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Node.js production server for the Kiln framework",
5
5
  "license": "MIT",
6
6
  "type": "module",