@lunora/astro 1.0.0-alpha.311 → 1.0.0-alpha.312
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
|
@@ -46,6 +46,8 @@ interface LunoraIntegrationOptions {
|
|
|
46
46
|
* - Documents the `serverEntry` (default `src/server.ts`) where the
|
|
47
47
|
* `withLunora(astroWorker, { shardDO: env.SHARD, … })` composition — or the
|
|
48
48
|
* generated builder's `.buildFrameworkWorker(host)` — lives.
|
|
49
|
+
* - Writes the security headers (and immutable caching for `_astro/`) into the
|
|
50
|
+
* client output's `_headers` at `astro:build:done`, when wrangler deploys it.
|
|
49
51
|
* - Checks, at `astro:config:done`, that `serverEntry` exists and contains an
|
|
50
52
|
* actual composition CALL (not merely an import of it) — and warns
|
|
51
53
|
* (does not fail the build) when it doesn't, so a missing wrapper is caught
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ interface LunoraIntegrationOptions {
|
|
|
46
46
|
* - Documents the `serverEntry` (default `src/server.ts`) where the
|
|
47
47
|
* `withLunora(astroWorker, { shardDO: env.SHARD, … })` composition — or the
|
|
48
48
|
* generated builder's `.buildFrameworkWorker(host)` — lives.
|
|
49
|
+
* - Writes the security headers (and immutable caching for `_astro/`) into the
|
|
50
|
+
* client output's `_headers` at `astro:build:done`, when wrangler deploys it.
|
|
49
51
|
* - Checks, at `astro:config:done`, that `serverEntry` exists and contains an
|
|
50
52
|
* actual composition CALL (not merely an import of it) — and warns
|
|
51
53
|
* (does not fail the build) when it doesn't, so a missing wrapper is caught
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{lunora as a}from"./packem_shared/lunora-
|
|
1
|
+
import{lunora as a}from"./packem_shared/lunora-BLjyf8aS.mjs";import{withFrameworkWorker as t}from"@lunora/runtime";export{a as lunora,t as withLunora};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{existsSync as d,readFileSync as v}from"node:fs";import{fileURLToPath as l}from"node:url";const f=String.raw`\/\*[\s\S]*?\*\/`,y=String.raw`\/\/[^\n]*`,L=String.raw`"(?:[^"\\\n]|\\.)*"`,_=String.raw`'(?:[^'\\\n]|\\.)*'`,g=String.raw`\x60(?:[^\x60\\$]|\\.|\$(?!\{))*\x60`,N=new RegExp([f,y,L,_,g].join("|"),"gu"),R=/[^\n]/gu,A=e=>e.replaceAll(R," "),S=e=>e.replaceAll(N,A),w=["assetFileNames","chunkFileNames","entryFileNames"],m=e=>(e===void 0?[]:[e].flat()).map(r=>typeof r=="object"&&r!==null?r:{}),T=e=>m(e).every(r=>w.every(o=>r[o]===void 0||typeof r[o]=="string"&&r[o].includes("[hash]"))),b=(e,r)=>[...m(e).flatMap(o=>w.map(t=>o[t]).filter(t=>typeof t=="string")),`${r}/[name].[hash][extname]`,`${r}/[name].[hash].js`,`${r}/[name].[hash]_[name][extname]`],O=async(e,r)=>{const o=r?.root;if(e.dir===void 0||o===void 0)return;const{emitProjectAssetHeaders:t}=await import("@lunora/config/cloudflare"),s=r?.vite?.build?.rollupOptions?.output,a=r?.build?.assets??"_astro";t({hashedDirectory:T(s)?a:void 0,hashedNamePatterns:b(s,a),outputDirectory:l(e.dir),projectRoot:l(o),publicDirectory:r?.publicDir===void 0?void 0:l(r.publicDir),requireAssetsDirectory:!0},{info:i=>{e.logger?.info(i)},warn:i=>{e.logger?.warn(i)}})},h=["// 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,p="src/server.ts",u="src/worker.ts",D=(e={})=>{const r=(e.serverEntry??p).trim();let o;return{hooks:{"astro:build:done":(t={})=>O(t,o),"astro:config:done":(t={})=>{if(r.length===0)throw new TypeError("@lunora/astro: `serverEntry` must be a non-empty path.");o=t.config;const s=t.config?.root;if(s===void 0)return;const a=n=>{t.logger?.warn?t.logger.warn(n):console.warn(n)},i=l(new URL(r,s));if(!d(i)){const n=e.serverEntry===void 0&&d(l(new URL(u,s)));a(n?`@lunora/astro: the default server entry is now "${p}", and this project still composes in "${u}". 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: "${u}" })\`.`:`@lunora/astro: server entry "${r}" 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
|
+
${h}`);return}let c;try{c=v(i,"utf8")}catch(n){const E=n instanceof Error?n.message:String(n);a(`@lunora/astro: could not read server entry "${r}" (${E}) — skipping the \`withLunora\` check.`);return}P.test(S(c))||a(`@lunora/astro: couldn't find a \`withLunora(...)\` or \`.buildFrameworkWorker(...)\` call in the server entry "${r}" — \`/_lunora/*\` (Lunora realtime) will be unrouted and subscriptions will silently 404. Compose the Astro worker:
|
|
5
|
+
|
|
6
|
+
${h}`)}},name:"@lunora/astro"}};export{D as lunora};
|
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.312",
|
|
4
4
|
"description": "Astro integration for Lunora — single-worker composition plus reactive-loader server helpers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@lunora/client": "^1.0.0-alpha.286",
|
|
54
|
+
"@lunora/config": "^1.0.0-alpha.457",
|
|
54
55
|
"@lunora/runtime": "^1.0.0-alpha.276"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
@@ -1,6 +0,0 @@
|
|
|
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};
|