@lunora/vite 1.0.0-alpha.152 → 1.0.0-alpha.153
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.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-CBgNvhG9.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-
|
|
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-CBgNvhG9.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-xwt4m9UW.mjs";import{STUDIO_PATH as Ar,buildStudioUrl as _r}from"./packem_shared/STUDIO_PATH-xwt4m9UW.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
2
|
${l(d)}
|
|
3
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{detectAgentRules as L}from"@lunora/config";import{transportRejectionReason as b,serveJsonHandler as y,handleSeedRequest as A,handleSchemaEditRequest as H,handlePolicyScaffoldRequest as I,isStandaloneModulePath as _,renderStudioHtml as N,resolveAdminToken as p,sendStudioDocument as v,SEED_ENDPOINT as C,SCHEMA_EDIT_ENDPOINT as E,POLICY_SCAFFOLD_ENDPOINT as $,studioAssetsStamp as D,loadStudioAssets as O,applyStudioAssetCache as P,readStandaloneAsset as x,assetContentType as R}from"@lunora/config/studio-host";const i="/__lunora",U=`${i}/studio.js`,S=`${i}/styles.css`,k=/^\//,g=/\/$/,B={[$]:I,[E]:H,[C]:A},m=(t,e,o)=>{t.statusCode=200,t.setHeader("Content-Type",o),t.end(e)},j=t=>{const e=i.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(g,"");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}`},w=t=>{try{return new URL(t,"http://localhost").pathname.replace(g,"")}catch{return t}},F=(t,e)=>{let o,n,r;const c=t.config.root??process.cwd(),T=(d,l,s)=>{const a=D();if((o===void 0||a!==n)&&(o=O(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 u=d===S,f=d.slice(d.lastIndexOf("/")+1);if(P(l,s,f,a))return;if(u){m(s,o.styles,"text/css; charset=utf-8");return}const h=x(f);if(h===void 0){s.statusCode=404,s.setHeader("Content-Type","text/plain"),s.end("Not found");return}m(s,h,R(f))};return(d,l,s)=>{const a=w(d.url??"");if(a!==i&&!a.startsWith(`${i}/`)){s();return}if(e||b(d,t.config.logger)!==void 0){l.statusCode=403,l.setHeader("Content-Type","text/plain"),l.end("Lunora studio is only available on loopback hosts in dev.");return}const u=B[a];if(u!==void 0){y(d,l,u,c);return}if(a===S||_(a)){T(a,d,l);return}r??=N({adminToken:p(c),basePath:i,dataEditable:!0,rulesInstalled:L(c).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:U,styleHref:S}),v(l,r)}},M=()=>({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(F(t,o)),()=>{const n=()=>{const r=j({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${r}\x1B[39m`)};if(typeof t.printUrls=="function"){const r=t.printUrls.bind(t);t.printUrls=()=>{r(),n()}}else t.httpServer?.listening===!0?n():t.httpServer?.once("listening",n)}},name:"lunora:studio"});export{i as STUDIO_PATH,U as STUDIO_SCRIPT_PATH,S as STUDIO_STYLE_PATH,j as buildStudioUrl,M as studioPlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/vite",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.153",
|
|
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.51.2",
|
|
49
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
50
|
-
"@lunora/config": "1.0.0-alpha.
|
|
49
|
+
"@lunora/codegen": "1.0.0-alpha.122",
|
|
50
|
+
"@lunora/config": "1.0.0-alpha.153",
|
|
51
51
|
"@lunora/errors": "1.0.0-alpha.22",
|
|
52
52
|
"@visulima/vite-overlay": "2.0.12",
|
|
53
53
|
"ts-morph": "^28.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{detectAgentRules as v}from"@lunora/config";import{handleSeedRequest as A,handleSchemaEditRequest as H,handlePolicyScaffoldRequest as L,SEED_ENDPOINT as b,SCHEMA_EDIT_ENDPOINT as N,POLICY_SCAFFOLD_ENDPOINT as C,transportRejectionReason as E,serveJsonHandler as I,isStandaloneModulePath as _,renderStudioHtml as R,resolveAdminToken as O,sendStudioDocument as D,headerValue as h,studioAssetsStamp as P,loadStudioAssets as $,applyStudioAssetCache as j,readStandaloneAsset as x,assetContentType as U}from"@lunora/config/studio-host";const l="/__lunora",k=`${l}/studio.js`,S=`${l}/styles.css`,B=/^\//,T=/\/$/,y={[C]:L,[N]:H,[b]:A},w=new Set(Object.keys(y)),G=t=>{const e=h(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=h(t.origin);if(o===void 0||o==="null")return;let s;try{s=new URL(o).host.toLowerCase()}catch{return"invalid origin header"}const n=h(t.host);return n===void 0||s!==n?"cross-origin request rejected":void 0},F=t=>{const e=t.headers??{},o=G(e);if(o!==void 0)return o;const s=(t.method??"GET").toUpperCase();if(s!=="GET"&&s!=="HEAD"&&!h(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)},J=t=>{const e=l.replace(B,"");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(T,"");if(t.address===void 0||typeof t.address=="string")return`http://localhost:5173${o}/${e}`;const s=t.address.address==="::"||t.address.address==="0.0.0.0"?"localhost":t.address.address;return`http://${s.includes(":")?`[${s}]`:s}:${String(t.address.port)}${o}/${e}`},W=t=>{try{return new URL(t,"http://localhost").pathname.replace(T,"")}catch{return t}},M=(t,e)=>{let o,s,n;const u=t.config.root??process.cwd(),p=(r,a,i)=>{const d=P();if((o===void 0||d!==s)&&(o=$(t.config.logger),s=d),o===void 0){i.statusCode=501,i.setHeader("Content-Type","text/plain"),i.end("Lunora studio assets not found — install and build @lunora/studio.");return}const f=r===S,c=r.slice(r.lastIndexOf("/")+1);if(j(a,i,c,d))return;if(f){m(i,o.styles,"text/css; charset=utf-8");return}const g=x(c);if(g===void 0){i.statusCode=404,i.setHeader("Content-Type","text/plain"),i.end("Not found");return}m(i,g,U(c))};return(r,a,i)=>{const d=W(r.url??"");if(d!==l&&!d.startsWith(`${l}/`)){i();return}if(e||E(r,t.config.logger)!==void 0){a.statusCode=403,a.setHeader("Content-Type","text/plain"),a.end("Lunora studio is only available on loopback hosts in dev.");return}if(w.has(d)){const c=F(r);if(c!==void 0){a.statusCode=403,a.setHeader("Content-Type","application/json; charset=utf-8"),a.end(JSON.stringify({error:c,ok:!1}));return}}const f=y[d];if(f!==void 0){I(r,a,f,u);return}if(d===S||_(d)){p(d,r,a);return}n??=R({adminToken:O(u),basePath:l,dataEditable:!0,rulesInstalled:v(u).installed,runAsIdentity:!0,schemaEditable:!0,scriptSrc:k,styleHref:S}),D(a,n)}},q=()=>({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(M(t,o)),()=>{const s=()=>{const n=J({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${n}\x1B[39m`)};if(typeof t.printUrls=="function"){const n=t.printUrls.bind(t);t.printUrls=()=>{n(),s()}}else t.httpServer?.listening===!0?s():t.httpServer?.once("listening",s)}},name:"lunora:studio"});export{l as STUDIO_PATH,k as STUDIO_SCRIPT_PATH,S as STUDIO_STYLE_PATH,J as buildStudioUrl,q as studioPlugin};
|