@lunora/astro 1.0.0-alpha.110 → 1.0.0-alpha.112
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/README.md +14 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -91,11 +91,22 @@ Reactivity comes from the island adapter you hydrate with, not from this package
|
|
|
91
91
|
import { createServerClient, preloadQuery, serializePreloaded } from "@lunora/astro/server";
|
|
92
92
|
import { api } from "../lunora/_generated/api";
|
|
93
93
|
|
|
94
|
-
const client = createServerClient({ url: Astro.url.origin
|
|
94
|
+
const client = createServerClient({ url: Astro.url.origin });
|
|
95
95
|
const preloaded = await preloadQuery(client, api.messages.list, {});
|
|
96
96
|
---
|
|
97
97
|
|
|
98
|
-
<
|
|
98
|
+
<script id="preloaded" type="application/json" set:html={serializePreloaded(preloaded)}></script>
|
|
99
|
+
<my-island></my-island>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The island has to pick the token up explicitly — no adapter discovers `#preloaded` on its own:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { hydratePreloaded } from "@lunora/react";
|
|
106
|
+
import { deserializePreloaded } from "@lunora/astro/server";
|
|
107
|
+
|
|
108
|
+
const preloaded = deserializePreloaded(document.querySelector("#preloaded")!.textContent!);
|
|
109
|
+
const initial = hydratePreloaded(preloaded); // seeds the first paint, then goes live
|
|
99
110
|
```
|
|
100
111
|
|
|
101
112
|
### Feature flags
|
|
@@ -108,7 +119,7 @@ const preloaded = await preloadQuery(client, api.messages.list, {});
|
|
|
108
119
|
import { createServerClient, preloadQuery, preloadedQueryResult } from "@lunora/astro/server";
|
|
109
120
|
import { api } from "../lunora/_generated/api";
|
|
110
121
|
|
|
111
|
-
const client = createServerClient({ url: Astro.url.origin
|
|
122
|
+
const client = createServerClient({ url: Astro.url.origin });
|
|
112
123
|
const preloaded = await preloadQuery(client, api.homepage.heroFlag, {}); // a query that returns ctx.flags.boolean(...)
|
|
113
124
|
const newHero = preloadedQueryResult(preloaded);
|
|
114
125
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/astro",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.112",
|
|
4
4
|
"description": "Astro integration for Lunora — single-worker composition plus reactive-loader server helpers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@lunora/client": "1.0.0-alpha.
|
|
54
|
-
"@lunora/runtime": "1.0.0-alpha.
|
|
53
|
+
"@lunora/client": "1.0.0-alpha.76",
|
|
54
|
+
"@lunora/runtime": "1.0.0-alpha.92"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"astro": ">=6.0.0"
|