@lunora/astro 1.0.0-alpha.15 → 1.0.0-alpha.150

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
@@ -70,7 +70,7 @@ export default defineConfig({
70
70
  ```
71
71
 
72
72
  ```ts
73
- // src/worker.ts — the composed worker's `export default`.
73
+ // src/server.ts — the composed worker's `export default`.
74
74
  import { handle } from "@astrojs/cloudflare/handler";
75
75
  import { withLunora } from "@lunora/astro";
76
76
 
@@ -81,7 +81,7 @@ export default withLunora(
81
81
  );
82
82
  ```
83
83
 
84
- Set `"main": "src/worker.ts"` in `wrangler.jsonc` so wrangler bundles this entry. `withLunora` reserves `/_lunora/rpc`, `/_lunora/ws`, and `/_lunora/admin/*` for the realtime plane; every other request falls through to Astro's SSR handler. An Astro render that throws is contained at the seam as a plain 500 — it can't take down realtime.
84
+ Set `"main": "src/server.ts"` in `wrangler.jsonc` so wrangler bundles this entry. `withLunora` reserves `/_lunora/rpc`, `/_lunora/ws`, and `/_lunora/admin/*` for the realtime plane; every other request falls through to Astro's SSR handler. An Astro render that throws is contained at the seam as a plain 500 — it can't take down realtime.
85
85
 
86
86
  Reactivity comes from the island adapter you hydrate with, not from this package. Preload a query in `.astro` frontmatter or a server endpoint with `@lunora/astro/server`, then hand the token to that adapter's `hydratePreloaded`:
87
87
 
@@ -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 + "/_lunora/rpc" });
94
+ const client = createServerClient({ url: Astro.url.origin });
95
95
  const preloaded = await preloadQuery(client, api.messages.list, {});
96
96
  ---
97
97
 
98
- <my-island data-preloaded={serializePreloaded(preloaded)}></my-island>
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 + "/_lunora/rpc" });
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/dist/index.d.mts CHANGED
@@ -1,27 +1,12 @@
1
1
  export { type FrameworkHostHandler as AstroWorkerHandler, type LunoraWorker as ComposedWorker, type FrameworkWorkerOptions as LunoraOptions, withFrameworkWorker as withLunora } from '@lunora/runtime';
2
2
  /**
3
- * The Lunora Astro **integration** an `AstroIntegration` object
4
- * (`{ name, hooks }`) added to `astro.config.*`'s `integrations` array.
5
- *
6
- * Astro is multi-framework at the UI layer, so this integration is **not** a new
7
- * reactive runtime. Its job is the *composition* seam (PLAN4 class-B): make the
8
- * Worker `@astrojs/cloudflare` emits mount Lunora realtime under `/_lunora/*`
9
- * via `withLunora`, and surface the framework-neutral server helpers
10
- * (`@lunora/astro/server`) to Astro server endpoints / `.astro` frontmatter.
11
- *
12
- * Reactivity itself comes from whichever island adapter the app hydrates with —
13
- * `@lunora/react`, `@lunora/solid`, `@lunora/svelte`, or `@lunora/vue` — each of
14
- * which ships its own `hydratePreloaded(preloaded)` for the SSR-seed → live
15
- * handoff. This package owns the server/composition half only.
16
- */
17
- /**
18
- * Structural subset of Astro's `AstroIntegration`. Declared locally (rather than
19
- * importing `astro`'s type) so `@lunora/astro`'s public surface stays decoupled
20
- * from a specific Astro major and type-checks even when `astro` is not installed
21
- * — `astro` is an *optional* peer here (only the host Astro app pulls it in).
22
- * The shape is assignable to/from Astro's real `AstroIntegration`, so adding the
23
- * returned object to `integrations` type-checks in a real Astro project.
24
- */
3
+ * Structural subset of Astro's `AstroIntegration`. Declared locally (rather than
4
+ * importing `astro`'s type) so `@lunora/astro`'s public surface stays decoupled
5
+ * from a specific Astro major and type-checks even when `astro` is not installed
6
+ * `astro` is an *optional* peer here (only the host Astro app pulls it in).
7
+ * The shape is assignable to/from Astro's real `AstroIntegration`, so adding the
8
+ * returned object to `integrations` type-checks in a real Astro project.
9
+ */
25
10
  interface AstroIntegrationLike {
26
11
  readonly hooks: {
27
12
  readonly [hook: string]: ((...arguments_: never[]) => unknown) | undefined;
@@ -31,41 +16,95 @@ interface AstroIntegrationLike {
31
16
  /** Options for the `lunora` integration. */
32
17
  interface LunoraIntegrationOptions {
33
18
  /**
34
- * Path (or specifier) of the module that calls `withLunora` and is the
35
- * composed worker's `export default`. Documented for the wiring story; when
36
- * omitted the integration assumes the conventional `src/worker.ts`.
37
- */
19
+ * Path (or specifier) of the module that composes the Lunora plane with the
20
+ * Astro handler and is the composed worker's `export default`. Documented for
21
+ * the wiring story; when omitted the integration assumes the conventional
22
+ * `src/server.ts` — deliberately NOT `src/worker.ts`, which `lunora deploy`
23
+ * treats as a SvelteKit-shaped entry to pass to wrangler positionally, and
24
+ * which the `@astrojs/cloudflare` redirect's `no_bundle: true` then uploads
25
+ * untranspiled.
26
+ */
38
27
  readonly serverEntry?: string;
39
28
  }
40
29
  /**
41
- * The Lunora Astro integration. Add it to `astro.config.*`:
42
- *
43
- * ```ts
44
- * import cloudflare from "@astrojs/cloudflare";
45
- * import { defineConfig } from "astro/config";
46
- * import { lunora } from "@lunora/astro";
47
- *
48
- * export default defineConfig({
49
- * output: "server",
50
- * adapter: cloudflare(),
51
- * integrations: [lunora()],
52
- * });
53
- * ```
54
- *
55
- * What it does:
56
- *
57
- * - Marks the build so the `@astrojs/cloudflare` server entry is wrapped with
58
- * `withLunora` the composed worker reserves `/_lunora/*` for Lunora realtime
59
- * and forwards everything else to Astro's SSR handler (one worker, one deploy).
60
- * - Documents the `serverEntry` (default `src/worker.ts`) where the
61
- * `withLunora(astroWorker, { shardDO: env.SHARD, })` composition lives.
62
- *
63
- * The hook is intentionally minimal here: the load-bearing composition is the
64
- * `withLunora` wrapper at the server-entry boundary (see `withLunora` for the
65
- * `@astrojs/cloudflare` injection point). The integration object exists so the
66
- * wiring is declared in `astro.config` the idiomatic Astro way, and so future
67
- * build-time hooks (binding reconcile, dev middleware) have a home without
68
- * changing the public surface.
69
- */
30
+ * The Lunora Astro integration. Add it to `astro.config.*`:
31
+ *
32
+ * ```ts
33
+ * import cloudflare from "@astrojs/cloudflare";
34
+ * import { defineConfig } from "astro/config";
35
+ * import { lunora } from "@lunora/astro";
36
+ *
37
+ * export default defineConfig({
38
+ * output: "server",
39
+ * adapter: cloudflare(),
40
+ * integrations: [lunora()],
41
+ * });
42
+ * ```
43
+ *
44
+ * What it does:
45
+ *
46
+ * - Documents the `serverEntry` (default `src/server.ts`) where the
47
+ * `withLunora(astroWorker, { shardDO: env.SHARD, })` composition or the
48
+ * generated builder's `.buildFrameworkWorker(host)` lives.
49
+ * - Checks, at `astro:config:done`, that `serverEntry` exists and contains an
50
+ * actual composition CALL (not merely an import of it) and warns
51
+ * (does not fail the build) when it doesn't, so a missing wrapper is caught
52
+ * at build time instead of shipping a worker where `/_lunora/*` is unrouted
53
+ * and realtime silently 404s.
54
+ *
55
+ * This integration does NOT wrap the server entry itself no file is written
56
+ * or modified. The load-bearing composition is the `withLunora` call the
57
+ * project author writes at the server-entry boundary (see `withLunora` for the
58
+ * `@astrojs/cloudflare` injection point); this object exists so the wiring is
59
+ * declared in `astro.config` the idiomatic Astro way, checked once at build
60
+ * time, and has a home for future build-time hooks (binding reconcile, dev
61
+ * middleware) without changing the public surface.
62
+ */
70
63
  declare const lunora: (options?: LunoraIntegrationOptions) => AstroIntegrationLike;
71
- export { type AstroIntegrationLike, type LunoraIntegrationOptions, lunora };
64
+ export {
65
+ /**
66
+ * `@lunora/astro` — the Astro integration for Lunora (PLAN4 class-B:
67
+ * own-CF-adapter, hook-injection composition).
68
+ *
69
+ * Astro is multi-framework at the UI layer, so this package is **not** a new
70
+ * reactive layer. Reactivity comes from whichever island adapter the app
71
+ * hydrates with (`@lunora/react`, `@lunora/solid`, `@lunora/svelte`,
72
+ * `@lunora/vue`). `@lunora/astro` owns two server-side seams instead.
73
+ *
74
+ * Seam 1 — single-worker composition: `withLunora` wraps the Worker
75
+ * `@astrojs/cloudflare` emits so Lunora realtime (`/_lunora/rpc`, `/_lunora/ws`,
76
+ * `/_lunora/admin/*` + `ShardDO`) is mounted *inside* it, while everything else
77
+ * falls through to Astro's SSR handler — one worker, one deploy. `lunora` is the
78
+ * matching `astro.config` integration.
79
+ *
80
+ * Seam 2 — reactive-loader server helpers: the framework-neutral `@lunora/client/ssr`
81
+ * contract (`createServerClient`, `preloadQuery`, `getServerSession`,
82
+ * `serializePreloaded`) is re-exported from `@lunora/astro/server` for use in
83
+ * Astro server endpoints / `.astro` frontmatter. Preload a query there, then
84
+ * hand the `Preloaded` token to your island adapter's `hydratePreloaded` for the
85
+ * "your loaders are live" SSR-seed → live handoff.
86
+ */
87
+ type AstroIntegrationLike,
88
+ /**
89
+ * `@lunora/astro` — the Astro integration for Lunora (PLAN4 class-B:
90
+ * own-CF-adapter, hook-injection composition).
91
+ *
92
+ * Astro is multi-framework at the UI layer, so this package is **not** a new
93
+ * reactive layer. Reactivity comes from whichever island adapter the app
94
+ * hydrates with (`@lunora/react`, `@lunora/solid`, `@lunora/svelte`,
95
+ * `@lunora/vue`). `@lunora/astro` owns two server-side seams instead.
96
+ *
97
+ * Seam 1 — single-worker composition: `withLunora` wraps the Worker
98
+ * `@astrojs/cloudflare` emits so Lunora realtime (`/_lunora/rpc`, `/_lunora/ws`,
99
+ * `/_lunora/admin/*` + `ShardDO`) is mounted *inside* it, while everything else
100
+ * falls through to Astro's SSR handler — one worker, one deploy. `lunora` is the
101
+ * matching `astro.config` integration.
102
+ *
103
+ * Seam 2 — reactive-loader server helpers: the framework-neutral `@lunora/client/ssr`
104
+ * contract (`createServerClient`, `preloadQuery`, `getServerSession`,
105
+ * `serializePreloaded`) is re-exported from `@lunora/astro/server` for use in
106
+ * Astro server endpoints / `.astro` frontmatter. Preload a query there, then
107
+ * hand the `Preloaded` token to your island adapter's `hydratePreloaded` for the
108
+ * "your loaders are live" SSR-seed → live handoff.
109
+ */
110
+ type LunoraIntegrationOptions, lunora };
package/dist/index.d.ts CHANGED
@@ -1,27 +1,12 @@
1
1
  export { type FrameworkHostHandler as AstroWorkerHandler, type LunoraWorker as ComposedWorker, type FrameworkWorkerOptions as LunoraOptions, withFrameworkWorker as withLunora } from '@lunora/runtime';
2
2
  /**
3
- * The Lunora Astro **integration** an `AstroIntegration` object
4
- * (`{ name, hooks }`) added to `astro.config.*`'s `integrations` array.
5
- *
6
- * Astro is multi-framework at the UI layer, so this integration is **not** a new
7
- * reactive runtime. Its job is the *composition* seam (PLAN4 class-B): make the
8
- * Worker `@astrojs/cloudflare` emits mount Lunora realtime under `/_lunora/*`
9
- * via `withLunora`, and surface the framework-neutral server helpers
10
- * (`@lunora/astro/server`) to Astro server endpoints / `.astro` frontmatter.
11
- *
12
- * Reactivity itself comes from whichever island adapter the app hydrates with —
13
- * `@lunora/react`, `@lunora/solid`, `@lunora/svelte`, or `@lunora/vue` — each of
14
- * which ships its own `hydratePreloaded(preloaded)` for the SSR-seed → live
15
- * handoff. This package owns the server/composition half only.
16
- */
17
- /**
18
- * Structural subset of Astro's `AstroIntegration`. Declared locally (rather than
19
- * importing `astro`'s type) so `@lunora/astro`'s public surface stays decoupled
20
- * from a specific Astro major and type-checks even when `astro` is not installed
21
- * — `astro` is an *optional* peer here (only the host Astro app pulls it in).
22
- * The shape is assignable to/from Astro's real `AstroIntegration`, so adding the
23
- * returned object to `integrations` type-checks in a real Astro project.
24
- */
3
+ * Structural subset of Astro's `AstroIntegration`. Declared locally (rather than
4
+ * importing `astro`'s type) so `@lunora/astro`'s public surface stays decoupled
5
+ * from a specific Astro major and type-checks even when `astro` is not installed
6
+ * `astro` is an *optional* peer here (only the host Astro app pulls it in).
7
+ * The shape is assignable to/from Astro's real `AstroIntegration`, so adding the
8
+ * returned object to `integrations` type-checks in a real Astro project.
9
+ */
25
10
  interface AstroIntegrationLike {
26
11
  readonly hooks: {
27
12
  readonly [hook: string]: ((...arguments_: never[]) => unknown) | undefined;
@@ -31,41 +16,95 @@ interface AstroIntegrationLike {
31
16
  /** Options for the `lunora` integration. */
32
17
  interface LunoraIntegrationOptions {
33
18
  /**
34
- * Path (or specifier) of the module that calls `withLunora` and is the
35
- * composed worker's `export default`. Documented for the wiring story; when
36
- * omitted the integration assumes the conventional `src/worker.ts`.
37
- */
19
+ * Path (or specifier) of the module that composes the Lunora plane with the
20
+ * Astro handler and is the composed worker's `export default`. Documented for
21
+ * the wiring story; when omitted the integration assumes the conventional
22
+ * `src/server.ts` — deliberately NOT `src/worker.ts`, which `lunora deploy`
23
+ * treats as a SvelteKit-shaped entry to pass to wrangler positionally, and
24
+ * which the `@astrojs/cloudflare` redirect's `no_bundle: true` then uploads
25
+ * untranspiled.
26
+ */
38
27
  readonly serverEntry?: string;
39
28
  }
40
29
  /**
41
- * The Lunora Astro integration. Add it to `astro.config.*`:
42
- *
43
- * ```ts
44
- * import cloudflare from "@astrojs/cloudflare";
45
- * import { defineConfig } from "astro/config";
46
- * import { lunora } from "@lunora/astro";
47
- *
48
- * export default defineConfig({
49
- * output: "server",
50
- * adapter: cloudflare(),
51
- * integrations: [lunora()],
52
- * });
53
- * ```
54
- *
55
- * What it does:
56
- *
57
- * - Marks the build so the `@astrojs/cloudflare` server entry is wrapped with
58
- * `withLunora` the composed worker reserves `/_lunora/*` for Lunora realtime
59
- * and forwards everything else to Astro's SSR handler (one worker, one deploy).
60
- * - Documents the `serverEntry` (default `src/worker.ts`) where the
61
- * `withLunora(astroWorker, { shardDO: env.SHARD, })` composition lives.
62
- *
63
- * The hook is intentionally minimal here: the load-bearing composition is the
64
- * `withLunora` wrapper at the server-entry boundary (see `withLunora` for the
65
- * `@astrojs/cloudflare` injection point). The integration object exists so the
66
- * wiring is declared in `astro.config` the idiomatic Astro way, and so future
67
- * build-time hooks (binding reconcile, dev middleware) have a home without
68
- * changing the public surface.
69
- */
30
+ * The Lunora Astro integration. Add it to `astro.config.*`:
31
+ *
32
+ * ```ts
33
+ * import cloudflare from "@astrojs/cloudflare";
34
+ * import { defineConfig } from "astro/config";
35
+ * import { lunora } from "@lunora/astro";
36
+ *
37
+ * export default defineConfig({
38
+ * output: "server",
39
+ * adapter: cloudflare(),
40
+ * integrations: [lunora()],
41
+ * });
42
+ * ```
43
+ *
44
+ * What it does:
45
+ *
46
+ * - Documents the `serverEntry` (default `src/server.ts`) where the
47
+ * `withLunora(astroWorker, { shardDO: env.SHARD, })` composition or the
48
+ * generated builder's `.buildFrameworkWorker(host)` lives.
49
+ * - Checks, at `astro:config:done`, that `serverEntry` exists and contains an
50
+ * actual composition CALL (not merely an import of it) and warns
51
+ * (does not fail the build) when it doesn't, so a missing wrapper is caught
52
+ * at build time instead of shipping a worker where `/_lunora/*` is unrouted
53
+ * and realtime silently 404s.
54
+ *
55
+ * This integration does NOT wrap the server entry itself no file is written
56
+ * or modified. The load-bearing composition is the `withLunora` call the
57
+ * project author writes at the server-entry boundary (see `withLunora` for the
58
+ * `@astrojs/cloudflare` injection point); this object exists so the wiring is
59
+ * declared in `astro.config` the idiomatic Astro way, checked once at build
60
+ * time, and has a home for future build-time hooks (binding reconcile, dev
61
+ * middleware) without changing the public surface.
62
+ */
70
63
  declare const lunora: (options?: LunoraIntegrationOptions) => AstroIntegrationLike;
71
- export { type AstroIntegrationLike, type LunoraIntegrationOptions, lunora };
64
+ export {
65
+ /**
66
+ * `@lunora/astro` — the Astro integration for Lunora (PLAN4 class-B:
67
+ * own-CF-adapter, hook-injection composition).
68
+ *
69
+ * Astro is multi-framework at the UI layer, so this package is **not** a new
70
+ * reactive layer. Reactivity comes from whichever island adapter the app
71
+ * hydrates with (`@lunora/react`, `@lunora/solid`, `@lunora/svelte`,
72
+ * `@lunora/vue`). `@lunora/astro` owns two server-side seams instead.
73
+ *
74
+ * Seam 1 — single-worker composition: `withLunora` wraps the Worker
75
+ * `@astrojs/cloudflare` emits so Lunora realtime (`/_lunora/rpc`, `/_lunora/ws`,
76
+ * `/_lunora/admin/*` + `ShardDO`) is mounted *inside* it, while everything else
77
+ * falls through to Astro's SSR handler — one worker, one deploy. `lunora` is the
78
+ * matching `astro.config` integration.
79
+ *
80
+ * Seam 2 — reactive-loader server helpers: the framework-neutral `@lunora/client/ssr`
81
+ * contract (`createServerClient`, `preloadQuery`, `getServerSession`,
82
+ * `serializePreloaded`) is re-exported from `@lunora/astro/server` for use in
83
+ * Astro server endpoints / `.astro` frontmatter. Preload a query there, then
84
+ * hand the `Preloaded` token to your island adapter's `hydratePreloaded` for the
85
+ * "your loaders are live" SSR-seed → live handoff.
86
+ */
87
+ type AstroIntegrationLike,
88
+ /**
89
+ * `@lunora/astro` — the Astro integration for Lunora (PLAN4 class-B:
90
+ * own-CF-adapter, hook-injection composition).
91
+ *
92
+ * Astro is multi-framework at the UI layer, so this package is **not** a new
93
+ * reactive layer. Reactivity comes from whichever island adapter the app
94
+ * hydrates with (`@lunora/react`, `@lunora/solid`, `@lunora/svelte`,
95
+ * `@lunora/vue`). `@lunora/astro` owns two server-side seams instead.
96
+ *
97
+ * Seam 1 — single-worker composition: `withLunora` wraps the Worker
98
+ * `@astrojs/cloudflare` emits so Lunora realtime (`/_lunora/rpc`, `/_lunora/ws`,
99
+ * `/_lunora/admin/*` + `ShardDO`) is mounted *inside* it, while everything else
100
+ * falls through to Astro's SSR handler — one worker, one deploy. `lunora` is the
101
+ * matching `astro.config` integration.
102
+ *
103
+ * Seam 2 — reactive-loader server helpers: the framework-neutral `@lunora/client/ssr`
104
+ * contract (`createServerClient`, `preloadQuery`, `getServerSession`,
105
+ * `serializePreloaded`) is re-exported from `@lunora/astro/server` for use in
106
+ * Astro server endpoints / `.astro` frontmatter. Preload a query there, then
107
+ * hand the `Preloaded` token to your island adapter's `hydratePreloaded` for the
108
+ * "your loaders are live" SSR-seed → live handoff.
109
+ */
110
+ type LunoraIntegrationOptions, lunora };
package/dist/index.mjs CHANGED
@@ -1,2 +1 @@
1
- export { lunora } from './packem_shared/lunora-DCkPGEVa.mjs';
2
- export { withFrameworkWorker as withLunora } from '@lunora/runtime';
1
+ import{lunora as a}from"./packem_shared/lunora-DnV2_atg.mjs";import{withFrameworkWorker as t}from"@lunora/runtime";export{a as lunora,t as withLunora};
@@ -0,0 +1,6 @@
1
+ import{existsSync as u,readFileSync as E}from"node:fs";import{fileURLToPath as c}from"node:url";const p=String.raw`\/\*[\s\S]*?\*\/`,L=String.raw`\/\/[^\n]*`,f=String.raw`"(?:[^"\\\n]|\\.)*"`,m=String.raw`'(?:[^'\\\n]|\\.)*'`,v=String.raw`\x60(?:[^\x60\\$]|\\.|\$(?!\{))*\x60`,y=new RegExp([p,L,f,m,v].join("|"),"gu"),_=/[^\n]/gu,g=e=>e.replaceAll(_," "),R=e=>e.replaceAll(y,g),d=["// src/server.ts",'import { handle } from "@astrojs/cloudflare/handler";','import { withLunora } from "@lunora/astro";',"","// `shardDO` lives on `env` (per request), so pass an `(env) => options` factory.","export default withLunora("," (req, env, ctx) => handle(req, env, ctx),"," (env) => ({ shardDO: env.SHARD /* , … */ }),",");"].join(`
2
+ `),S=/\b(?:withLunora|withFrameworkWorker|buildFrameworkWorker)\s*\(/u,h="src/server.ts",s="src/worker.ts",k=(e={})=>{const n=(e.serverEntry??h).trim();return{hooks:{"astro:config:done":(o={})=>{if(n.length===0)throw new TypeError("@lunora/astro: `serverEntry` must be a non-empty path.");const t=o.config?.root;if(t===void 0)return;const a=r=>{o.logger?.warn?o.logger.warn(r):console.warn(r)},l=c(new URL(n,t));if(!u(l)){const r=e.serverEntry===void 0&&u(c(new URL(s,t)));a(r?`@lunora/astro: the default server entry is now "${h}", and this project still composes in "${s}". Rename it — \`lunora deploy\` passes a file at that exact path to wrangler positionally, and @astrojs/cloudflare's \`no_bundle\` redirect then uploads it untranspiled — or keep the old name with \`lunora({ serverEntry: "${s}" })\`.`:`@lunora/astro: server entry "${n}" not found — add it (or point \`lunora({ serverEntry })\` at the right path) and wrap the Astro worker with \`withLunora\`, or \`/_lunora/*\` (Lunora realtime) will be unrouted:
3
+
4
+ ${d}`);return}let i;try{i=E(l,"utf8")}catch(r){const w=r instanceof Error?r.message:String(r);a(`@lunora/astro: could not read server entry "${n}" (${w}) — skipping the \`withLunora\` check.`);return}S.test(R(i))||a(`@lunora/astro: couldn't find a \`withLunora(...)\` or \`.buildFrameworkWorker(...)\` call in the server entry "${n}" — \`/_lunora/*\` (Lunora realtime) will be unrouted and subscriptions will silently 404. Compose the Astro worker:
5
+
6
+ ${d}`)}},name:"@lunora/astro"}};export{k as lunora};
package/dist/server.mjs CHANGED
@@ -1 +1 @@
1
- export { createServerClient, deserializePreloaded, getServerSession, preloadQuery, preloadedQueryResult, serializePreloaded } from '@lunora/client/ssr';
1
+ import{createServerClient as d,deserializePreloaded as l,getServerSession as a,preloadQuery as o,preloadedQueryResult as i,serializePreloaded as s}from"@lunora/client/ssr";export{d as createServerClient,l as deserializePreloaded,a as getServerSession,o as preloadQuery,i as preloadedQueryResult,s as serializePreloaded};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/astro",
3
- "version": "1.0.0-alpha.15",
3
+ "version": "1.0.0-alpha.150",
4
4
  "description": "Astro integration for Lunora — single-worker composition plus reactive-loader server helpers",
5
5
  "keywords": [
6
6
  "astro",
@@ -50,11 +50,11 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@lunora/client": "1.0.0-alpha.9",
54
- "@lunora/runtime": "1.0.0-alpha.9"
53
+ "@lunora/client": "1.0.0-alpha.117",
54
+ "@lunora/runtime": "1.0.0-alpha.130"
55
55
  },
56
56
  "peerDependencies": {
57
- "astro": "^6.0.0"
57
+ "astro": ">=6.0.0"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
60
  "astro": {
@@ -1,15 +0,0 @@
1
- const lunora = (options = {}) => {
2
- const serverEntry = options.serverEntry ?? "src/worker.ts";
3
- return {
4
- hooks: {
5
- "astro:config:done": () => {
6
- if (serverEntry.length === 0) {
7
- throw new Error("@lunora/astro: `serverEntry` must be a non-empty path.");
8
- }
9
- }
10
- },
11
- name: "@lunora/astro"
12
- };
13
- };
14
-
15
- export { lunora };