@lunora/astro 1.0.0-alpha.3 → 1.0.0-alpha.30
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/LICENSE.md
CHANGED
|
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
|
103
103
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
104
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
105
|
specific language governing permissions and limitations under the License.
|
|
106
|
+
|
|
107
|
+
<!-- DEPENDENCIES -->
|
|
108
|
+
<!-- /DEPENDENCIES -->
|
|
109
|
+
|
|
110
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
111
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -98,6 +98,24 @@ const preloaded = await preloadQuery(client, api.messages.list, {});
|
|
|
98
98
|
<my-island data-preloaded={serializePreloaded(preloaded)}></my-island>
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
### Feature flags
|
|
102
|
+
|
|
103
|
+
`@lunora/astro` ships no flag hook — like every other surface, flags follow the same server/island split. Read `ctx.flags` server-side (a server endpoint, a function, or the same `.astro` frontmatter) and hand the resolved value to the island, or call `useFlag` inside the island itself via the adapter you hydrate with (`@lunora/react`, `@lunora/vue`, …). Requires [`@lunora/flags`](https://www.npmjs.com/package/@lunora/flags) wired in `lunora/flags.ts`.
|
|
104
|
+
|
|
105
|
+
```astro
|
|
106
|
+
---
|
|
107
|
+
// src/pages/index.astro — resolve the flag once, server-side
|
|
108
|
+
import { createServerClient, preloadQuery, preloadedQueryResult } from "@lunora/astro/server";
|
|
109
|
+
import { api } from "../lunora/_generated/api";
|
|
110
|
+
|
|
111
|
+
const client = createServerClient({ url: Astro.url.origin + "/_lunora/rpc" });
|
|
112
|
+
const preloaded = await preloadQuery(client, api.homepage.heroFlag, {}); // a query that returns ctx.flags.boolean(...)
|
|
113
|
+
const newHero = preloadedQueryResult(preloaded);
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
{newHero ? <NewHero client:load /> : <ClassicHero client:load />}
|
|
117
|
+
```
|
|
118
|
+
|
|
101
119
|
> This README covers the basics. For the full API, options, and guides, see the **[documentation](https://lunora.sh/docs/frameworks/bring-your-framework)**.
|
|
102
120
|
|
|
103
121
|
## Related
|