@jk2908/solas 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +7 -5
- package/dist/adapters/cloudflare/vite.js +1 -1
- package/dist/internal/codegen/environments.js +1 -1
- package/dist/{adapters → runtime}/node.d.ts +2 -2
- package/dist/{adapters → runtime}/node.js +2 -2
- package/package.json +9 -9
- /package/dist/{adapters → runtime}/cloudflare/assets.d.ts +0 -0
- /package/dist/{adapters → runtime}/cloudflare/assets.js +0 -0
- /package/dist/{adapters/cloudflare/runtime.d.ts → runtime/cloudflare/index.d.ts} +0 -0
- /package/dist/{adapters/cloudflare/runtime.js → runtime/cloudflare/index.js} +0 -0
- /package/dist/{adapters → runtime}/cloudflare/worker.d.ts +0 -0
- /package/dist/{adapters → runtime}/cloudflare/worker.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Breaking
|
|
6
|
+
|
|
7
|
+
- Runtime helpers moved out of `@jk2908/solas/adapters/*`: `serve` is now a named export from `@jk2908/solas/runtime/node`, and `createWorker`/`createCloudflareAssets` are now `@jk2908/solas/runtime/cloudflare`. The old `@jk2908/solas/adapters/node` and `@jk2908/solas/adapters/cloudflare/runtime` entries are removed. `@jk2908/solas/adapters/*` now contains build adapters only.
|
|
8
|
+
|
|
3
9
|
## 0.13.2
|
|
4
10
|
|
|
5
11
|
### Changed
|
package/README.md
CHANGED
|
@@ -659,18 +659,18 @@ Because workers have no filesystem, the Worker reads its own output through the
|
|
|
659
659
|
`cloudflare()` forwards its `cloudflare` option to `@cloudflare/vite-plugin`. To build a Worker manually, `createWorker` composes the entry behaviour, and `createCloudflareAssets` builds the store directly:
|
|
660
660
|
|
|
661
661
|
```ts
|
|
662
|
-
import { createCloudflareAssets } from '@jk2908/solas/
|
|
662
|
+
import { createCloudflareAssets } from '@jk2908/solas/runtime/cloudflare'
|
|
663
663
|
|
|
664
664
|
const assets = createCloudflareAssets(env)
|
|
665
665
|
```
|
|
666
666
|
|
|
667
667
|
## Node
|
|
668
668
|
|
|
669
|
-
`vite dev` and `vite preview` already run the built handler in Node (via `@vitejs/plugin-rsc`'s default server handler), so nothing extra is needed locally. For a production Node server, use `@jk2908/solas/
|
|
669
|
+
`vite dev` and `vite preview` already run the built handler in Node (via `@vitejs/plugin-rsc`'s default server handler), so nothing extra is needed locally. For a production Node server, use `@jk2908/solas/runtime/node`:
|
|
670
670
|
|
|
671
671
|
```ts
|
|
672
672
|
// server.ts
|
|
673
|
-
import serve from '@jk2908/solas/
|
|
673
|
+
import { serve } from '@jk2908/solas/runtime/node'
|
|
674
674
|
|
|
675
675
|
await serve()
|
|
676
676
|
```
|
|
@@ -686,6 +686,8 @@ await serve()
|
|
|
686
686
|
|
|
687
687
|
`serve()` loads the built RSC entry (`dist/rsc/index.js` by default) and forwards requests to its fetch handler, which already serves prerendered routes, client assets, and RSC/SSR responses. Options: `port` (defaults to `PORT` or `3000`), `host`, `outDir`, and `entry`. Run from the project root so the handler can resolve `dist`.
|
|
688
688
|
|
|
689
|
+
`serve` is a runtime helper, not a build adapter: it starts an HTTP server and returns it, so it belongs in `server.ts`. Do not pass it to `solas({ adapter })`; that option expects an `Adapter` with `name` and `plugins`, such as `cloudflare()` or the static adapter.
|
|
690
|
+
|
|
689
691
|
Bun and Deno do not need the helper. Their native servers pass the handler a `Request` directly and expect a `Response`, so the Node-specific HTTP-to-Fetch bridging (streams, `duplex`, backpressure) is not needed:
|
|
690
692
|
|
|
691
693
|
```ts
|
|
@@ -702,7 +704,7 @@ import handler from './dist/rsc/index.js'
|
|
|
702
704
|
Deno.serve(request => handler.fetch(request))
|
|
703
705
|
```
|
|
704
706
|
|
|
705
|
-
The handler reads `dist` through `node:fs`, which Bun and Deno (2.x, via Node compat) provide. Run from the project root. Bun can also run `@jk2908/solas/
|
|
707
|
+
The handler reads `dist` through `node:fs`, which Bun and Deno (2.x, via Node compat) provide. Run from the project root. Bun can also run `@jk2908/solas/runtime/node` as-is, since it implements `node:http`.
|
|
706
708
|
|
|
707
709
|
## Static
|
|
708
710
|
|
|
@@ -731,7 +733,7 @@ Server actions and runtime endpoints also need a server, so the build warns when
|
|
|
731
733
|
|
|
732
734
|
## Runtime
|
|
733
735
|
|
|
734
|
-
At request time Solas reads its output through an `Assets` interface (`exists`/`readText`/`readBuffer`/`mimeType`) injected into `createHandler`, defaulting to the Node standard library (which Bun runs natively). References are logical (`{ namespace, path }`), where the namespaces are `client` (Vite client output), `static` (full prerenders), and `artifact` (runtime manifest and ppr files). Platforms without a filesystem provide their own store; `@jk2908/solas/
|
|
736
|
+
At request time Solas reads its output through an `Assets` interface (`exists`/`readText`/`readBuffer`/`mimeType`) injected into `createHandler`, defaulting to the Node standard library (which Bun runs natively). References are logical (`{ namespace, path }`), where the namespaces are `client` (Vite client output), `static` (full prerenders), and `artifact` (runtime manifest and ppr files). Platforms without a filesystem provide their own store; `@jk2908/solas/runtime/cloudflare` builds one around the `ASSETS` binding via `createWorker`. Build-time reads and writes use `node:fs` directly and are not abstracted.
|
|
735
737
|
|
|
736
738
|
## Scripts
|
|
737
739
|
|
|
@@ -4,7 +4,7 @@ import { cloudflare as cloudflareVitePlugin } from '@cloudflare/vite-plugin';
|
|
|
4
4
|
import * as Config from '../../config.js';
|
|
5
5
|
import { writeCloudflareEntry } from '../../internal/codegen/environments.js';
|
|
6
6
|
import { setPrerenderImport, setRscEntry } from '../../internal/postbuild.js';
|
|
7
|
-
import { NAMESPACE_PREFIX } from '
|
|
7
|
+
import { NAMESPACE_PREFIX } from '../../runtime/cloudflare/assets.js';
|
|
8
8
|
import { withBindingsShim } from './bindings.js';
|
|
9
9
|
const VIRTUAL_ENTRY = 'virtual:solas-cloudflare-entry';
|
|
10
10
|
/**
|
|
@@ -31,7 +31,7 @@ export function writeCloudflareEntry() {
|
|
|
31
31
|
return source `
|
|
32
32
|
${AUTOGEN_MSG}
|
|
33
33
|
|
|
34
|
-
import { createWorker } from '${Config.PKG_NAME}/
|
|
34
|
+
import { createWorker } from '${Config.PKG_NAME}/runtime/cloudflare'
|
|
35
35
|
|
|
36
36
|
import { manifest } from './manifest.js'
|
|
37
37
|
import { importMap } from './maps.js'
|
|
@@ -38,7 +38,7 @@ export type Server = http.Server & AsyncDisposable;
|
|
|
38
38
|
* Deno and Bun do not need this helper: use `Deno.serve(handler.fetch)` or
|
|
39
39
|
* `Bun.serve({ fetch: handler.fetch })` directly.
|
|
40
40
|
*/
|
|
41
|
-
declare function
|
|
41
|
+
declare function serve(options?: ServeOptions): Promise<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> & {
|
|
42
42
|
[Symbol.asyncDispose](): Promise<void>;
|
|
43
43
|
}>;
|
|
44
|
-
export {
|
|
44
|
+
export { serve };
|
|
@@ -151,7 +151,7 @@ async function sendResponse(res, response) {
|
|
|
151
151
|
* Deno and Bun do not need this helper: use `Deno.serve(handler.fetch)` or
|
|
152
152
|
* `Bun.serve({ fetch: handler.fetch })` directly.
|
|
153
153
|
*/
|
|
154
|
-
async function
|
|
154
|
+
async function serve(options = {}) {
|
|
155
155
|
const outDir = options.outDir ?? 'dist';
|
|
156
156
|
const entry = path.resolve(options.entry ?? path.join(outDir, 'rsc', 'index.js'));
|
|
157
157
|
const port = options.port ?? (Number(process.env.PORT) || 3000);
|
|
@@ -194,4 +194,4 @@ async function adapter(options = {}) {
|
|
|
194
194
|
},
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
-
export {
|
|
197
|
+
export { serve };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jk2908/solas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "A Vite + React meta-framework exploring streaming, Server Components, and partial prerendering. Designed for simplicity and lightness",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -73,17 +73,17 @@
|
|
|
73
73
|
"types": "./dist/adapters/cloudflare/index.d.ts",
|
|
74
74
|
"import": "./dist/adapters/cloudflare/index.js"
|
|
75
75
|
},
|
|
76
|
-
"./adapters/cloudflare/runtime": {
|
|
77
|
-
"types": "./dist/adapters/cloudflare/runtime.d.ts",
|
|
78
|
-
"import": "./dist/adapters/cloudflare/runtime.js"
|
|
79
|
-
},
|
|
80
|
-
"./adapters/node": {
|
|
81
|
-
"types": "./dist/adapters/node.d.ts",
|
|
82
|
-
"import": "./dist/adapters/node.js"
|
|
83
|
-
},
|
|
84
76
|
"./adapters/static": {
|
|
85
77
|
"types": "./dist/adapters/static.d.ts",
|
|
86
78
|
"import": "./dist/adapters/static.js"
|
|
79
|
+
},
|
|
80
|
+
"./runtime/cloudflare": {
|
|
81
|
+
"types": "./dist/runtime/cloudflare/index.d.ts",
|
|
82
|
+
"import": "./dist/runtime/cloudflare/index.js"
|
|
83
|
+
},
|
|
84
|
+
"./runtime/node": {
|
|
85
|
+
"types": "./dist/runtime/node.d.ts",
|
|
86
|
+
"import": "./dist/runtime/node.js"
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|