@lunora/astro 1.0.0-alpha.111 → 1.0.0-alpha.113

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/dist/index.d.mts CHANGED
@@ -16,9 +16,13 @@ interface AstroIntegrationLike {
16
16
  /** Options for the `lunora` integration. */
17
17
  interface LunoraIntegrationOptions {
18
18
  /**
19
- * Path (or specifier) of the module that calls `withLunora` and is the
20
- * composed worker's `export default`. Documented for the wiring story; when
21
- * omitted the integration assumes the conventional `src/worker.ts`.
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.
22
26
  */
23
27
  readonly serverEntry?: string;
24
28
  }
@@ -39,10 +43,11 @@ interface LunoraIntegrationOptions {
39
43
  *
40
44
  * What it does:
41
45
  *
42
- * - Documents the `serverEntry` (default `src/worker.ts`) where the
43
- * `withLunora(astroWorker, { shardDO: env.SHARD, … })` composition lives.
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.
44
49
  * - Checks, at `astro:config:done`, that `serverEntry` exists and contains an
45
- * actual `withLunora(...)` CALL (not merely an import of it) — and warns
50
+ * actual composition CALL (not merely an import of it) — and warns
46
51
  * (does not fail the build) when it doesn't, so a missing wrapper is caught
47
52
  * at build time instead of shipping a worker where `/_lunora/*` is unrouted
48
53
  * and realtime silently 404s.
package/dist/index.d.ts CHANGED
@@ -16,9 +16,13 @@ interface AstroIntegrationLike {
16
16
  /** Options for the `lunora` integration. */
17
17
  interface LunoraIntegrationOptions {
18
18
  /**
19
- * Path (or specifier) of the module that calls `withLunora` and is the
20
- * composed worker's `export default`. Documented for the wiring story; when
21
- * omitted the integration assumes the conventional `src/worker.ts`.
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.
22
26
  */
23
27
  readonly serverEntry?: string;
24
28
  }
@@ -39,10 +43,11 @@ interface LunoraIntegrationOptions {
39
43
  *
40
44
  * What it does:
41
45
  *
42
- * - Documents the `serverEntry` (default `src/worker.ts`) where the
43
- * `withLunora(astroWorker, { shardDO: env.SHARD, … })` composition lives.
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.
44
49
  * - Checks, at `astro:config:done`, that `serverEntry` exists and contains an
45
- * actual `withLunora(...)` CALL (not merely an import of it) — and warns
50
+ * actual composition CALL (not merely an import of it) — and warns
46
51
  * (does not fail the build) when it doesn't, so a missing wrapper is caught
47
52
  * at build time instead of shipping a worker where `/_lunora/*` is unrouted
48
53
  * and realtime silently 404s.
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{lunora as a}from"./packem_shared/lunora-DOdRz5Mw.mjs";import{withFrameworkWorker as t}from"@lunora/runtime";export{a as lunora,t as withLunora};
1
+ import{lunora as a}from"./packem_shared/lunora-CSieksVN.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 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
+ `),p=/\b(?:withLunora|withFrameworkWorker|buildFrameworkWorker)\s*\(/u,L=String.raw`\/\*[\s\S]*?\*\/`,f=String.raw`\/\/[^\n]*`,m=String.raw`"(?:[^"\\\n]|\\.)*"`,v=String.raw`'(?:[^'\\\n]|\\.)*'`,y=String.raw`\x60(?:[^\x60\\$]|\\.|\$(?!\{))*\x60`,_=new RegExp([L,f,m,v,y].join("|"),"gu"),g=/[^\n]/gu,R=n=>n.replaceAll(_,e=>e.replaceAll(g," ")),h="src/server.ts",s="src/worker.ts",N=(n={})=>{const e=(n.serverEntry??h).trim();return{hooks:{"astro:config:done":(o={})=>{if(e.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(e,t));if(!u(l)){const r=n.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 "${e}" 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 "${e}" (${w}) — skipping the \`withLunora\` check.`);return}p.test(R(i))||a(`@lunora/astro: couldn't find a \`withLunora(...)\` or \`.buildFrameworkWorker(...)\` call in the server entry "${e}" — \`/_lunora/*\` (Lunora realtime) will be unrouted and subscriptions will silently 404. Compose the Astro worker:
5
+
6
+ ${d}`)}},name:"@lunora/astro"}};export{N as lunora};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/astro",
3
- "version": "1.0.0-alpha.111",
3
+ "version": "1.0.0-alpha.113",
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.74",
54
- "@lunora/runtime": "1.0.0-alpha.90"
53
+ "@lunora/client": "1.0.0-alpha.77",
54
+ "@lunora/runtime": "1.0.0-alpha.92"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "astro": ">=6.0.0"
@@ -1,6 +0,0 @@
1
- import{existsSync as c,readFileSync as h}from"node:fs";import{fileURLToPath as w}from"node:url";const i=["// src/worker.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
- `),d=/\bwithLunora\s*\(/u,v=(l={})=>{const o=(l.serverEntry??"src/worker.ts").trim();return{hooks:{"astro:config:done":(t={})=>{if(o.length===0)throw new TypeError("@lunora/astro: `serverEntry` must be a non-empty path.");const e=t.config?.root;if(e===void 0)return;const n=r=>{t.logger?.warn?t.logger.warn(r):console.warn(r)},a=w(new URL(o,e));if(!c(a)){n(`@lunora/astro: server entry "${o}" 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
- ${i}`);return}let s;try{s=h(a,"utf8")}catch(r){const u=r instanceof Error?r.message:String(r);n(`@lunora/astro: could not read server entry "${o}" (${u}) — skipping the \`withLunora\` check.`);return}d.test(s)||n(`@lunora/astro: couldn't find a \`withLunora(...)\` call in the server entry "${o}" — \`/_lunora/*\` (Lunora realtime) will be unrouted and subscriptions will silently 404. Wrap the Astro worker:
5
-
6
- ${i}`)}},name:"@lunora/astro"}};export{v as lunora};