@lunora/astro 0.0.0 → 1.0.0-alpha.1

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.
@@ -0,0 +1,71 @@
1
+ export { type FrameworkHostHandler as AstroWorkerHandler, type LunoraWorker as ComposedWorker, type FrameworkWorkerOptions as LunoraOptions, withFrameworkWorker as withLunora } from '@lunora/runtime';
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
+ */
25
+ interface AstroIntegrationLike {
26
+ readonly hooks: {
27
+ readonly [hook: string]: ((...arguments_: never[]) => unknown) | undefined;
28
+ };
29
+ readonly name: string;
30
+ }
31
+ /** Options for the `lunora` integration. */
32
+ interface LunoraIntegrationOptions {
33
+ /**
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
+ */
38
+ readonly serverEntry?: string;
39
+ }
40
+ /**
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
+ */
70
+ declare const lunora: (options?: LunoraIntegrationOptions) => AstroIntegrationLike;
71
+ export { type AstroIntegrationLike, type LunoraIntegrationOptions, lunora };
@@ -0,0 +1,71 @@
1
+ export { type FrameworkHostHandler as AstroWorkerHandler, type LunoraWorker as ComposedWorker, type FrameworkWorkerOptions as LunoraOptions, withFrameworkWorker as withLunora } from '@lunora/runtime';
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
+ */
25
+ interface AstroIntegrationLike {
26
+ readonly hooks: {
27
+ readonly [hook: string]: ((...arguments_: never[]) => unknown) | undefined;
28
+ };
29
+ readonly name: string;
30
+ }
31
+ /** Options for the `lunora` integration. */
32
+ interface LunoraIntegrationOptions {
33
+ /**
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
+ */
38
+ readonly serverEntry?: string;
39
+ }
40
+ /**
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
+ */
70
+ declare const lunora: (options?: LunoraIntegrationOptions) => AstroIntegrationLike;
71
+ export { type AstroIntegrationLike, type LunoraIntegrationOptions, lunora };
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ export { lunora } from './packem_shared/lunora-DCkPGEVa.mjs';
2
+ export { withFrameworkWorker as withLunora } from '@lunora/runtime';
@@ -0,0 +1,15 @@
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 };
@@ -0,0 +1 @@
1
+ export { type ArgsOf, type AuthLike, type FunctionReference, type HeadersSource, type Preloaded, type ReturnOf, type ServerClientOptions, type ServerSession, createServerClient, deserializePreloaded, getServerSession, preloadQuery, preloadedQueryResult, serializePreloaded } from '@lunora/client/ssr';
@@ -0,0 +1 @@
1
+ export { type ArgsOf, type AuthLike, type FunctionReference, type HeadersSource, type Preloaded, type ReturnOf, type ServerClientOptions, type ServerSession, createServerClient, deserializePreloaded, getServerSession, preloadQuery, preloadedQueryResult, serializePreloaded } from '@lunora/client/ssr';
@@ -0,0 +1 @@
1
+ export { createServerClient, deserializePreloaded, getServerSession, preloadQuery, preloadedQueryResult, serializePreloaded } from '@lunora/client/ssr';
package/package.json CHANGED
@@ -1,31 +1,67 @@
1
1
  {
2
2
  "name": "@lunora/astro",
3
- "version": "0.0.0",
3
+ "version": "1.0.0-alpha.1",
4
4
  "description": "Astro integration for Lunora — single-worker composition plus reactive-loader server helpers",
5
- "license": "FSL-1.1-Apache-2.0",
5
+ "keywords": [
6
+ "astro",
7
+ "cloudflare",
8
+ "durable-objects",
9
+ "integration",
10
+ "lunora",
11
+ "realtime",
12
+ "ssr",
13
+ "workers"
14
+ ],
6
15
  "homepage": "https://lunora.sh",
16
+ "bugs": "https://github.com/anolilab/lunora/issues",
17
+ "license": "FSL-1.1-Apache-2.0",
18
+ "author": {
19
+ "name": "Daniel Bannert",
20
+ "email": "d.bannert@anolilab.de"
21
+ },
7
22
  "repository": {
8
23
  "type": "git",
9
24
  "url": "git+https://github.com/anolilab/lunora.git",
10
25
  "directory": "packages/astro"
11
26
  },
12
- "bugs": {
13
- "url": "https://github.com/anolilab/lunora/issues"
14
- },
15
- "keywords": [
16
- "lunora",
17
- "cloudflare",
18
- "workers",
19
- "durable-objects",
20
- "astro",
21
- "integration",
22
- "ssr",
23
- "realtime"
27
+ "files": [
28
+ "dist",
29
+ "README.md",
30
+ "LICENSE.md",
31
+ "__assets__"
24
32
  ],
33
+ "type": "module",
34
+ "sideEffects": false,
35
+ "main": "./dist/index.mjs",
36
+ "module": "./dist/index.mjs",
37
+ "types": "./dist/index.d.ts",
38
+ "exports": {
39
+ ".": {
40
+ "types": "./dist/index.d.ts",
41
+ "import": "./dist/index.mjs"
42
+ },
43
+ "./server": {
44
+ "types": "./dist/server.d.ts",
45
+ "import": "./dist/server.mjs"
46
+ },
47
+ "./package.json": "./package.json"
48
+ },
25
49
  "publishConfig": {
26
50
  "access": "public"
27
51
  },
28
- "files": [
29
- "README.md"
30
- ]
52
+ "dependencies": {
53
+ "@lunora/client": "1.0.0-alpha.1",
54
+ "@lunora/runtime": "1.0.0-alpha.1"
55
+ },
56
+ "peerDependencies": {
57
+ "astro": "^6.0.0"
58
+ },
59
+ "peerDependenciesMeta": {
60
+ "astro": {
61
+ "optional": true
62
+ }
63
+ },
64
+ "engines": {
65
+ "node": "^22.15.0 || >=24.11.0"
66
+ }
31
67
  }