@lunora/vite 1.0.0-alpha.281 → 1.0.0-alpha.283

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
@@ -6,6 +6,7 @@ export { type DetectedFramework, type FrameworkClass, type FrameworkDetection, G
6
6
  import { materializeRemoteWranglerConfig } from '@lunora/config/cloudflare';
7
7
  export { type ReconcileCronsResult as ReconcileResult, reconcileWranglerCrons } from '@lunora/config/cloudflare';
8
8
  import { AddressInfo } from 'node:net';
9
+ export { STUDIO_PATH } from '@lunora/config/studio-host';
9
10
  /** Options forwarded to `@cloudflare/vite-plugin`'s cloudflare plugin. */
10
11
  type CloudflarePluginOptions = Record<string, unknown>;
11
12
  /**
@@ -449,8 +450,6 @@ type Solution = NonNullable<Awaited<ReturnType<SolutionFinder["handle"]>>>;
449
450
  declare const lunoraSolutionFinder: SolutionFinder;
450
451
  /** The finders Lunora injects into the overlay by default. */
451
452
  declare const lunoraSolutionFinders: ReadonlyArray<SolutionFinder>;
452
- /** Dev-server path the studio SPA is served from. */
453
- declare const STUDIO_PATH = "/__lunora";
454
453
  /**
455
454
  * Build the user-facing studio URL from the dev server's resolved address.
456
455
  * Pure so it can be unit-tested without a live server. Prefers Vite's own
@@ -559,4 +558,4 @@ declare const resolveOverlayOption: (overlay: LunoraPluginOptions["overlay"]) =>
559
558
  */
560
559
  declare const lunora: (options?: LunoraPluginOptions) => LunoraPlugins;
561
560
  declare const VERSION: string;
562
- export { CLASS_A_WIRING, type ClassAWiring, type CloudflarePluginOptions, LUNORA_API_UPDATED_EVENT, LUNORA_WORKER_VIRTUAL_ID, type LunoraPluginOptions, type LunoraPlugins, type LunoraShardConfig, type OverlayPluginOptions, type PlanViteRemoteOptions, type ResolvedLunoraPluginOptions, STUDIO_PATH, type Solution, type SolutionFinder, VERSION, type ViteRemotePlan, WORKER_STARTUP_HINT, type WorkerEntryComposition, augmentWorkerStartupError, buildStudioUrl, buildWorkerEntrySource, checkLunoraProxy, codegenPlugin, containerLogsPlugin, devStatePlugin, devVariablesPlugin, frameworkComposePlugin, isAutoComposable, isWorkerEntryEvalError, logStreamPlugin, lunora, lunoraSolutionFinder, lunoraSolutionFinders, planViteRemoteBindings, proxyCheckPlugin, remoteBindingsPlugin, resolveOverlayOption, studioPlugin, withRemoteBindings, withWorkerStartupHint, wranglerValidatorPlugin };
561
+ export { CLASS_A_WIRING, type ClassAWiring, type CloudflarePluginOptions, LUNORA_API_UPDATED_EVENT, LUNORA_WORKER_VIRTUAL_ID, type LunoraPluginOptions, type LunoraPlugins, type LunoraShardConfig, type OverlayPluginOptions, type PlanViteRemoteOptions, type ResolvedLunoraPluginOptions, type Solution, type SolutionFinder, VERSION, type ViteRemotePlan, WORKER_STARTUP_HINT, type WorkerEntryComposition, augmentWorkerStartupError, buildStudioUrl, buildWorkerEntrySource, checkLunoraProxy, codegenPlugin, containerLogsPlugin, devStatePlugin, devVariablesPlugin, frameworkComposePlugin, isAutoComposable, isWorkerEntryEvalError, logStreamPlugin, lunora, lunoraSolutionFinder, lunoraSolutionFinders, planViteRemoteBindings, proxyCheckPlugin, remoteBindingsPlugin, resolveOverlayOption, studioPlugin, withRemoteBindings, withWorkerStartupHint, wranglerValidatorPlugin };
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { type DetectedFramework, type FrameworkClass, type FrameworkDetection, G
6
6
  import { materializeRemoteWranglerConfig } from '@lunora/config/cloudflare';
7
7
  export { type ReconcileCronsResult as ReconcileResult, reconcileWranglerCrons } from '@lunora/config/cloudflare';
8
8
  import { AddressInfo } from 'node:net';
9
+ export { STUDIO_PATH } from '@lunora/config/studio-host';
9
10
  /** Options forwarded to `@cloudflare/vite-plugin`'s cloudflare plugin. */
10
11
  type CloudflarePluginOptions = Record<string, unknown>;
11
12
  /**
@@ -449,8 +450,6 @@ type Solution = NonNullable<Awaited<ReturnType<SolutionFinder["handle"]>>>;
449
450
  declare const lunoraSolutionFinder: SolutionFinder;
450
451
  /** The finders Lunora injects into the overlay by default. */
451
452
  declare const lunoraSolutionFinders: ReadonlyArray<SolutionFinder>;
452
- /** Dev-server path the studio SPA is served from. */
453
- declare const STUDIO_PATH = "/__lunora";
454
453
  /**
455
454
  * Build the user-facing studio URL from the dev server's resolved address.
456
455
  * Pure so it can be unit-tested without a live server. Prefers Vite's own
@@ -559,4 +558,4 @@ declare const resolveOverlayOption: (overlay: LunoraPluginOptions["overlay"]) =>
559
558
  */
560
559
  declare const lunora: (options?: LunoraPluginOptions) => LunoraPlugins;
561
560
  declare const VERSION: string;
562
- export { CLASS_A_WIRING, type ClassAWiring, type CloudflarePluginOptions, LUNORA_API_UPDATED_EVENT, LUNORA_WORKER_VIRTUAL_ID, type LunoraPluginOptions, type LunoraPlugins, type LunoraShardConfig, type OverlayPluginOptions, type PlanViteRemoteOptions, type ResolvedLunoraPluginOptions, STUDIO_PATH, type Solution, type SolutionFinder, VERSION, type ViteRemotePlan, WORKER_STARTUP_HINT, type WorkerEntryComposition, augmentWorkerStartupError, buildStudioUrl, buildWorkerEntrySource, checkLunoraProxy, codegenPlugin, containerLogsPlugin, devStatePlugin, devVariablesPlugin, frameworkComposePlugin, isAutoComposable, isWorkerEntryEvalError, logStreamPlugin, lunora, lunoraSolutionFinder, lunoraSolutionFinders, planViteRemoteBindings, proxyCheckPlugin, remoteBindingsPlugin, resolveOverlayOption, studioPlugin, withRemoteBindings, withWorkerStartupHint, wranglerValidatorPlugin };
561
+ export { CLASS_A_WIRING, type ClassAWiring, type CloudflarePluginOptions, LUNORA_API_UPDATED_EVENT, LUNORA_WORKER_VIRTUAL_ID, type LunoraPluginOptions, type LunoraPlugins, type LunoraShardConfig, type OverlayPluginOptions, type PlanViteRemoteOptions, type ResolvedLunoraPluginOptions, type Solution, type SolutionFinder, VERSION, type ViteRemotePlan, WORKER_STARTUP_HINT, type WorkerEntryComposition, augmentWorkerStartupError, buildStudioUrl, buildWorkerEntrySource, checkLunoraProxy, codegenPlugin, containerLogsPlugin, devStatePlugin, devVariablesPlugin, frameworkComposePlugin, isAutoComposable, isWorkerEntryEvalError, logStreamPlugin, lunora, lunoraSolutionFinder, lunoraSolutionFinders, planViteRemoteBindings, proxyCheckPlugin, remoteBindingsPlugin, resolveOverlayOption, studioPlugin, withRemoteBindings, withWorkerStartupHint, wranglerValidatorPlugin };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import{createRequire as l}from"node:module";import{cloudflare as s}from"@cloudflare/vite-plugin";import{detectAgentRules as u,claimAgentRulesHint as c,lunoraLine as a,AGENT_RULES_HINT as f,detectFramework as d,targetRunsOwnDevServer as m,resolveTargetOrThrow as g,isRunnableTarget as p,runnableTargetIds as v}from"@lunora/config";import{GENERATED_CLASS_MODULES as lr,detectFramework as sr}from"@lunora/config";import S from"@visulima/vite-overlay";import{reconcileBindingsSafely as w}from"@lunora/config/cloudflare";import{reconcileWranglerCrons as cr}from"@lunora/config/cloudflare";import h from"./packem_shared/codegenPlugin-CV_h92v2.mjs";import R from"./packem_shared/containerLogsPlugin-67PZ8zmb.mjs";import k from"./packem_shared/devStatePlugin-CCWf9AFZ.mjs";import P from"./packem_shared/devVariablesPlugin-DbD6cSF0.mjs";import{frameworkComposePlugin as A}from"./packem_shared/CLASS_A_WIRING-B4-x5Aws.mjs";import{CLASS_A_WIRING as dr,LUNORA_WORKER_VIRTUAL_ID as mr,buildWorkerEntrySource as gr,isAutoComposable as pr}from"./packem_shared/CLASS_A_WIRING-B4-x5Aws.mjs";import E from"./packem_shared/logStreamPlugin-DtOu5VX8.mjs";import{proxyCheckPlugin as T}from"./packem_shared/checkLunoraProxy-BNPgNWtV.mjs";import{checkLunoraProxy as Sr}from"./packem_shared/checkLunoraProxy-BNPgNWtV.mjs";import{remoteBindingsPlugin as O}from"./packem_shared/planViteRemoteBindings-ByOliZuE.mjs";import{planViteRemoteBindings as hr,withRemoteBindings as Rr}from"./packem_shared/planViteRemoteBindings-ByOliZuE.mjs";import{lunoraSolutionFinders as _}from"./packem_shared/lunoraSolutionFinder--J0x2mAM.mjs";import{lunoraSolutionFinder as Pr}from"./packem_shared/lunoraSolutionFinder--J0x2mAM.mjs";import{studioPlugin as x}from"./packem_shared/STUDIO_PATH-UztnV2ca.mjs";import{STUDIO_PATH as Er,buildStudioUrl as Tr}from"./packem_shared/STUDIO_PATH-UztnV2ca.mjs";import{withWorkerStartupHint as b}from"./packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs";import{WORKER_STARTUP_HINT as _r,augmentWorkerStartupError as xr,isWorkerEntryEvalError as br}from"./packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs";import{wranglerValidatorPlugin as y}from"./packem_shared/wranglerValidatorPlugin-BlGHjTXZ.mjs";import{default as Lr}from"./packem_shared/LUNORA_API_UPDATED_EVENT-CO2Rv2re.mjs";const L=o=>({apply:"serve",configureServer(r){return()=>{u(o.projectRoot).installed||!c()||r.config.logger.warn(`
1
+ import{createRequire as l}from"node:module";import{cloudflare as s}from"@cloudflare/vite-plugin";import{detectAgentRules as u,claimAgentRulesHint as c,lunoraLine as a,AGENT_RULES_HINT as f,detectFramework as d,targetRunsOwnDevServer as m,resolveTargetOrThrow as g,isRunnableTarget as p,runnableTargetIds as v}from"@lunora/config";import{GENERATED_CLASS_MODULES as lr,detectFramework as sr}from"@lunora/config";import S from"@visulima/vite-overlay";import{reconcileBindingsSafely as w}from"@lunora/config/cloudflare";import{reconcileWranglerCrons as cr}from"@lunora/config/cloudflare";import h from"./packem_shared/codegenPlugin-CV_h92v2.mjs";import R from"./packem_shared/containerLogsPlugin-67PZ8zmb.mjs";import k from"./packem_shared/devStatePlugin-CCWf9AFZ.mjs";import P from"./packem_shared/devVariablesPlugin-DbD6cSF0.mjs";import{frameworkComposePlugin as A}from"./packem_shared/CLASS_A_WIRING-B4-x5Aws.mjs";import{CLASS_A_WIRING as dr,LUNORA_WORKER_VIRTUAL_ID as mr,buildWorkerEntrySource as gr,isAutoComposable as pr}from"./packem_shared/CLASS_A_WIRING-B4-x5Aws.mjs";import E from"./packem_shared/logStreamPlugin-DtOu5VX8.mjs";import{proxyCheckPlugin as T}from"./packem_shared/checkLunoraProxy-BNPgNWtV.mjs";import{checkLunoraProxy as Sr}from"./packem_shared/checkLunoraProxy-BNPgNWtV.mjs";import{remoteBindingsPlugin as x}from"./packem_shared/planViteRemoteBindings-ByOliZuE.mjs";import{planViteRemoteBindings as hr,withRemoteBindings as Rr}from"./packem_shared/planViteRemoteBindings-ByOliZuE.mjs";import{lunoraSolutionFinders as O}from"./packem_shared/lunoraSolutionFinder--J0x2mAM.mjs";import{lunoraSolutionFinder as Pr}from"./packem_shared/lunoraSolutionFinder--J0x2mAM.mjs";import{studioPlugin as _}from"./packem_shared/buildStudioUrl-DMMWpguZ.mjs";import{buildStudioUrl as Er}from"./packem_shared/buildStudioUrl-DMMWpguZ.mjs";import{withWorkerStartupHint as b}from"./packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs";import{WORKER_STARTUP_HINT as xr,augmentWorkerStartupError as Or,isWorkerEntryEvalError as _r}from"./packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs";import{wranglerValidatorPlugin as y}from"./packem_shared/wranglerValidatorPlugin-BlGHjTXZ.mjs";import{default as yr}from"./packem_shared/LUNORA_API_UPDATED_EVENT-CO2Rv2re.mjs";import{STUDIO_PATH as Dr}from"@lunora/config/studio-host";const L=o=>({apply:"serve",configureServer(r){return()=>{u(o.projectRoot).installed||!c()||r.config.logger.warn(`
2
2
  ${a(f)}
3
- `)}},name:"lunora:agent-rules-hint"}),D=o=>({async config(r,t){t.isPreview!==!0&&await w(o,{info:e=>{console.info(e)},warn:e=>{console.warn(e)}})},enforce:"pre",name:"lunora:bindings-provision"}),W=()=>({}),C={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)"},N=o=>{const r=C[o.framework];return o.framework==="none"?a("no meta-framework detected — running standalone."):o.class==="B"?a(`detected ${r} — composition is handled by the framework adapter.`):a(`detected ${r} — composing the Lunora worker into one Cloudflare Worker.`)},U=(o,r)=>{let t=!1;const e=()=>{r.framework??=d(o.projectRoot)};return{config(){e()},configResolved(){e()},configureServer(){e(),!t&&r.framework!==void 0&&(t=!0,console.info(N(r.framework)))},name:"lunora:framework-detect"}},I=o=>{if(o===!1)return!1;const r=o===!0||o===void 0?{}:o;return{...r,forwardedConsoleMethods:r.forwardedConsoleMethods??["error","warn"],solutionFinders:[..._,...r.solutionFinders??[]]}},$=(o,r)=>{const t=g(o,r);if(!p(t)){const e=v();throw new Error(`target "${t}" has no command-line toolchain, so the Lunora Vite plugin cannot build or serve it — it can only generate for it (\`lunora codegen --target ${t}\`). Buildable targets: ${e.join(", ")}`)}return t},j=o=>{const r=o??{},t=r.schemaDir??"lunora";let e;r.cloudflare===!1?e=!1:r.cloudflare===!0||r.cloudflare===void 0?e={}:e=r.cloudflare;const n=r.projectRoot??process.cwd(),i=$(n,r.target);return{allowUnauthenticatedShardAccess:r.allowUnauthenticatedShardAccess??!1,apiSpec:r.apiSpec??"openapi",cloudflare:e,studio:r.studio??!0,generatedDir:`${t}/_generated`,overlay:I(r.overlay),projectRoot:n,schemaDir:t,shard:r.shard??{},target:i,validateWrangler:r.validateWrangler??!0}},tr=o=>{const r=j(o),t=W(),e=[U(r,t),A(r,t),P(r),D(r),h(r),E(),k(r),L(r),T()];r.studio&&e.push(x(r)),r.validateWrangler&&e.push(y(r)),r.overlay!==!1&&e.push(S(r.overlay)),e.push(R(r));const n=r.cloudflare===!1?void 0:{...r.cloudflare};return e.push(O(n,{projectRoot:r.projectRoot})),n!==void 0&&(e.push(...b(s(n))),m(r.target)&&e.push({configureServer(i){i.config.logger.warn(`[lunora] target "${r.target}": vite dev serves the worker in workerd, not on ${r.target}. \`vite build\` then \`lunora deploy\` ships it to ${r.target}.`)},name:"lunora:target-runtime-notice"})),e},nr=l(import.meta.url)("../package.json").version;export{dr as CLASS_A_WIRING,lr as GENERATED_CLASS_MODULES,Lr as LUNORA_API_UPDATED_EVENT,mr as LUNORA_WORKER_VIRTUAL_ID,Er as STUDIO_PATH,nr as VERSION,_r as WORKER_STARTUP_HINT,xr as augmentWorkerStartupError,Tr as buildStudioUrl,gr as buildWorkerEntrySource,Sr as checkLunoraProxy,h as codegenPlugin,R as containerLogsPlugin,sr as detectFramework,k as devStatePlugin,P as devVariablesPlugin,A as frameworkComposePlugin,pr as isAutoComposable,br as isWorkerEntryEvalError,E as logStreamPlugin,tr as lunora,Pr as lunoraSolutionFinder,_ as lunoraSolutionFinders,hr as planViteRemoteBindings,T as proxyCheckPlugin,cr as reconcileWranglerCrons,O as remoteBindingsPlugin,I as resolveOverlayOption,x as studioPlugin,Rr as withRemoteBindings,b as withWorkerStartupHint,y as wranglerValidatorPlugin};
3
+ `)}},name:"lunora:agent-rules-hint"}),D=o=>({async config(r,t){t.isPreview!==!0&&await w(o,{info:e=>{console.info(e)},warn:e=>{console.warn(e)}})},enforce:"pre",name:"lunora:bindings-provision"}),W=()=>({}),C={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)"},N=o=>{const r=C[o.framework];return o.framework==="none"?a("no meta-framework detected — running standalone."):o.class==="B"?a(`detected ${r} — composition is handled by the framework adapter.`):a(`detected ${r} — composing the Lunora worker into one Cloudflare Worker.`)},U=(o,r)=>{let t=!1;const e=()=>{r.framework??=d(o.projectRoot)};return{config(){e()},configResolved(){e()},configureServer(){e(),!t&&r.framework!==void 0&&(t=!0,console.info(N(r.framework)))},name:"lunora:framework-detect"}},I=o=>{if(o===!1)return!1;const r=o===!0||o===void 0?{}:o;return{...r,forwardedConsoleMethods:r.forwardedConsoleMethods??["error","warn"],solutionFinders:[...O,...r.solutionFinders??[]]}},$=(o,r)=>{const t=g(o,r);if(!p(t)){const e=v();throw new Error(`target "${t}" has no command-line toolchain, so the Lunora Vite plugin cannot build or serve it — it can only generate for it (\`lunora codegen --target ${t}\`). Buildable targets: ${e.join(", ")}`)}return t},j=o=>{const r=o??{},t=r.schemaDir??"lunora";let e;r.cloudflare===!1?e=!1:r.cloudflare===!0||r.cloudflare===void 0?e={}:e=r.cloudflare;const n=r.projectRoot??process.cwd(),i=$(n,r.target);return{allowUnauthenticatedShardAccess:r.allowUnauthenticatedShardAccess??!1,apiSpec:r.apiSpec??"openapi",cloudflare:e,studio:r.studio??!0,generatedDir:`${t}/_generated`,overlay:I(r.overlay),projectRoot:n,schemaDir:t,shard:r.shard??{},target:i,validateWrangler:r.validateWrangler??!0}},tr=o=>{const r=j(o),t=W(),e=[U(r,t),A(r,t),P(r),D(r),h(r),E(),k(r),L(r),T()];r.studio&&e.push(_(r)),r.validateWrangler&&e.push(y(r)),r.overlay!==!1&&e.push(S(r.overlay)),e.push(R(r));const n=r.cloudflare===!1?void 0:{...r.cloudflare};return e.push(x(n,{projectRoot:r.projectRoot})),n!==void 0&&(e.push(...b(s(n))),m(r.target)&&e.push({configureServer(i){i.config.logger.warn(`[lunora] target "${r.target}": vite dev serves the worker in workerd, not on ${r.target}. \`vite build\` then \`lunora deploy\` ships it to ${r.target}.`)},name:"lunora:target-runtime-notice"})),e},nr=l(import.meta.url)("../package.json").version;export{dr as CLASS_A_WIRING,lr as GENERATED_CLASS_MODULES,yr as LUNORA_API_UPDATED_EVENT,mr as LUNORA_WORKER_VIRTUAL_ID,Dr as STUDIO_PATH,nr as VERSION,xr as WORKER_STARTUP_HINT,Or as augmentWorkerStartupError,Er as buildStudioUrl,gr as buildWorkerEntrySource,Sr as checkLunoraProxy,h as codegenPlugin,R as containerLogsPlugin,sr as detectFramework,k as devStatePlugin,P as devVariablesPlugin,A as frameworkComposePlugin,pr as isAutoComposable,_r as isWorkerEntryEvalError,E as logStreamPlugin,tr as lunora,Pr as lunoraSolutionFinder,O as lunoraSolutionFinders,hr as planViteRemoteBindings,T as proxyCheckPlugin,cr as reconcileWranglerCrons,x as remoteBindingsPlugin,I as resolveOverlayOption,_ as studioPlugin,Rr as withRemoteBindings,b as withWorkerStartupHint,y as wranglerValidatorPlugin};
@@ -0,0 +1 @@
1
+ import{STUDIO_PATH as d,studioMountPath as a,isNonLoopbackHost as c,createStudioMiddleware as n}from"@lunora/config/studio-host";import{STUDIO_PATH as u}from"@lunora/config/studio-host";const l=/\/$/,i=e=>{if(e.resolvedLocal!==void 0&&e.resolvedLocal!=="")return`${e.resolvedLocal.replace(l,"")}${d}`;const o=a(e.base);if(e.address===void 0||typeof e.address=="string")return`http://localhost:5173${o}`;const s=e.address.address==="::"||e.address.address==="0.0.0.0"?"localhost":e.address.address;return`http://${s.includes(":")?`[${s}]`:s}:${String(e.address.port)}${o}`},f=e=>({apply:"serve",configureServer(o){const s=c(o.config.server?.host);return o.middlewares.use(n({apiSpec:e.apiSpec,base:o.config.base,isNonLoopbackBind:s,logger:o.config.logger,projectRoot:e.projectRoot,schemaDirectory:e.schemaDir})),()=>{const t=()=>{const r=i({address:o.httpServer?.address()??void 0,base:o.config.base,resolvedLocal:o.resolvedUrls?.local[0]});o.config.logger.info(` \x1B[32m➜\x1B[39m \x1B[1mLunora\x1B[22m: \x1B[36m${r}\x1B[39m`)};if(typeof o.printUrls=="function"){const r=o.printUrls.bind(o);o.printUrls=()=>{r(),t()}}else o.httpServer?.listening===!0?t():o.httpServer?.once("listening",t)}},name:"lunora:studio"});export{u as STUDIO_PATH,i as buildStudioUrl,f as studioPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/vite",
3
- "version": "1.0.0-alpha.281",
3
+ "version": "1.0.0-alpha.283",
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",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@cloudflare/vite-plugin": "1.54.4",
49
- "@lunora/codegen": "1.0.0-alpha.238",
50
- "@lunora/config": "1.0.0-alpha.283",
49
+ "@lunora/codegen": "1.0.0-alpha.240",
50
+ "@lunora/config": "1.0.0-alpha.285",
51
51
  "@lunora/errors": "1.0.0-alpha.47",
52
52
  "@visulima/vite-overlay": "2.0.20"
53
53
  },
@@ -1 +0,0 @@
1
- import{detectAgentRules as A}from"@lunora/config";import{transportRejectionReason as H,serveJsonHandler as p,handleSeedRequest as I,handleSchemaEditRequest as _,handlePolicyScaffoldRequest as D,isStandaloneModulePath as N,renderStudioHtml as P,resolveAdminToken as v,sendStudioDocument as C,SEED_ENDPOINT as E,SCHEMA_EDIT_ENDPOINT as $,POLICY_SCAFFOLD_ENDPOINT as x,studioAssetsStamp as O,loadStudioAssets as R,applyStudioAssetCache as U,readStandaloneAsset as B,assetContentType as k}from"@lunora/config/studio-host";const f="/__lunora",j=`${f}/studio.js`,m=`${f}/styles.css`,W=/^\//,g=/\/$/,w={[x]:D,[$]:_,[E]:I},y=(t,e,s)=>{t.statusCode=200,t.setHeader("Content-Type",s),t.end(e)},F=t=>{const e=f.replace(W,"");if(t.resolvedLocal!==void 0&&t.resolvedLocal!=="")return`${t.resolvedLocal.endsWith("/")?t.resolvedLocal.slice(0,-1):t.resolvedLocal}/${e}`;const s=t.base===void 0||t.base==="/"?"":t.base.replace(g,"");if(t.address===void 0||typeof t.address=="string")return`http://localhost:5173${s}/${e}`;const a=t.address.address==="::"||t.address.address==="0.0.0.0"?"localhost":t.address.address;return`http://${a.includes(":")?`[${a}]`:a}:${String(t.address.port)}${s}/${e}`},G=t=>{try{return new URL(t,"http://localhost").pathname.replace(g,"")}catch{return t}},J=(t,e,s)=>{let a,c,r;const{projectRoot:S}=s,T=t.config.base??"/",h=T==="/"?"":T.replace(g,""),L=(n,d,o)=>{const i=O();if((a===void 0||i!==c)&&(a=R(t.config.logger),c=i),a===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 l=n===m,u=n.slice(n.lastIndexOf("/")+1);if(U(d,o,u,i))return;if(l){y(o,a.styles,"text/css; charset=utf-8");return}const b=B(u);if(b===void 0){o.statusCode=404,o.setHeader("Content-Type","text/plain"),o.end("Not found");return}y(o,b,k(u))};return(n,d,o)=>{const i=G(n.url??""),l=h!==""&&i.startsWith(h)?i.slice(h.length):i;if(l!==f&&!l.startsWith(`${f}/`)){o();return}if(e||H(n,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}const u=w[l];if(u!==void 0){p(n,d,u,S,{apiSpec:s.apiSpec,schemaDirectory:s.schemaDir});return}if(l===m||N(l)){L(l,n,d);return}r??=P({adminToken:v(S),basePath:f,dataEditable:!0,rulesInstalled:A(S).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:j,styleHref:m}),C(d,r)}},q=t=>({apply:"serve",configureServer(e){const s=e.config.server?.host,a=s!==void 0&&s!==!1&&s!=="localhost"&&s!=="127.0.0.1"&&s!=="::1";return e.middlewares.use(J(e,a,t)),()=>{const c=()=>{const r=F({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${r}\x1B[39m`)};if(typeof e.printUrls=="function"){const r=e.printUrls.bind(e);e.printUrls=()=>{r(),c()}}else e.httpServer?.listening===!0?c():e.httpServer?.once("listening",c)}},name:"lunora:studio"});export{f as STUDIO_PATH,j as STUDIO_SCRIPT_PATH,m as STUDIO_STYLE_PATH,F as buildStudioUrl,q as studioPlugin};