@jk2908/solas 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.3 - 2026-05-27
4
+
5
+ - Updated README docs to show that `dynamic()` must be awaited in request-time deferred `ppr` usage examples.
6
+ - Clarified route docs for `+endpoint.ts`, including that endpoint files can be placed anywhere in `app/` and how GET requests are resolved when `+page.tsx` and `+endpoint.ts` share a route.
7
+ - Tightened README language around experimental status, `url`, and `trustedOrigins`/CSRF guidance.
8
+
3
9
  ## 0.4.2 - 2026-05-22
4
10
 
5
11
  - Changed `precompress` to default to `false`, so Solas no longer emits precompressed build output unless you opt in.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Solas is a minimal React meta-framework powered by Vite, created for experimenting with routing, streaming, and prerendering with React Server Components.
4
4
 
5
- It has not been rigorously tested yet (there are currently no automated tests) ... and broken behaviour should be expected.
5
+ Solas is experimental and currently has no automated test suite, so expect rough edges.
6
6
 
7
7
  Solas currently requires Bun 1.2+ on your `PATH`. You can still manage dependencies with `npm`, `pnpm`, or `yarn`, but the Solas CLI and Vite plugin runtime use Bun APIs directly.
8
8
 
@@ -56,7 +56,7 @@ Use these filename conventions:
56
56
 
57
57
  - `+layout.tsx`: shared layout for a route branch.
58
58
  - `+page.tsx`: page component for a route.
59
- - `+endpoint.ts`: request handler for non-page routes.
59
+ - `+endpoint.ts`: request handler. Can be placed in any folder and responds to all HTTP methods for its route path.
60
60
  - `+middleware.ts`: middleware that runs for the current route branch and is inherited by child routes. Parent and child middleware stack together.
61
61
  - `+loading.tsx`: loading fallback inherited by child routes.
62
62
  - `+401.tsx`: boundary for unauthorised responses in the current route branch and its children.
@@ -68,6 +68,13 @@ Nested folders create nested routes. Dynamic segments use `[param]`, and catch-a
68
68
 
69
69
  Status boundaries follow the same override pattern as layouts: a child route uses the nearest matching boundary file above it, and a more specific boundary replaces a parent one.
70
70
 
71
+ If a route has both `+page.tsx` and `+endpoint.ts`, Solas selects the GET handler by `Accept` header:
72
+
73
+ - `Accept: text/html` or `text/x-component`: render `+page.tsx`
74
+ - other GET requests (for example `application/json`): run `+endpoint.ts` `GET`
75
+
76
+ Non-GET methods (`POST`, `PUT`, `PATCH`, `DELETE`) always run `+endpoint.ts`.
77
+
71
78
  ## Config
72
79
 
73
80
  All Solas options are passed to `solas()` inside `defineConfig`.
@@ -81,14 +88,9 @@ Solas resolves it in this order:
81
88
  - the `url` option passed to `solas()`
82
89
  - `VITE_APP_URL`
83
90
 
84
- Current behaviour:
91
+ Solas exposes the resolved value as `import.meta.env.VITE_APP_URL`. If `url` is set, prerender also uses it as the request origin for build-time renders.
85
92
 
86
- - Solas reads that value during plugin configuration.
87
- - Solas exposes the resolved value as `import.meta.env.VITE_APP_URL`.
88
- - If `url` is set, prerender uses it as the request origin for build-time renders.
89
- - The runtime router does not otherwise require `config.url` for routing to work.
90
-
91
- In practice, you only need `url` if your app code wants to read the public origin from `import.meta.env.VITE_APP_URL`, or if your prerendered output needs a real public origin.
93
+ In practice, you only need `url` if your app reads `import.meta.env.VITE_APP_URL` or your prerendered output needs a real public origin.
92
94
 
93
95
  If you do want to set it explicitly, this is the shape:
94
96
 
@@ -126,9 +128,9 @@ export default defineConfig({
126
128
 
127
129
  ### `precompress`
128
130
 
129
- Use `precompress` to control whether Solas writes compressed build assets.
131
+ Use `precompress` to control whether Solas writes compressed browser-served build assets (like `.js`, `.css`, etc.).
130
132
 
131
- Default: `true`
133
+ Default: `false`
132
134
 
133
135
  ```ts
134
136
  export default defineConfig({
@@ -208,7 +210,7 @@ export default function Page() {
208
210
  }
209
211
 
210
212
  async function Ts() {
211
- dynamic()
213
+ await dynamic()
212
214
  return <div>{Date.now()}</div>
213
215
  }
214
216
  ```
@@ -294,12 +296,10 @@ Use `trustedOrigins` to allow specific origins to make cross-origin browser subm
294
296
 
295
297
  Default: `[]`
296
298
 
297
- Solas protects server actions and `+endpoint` handlers against CSRF.
298
-
299
- Server actions are always `POST` requests. `+endpoint` handlers are protected on `POST`, `PUT`, `PATCH`, and `DELETE` requests.
300
-
301
299
  By default, only same-origin browser requests are allowed. Add a trusted origin when a third-party service needs to submit through the user's browser, such as a payment gateway or identity provider.
302
300
 
301
+ This setting controls which cross-origin browser sources are allowed for unsafe requests. See Security > CSRF for enforcement details.
302
+
303
303
  Each value must be a complete origin including protocol:
304
304
 
305
305
  ```ts
@@ -312,7 +312,7 @@ export default defineConfig({
312
312
  })
313
313
  ```
314
314
 
315
- Only add origins you completely trust. These origins are treated as allowed browser sources for unsafe requests.
315
+ Only add origins you completely trust.
316
316
 
317
317
  ### `sitemap`
318
318
 
@@ -99,7 +99,8 @@ export class ExportReader {
99
99
  // capture one supported literal value (string, number, boolean, null)
100
100
  '\\s*=\\s*(?<value>(?:"(?:[^"\\\\]|\\\\.)*"|\'(?:[^\'\\\\]|\\\\.)*\'|\\x60(?:[^\\x60\\\\]|\\\\.)*\\x60|true|false|null|-?\\d+(?:\\.\\d+)?))(?=\\s|;|$)';
101
101
  // multiline mode lets ^ match the start of each transpiled line, so the
102
- // export regex stays anchored to a real statement boundary instead of the file start
102
+ // export regex stays anchored to a real statement boundary instead of
103
+ // the file start
103
104
  const text = code.match(new RegExp(source, 'm'))?.groups?.value;
104
105
  if (!text)
105
106
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jk2908/solas",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
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",