@lunora/vite 1.0.0-alpha.136 → 1.0.0-alpha.138

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.
Files changed (30) hide show
  1. package/dist/index.d.mts +2 -2
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.mjs +3 -3
  4. package/dist/packem_shared/{CLASS_A_WIRING-CucVpjQI.mjs → CLASS_A_WIRING-CBEvhsXt.mjs} +7 -7
  5. package/dist/packem_shared/DEV_WORKER_ENV_VALUE-CaO3rUSk.mjs +1 -0
  6. package/dist/packem_shared/STUDIO_PATH-DWBxpyjt.mjs +1 -0
  7. package/dist/packem_shared/{WORKER_STARTUP_HINT-Dsm2vG6Q.mjs → WORKER_STARTUP_HINT-COlRTY32.mjs} +5 -5
  8. package/dist/packem_shared/{checkLunoraProxy-n_jVuOU-.mjs → checkLunoraProxy-C9M8c5eS.mjs} +1 -1
  9. package/dist/packem_shared/codegenPlugin-CtFR4SEw.mjs +3 -0
  10. package/dist/packem_shared/{containerLogsPlugin-QOsfYAYL.mjs → containerLogsPlugin-CWkqSCL3.mjs} +1 -1
  11. package/dist/packem_shared/devStatePlugin-BH928A-A.mjs +1 -0
  12. package/dist/packem_shared/devVariablesPlugin-DDvQh3l6.mjs +1 -0
  13. package/dist/packem_shared/log-DE48L4Oz.mjs +1 -0
  14. package/dist/packem_shared/logStreamPlugin-DFdSz0AO.mjs +3 -0
  15. package/dist/packem_shared/lunoraSolutionFinder--J0x2mAM.mjs +1 -0
  16. package/dist/packem_shared/planViteRemoteBindings-BKGgYFk4.mjs +1 -0
  17. package/dist/packem_shared/server-close-Qoh4i6Ay.mjs +1 -0
  18. package/dist/packem_shared/wranglerValidatorPlugin-Dma0xUy2.mjs +3 -0
  19. package/package.json +6 -7
  20. package/dist/packem_shared/DEV_WORKER_ENV_VALUE-CdVg3e_J.mjs +0 -1
  21. package/dist/packem_shared/STUDIO_PATH-onjC3IB9.mjs +0 -1
  22. package/dist/packem_shared/codegenPlugin-CAs97KEK.mjs +0 -3
  23. package/dist/packem_shared/devStatePlugin-CMRBp9zZ.mjs +0 -1
  24. package/dist/packem_shared/devVariablesPlugin-0SvpKjRJ.mjs +0 -1
  25. package/dist/packem_shared/log-DTdeAemA.mjs +0 -1
  26. package/dist/packem_shared/logStreamPlugin-CFlQAr0R.mjs +0 -3
  27. package/dist/packem_shared/lunoraSolutionFinder-Dl5pUZK2.mjs +0 -1
  28. package/dist/packem_shared/planViteRemoteBindings-DGYDapgM.mjs +0 -1
  29. package/dist/packem_shared/server-close-C8zGVydc.mjs +0 -1
  30. package/dist/packem_shared/wranglerValidatorPlugin-pzoKmqgc.mjs +0 -3
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { CodegenOptions } from '@lunora/codegen';
2
2
  import errorOverlayPlugin from '@visulima/vite-overlay';
3
3
  import { Plugin } from 'vite';
4
- import { materializeRemoteWranglerConfig } from '@lunora/config/cloudflare';
5
- export { type ReconcileCronsResult as ReconcileResult, reconcileWranglerCrons } from '@lunora/config/cloudflare';
6
4
  import { FrameworkDetection, DetectedFramework, readProjectRemotePreference } from '@lunora/config';
7
5
  export { type DetectedFramework, type FrameworkClass, type FrameworkDetection, detectFramework } from '@lunora/config';
6
+ import { materializeRemoteWranglerConfig } from '@lunora/config/cloudflare';
7
+ export { type ReconcileCronsResult as ReconcileResult, reconcileWranglerCrons } from '@lunora/config/cloudflare';
8
8
  import { AddressInfo } from 'node:net';
9
9
  /** Options forwarded to `@cloudflare/vite-plugin`'s cloudflare plugin. */
10
10
  type CloudflarePluginOptions = Record<string, unknown>;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { CodegenOptions } from '@lunora/codegen';
2
2
  import errorOverlayPlugin from '@visulima/vite-overlay';
3
3
  import { Plugin } from 'vite';
4
- import { materializeRemoteWranglerConfig } from '@lunora/config/cloudflare';
5
- export { type ReconcileCronsResult as ReconcileResult, reconcileWranglerCrons } from '@lunora/config/cloudflare';
6
4
  import { FrameworkDetection, DetectedFramework, readProjectRemotePreference } from '@lunora/config';
7
5
  export { type DetectedFramework, type FrameworkClass, type FrameworkDetection, detectFramework } from '@lunora/config';
6
+ import { materializeRemoteWranglerConfig } from '@lunora/config/cloudflare';
7
+ export { type ReconcileCronsResult as ReconcileResult, reconcileWranglerCrons } from '@lunora/config/cloudflare';
8
8
  import { AddressInfo } from 'node:net';
9
9
  /** Options forwarded to `@cloudflare/vite-plugin`'s cloudflare plugin. */
10
10
  type CloudflarePluginOptions = Record<string, unknown>;
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import{createRequire as u}from"node:module";import{cloudflare as m}from"@cloudflare/vite-plugin";import{detectAgentRules as d,claimAgentRulesHint as c,AGENT_RULES_HINT as f,detectFramework as p,resolveTargetOrThrow as g}from"@lunora/config";import{detectFramework as lr}from"@lunora/config";import S from"@visulima/vite-overlay";import{g as s}from"./packem_shared/log-DTdeAemA.mjs";import R from"./packem_shared/codegenPlugin-CAs97KEK.mjs";import v from"./packem_shared/containerLogsPlugin-QOsfYAYL.mjs";import k from"./packem_shared/devStatePlugin-CMRBp9zZ.mjs";import h from"./packem_shared/devVariablesPlugin-0SvpKjRJ.mjs";import{createCommandProbe as w,withDevWorkerEnv as P}from"./packem_shared/DEV_WORKER_ENV_VALUE-CdVg3e_J.mjs";import{DEV_WORKER_ENV_VALUE as mr,DEV_WORKER_ENV_VAR as dr}from"./packem_shared/DEV_WORKER_ENV_VALUE-CdVg3e_J.mjs";import{frameworkComposePlugin as E}from"./packem_shared/CLASS_A_WIRING-CucVpjQI.mjs";import{CLASS_A_WIRING as fr,LUNORA_WORKER_VIRTUAL_ID as pr,buildWorkerEntrySource as gr,isAutoComposable as Sr}from"./packem_shared/CLASS_A_WIRING-CucVpjQI.mjs";import A from"./packem_shared/logStreamPlugin-CFlQAr0R.mjs";import{proxyCheckPlugin as _}from"./packem_shared/checkLunoraProxy-n_jVuOU-.mjs";import{checkLunoraProxy as vr}from"./packem_shared/checkLunoraProxy-n_jVuOU-.mjs";import{planViteRemoteBindings as x,remoteBindingsCleanupPlugin as W,remoteBindingsConfigPlugin as C}from"./packem_shared/planViteRemoteBindings-DGYDapgM.mjs";import{withRemoteBindings as hr}from"./packem_shared/planViteRemoteBindings-DGYDapgM.mjs";import{lunoraSolutionFinders as V}from"./packem_shared/lunoraSolutionFinder-Dl5pUZK2.mjs";import{lunoraSolutionFinder as Pr}from"./packem_shared/lunoraSolutionFinder-Dl5pUZK2.mjs";import{studioPlugin as D}from"./packem_shared/STUDIO_PATH-onjC3IB9.mjs";import{STUDIO_PATH as Ar,buildStudioUrl as _r}from"./packem_shared/STUDIO_PATH-onjC3IB9.mjs";import{withWorkerStartupHint as T}from"./packem_shared/WORKER_STARTUP_HINT-Dsm2vG6Q.mjs";import{WORKER_STARTUP_HINT as Wr,augmentWorkerStartupError as Cr,isWorkerEntryEvalError as Vr}from"./packem_shared/WORKER_STARTUP_HINT-Dsm2vG6Q.mjs";import{wranglerValidatorPlugin as $}from"./packem_shared/wranglerValidatorPlugin-pzoKmqgc.mjs";import{default as Tr}from"./packem_shared/LUNORA_API_UPDATED_EVENT-CO2Rv2re.mjs";import{reconcileWranglerCrons as yr}from"@lunora/config/cloudflare";const y=e=>({apply:"serve",configureServer(r){return()=>{d(e.projectRoot).installed||!c()||r.config.logger.warn(`
2
- ${s(f)}
3
- `)}},name:"lunora:agent-rules-hint"}),N=()=>({}),O={astro:"Astro",none:"standalone (SPA / SSR-less)",nuxt:"Nuxt","react-router":"React Router","solid-start":"SolidStart",sveltekit:"SvelteKit","tanstack-start":"TanStack Start","tanstack-start-solid":"TanStack Start (Solid)",vinext:"Next.js on Vite (vinext)"},U=e=>{const r=O[e.framework];return e.framework==="none"?s("no meta-framework detected — running standalone."):e.class==="B"?s(`detected ${r} — composition is handled by the framework adapter.`):s(`detected ${r} — composing the Lunora worker into one Cloudflare Worker.`)},L=(e,r)=>{let t=!1;const o=()=>{r.framework??=p(e.projectRoot)};return{config(){o()},configResolved(){o()},configureServer(){o(),!t&&r.framework!==void 0&&(t=!0,console.info(U(r.framework)))},name:"lunora:framework-detect"}},b=e=>{if(e===!1)return!1;const r=e===!0||e===void 0?{}:e;return{...r,forwardedConsoleMethods:r.forwardedConsoleMethods??["error","warn"],solutionFinders:[...V,...r.solutionFinders??[]]}},I=e=>{const r=e??{},t=r.schemaDir??"lunora";let o;r.cloudflare===!1?o=!1:r.cloudflare===!0||r.cloudflare===void 0?o={}:o=r.cloudflare;const n=r.projectRoot??process.cwd();return{allowUnauthenticatedShardAccess:r.allowUnauthenticatedShardAccess??!1,apiSpec:r.apiSpec??"openapi",cloudflare:o,studio:r.studio??!0,generatedDir:r.generatedDir??`${t}/_generated`,overlay:b(r.overlay),projectRoot:n,schemaDir:t,target:g(n,r.target),validateWrangler:r.validateWrangler??!0}},ar=e=>{const r=I(e),t=N(),{isServe:o,plugin:n}=w(),a=[n,L(r,t),E(r,t),h(r),R(r),A(),k(r),y(r),_()];if(r.studio&&a.push(D()),r.validateWrangler&&a.push($(r)),r.overlay!==!1&&a.push(S(r.overlay)),r.cloudflare!==!1){a.push(v(r));const i=x({projectRoot:r.projectRoot}),l=P(r.cloudflare,o);i.enabled&&(i.configPath!==void 0&&a.push(W(i.cleanup)),a.push(C(l,i))),a.push(...T(m(l)))}return a},nr=u(import.meta.url)("../package.json").version;export{fr as CLASS_A_WIRING,mr as DEV_WORKER_ENV_VALUE,dr as DEV_WORKER_ENV_VAR,Tr as LUNORA_API_UPDATED_EVENT,pr as LUNORA_WORKER_VIRTUAL_ID,Ar as STUDIO_PATH,nr as VERSION,Wr as WORKER_STARTUP_HINT,Cr as augmentWorkerStartupError,_r as buildStudioUrl,gr as buildWorkerEntrySource,vr as checkLunoraProxy,R as codegenPlugin,v as containerLogsPlugin,w as createCommandProbe,lr as detectFramework,k as devStatePlugin,h as devVariablesPlugin,E as frameworkComposePlugin,Sr as isAutoComposable,Vr as isWorkerEntryEvalError,A as logStreamPlugin,ar as lunora,Pr as lunoraSolutionFinder,V as lunoraSolutionFinders,x as planViteRemoteBindings,_ as proxyCheckPlugin,yr as reconcileWranglerCrons,W as remoteBindingsCleanupPlugin,C as remoteBindingsConfigPlugin,b as resolveOverlayOption,D as studioPlugin,P as withDevWorkerEnv,hr as withRemoteBindings,T as withWorkerStartupHint,$ as wranglerValidatorPlugin};
1
+ import{createRequire as u}from"node:module";import{cloudflare as c}from"@cloudflare/vite-plugin";import{detectAgentRules as m,claimAgentRulesHint as f,AGENT_RULES_HINT as d,detectFramework as p,resolveTargetOrThrow as g}from"@lunora/config";import{detectFramework as sr}from"@lunora/config";import R from"@visulima/vite-overlay";import{l}from"./packem_shared/log-DE48L4Oz.mjs";import S from"./packem_shared/codegenPlugin-CtFR4SEw.mjs";import v from"./packem_shared/containerLogsPlugin-CWkqSCL3.mjs";import k from"./packem_shared/devStatePlugin-BH928A-A.mjs";import h from"./packem_shared/devVariablesPlugin-DDvQh3l6.mjs";import{createCommandProbe as w,withDevWorkerEnv as P}from"./packem_shared/DEV_WORKER_ENV_VALUE-CaO3rUSk.mjs";import{DEV_WORKER_ENV_VALUE as cr,DEV_WORKER_ENV_VAR as mr}from"./packem_shared/DEV_WORKER_ENV_VALUE-CaO3rUSk.mjs";import{frameworkComposePlugin as E}from"./packem_shared/CLASS_A_WIRING-CBEvhsXt.mjs";import{CLASS_A_WIRING as dr,LUNORA_WORKER_VIRTUAL_ID as pr,buildWorkerEntrySource as gr,isAutoComposable as Rr}from"./packem_shared/CLASS_A_WIRING-CBEvhsXt.mjs";import A from"./packem_shared/logStreamPlugin-DFdSz0AO.mjs";import{proxyCheckPlugin as _}from"./packem_shared/checkLunoraProxy-C9M8c5eS.mjs";import{checkLunoraProxy as vr}from"./packem_shared/checkLunoraProxy-C9M8c5eS.mjs";import{planViteRemoteBindings as x,remoteBindingsCleanupPlugin as O,remoteBindingsConfigPlugin as W}from"./packem_shared/planViteRemoteBindings-BKGgYFk4.mjs";import{withRemoteBindings as hr}from"./packem_shared/planViteRemoteBindings-BKGgYFk4.mjs";import{lunoraSolutionFinders as D}from"./packem_shared/lunoraSolutionFinder--J0x2mAM.mjs";import{lunoraSolutionFinder as Pr}from"./packem_shared/lunoraSolutionFinder--J0x2mAM.mjs";import{studioPlugin as T}from"./packem_shared/STUDIO_PATH-DWBxpyjt.mjs";import{STUDIO_PATH as Ar,buildStudioUrl as _r}from"./packem_shared/STUDIO_PATH-DWBxpyjt.mjs";import{withWorkerStartupHint as V}from"./packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs";import{WORKER_STARTUP_HINT as Or,augmentWorkerStartupError as Wr,isWorkerEntryEvalError as Dr}from"./packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs";import{wranglerValidatorPlugin as C}from"./packem_shared/wranglerValidatorPlugin-Dma0xUy2.mjs";import{default as Vr}from"./packem_shared/LUNORA_API_UPDATED_EVENT-CO2Rv2re.mjs";import{reconcileWranglerCrons as Lr}from"@lunora/config/cloudflare";const L=e=>({apply:"serve",configureServer(r){return()=>{m(e.projectRoot).installed||!f()||r.config.logger.warn(`
2
+ ${l(d)}
3
+ `)}},name:"lunora:agent-rules-hint"}),N=()=>({}),y={astro:"Astro",none:"standalone (SPA / SSR-less)",nuxt:"Nuxt","react-router":"React Router","solid-start":"SolidStart",sveltekit:"SvelteKit","tanstack-start":"TanStack Start","tanstack-start-solid":"TanStack Start (Solid)",vinext:"Next.js on Vite (vinext)"},U=e=>{const r=y[e.framework];return e.framework==="none"?l("no meta-framework detected — running standalone."):e.class==="B"?l(`detected ${r} — composition is handled by the framework adapter.`):l(`detected ${r} — composing the Lunora worker into one Cloudflare Worker.`)},b=(e,r)=>{let t=!1;const o=()=>{r.framework??=p(e.projectRoot)};return{config(){o()},configResolved(){o()},configureServer(){o(),!t&&r.framework!==void 0&&(t=!0,console.info(U(r.framework)))},name:"lunora:framework-detect"}},I=e=>{if(e===!1)return!1;const r=e===!0||e===void 0?{}:e;return{...r,forwardedConsoleMethods:r.forwardedConsoleMethods??["error","warn"],solutionFinders:[...D,...r.solutionFinders??[]]}},j=e=>{const r=e??{},t=r.schemaDir??"lunora";let o;r.cloudflare===!1?o=!1:r.cloudflare===!0||r.cloudflare===void 0?o={}:o=r.cloudflare;const a=r.projectRoot??process.cwd();return{allowUnauthenticatedShardAccess:r.allowUnauthenticatedShardAccess??!1,apiSpec:r.apiSpec??"openapi",cloudflare:o,studio:r.studio??!0,generatedDir:r.generatedDir??`${t}/_generated`,overlay:I(r.overlay),projectRoot:a,schemaDir:t,target:g(a,r.target),validateWrangler:r.validateWrangler??!0}},nr=e=>{const r=j(e),t=N(),{isServe:o,plugin:a}=w(),n=[a,b(r,t),E(r,t),h(r),S(r),A(),k(r),L(r),_()];if(r.studio&&n.push(T()),r.validateWrangler&&n.push(C(r)),r.overlay!==!1&&n.push(R(r.overlay)),r.cloudflare!==!1){n.push(v(r));const i=x({projectRoot:r.projectRoot}),s=P(r.cloudflare,o);i.enabled&&(i.configPath!==void 0&&n.push(O(i.cleanup)),n.push(W(s,i))),n.push(...V(c(s)))}return n},ar=u(import.meta.url)("../package.json").version;export{dr as CLASS_A_WIRING,cr as DEV_WORKER_ENV_VALUE,mr as DEV_WORKER_ENV_VAR,Vr as LUNORA_API_UPDATED_EVENT,pr as LUNORA_WORKER_VIRTUAL_ID,Ar as STUDIO_PATH,ar as VERSION,Or as WORKER_STARTUP_HINT,Wr as augmentWorkerStartupError,_r as buildStudioUrl,gr as buildWorkerEntrySource,vr as checkLunoraProxy,S as codegenPlugin,v as containerLogsPlugin,w as createCommandProbe,sr as detectFramework,k as devStatePlugin,h as devVariablesPlugin,E as frameworkComposePlugin,Rr as isAutoComposable,Dr as isWorkerEntryEvalError,A as logStreamPlugin,nr as lunora,Pr as lunoraSolutionFinder,D as lunoraSolutionFinders,x as planViteRemoteBindings,_ as proxyCheckPlugin,Lr as reconcileWranglerCrons,O as remoteBindingsCleanupPlugin,W as remoteBindingsConfigPlugin,I as resolveOverlayOption,T as studioPlugin,P as withDevWorkerEnv,hr as withRemoteBindings,V as withWorkerStartupHint,C as wranglerValidatorPlugin};
@@ -1,12 +1,12 @@
1
- import{existsSync as f,readFileSync as h}from"node:fs";import{resolve as k,join as c}from"node:path";import{LunoraError as v}from"@lunora/errors";const d="virtual:lunora/worker",w="\0",i=`${w}${d}`,A=`// @lunora/vite — the composed worker entry is worker-only and unavailable in the client environment.
1
+ import{existsSync as f,readFileSync as h}from"node:fs";import{resolve as v,join as l}from"node:path";import{LunoraError as k}from"@lunora/errors";const d="virtual:lunora/worker",R="\0",i=`${R}${d}`,w=`// @lunora/vite — the composed worker entry is worker-only and unavailable in the client environment.
2
2
  export default {};
3
- `,R=/\/$/,m={"react-router":{handler:'{ fetch: (request) => createRequestHandler(() => import("virtual:react-router/server-build"), import.meta.env.MODE)(request) }',imports:'import { createRequestHandler } from "react-router";'},"solid-start":{handler:"ssrModule.default",imports:'import * as ssrModule from "@solidjs/start/server-handler";'},"tanstack-start":{handler:"ssrModule.default",imports:'import * as ssrModule from "@tanstack/react-start/server-entry";'},"tanstack-start-solid":{handler:"ssrModule.default",imports:'import * as ssrModule from "@tanstack/solid-start/server-entry";'},vinext:{handler:"ssrModule.default",imports:'import * as ssrModule from "vinext/server/fetch-handler";'}},l=r=>{const e=r.framework;return e?.class==="A"&&m[e.framework]!==void 0},S=r=>{try{const e=JSON.parse(h(c(r,"package.json"),"utf8"));return["dependencies","devDependencies","peerDependencies"].some(t=>e[t]?.lunorash!==void 0)}catch{return!1}},O=(r,e,t=!1,n=!1,o=!1)=>{const a=m[r];if(a===void 0)throw new v("INTERNAL",`[lunora] no class-A worker wiring for framework "${r}"`);const s=e.replaceAll("\\","/"),u=n?"lunorash/runtime":"@lunora/runtime",p=t?`
3
+ `,A=/\/$/,u={"react-router":{handler:'{ fetch: (request) => createRequestHandler(() => import("virtual:react-router/server-build"), import.meta.env.MODE)(request) }',imports:'import { createRequestHandler } from "react-router";'},"solid-start":{handler:"ssrModule.default",imports:'import * as ssrModule from "@solidjs/start/server-handler";'},"tanstack-start":{handler:"ssrModule.default",imports:'import * as ssrModule from "@tanstack/react-start/server-entry";'},"tanstack-start-solid":{handler:"ssrModule.default",imports:'import * as ssrModule from "@tanstack/solid-start/server-entry";'},vinext:{handler:"ssrModule.default",imports:'import * as ssrModule from "vinext/server/fetch-handler";'}},c=e=>{const r=e.framework;return r?.class==="A"&&u[r.framework]!==void 0},S=e=>{try{const r=JSON.parse(h(l(e,"package.json"),"utf8"));return["dependencies","devDependencies","peerDependencies"].some(t=>r[t]?.lunorash!==void 0)}catch{return!1}},O=(e,r,t=!1,a=!1,o=!1)=>{const n=u[e];if(n===void 0)throw new k("INTERNAL",`[lunora] no class-A worker wiring for framework "${e}"`);const s=r.replaceAll("\\","/"),m=a?"lunorash/runtime":"@lunora/runtime",p=t?`
4
4
  export * from "${s}/containers";
5
5
  `:"";return`// Generated by @lunora/vite — class-A worker composition (PLAN4 M2).
6
- // Do not edit: emitted from the detected framework (${r}). Point your
6
+ // Do not edit: emitted from the detected framework (${e}). Point your
7
7
  // wrangler \`main\` here (or re-export it) instead of hand-wiring createWorker.
8
- import { composeWorker } from "${u}";
9
- ${a.imports}
8
+ import { composeWorker } from "${m}";
9
+ ${n.imports}
10
10
  import { LUNORA_FUNCTIONS } from "${s}/functions";
11
11
  import { openApiSpec } from "${s}/openapi";
12
12
  import { createShardDO } from "${s}/shard";
@@ -21,7 +21,7 @@ export default {
21
21
  worker ??= composeWorker({${o?`
22
22
  allowUnauthenticatedShardAccess: true,`:""}
23
23
  functions: LUNORA_FUNCTIONS,
24
- httpRouter: ${a.handler},
24
+ httpRouter: ${n.handler},
25
25
  openApiSpec,
26
26
  routes: {},
27
27
  shardDO: env.SHARD,
@@ -30,4 +30,4 @@ export default {
30
30
  return worker.fetch(request, env, context);
31
31
  },
32
32
  };
33
- `},x=(r,e)=>{const t=k(r.projectRoot,r.generatedDir.replace(R,"")),n=S(r.projectRoot);return{load(o){if(o===i&&l(e)&&e.framework!==void 0){if(this.environment.name==="client")return A;const a=f(c(t,"containers.ts"));return O(e.framework.framework,t,a,n,r.allowUnauthenticatedShardAccess)}},name:"lunora:framework-compose",resolveId(o){if(o===d&&l(e))return i}}};export{m as CLASS_A_WIRING,d as LUNORA_WORKER_VIRTUAL_ID,i as RESOLVED_LUNORA_WORKER_ID,O as buildWorkerEntrySource,x as frameworkComposePlugin,l as isAutoComposable};
33
+ `},_=(e,r)=>{const t=v(e.projectRoot,e.generatedDir.replace(A,"")),a=S(e.projectRoot);return{load(o){if(o===i&&c(r)&&r.framework!==void 0){if(this.environment.name==="client")return w;const n=f(l(t,"containers.ts"));return O(r.framework.framework,t,n,a,e.allowUnauthenticatedShardAccess)}},name:"lunora:framework-compose",resolveId(o){if(o===d&&c(r))return i}}};export{u as CLASS_A_WIRING,d as LUNORA_WORKER_VIRTUAL_ID,i as RESOLVED_LUNORA_WORKER_ID,O as buildWorkerEntrySource,_ as frameworkComposePlugin,c as isAutoComposable};
@@ -0,0 +1 @@
1
+ const o="WORKER_ENV",a="development",r=(n,t)=>{const e=n.config;return{...n,config:c=>{if(typeof e=="function"){const s=e(c);s&&Object.assign(c,s)}else e&&Object.assign(c,e);t()&&(c.vars={[o]:a,...c.vars})}}},i=()=>{let n;return{isServe:()=>n==="serve",plugin:{config(t,e){n=e.command},enforce:"pre",name:"lunora:command-probe"}}};export{a as DEV_WORKER_ENV_VALUE,o as DEV_WORKER_ENV_VAR,i as createCommandProbe,r as withDevWorkerEnv};
@@ -0,0 +1 @@
1
+ import{detectAgentRules as C}from"@lunora/config";import{handleSeedRequest as L,handleSchemaEditRequest as b,handlePolicyScaffoldRequest as A,SEED_ENDPOINT as E,SCHEMA_EDIT_ENDPOINT as N,POLICY_SCAFFOLD_ENDPOINT as p,transportRejectionReason as I,serveJsonHandler as _,isStandaloneModulePath as R,renderStudioHtml as O,resolveAdminToken as $,headerValue as u,studioAssetsStamp as D,loadStudioAssets as P,readStandaloneAsset as x,assetContentType as j}from"@lunora/config/studio-host";const l="/__lunora",U=`${l}/studio.js`,g=`${l}/styles.css`,k=/^\//,v=/\/$/,y={[p]:A,[N]:b,[E]:L},w=new Set(Object.keys(y)),B=t=>{const e=u(t["sec-fetch-site"]);if(e!==void 0)return e==="same-origin"||e==="same-site"||e==="none"?void 0:"cross-origin request rejected";const o=u(t.origin);if(o===void 0||o==="null")return;let n;try{n=new URL(o).host.toLowerCase()}catch{return"invalid origin header"}const i=u(t.host);return i===void 0||n!==i?"cross-origin request rejected":void 0},G=t=>{const e=t.headers??{},o=B(e);if(o!==void 0)return o;const n=(t.method??"GET").toUpperCase();if(n!=="GET"&&n!=="HEAD"&&!u(e["content-type"])?.startsWith("application/json"))return"content-type must be application/json"},m=(t,e,o)=>{t.statusCode=200,t.setHeader("Content-Type",o),t.end(e)},W=t=>{const e=l.replace(k,"");if(t.resolvedLocal!==void 0&&t.resolvedLocal!=="")return`${t.resolvedLocal.endsWith("/")?t.resolvedLocal.slice(0,-1):t.resolvedLocal}/${e}`;const o=t.base===void 0||t.base==="/"?"":t.base.replace(v,"");if(t.address===void 0||typeof t.address=="string")return`http://localhost:5173${o}/${e}`;const n=t.address.address==="::"||t.address.address==="0.0.0.0"?"localhost":t.address.address;return`http://${n.includes(":")?`[${n}]`:n}:${String(t.address.port)}${o}/${e}`},F=t=>{try{return new URL(t,"http://localhost").pathname.replace(v,"")}catch{return t}},J=(t,e)=>{let o,n,i;const f=t.config.root??process.cwd(),H=(r,d,s)=>{const a=D();if((o===void 0||a!==n)&&(o=P(t.config.logger),n=a),o===void 0){s.statusCode=501,s.setHeader("Content-Type","text/plain"),s.end("Lunora studio assets not found — install and build @lunora/studio.");return}const h=r===g,c=r.slice(r.lastIndexOf("/")+1),S=a===void 0?void 0:`W/"${c}-${String(a)}"`;if(s.setHeader("Cache-Control","no-cache"),S!==void 0&&(s.setHeader("ETag",S),u(d.headers?.["if-none-match"])===S.toLowerCase())){s.statusCode=304,s.end();return}if(h){m(s,o.styles,"text/css; charset=utf-8");return}const T=x(c);if(T===void 0){s.statusCode=404,s.setHeader("Content-Type","text/plain"),s.end("Not found");return}m(s,T,j(c))};return(r,d,s)=>{const a=F(r.url??"");if(a!==l&&!a.startsWith(`${l}/`)){s();return}if(e||I(r,t.config.logger)!==void 0){d.statusCode=403,d.setHeader("Content-Type","text/plain"),d.end("Lunora studio is only available on loopback hosts in dev.");return}if(w.has(a)){const c=G(r);if(c!==void 0){d.statusCode=403,d.setHeader("Content-Type","application/json; charset=utf-8"),d.end(JSON.stringify({error:c,ok:!1}));return}}const h=y[a];if(h!==void 0){_(r,d,h,f);return}if(a===g||R(a)){H(a,r,d);return}i??=O({adminToken:$(f),basePath:l,dataEditable:!0,rulesInstalled:C(f).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:U,styleHref:g}),m(d,i,"text/html; charset=utf-8")}},V=()=>({apply:"serve",configureServer(t){const e=t.config.server?.host,o=e!==void 0&&e!==!1&&e!=="localhost"&&e!=="127.0.0.1"&&e!=="::1";return t.middlewares.use(J(t,o)),()=>{const n=()=>{const i=W({address:t.httpServer?.address()??void 0,base:t.config.base,resolvedLocal:t.resolvedUrls?.local[0]});t.config.logger.info(` \x1B[32m➜\x1B[39m \x1B[1mLunora\x1B[22m: \x1B[36m${i}\x1B[39m`)};if(typeof t.printUrls=="function"){const i=t.printUrls.bind(t);t.printUrls=()=>{i(),n()}}else t.httpServer?.listening===!0?n():t.httpServer?.once("listening",n)}},name:"lunora:studio"});export{l as STUDIO_PATH,U as STUDIO_SCRIPT_PATH,g as STUDIO_STYLE_PATH,W as buildStudioUrl,V as studioPlugin};
@@ -1,5 +1,5 @@
1
- const n=[""," ┌─ Lunora ──────────────────────────────────────────────────────────────"," │ Your Worker entry threw while loading, so the dev server couldn't read"," │ its exports. The TypeError above comes from inside the Cloudflare"," │ runtime and hides the file that actually failed. It is almost always:"," │"," │ • A circular import in lunora/. A query/mutation/action module ran at"," │ the top level before `v`/`query`/`mutation` finished initializing,"," │ so they were `undefined` (hence `reading 'string'`/`'id'`/…)."," │ → Import `v`/`query`/`mutation` only from `lunora/_generated/server`,"," │ and don't import one lunora/ function module from another at the"," │ top level."," │"," │ • Stale or missing generated files."," │ → Re-run `lunora codegen`, then restart the dev server."," │"," │ Tip: check the lunora/ files you edited most recently — the throw is at"," │ their module top level."," └───────────────────────────────────────────────────────────────────────"].join(`
2
- `),l=/runner-worker[/\\]index\.js/u,u=/getWorkerEntryExportTypes/u,d=e=>{if(!(e instanceof Error))return!1;const r=`${e.stack??""}
3
- ${e.message}`;return l.test(r)||u.test(r)},i=Symbol.for("lunora.workerStartupHintApplied"),c=e=>{if(!d(e))return e;const r=e;return r[i]||Object.isFrozen(r)||Object.isSealed(r)||(r[i]=!0,r.message=`${r.message}
4
- ${n}`,typeof r.stack=="string"&&(r.stack=`${r.stack}
5
- ${n}`)),e},s=e=>async(...r)=>{try{return await e(...r)}catch(t){throw c(t)}},h=e=>typeof e=="function"?s(e):e!==null&&typeof e=="object"&&"handler"in e&&typeof e.handler=="function"?{...e,handler:s(e.handler)}:e,f=["configureServer","buildStart"],m=e=>e.map(r=>{let t=r;for(const o of f){const a=r[o];a!==void 0&&(t={...t,[o]:h(a)})}return t});export{n as WORKER_STARTUP_HINT,c as augmentWorkerStartupError,d as isWorkerEntryEvalError,m as withWorkerStartupHint};
1
+ const a=[""," ┌─ Lunora ──────────────────────────────────────────────────────────────"," │ Your Worker entry threw while loading, so the dev server couldn't read"," │ its exports. The TypeError above comes from inside the Cloudflare"," │ runtime and hides the file that actually failed. It is almost always:"," │"," │ • A circular import in lunora/. A query/mutation/action module ran at"," │ the top level before `v`/`query`/`mutation` finished initializing,"," │ so they were `undefined` (hence `reading 'string'`/`'id'`/…)."," │ → Import `v`/`query`/`mutation` only from `lunora/_generated/server`,"," │ and don't import one lunora/ function module from another at the"," │ top level."," │"," │ • Stale or missing generated files."," │ → Re-run `lunora codegen`, then restart the dev server."," │"," │ Tip: check the lunora/ files you edited most recently — the throw is at"," │ their module top level."," └───────────────────────────────────────────────────────────────────────"].join(`
2
+ `),u=/runner-worker[/\\]index\.js/u,l=/getWorkerEntryExportTypes/u,c=e=>{if(!(e instanceof Error))return!1;const t=`${e.stack??""}
3
+ ${e.message}`;return u.test(t)||l.test(t)},i=Symbol.for("lunora.workerStartupHintApplied"),d=e=>{if(!c(e))return e;const t=e;return t[i]||Object.isFrozen(t)||Object.isSealed(t)||(t[i]=!0,t.message=`${t.message}
4
+ ${a}`,typeof t.stack=="string"&&(t.stack=`${t.stack}
5
+ ${a}`)),e},s=e=>async(...t)=>{try{return await e(...t)}catch(r){throw d(r)}},f=e=>typeof e=="function"?s(e):e!==null&&typeof e=="object"&&"handler"in e&&typeof e.handler=="function"?{...e,handler:s(e.handler)}:e,m=["configureServer","buildStart"],h=e=>e.map(t=>{let r=t;for(const n of m){const o=t[n];o!==void 0&&(r={...r,[n]:f(o)})}return r});export{a as WORKER_STARTUP_HINT,d as augmentWorkerStartupError,c as isWorkerEntryEvalError,h as withWorkerStartupHint};
@@ -1 +1 @@
1
- import{g as a}from"./log-DTdeAemA.mjs";const c=["/_lunora"],h="/_lunora/ws",p=e=>{if(e.startsWith("^"))try{return new RegExp(e,"u").test(h)}catch{return!1}return c.some(r=>e.startsWith(r)||r.startsWith(e))},i=(e,r)=>{if(!e)return[];const t=[];for(const[s,o]of Object.entries(e)){if(!p(s))continue;if(typeof o=="string"){t.push(`${r}.proxy["${s}"] uses the string shorthand, which does not proxy WebSocket upgrades. Live queries and shapes will never connect (the app hangs on its loading state) while HTTP RPC appears to work. Use the object form: { target: "${o}", ws: true }.`);continue}if(typeof o!="object"||o===null)continue;const n=o;n.ws!==!0&&t.push(`${r}.proxy["${s}"] is missing \`ws: true\`, so WebSocket upgrades are not proxied. Live queries and shapes will never connect (the app hangs on its loading state) while HTTP RPC appears to work.`),n.changeOrigin===!0&&t.push(`${r}.proxy["${s}"] sets \`changeOrigin: true\`, so the worker sees a different origin than the browser sends. Loopback-to-loopback is trusted by default; for any other dev host add the dev-server origin to the worker's \`security.csrf.trustedOrigins\` or the cookie-bearing WebSocket upgrade is rejected with FORBIDDEN_ORIGIN.`)}return t},g=()=>({apply:"serve",configResolved(e){const r=[...i(e.server.proxy,"server"),...i(e.preview.proxy,"preview")];for(const t of r)e.logger.warn(a(t))},name:"lunora:proxy-check"});export{i as checkLunoraProxy,g as proxyCheckPlugin};
1
+ import{l as a}from"./log-DE48L4Oz.mjs";const c=["/_lunora"],u="/_lunora/ws",h=e=>{if(e.startsWith("^"))try{return new RegExp(e,"u").test(u)}catch{return!1}return c.some(r=>e.startsWith(r)||r.startsWith(e))},i=(e,r)=>{if(!e)return[];const t=[];for(const[s,o]of Object.entries(e)){if(!h(s))continue;if(typeof o=="string"){t.push(`${r}.proxy["${s}"] uses the string shorthand, which does not proxy WebSocket upgrades. Live queries and shapes will never connect (the app hangs on its loading state) while HTTP RPC appears to work. Use the object form: { target: "${o}", ws: true }.`);continue}if(typeof o!="object"||o===null)continue;const n=o;n.ws!==!0&&t.push(`${r}.proxy["${s}"] is missing \`ws: true\`, so WebSocket upgrades are not proxied. Live queries and shapes will never connect (the app hangs on its loading state) while HTTP RPC appears to work.`),n.changeOrigin===!0&&t.push(`${r}.proxy["${s}"] sets \`changeOrigin: true\`, so the worker sees a different origin than the browser sends. Loopback-to-loopback is trusted by default; for any other dev host add the dev-server origin to the worker's \`security.csrf.trustedOrigins\` or the cookie-bearing WebSocket upgrade is rejected with FORBIDDEN_ORIGIN.`)}return t},g=()=>({apply:"serve",configResolved(e){const r=[...i(e.server.proxy,"server"),...i(e.preview.proxy,"preview")];for(const t of r)e.logger.warn(a(t))},name:"lunora:proxy-check"});export{i as checkLunoraProxy,g as proxyCheckPlugin};
@@ -0,0 +1,3 @@
1
+ import{existsSync as O}from"node:fs";import{join as x,resolve as h,sep as b,basename as L}from"node:path";import{findTsconfig as G,createCodegenProject as M,refreshCodegenProject as I,runCodegen as B,describeErrorLevelFindings as U,CodegenDiagnosticError as V}from"@lunora/codegen";import{LUNORA_CONFIG_FILE as F,inferLunoraBindings as J}from"@lunora/config";import{findWranglerFile as z,readWranglerJsonc as q,WRANGLER_FILES as H,collectWranglerSecretVariables as K,reconcileWranglerBindings as Q,reconcileWranglerCrons as X,reconcileWranglerCompatibilityDate as Y}from"@lunora/config/cloudflare";import{isRunnableDevEnvironment as Z}from"vite";import ee from"./LUNORA_API_UPDATED_EVENT-CO2Rv2re.mjs";import{L as f,a as P}from"./log-DE48L4Oz.mjs";import{r as ne,a as re}from"./server-close-Qoh4i6Ay.mjs";const W=(n,r)=>{try{const{parsed:o,text:e}=q(n);return o===void 0?`raw:${e}`:JSON.stringify(r?r(o):o)}catch{return"unreadable"}},te=n=>{const r={...n},{triggers:o}=r;if(o!==null&&typeof o=="object"){const e={...o};delete e.crons,Object.keys(e).length>0?r.triggers=e:delete r.triggers}return r},k=n=>{const r=z(n),o=r===void 0?"absent":W(r,te),e=x(n,F),s=O(e)?W(e):"absent";return`${o}\0${s}`},oe=100,_=/[/\\]tsconfig\..+\.json$/u,ie=n=>{const r=n.map(e=>` • ${e.kind} "${e.exportName}" — class ${e.className} is not exported by your worker entry.`),o=[...new Set(n.map(e=>e.module))].map(e=>` export * from "./lunora/_generated/${e}";`);return[`[lunora] ${String(n.length)} declared ${n.length===1?"binding is":"bindings are"} not exported by your worker entry — \`wrangler deploy\` will fail.`,...r,"","Add to your worker entry:",...o].join(`
2
+ `)},ae=async(n,r,o)=>{try{const e=await J({projectRoot:n.projectRoot,schemaDir:n.schemaDir}),s=Q(n.projectRoot,e);s.changed&&r.info?.(`${f} inferred bindings → ${s.added.join(", ")} (written to ${s.wranglerPath??"wrangler.jsonc"})`);for(const c of s.warnings)r.warn(`${f} ${c}`);s.exportGaps.length>0&&o?.(s.exportGaps)}catch(e){const s=e instanceof Error?e.message:String(e);r.warn(`${f} binding inference skipped: ${s}`)}},ce=(n,r,o)=>{try{const e=X(n,r);e.changed&&o.info?.(`${f} synced ${r.length.toFixed(0)} cron trigger(s) into ${e.wranglerPath??"wrangler.jsonc"}`)}catch(e){const s=e instanceof Error?e.message:String(e);o.warn(`${f} cron trigger sync skipped: ${s}`)}try{const e=Y(n);e.changed&&o.info?.(`${f} bumped compatibility_date to ${e.date??"unknown"} (Workers Cache enabled) → ${e.wranglerPath??"wrangler.jsonc"}`)}catch(e){const s=e instanceof Error?e.message:String(e);o.warn(`${f} compatibility date sync skipped: ${s}`)}},se=n=>{const{advisoryNames:r,platformDiagnosticNames:o}=U(n),e=[...new Set([...r,...o])].toSorted((c,l)=>c.localeCompare(l));if(e.length===0)return;const s=e.length===1?"advisory/platform diagnostic":"advisories/platform diagnostics";return`${f} ${String(e.length)} ERROR-level ${s} (${e.join(", ")}) — see the log above for detail.`},N=(n,r,o,e)=>{const s=x(n.projectRoot,n.schemaDir,"schema.ts");if(!O(s))return r.warn(`${f} schema.ts not found at ${s} — codegen skipped`),{};try{const c=B({apiSpec:n.apiSpec,lunoraDirectory:n.schemaDir,project:e,projectRoot:n.projectRoot,target:n.target,wranglerVariables:K(n.projectRoot)});ce(n.projectRoot,c.cronTriggers,r);for(const l of c.advisories){const g=P(l.level,l.name,l.detail,l.remediation);l.level==="ERROR"?r.error(g):r.warn(g)}for(const l of c.platformDiagnostics){const g=P(l.level==="error"?"ERROR":"WARN",l.name,l.message,l.remediation);l.level==="error"?r.error(g):r.warn(g)}return{blockingMessage:se(c),outputDirectory:h(c.outputDirectory)}}catch(c){const l=c instanceof Error?c.message:String(c);return r.error(`${f} codegen failed: ${l}`),o?.onError(c,l),{}}},le=(n,r,o)=>{let e;for(const[s,c]of Object.entries(n.environments)){if(s==="client"){e=c;continue}Z(c)||c.hot.send({path:"*",triggeredBy:r,type:"full-reload"})}if(e===void 0){n.hot.send({type:"full-reload"});return}if(o){e.hot.send({type:"full-reload"});return}e.hot.send({event:ee,type:"custom"})},$e=n=>{const r=h(n.projectRoot,n.schemaDir);let o=h(n.projectRoot,n.generatedDir),e;const s=new Map;let c,l=!1,g=!1,S;return{config(t,w){S=w.command},async buildStart(){const t={error:u=>{console.error(u)},info:u=>{console.info(u)},warn:u=>{console.warn(u)}},{blockingMessage:w,outputDirectory:y}=N(n,t);y!==void 0&&(o=y),S==="build"&&w!==void 0&&this.error(w),await ae(n,t,u=>{e?.hot.send({err:{loc:void 0,message:ie(u),stack:""},type:"error"})}),e!==void 0&&(c=k(n.projectRoot),l=!0)},configureServer(t){e=t,t.watcher.add(r),c=k(n.projectRoot),l=!1;const w={error:i=>{t.config.logger.error(i)},info:i=>{t.config.logger.info(i)},warn:i=>{t.config.logger.warn(i)}};let y=!1;const u={onError(i,a){y=!0;const d=i instanceof V?{column:i.column,file:i.file,line:i.line}:void 0,E=d===void 0?`[lunora] codegen failed: ${a}
3
+ (see terminal for full stack trace and file location)`:`[lunora] codegen failed: ${a}`;e?.hot.send({err:{loc:d,message:E,stack:i instanceof Error?i.stack??"":""},type:"error"})}},R=(i,a)=>i===a||i.startsWith(a+b);let j=!1,p,m;const T=()=>{for(const i of Object.values(t.environments)){const a=i.moduleGraph;for(const d of a.idToModuleMap.values())d.id&&R(d.id,o)&&a.invalidateModule(d)}},$=i=>{const a=h(i);if(_.test(a)){m=void 0;return}if(a.endsWith(`${b}tsconfig.json`)&&a===G(r)){m=void 0;return}R(a,r)&&(R(a,o)||a.endsWith(".ts")&&(a.includes(`${b}__tests__${b}`)||a.endsWith(".test.ts")||a.endsWith(".spec.ts")||(p&&clearTimeout(p),p=setTimeout(()=>{if(p=void 0,j)return;m===void 0?m=M(r):I(m,r);const{outputDirectory:d}=N(n,w,u,m);if(d===void 0){m=void 0;return}o=d,T(),le(t,a,y),y=!1},oe))))},C=i=>{const a=h(i);(a.endsWith(`${b}tsconfig.json`)||_.test(a))&&(m=void 0)};t.watcher.on("add",$),t.watcher.on("change",$),t.watcher.on("unlink",$),t.watcher.on("unlink",C);const D=new Set([...H.map(i=>h(n.projectRoot,i)),h(n.projectRoot,F)]);for(const i of D)t.watcher.add(i);const v=i=>{if(!D.has(h(i))||g)return;const a=k(n.projectRoot);if(!l){c=a;return}if(c===void 0){c=a;return}a!==c&&(c=a,g=!0,t.config.logger.info(`${f} ${L(h(i))} changed — restarting dev server`),Promise.resolve(t.restart()).finally(()=>{g=!1}).catch(d=>{const E=d instanceof Error?d.message:String(d);t.config.logger.error(`${f} dev server restart failed: ${E} — keeping the running server; re-save your config to retry.`),t.hot.send({err:{loc:void 0,message:`[lunora] dev server restart failed: ${E}`,stack:""},type:"error"})}))};t.watcher.on("add",v),t.watcher.on("change",v),t.watcher.on("unlink",v);const A=()=>{j||(j=!0,m=void 0,p&&(clearTimeout(p),p=void 0),t.watcher.off("add",$),t.watcher.off("change",$),t.watcher.off("unlink",$),t.watcher.off("unlink",C),t.watcher.off("add",v),t.watcher.off("change",v),t.watcher.off("unlink",v))};return()=>{re(t,s,A)}},buildEnd(){ne(s,this.environment)},name:"lunora:codegen"}};export{$e as default};
@@ -1 +1 @@
1
- import{discoverContainerInfo as l,streamContainerLogs as m}from"@lunora/config";import{g as s}from"./log-DTdeAemA.mjs";const u=r=>{let n;const a=()=>{n?.close(),n=void 0};return{apply:"serve",buildEnd(){a()},configureServer(t){if(n||process.env.LUNORA_CONTAINER_LOGS==="0")return;const c=l(r.projectRoot,r.schemaDir).containers.map(e=>({className:e.className,exportName:e.exportName}));if(c.length===0)return;const{logger:o}=t.config;n=m({containers:c,onLine:e=>{const i=s(`container:${e.name} ${e.text}`);e.level==="error"?o.warn(i):o.info(i)},onUnavailable:e=>{o.warn(s(`container: Docker engine unreachable — container logs unavailable (${e})`))}}),t.httpServer?.once("close",a)},name:"lunora:container-logs"}};export{u as default};
1
+ import{discoverContainerInfo as l,streamContainerLogs as m}from"@lunora/config";import{l as i}from"./log-DE48L4Oz.mjs";const p=r=>{let n;const a=()=>{n?.close(),n=void 0};return{apply:"serve",buildEnd(){a()},configureServer(t){if(n||process.env.LUNORA_CONTAINER_LOGS==="0")return;const c=l(r.projectRoot,r.schemaDir).containers.map(e=>({className:e.className,exportName:e.exportName}));if(c.length===0)return;const{logger:o}=t.config;n=m({containers:c,onLine:e=>{const s=i(`container:${e.name} ${e.text}`);e.level==="error"?o.warn(s):o.info(s)},onUnavailable:e=>{o.warn(i(`container: Docker engine unreachable — container logs unavailable (${e})`))}}),t.httpServer?.once("close",a)},name:"lunora:container-logs"}};export{p as default};
@@ -0,0 +1 @@
1
+ import{DEV_HANDOFF_ENV as a,claimDevServerState as c,DEV_LOG_FILE_ENV as p,DEV_DAEMON_ENV as u,clearDevServerState as f}from"@lunora/config";import{l as v}from"./log-DE48L4Oz.mjs";import{r as g,a as S}from"./server-close-Qoh4i6Ay.mjs";const m=/\/$/,D=o=>{const r=o.resolvedUrls?.local[0];if(r!==void 0)return r.replace(m,"");const t=o.httpServer?.address();if(t!==null&&typeof t=="object")return`http://localhost:${String(t.port)}`},b=o=>{let r=!1;const t=new Map;return{apply:"serve",configureServer(e){const l=o.projectRoot,d=()=>{if(r)return;const n=D(e);if(n===void 0)return;const s=Number(process.env[a]),i=c(l,{background:process.env[u]==="1",logFile:process.env[p],mode:"vite",pid:process.pid,startedAt:new Date().toISOString(),url:n},Number.isInteger(s)&&s>0?{supersedePid:s}:void 0);if(!i.ok){i.existing!==void 0&&e.config.logger.warn(v(`another dev server is already recorded at ${i.existing.url} (pid ${String(i.existing.pid)}) — leaving .lunora/dev.json untouched`));return}r=!0};return S(e,t,()=>{r&&(f(l,process.pid),r=!1)}),()=>{if(typeof e.printUrls=="function"){const n=e.printUrls.bind(e);e.printUrls=()=>{n(),d()}}e.httpServer?.once("listening",()=>{setTimeout(d,0)})}},buildEnd(){g(t,this.environment)},name:"lunora:dev-state"}};export{b as default};
@@ -0,0 +1 @@
1
+ import{ensureDevVariables as a,createConfirm as n,fillDevSecrets as c}from"@lunora/config";import{l}from"./log-DE48L4Oz.mjs";const s=e=>({apply:"serve",async configResolved(){const o=r=>{console.info(l(r))};await a({confirm:n("[lunora] "),cwd:e.projectRoot,info:o}),c({cwd:e.projectRoot,info:o})},enforce:"pre",name:"lunora:dev-vars"});export{s as default};
@@ -0,0 +1 @@
1
+ import{paintBadge as a,BADGES as o}from"@lunora/config";const i=a(o.lunora),$=n=>`${i} ${n}`,A={ERROR:o.error,INFO:o.info,WARN:o.warn},e=(n,r,s,t)=>`${a(A[n])} ${r}: ${s} — ${t}`;export{i as L,e as a,$ as l};
@@ -0,0 +1,3 @@
1
+ import{detectAiAgent as u,LUNORA_EVENT_SOURCE as a,formatLunoraEvent as f}from"@lunora/config";import{a as l,r as d}from"./server-close-Qoh4i6Ay.mjs";const p=`"source":"${a}"`,s={error:"\x1B[31m",info:"\x1B[36m",reset:"\x1B[0m",warn:"\x1B[33m"},w=(r,e,t)=>t?`${s[e]}[lunora]${s.reset} ${r}`:`[lunora] ${r}`,v=r=>typeof r=="string"?r:Buffer.isBuffer(r)?r.toString("utf8"):void 0,m=(r,e)=>r.split(`
2
+ `).map(t=>{const n=f(t);return n?w(n.text,n.level,e):t}).join(`
3
+ `),S=(r,e)=>(...t)=>{try{const n=v(t[0]);if(n?.includes(p))return r(m(n,e),...t.slice(1))}catch{}return r(...t)},i=r=>{const e=r.write.bind(r),t=S(e,r.isTTY===!0);return r.write=t,()=>{r.write===t&&(r.write=e)}},g=()=>{const r=process.env.LUNORA_LOG_JSON;return r==="1"||r==="true"?!0:r==="0"||r==="false"?!1:u()!==void 0},A=()=>{const r=new Map;let e;return{apply:"serve",buildEnd(){d(r,this.environment)},configureServer(t){if(g())return;e?.();const n=i(process.stdout),c=i(process.stderr),o=()=>{n(),c(),e===o&&(e=void 0)};e=o,l(t,r,o)},name:"lunora:log-stream"}};export{A as default};
@@ -0,0 +1 @@
1
+ import{findLunoraSolution as r}from"@lunora/codegen";const s={handle:e=>{const n=typeof e.message=="string"?e.message:"",o=r(n);return Promise.resolve(o?{body:o.body,header:o.header}:void 0)},name:"lunora",priority:100},i=[s];export{s as lunoraSolutionFinder,i as lunoraSolutionFinders};
@@ -0,0 +1 @@
1
+ import{readProjectRemotePreference as a}from"@lunora/config";import{resolveRemoteEnabled as c,materializeRemoteWranglerConfig as f}from"@lunora/config/cloudflare";import{l as g}from"./log-DE48L4Oz.mjs";const d=()=>{},P=e=>{const n=e.readPreference??a;if(!c({configPreference:n(e.projectRoot),envValue:e.remoteEnv??process.env.LUNORA_REMOTE}))return{cleanup:d,enabled:!1};const r=(e.materialize??f)({enabled:!0,projectRoot:e.projectRoot});return{cleanup:r.cleanup,configPath:r.configPath,enabled:!0,reason:r.reason}},s=(e,n)=>!n.enabled||n.configPath===void 0||typeof e.configPath=="string"?e:{...e,configPath:n.configPath},b=(e,n)=>({config(o,t){if(t.command!=="serve")return;const r=s(e,n),i=e;r.configPath!==void 0&&i.configPath===void 0?i.configPath=r.configPath:n.enabled&&n.configPath===void 0&&n.reason!==void 0&&console.info(g(`remote bindings requested but not applied: ${n.reason}`))},enforce:"pre",name:"lunora:remote-bindings-config"}),h=e=>({buildEnd(){e()},closeBundle(){e()},enforce:"pre",name:"lunora:remote-bindings-cleanup"});export{P as planViteRemoteBindings,h as remoteBindingsCleanupPlugin,b as remoteBindingsConfigPlugin,s as withRemoteBindings};
@@ -0,0 +1 @@
1
+ const o=(e,s,t)=>{e.httpServer?e.httpServer.once("close",t):s.set(e.environments.client,t)},r=(e,s)=>{const t=e.get(s);t!==void 0&&(e.delete(s),t())};export{o as a,r};
@@ -0,0 +1,3 @@
1
+ import{spawnSync as s}from"node:child_process";import{validateWranglerProject as i,readWranglerJsonc as c}from"@lunora/config/cloudflare";import{LunoraError as l}from"@lunora/errors";import{l as a}from"./log-DE48L4Oz.mjs";const g=r=>r.startsWith("./")||r.startsWith("../")||r.startsWith("/")||r.includes("Dockerfile"),d=()=>{try{return s("docker",["info"],{stdio:"ignore"}).status===0}catch{return!1}},u=(r,e=d)=>{const{parsed:n}=c(r);!(n?.containers??[]).some(t=>typeof t?.image=="string"&&g(t.image))||e()||console.warn(a("wrangler.jsonc declares containers built from a local Dockerfile, but no Docker-compatible engine is running. Start Docker (or Colima) before `vite dev`, or the container instances will fail to start."))},f=(r,e)=>{const n=["[lunora] wrangler configuration is missing bindings required by your schema.",` file: ${r}`,"",...e.map(o=>` - ${o}`),""," Update your wrangler.jsonc and restart the dev server."];return new Error(n.join(`
2
+ `))},b=r=>({configResolved(){const e=i({projectRoot:r.projectRoot,schemaDir:r.schemaDir});if(!e.wranglerPath)throw new l("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${r.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
3
+ `));for(const n of e.report.warnings)console.warn(a(`wrangler validator: ${n}`));if(e.problems.length>0)throw f(e.wranglerPath,e.problems);u(e.wranglerPath)},name:"lunora:wrangler-validator"});export{u as warnWhenDockerMissing,b as wranglerValidatorPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/vite",
3
- "version": "1.0.0-alpha.136",
3
+ "version": "1.0.0-alpha.138",
4
4
  "description": "The Lunora Vite plugin: codegen, type sync, wrangler validation, and an error overlay over @cloudflare/vite-plugin",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -45,17 +45,16 @@
45
45
  "access": "public"
46
46
  },
47
47
  "dependencies": {
48
- "@cloudflare/vite-plugin": "1.47.0",
49
- "@lunora/codegen": "1.0.0-alpha.107",
50
- "@lunora/config": "1.0.0-alpha.136",
48
+ "@cloudflare/vite-plugin": "1.51.2",
49
+ "@lunora/codegen": "1.0.0-alpha.109",
50
+ "@lunora/config": "1.0.0-alpha.138",
51
51
  "@lunora/errors": "1.0.0-alpha.21",
52
- "@visulima/vite-overlay": "2.0.5",
53
- "jsonc-parser": "^3.3.1",
52
+ "@visulima/vite-overlay": "2.0.12",
54
53
  "ts-morph": "^28.0.0"
55
54
  },
56
55
  "peerDependencies": {
57
56
  "@lunora/studio": ">=1.0.0-alpha.50 <2.0.0-0",
58
- "vite": "^8.1.5"
57
+ "vite": "^6.1.0 || ^7.0.0 || ^8.0.0"
59
58
  },
60
59
  "peerDependenciesMeta": {
61
60
  "@lunora/studio": {
@@ -1 +0,0 @@
1
- const a="WORKER_ENV",t="development",c=(n,r)=>{const e=n.config;return{...n,config:o=>{if(typeof e=="function"){const s=e(o);s&&Object.assign(o,s)}else e&&Object.assign(o,e);r()&&(o.vars={[a]:t,...o.vars})}}},E=()=>{let n;return{isServe:()=>n==="serve",plugin:{config(r,e){n=e.command},enforce:"pre",name:"lunora:command-probe"}}};export{t as DEV_WORKER_ENV_VALUE,a as DEV_WORKER_ENV_VAR,E as createCommandProbe,c as withDevWorkerEnv};
@@ -1 +0,0 @@
1
- import{detectAgentRules as C}from"@lunora/config";import{handleSeedRequest as H,handleSchemaEditRequest as L,handlePolicyScaffoldRequest as $,SEED_ENDPOINT as b,SCHEMA_EDIT_ENDPOINT as E,POLICY_SCAFFOLD_ENDPOINT as x,transportRejectionReason as I,serveJsonHandler as A,isStandaloneModulePath as P,renderStudioHtml as _,resolveAdminToken as O,headerValue as u,studioAssetsStamp as U,loadStudioAssets as D,readStandaloneAsset as R,assetContentType as j}from"@lunora/config/studio-host";const c="/__lunora",w=`${c}/studio.js`,v=`${c}/styles.css`,N=/^\//,m=/\/$/,T={[x]:$,[E]:L,[b]:H},B=new Set(Object.keys(T)),k=e=>{const t=u(e["sec-fetch-site"]);if(t!==void 0)return t==="same-origin"||t==="same-site"||t==="none"?void 0:"cross-origin request rejected";const s=u(e.origin);if(s===void 0||s==="null")return;let n;try{n=new URL(s).host.toLowerCase()}catch{return"invalid origin header"}const d=u(e.host);return d===void 0||n!==d?"cross-origin request rejected":void 0},q=e=>{const t=e.headers??{},s=k(t);if(s!==void 0)return s;const n=(e.method??"GET").toUpperCase();if(n!=="GET"&&n!=="HEAD"&&!u(t["content-type"])?.startsWith("application/json"))return"content-type must be application/json"},g=(e,t,s)=>{e.statusCode=200,e.setHeader("Content-Type",s),e.end(t)},W=e=>{const t=c.replace(N,"");if(e.resolvedLocal!==void 0&&e.resolvedLocal!=="")return`${e.resolvedLocal.endsWith("/")?e.resolvedLocal.slice(0,-1):e.resolvedLocal}/${t}`;const s=e.base===void 0||e.base==="/"?"":e.base.replace(m,"");if(e.address===void 0||typeof e.address=="string")return`http://localhost:5173${s}/${t}`;const n=e.address.address==="::"||e.address.address==="0.0.0.0"?"localhost":e.address.address;return`http://${n.includes(":")?`[${n}]`:n}:${String(e.address.port)}${s}/${t}`},F=e=>{try{return new URL(e,"http://localhost").pathname.replace(m,"")}catch{return e}},G=(e,t)=>{let s,n,d;const f=e.config.root??process.cwd(),y=(a,i,o)=>{const r=U();if((s===void 0||r!==n)&&(s=D(e.config.logger),n=r),s===void 0){o.statusCode=501,o.setHeader("Content-Type","text/plain"),o.end("Lunora studio assets not found — install and build @lunora/studio.");return}const p=a===v,l=a.slice(a.lastIndexOf("/")+1),h=r===void 0?void 0:`W/"${l}-${String(r)}"`;if(o.setHeader("Cache-Control","no-cache"),h!==void 0&&(o.setHeader("ETag",h),u(i.headers?.["if-none-match"])===h.toLowerCase())){o.statusCode=304,o.end();return}if(p){g(o,s.styles,"text/css; charset=utf-8");return}const S=R(l);if(S===void 0){o.statusCode=404,o.setHeader("Content-Type","text/plain"),o.end("Not found");return}g(o,S,j(l))};return(a,i,o)=>{const r=F(a.url??"");if(r!==c&&!r.startsWith(`${c}/`)){o();return}if(t||I(a,e.config.logger)!==void 0){i.statusCode=403,i.setHeader("Content-Type","text/plain"),i.end("Lunora studio is only available on loopback hosts in dev.");return}if(B.has(r)){const l=q(a);if(l!==void 0){i.statusCode=403,i.setHeader("Content-Type","application/json; charset=utf-8"),i.end(JSON.stringify({error:l,ok:!1}));return}}const p=T[r];if(p!==void 0){A(a,i,p,f);return}if(r===v||P(r)){y(r,a,i);return}d??=_({adminToken:O(f),basePath:c,dataEditable:!0,rulesInstalled:C(f).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:w,styleHref:v}),g(i,d,"text/html; charset=utf-8")}},V=()=>({apply:"serve",configureServer(e){const t=e.config.server?.host,s=t!==void 0&&t!==!1&&t!=="localhost"&&t!=="127.0.0.1"&&t!=="::1";return e.middlewares.use(G(e,s)),()=>{const n=()=>{const d=W({address:e.httpServer?.address()??void 0,base:e.config.base,resolvedLocal:e.resolvedUrls?.local[0]});e.config.logger.info(` \x1B[32m➜\x1B[39m \x1B[1mLunora\x1B[22m: \x1B[36m${d}\x1B[39m`)};if(typeof e.printUrls=="function"){const d=e.printUrls.bind(e);e.printUrls=()=>{d(),n()}}else e.httpServer?.listening===!0?n():e.httpServer?.once("listening",n)}},name:"lunora:studio"});export{c as STUDIO_PATH,w as STUDIO_SCRIPT_PATH,v as STUDIO_STYLE_PATH,W as buildStudioUrl,V as studioPlugin};
@@ -1,3 +0,0 @@
1
- import{existsSync as O}from"node:fs";import{join as _,resolve as p,sep as b,basename as L}from"node:path";import{createCodegenProject as M,refreshCodegenProject as A,runCodegen as G,describeErrorLevelFindings as T,CodegenDiagnosticError as B}from"@lunora/codegen";import{LUNORA_CONFIG_FILE as N,inferLunoraBindings as I}from"@lunora/config";import{findWranglerFile as J,readWranglerJsonc as V,WRANGLER_FILES as U,collectWranglerSecretVariables as X,reconcileWranglerBindings as Y,reconcileWranglerCrons as Z,reconcileWranglerCompatibilityDate as q}from"@lunora/config/cloudflare";import{isRunnableDevEnvironment as z}from"vite";import H from"./LUNORA_API_UPDATED_EVENT-CO2Rv2re.mjs";import{s as g,A as W}from"./log-DTdeAemA.mjs";import{r as K,a as Q}from"./server-close-C8zGVydc.mjs";const C=(r,o)=>{try{const{parsed:t,text:e}=V(r);return t===void 0?`raw:${e}`:JSON.stringify(o?o(t):t)}catch{return"unreadable"}},ee=r=>{const o={...r},{triggers:t}=o;if(t!==null&&typeof t=="object"){const e={...t};delete e.crons,Object.keys(e).length>0?o.triggers=e:delete o.triggers}return o},S=r=>{const o=J(r),t=o===void 0?"absent":C(o,ee),e=_(r,N),i=O(e)?C(e):"absent";return`${t}\0${i}`},re=100,oe=/[/\\]tsconfig\..+\.json$/u,te=r=>{const o=r.map(e=>` • ${e.kind} "${e.exportName}" — class ${e.className} is not exported by your worker entry.`),t=[...new Set(r.map(e=>e.module))].map(e=>` export * from "./lunora/_generated/${e}";`);return[`[lunora] ${String(r.length)} declared ${r.length===1?"binding is":"bindings are"} not exported by your worker entry — \`wrangler deploy\` will fail.`,...o,"","Add to your worker entry:",...t].join(`
2
- `)},ne=async(r,o,t)=>{try{const e=await I({projectRoot:r.projectRoot,schemaDir:r.schemaDir}),i=Y(r.projectRoot,e);i.changed&&o.info?.(`${g} inferred bindings → ${i.added.join(", ")} (written to ${i.wranglerPath??"wrangler.jsonc"})`);for(const s of i.warnings)o.warn(`${g} ${s}`);i.exportGaps.length>0&&t?.(i.exportGaps)}catch(e){const i=e instanceof Error?e.message:String(e);o.warn(`${g} binding inference skipped: ${i}`)}},se=(r,o,t)=>{try{const e=Z(r,o);e.changed&&t.info?.(`${g} synced ${o.length.toFixed(0)} cron trigger(s) into ${e.wranglerPath??"wrangler.jsonc"}`)}catch(e){const i=e instanceof Error?e.message:String(e);t.warn(`${g} cron trigger sync skipped: ${i}`)}try{const e=q(r);e.changed&&t.info?.(`${g} bumped compatibility_date to ${e.date??"unknown"} (Workers Cache enabled) → ${e.wranglerPath??"wrangler.jsonc"}`)}catch(e){const i=e instanceof Error?e.message:String(e);t.warn(`${g} compatibility date sync skipped: ${i}`)}},ae=r=>{const{advisoryNames:o,platformDiagnosticNames:t}=T(r),e=[...new Set([...o,...t])].toSorted((s,l)=>s.localeCompare(l));if(e.length===0)return;const i=e.length===1?"advisory/platform diagnostic":"advisories/platform diagnostics";return`${g} ${String(e.length)} ERROR-level ${i} (${e.join(", ")}) — see the log above for detail.`},x=(r,o,t,e)=>{const i=_(r.projectRoot,r.schemaDir,"schema.ts");if(!O(i))return o.warn(`${g} schema.ts not found at ${i} — codegen skipped`),{};try{const s=G({apiSpec:r.apiSpec,lunoraDirectory:r.schemaDir,project:e,projectRoot:r.projectRoot,target:r.target,wranglerVariables:X(r.projectRoot)});se(r.projectRoot,s.cronTriggers,o);for(const l of s.advisories){const f=W(l.level,l.name,l.detail,l.remediation);l.level==="ERROR"?o.error(f):o.warn(f)}for(const l of s.platformDiagnostics){const f=W(l.level==="error"?"ERROR":"WARN",l.name,l.message,l.remediation);l.level==="error"?o.error(f):o.warn(f)}return{blockingMessage:ae(s),outputDirectory:p(s.outputDirectory)}}catch(s){const l=s instanceof Error?s.message:String(s);return o.error(`${g} codegen failed: ${l}`),t?.onError(s,l),{}}},ie=(r,o,t)=>{let e;for(const[i,s]of Object.entries(r.environments)){if(i==="client"){e=s;continue}z(s)||s.hot.send({path:"*",triggeredBy:o,type:"full-reload"})}if(e===void 0){r.hot.send({type:"full-reload"});return}if(t){e.hot.send({type:"full-reload"});return}e.hot.send({event:H,type:"custom"})},ve=r=>{const o=p(r.projectRoot,r.schemaDir);let t=p(r.projectRoot,r.generatedDir),e;const i=new Map;let s,l=!1,f=!1,E;return{config(n,v){E=v.command},async buildStart(){const n={error:u=>{console.error(u)},info:u=>{console.info(u)},warn:u=>{console.warn(u)}},{blockingMessage:v,outputDirectory:w}=x(r,n);w!==void 0&&(t=w),E==="build"&&v!==void 0&&this.error(v),await ne(r,n,u=>{e?.hot.send({err:{loc:void 0,message:te(u),stack:""},type:"error"})}),e!==void 0&&(s=S(r.projectRoot),l=!0)},configureServer(n){e=n,n.watcher.add(o),s=S(r.projectRoot),l=!1;const v={error:a=>{n.config.logger.error(a)},info:a=>{n.config.logger.info(a)},warn:a=>{n.config.logger.warn(a)}};let w=!1;const u={onError(a,c){w=!0;const d=a instanceof B?{column:a.column,file:a.file,line:a.line}:void 0,j=d===void 0?`[lunora] codegen failed: ${c}
3
- (see terminal for full stack trace and file location)`:`[lunora] codegen failed: ${c}`;e?.hot.send({err:{loc:d,message:j,stack:a instanceof Error?a.stack??"":""},type:"error"})}},R=(a,c)=>a===c||a.startsWith(c+b);let k=!1,m,h;const P=()=>{for(const a of Object.values(n.environments)){const c=a.moduleGraph;for(const d of c.idToModuleMap.values())d.id&&R(d.id,t)&&c.invalidateModule(d)}},$=a=>{const c=p(a);if(R(c,o)&&!R(c,t)){if(c.endsWith(`${b}tsconfig.json`)||oe.test(c)){h=void 0;return}c.endsWith(".ts")&&(c.includes(`${b}__tests__${b}`)||c.endsWith(".test.ts")||c.endsWith(".spec.ts")||(m&&clearTimeout(m),m=setTimeout(()=>{if(m=void 0,k)return;h===void 0?h=M(o):A(h,o);const{outputDirectory:d}=x(r,v,u,h);if(d===void 0){h=void 0;return}t=d,P(),ie(n,c,w),w=!1},re)))}};n.watcher.on("add",$),n.watcher.on("change",$),n.watcher.on("unlink",$);const D=new Set([...U.map(a=>p(r.projectRoot,a)),p(r.projectRoot,N)]);for(const a of D)n.watcher.add(a);const y=a=>{if(!D.has(p(a))||f)return;const c=S(r.projectRoot);if(!l){s=c;return}if(s===void 0){s=c;return}c!==s&&(s=c,f=!0,n.config.logger.info(`${g} ${L(p(a))} changed — restarting dev server`),Promise.resolve(n.restart()).finally(()=>{f=!1}).catch(d=>{const j=d instanceof Error?d.message:String(d);n.config.logger.error(`${g} dev server restart failed: ${j} — keeping the running server; re-save your config to retry.`),n.hot.send({err:{loc:void 0,message:`[lunora] dev server restart failed: ${j}`,stack:""},type:"error"})}))};n.watcher.on("add",y),n.watcher.on("change",y),n.watcher.on("unlink",y);const F=()=>{k||(k=!0,h=void 0,m&&(clearTimeout(m),m=void 0),n.watcher.off("add",$),n.watcher.off("change",$),n.watcher.off("unlink",$),n.watcher.off("add",y),n.watcher.off("change",y),n.watcher.off("unlink",y))};return()=>{Q(n,i,F)}},buildEnd(){K(i,this.environment)},name:"lunora:codegen"}};export{ve as default};
@@ -1 +0,0 @@
1
- import{claimDevServerState as d,DEV_LOG_FILE_ENV as p,DEV_DAEMON_ENV as c,DEV_HANDOFF_ENV as u,clearDevServerState as v}from"@lunora/config";import{g}from"./log-DTdeAemA.mjs";import{r as f,a as m}from"./server-close-C8zGVydc.mjs";const S=/\/$/,D=n=>{const r=n.resolvedUrls?.local[0];if(r!==void 0)return r.replace(S,"");const t=n.httpServer?.address();if(t!==null&&typeof t=="object")return`http://localhost:${String(t.port)}`},_=n=>{let r=!1;const t=new Map;return{apply:"serve",configureServer(e){const l=n.projectRoot,a=()=>{if(r)return;const o=D(e);if(o===void 0)return;const s=Number(process.env[u]),i=d(l,{background:process.env[c]==="1",logFile:process.env[p],mode:"vite",pid:process.pid,startedAt:new Date().toISOString(),url:o},Number.isInteger(s)&&s>0?{supersedePid:s}:void 0);if(!i.ok){i.existing!==void 0&&e.config.logger.warn(g(`another dev server is already recorded at ${i.existing.url} (pid ${String(i.existing.pid)}) — leaving .lunora/dev.json untouched`));return}r=!0};return m(e,t,()=>{r&&(v(l,process.pid),r=!1)}),()=>{if(typeof e.printUrls=="function"){const o=e.printUrls.bind(e);e.printUrls=()=>{o(),a()}}e.httpServer?.once("listening",()=>{setTimeout(a,0)})}},buildEnd(){f(t,this.environment)},name:"lunora:dev-state"}};export{_ as default};
@@ -1 +0,0 @@
1
- import{ensureDevVariables as n,createConfirm as a,fillDevSecrets as c}from"@lunora/config";import{g as t}from"./log-DTdeAemA.mjs";const s=o=>({apply:"serve",async configResolved(){const e=r=>{console.info(t(r))};await n({confirm:a("[lunora] "),cwd:o.projectRoot,info:e}),c({cwd:o.projectRoot,info:e})},enforce:"pre",name:"lunora:dev-vars"});export{s as default};
@@ -1 +0,0 @@
1
- import{paintBadge as $,BADGES as r}from"@lunora/config";const R=$(r.lunora),p=o=>`${R} ${o}`,e={ERROR:r.error,INFO:r.info,WARN:r.warn},A=(o,a,n,t)=>`${$(e[o])} ${a}: ${n} — ${t}`;export{A,p as g,R as s};
@@ -1,3 +0,0 @@
1
- import{detectAiAgent as a,LUNORA_EVENT_SOURCE as c,formatLunoraEvent as l}from"@lunora/config";import{a as f,r as m}from"./server-close-C8zGVydc.mjs";const p=`"source":"${c}"`,s={error:"\x1B[31m",info:"\x1B[36m",reset:"\x1B[0m",warn:"\x1B[33m"},d=(r,t,e)=>e?`${s[t]}[lunora]${s.reset} ${r}`:`[lunora] ${r}`,v=r=>typeof r=="string"?r:Buffer.isBuffer(r)?r.toString("utf8"):void 0,g=(r,t)=>r.split(`
2
- `).map(e=>{const n=l(e);return n?d(n.text,n.level,t):e}).join(`
3
- `),w=(r,t)=>(...e)=>{try{const n=v(e[0]);if(n?.includes(p))return r(g(n,t),...e.slice(1))}catch{}return r(...e)},i=r=>{const t=r.write.bind(r),e=w(t,r.isTTY===!0);return r.write=e,()=>{r.write===e&&(r.write=t)}},x=()=>{const r=process.env.LUNORA_LOG_JSON;return r==="1"||r==="true"?!0:r==="0"||r==="false"?!1:a()!==void 0},L=()=>{const r=new Map;let t;return{apply:"serve",buildEnd(){m(r,this.environment)},configureServer(e){if(x())return;t?.();const n=i(process.stdout),u=i(process.stderr),o=()=>{n(),u(),t===o&&(t=void 0)};t=o,f(e,r,o)},name:"lunora:log-stream"}};export{L as default};
@@ -1 +0,0 @@
1
- import{findLunoraSolution as n}from"@lunora/codegen";const a={handle:r=>{const e=typeof r.message=="string"?r.message:"",o=n(e);return Promise.resolve(o?{body:o.body,header:o.header}:void 0)},name:"lunora",priority:100},s=[a];export{a as lunoraSolutionFinder,s as lunoraSolutionFinders};
@@ -1 +0,0 @@
1
- import{readProjectRemotePreference as a}from"@lunora/config";import{resolveRemoteEnabled as c,materializeRemoteWranglerConfig as g}from"@lunora/config/cloudflare";import{g as f}from"./log-DTdeAemA.mjs";const s=()=>{},p=e=>{const o=e.readPreference??a;if(!c({configPreference:o(e.projectRoot),envValue:e.remoteEnv??process.env.LUNORA_REMOTE}))return{cleanup:s,enabled:!1};const n=(e.materialize??g)({enabled:!0,projectRoot:e.projectRoot});return{cleanup:n.cleanup,configPath:n.configPath,enabled:!0,reason:n.reason}},d=(e,o)=>!o.enabled||o.configPath===void 0||typeof e.configPath=="string"?e:{...e,configPath:o.configPath},P=(e,o)=>({config(n,r){if(r.command!=="serve")return;const i=d(e,o),t=e;i.configPath!==void 0&&t.configPath===void 0?t.configPath=i.configPath:o.enabled&&o.configPath===void 0&&o.reason!==void 0&&console.info(f(`remote bindings requested but not applied: ${o.reason}`))},enforce:"pre",name:"lunora:remote-bindings-config"}),h=e=>({buildEnd(){e()},closeBundle(){e()},enforce:"pre",name:"lunora:remote-bindings-cleanup"});export{p as planViteRemoteBindings,h as remoteBindingsCleanupPlugin,P as remoteBindingsConfigPlugin,d as withRemoteBindings};
@@ -1 +0,0 @@
1
- const s=(e,r,t)=>{e.httpServer?e.httpServer.once("close",t):r.set(e.environments.client,t)},n=(e,r)=>{const t=e.get(r);t!==void 0&&(e.delete(r),t())};export{s as a,n as r};
@@ -1,3 +0,0 @@
1
- import{spawnSync as t}from"node:child_process";import{validateWranglerProject as i,readWranglerJsonc as s}from"@lunora/config/cloudflare";import{LunoraError as l}from"@lunora/errors";import{g as a}from"./log-DTdeAemA.mjs";const c=r=>r.startsWith("./")||r.startsWith("../")||r.startsWith("/")||r.includes("Dockerfile"),g=()=>{try{return t("docker",["info"],{stdio:"ignore"}).status===0}catch{return!1}},d=(r,e=g)=>{const{parsed:o}=s(r);!(o?.containers??[]).some(n=>typeof n?.image=="string"&&c(n.image))||e()||console.warn(a("wrangler.jsonc declares containers built from a local Dockerfile, but no Docker-compatible engine is running. Start Docker (or Colima) before `vite dev`, or the container instances will fail to start."))},m=(r,e)=>{const o=["[lunora] wrangler configuration is missing bindings required by your schema.",` file: ${r}`,"",...e.map(n=>` - ${n}`),""," Update your wrangler.jsonc and restart the dev server."];return new Error(o.join(`
2
- `))},p=r=>({configResolved(){const e=i({projectRoot:r.projectRoot,schemaDir:r.schemaDir});if(!e.wranglerPath)throw new l("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${r.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
3
- `));for(const o of e.report.warnings)console.warn(a(`wrangler validator: ${o}`));if(e.problems.length>0)throw m(e.wranglerPath,e.problems);d(e.wranglerPath)},name:"lunora:wrangler-validator"});export{d as warnWhenDockerMissing,p as wranglerValidatorPlugin};