@lunora/vite 1.0.0-alpha.347 → 1.0.0-alpha.348
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 S}from"node:module";import{cloudflare as k}from"@cloudflare/vite-plugin";import{
|
|
2
|
-
${
|
|
3
|
-
`)}},name:"lunora:agent-rules-hint"}),
|
|
1
|
+
import{createRequire as S}from"node:module";import{cloudflare as k}from"@cloudflare/vite-plugin";import{resolveDeployDriver as R,startCelldDevSession as P,formatLunoraEvent as y,lunoraLine as x,detectFramework as A,targetRunsOwnDevServer as C,resolveTargetOrThrow as W,isRunnableTarget as E,runnableTargetIds as _}from"@lunora/config";import{GENERATED_CLASS_MODULES as Ge,detectFramework as qe}from"@lunora/config";import D from"@visulima/vite-overlay";import{detectAgentRules as O,claimAgentRulesHint as T,lunoraLine as f,AGENT_RULES_HINT as b}from"@lunora/config/cli";import{reconcileBindingsSafely as $,findWranglerFile as L,readWranglerJsonc as U,warnCloudflareCliConfigOnce as N,hasCloudflareCredentials as j,withheldWorkersAi as F,describeWithheldWorkersAi as I}from"@lunora/config/cloudflare";import{reconcileWranglerCrons as Je}from"@lunora/config/cloudflare";import{r as B,a as V}from"./packem_shared/server-close-DWiO4Vxb.mjs";import H from"./packem_shared/codegenPlugin-BsLFhhzx.mjs";import M from"./packem_shared/containerLogsPlugin-BCqWF6EU.mjs";import K from"./packem_shared/devStatePlugin-CF4GDvBn.mjs";import G from"./packem_shared/devVariablesPlugin-DbD6cSF0.mjs";import{frameworkComposePlugin as q}from"./packem_shared/CLASS_A_WIRING-DCI5QzA9.mjs";import{CLASS_A_WIRING as Xe,LUNORA_WORKER_VIRTUAL_ID as Ye,buildWorkerEntrySource as Ze,isAutoComposable as er}from"./packem_shared/CLASS_A_WIRING-DCI5QzA9.mjs";import z from"./packem_shared/logStreamPlugin-EMXiy6pI.mjs";import{proxyCheckPlugin as J}from"./packem_shared/checkLunoraProxy-BNPgNWtV.mjs";import{checkLunoraProxy as or}from"./packem_shared/checkLunoraProxy-BNPgNWtV.mjs";import{remoteBindingsPlugin as Q}from"./packem_shared/planViteRemoteBindings-CNz2theU.mjs";import{planViteRemoteBindings as nr,withRemoteBindings as ir}from"./packem_shared/planViteRemoteBindings-CNz2theU.mjs";import{resolve as X}from"node:path";import{readServiceBindings as Y}from"@lunora/codegen";import{lunoraSolutionFinders as Z}from"./packem_shared/lunoraSolutionFinder--J0x2mAM.mjs";import{lunoraSolutionFinder as sr}from"./packem_shared/lunoraSolutionFinder--J0x2mAM.mjs";import{studioPlugin as ee}from"./packem_shared/buildStudioUrl-DMMWpguZ.mjs";import{buildStudioUrl as cr}from"./packem_shared/buildStudioUrl-DMMWpguZ.mjs";import{withWorkerStartupHint as re}from"./packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs";import{WORKER_STARTUP_HINT as dr,augmentWorkerStartupError as fr,isWorkerEntryEvalError as gr}from"./packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs";import{wranglerValidatorPlugin as oe}from"./packem_shared/wranglerValidatorPlugin-BlGHjTXZ.mjs";import{default as mr}from"./packem_shared/LUNORA_API_UPDATED_EVENT-CO2Rv2re.mjs";import{STUDIO_PATH as hr}from"@lunora/config/studio-host";const te=r=>({apply:"serve",configureServer(e){return()=>{O(r.projectRoot).installed||!T()||e.config.logger.warn(`
|
|
2
|
+
${f(b)}
|
|
3
|
+
`)}},name:"lunora:agent-rules-hint"}),ne=r=>({async config(e,t){t.isPreview!==!0&&await $(r,{info:o=>{console.info(o)},warn:o=>{console.warn(o)}})},enforce:"pre",name:"lunora:bindings-provision"}),h="/_lunora",ie=8787,d=new Map,w=r=>r.command==="serve"&&r.isPreview!==!0,ae=(r,e)=>{let t;return()=>{if(t===void 0)try{R(e).projectConfig?.(r,"dev"),t={runs:!0}}catch(o){t={reason:o instanceof Error?o.message:String(o),runs:!1}}return t}},se=r=>{const e=L(r),t=e===void 0?void 0:U(e).parsed?.dev?.port;return typeof t=="number"?t:ie},le=(r,e)=>r.map(t=>{const o=t.apply;return{...t,apply:(i,a)=>w(a)&&e()?!1:typeof o=="function"?o(i,a):o===void 0||o===a.command}}),ce=(r,e,{stream:t,tag:o})=>{const i=y(e);i!==void 0?r[i.level](`[lunora] ${i.text}`):t==="stderr"?r.warn(`[${o}] ${e}`):r.info(`[${o}] ${e}`)},ue=(r,e)=>{const t=se(r),o=new Map;return{apply:(i,a)=>w(a)&&e(),buildEnd(){V(o,this.environment)},config:i=>{if(i.server?.proxy?.[h]===void 0)return{server:{proxy:{[h]:{changeOrigin:!0,target:`http://127.0.0.1:${String(t)}`,ws:!0}}}}},async configureServer(i){const{logger:a}=i.config;await d.get(r)?.stop(),d.delete(r),a.info(`[lunora] starting the worker on celld at http://127.0.0.1:${String(t)} …`);const c=await P({log:(n,s)=>{ce(a,n,s)},port:t,projectRoot:r});d.set(r,c);const l=n=>{a.error(`[lunora] the worker on celld exited (code ${String(n)}) — restart vite dev to bring it back`)};c.exited.then(l).catch(()=>{}),B(i,o,()=>{d.get(r)===c&&d.delete(r),c.stop().catch(n=>{a.error(`[lunora] stopping celld failed: ${n instanceof Error?n.message:String(n)}`)})})},name:"lunora:celld-dev"}},de=r=>({configResolved(e){N(r.projectRoot,t=>{e.logger.warn(x(t))})},name:"lunora:cf-config-warning"}),fe=()=>({}),ge={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)"},pe=r=>{const e=ge[r.framework];return r.framework==="none"?f("no meta-framework detected — running standalone."):r.class==="B"?f(`detected ${e} — composition is handled by the framework adapter.`):f(`detected ${e} — composing the Lunora worker into one Cloudflare Worker.`)},me=(r,e)=>{let t=!1;const o=()=>{e.framework??=A(r.projectRoot)};return{config(){o()},configResolved(){o()},configureServer(){o(),!t&&e.framework!==void 0&&(t=!0,console.info(pe(e.framework)))},name:"lunora:framework-detect"}},p=new WeakSet,ve=(r,e={})=>{let t=!1;const o=r.experimental?.newConfig,i=o!==void 0&&o!==!1,a=e.hasCredentials??(()=>j({projectRoot:e.projectRoot})),c=l=>{const n=(s,...u)=>{const m=typeof l=="function"?l(s,...u):l,g=m===void 0?void 0:{...m},v=t?F(s.ai??g?.ai,a):void 0;return v!==void 0&&(delete s.ai,delete g?.ai,console.warn(f(I(v)))),g};return p.add(n),n};return{config(l,n){if(t=n.command==="serve"&&n.isPreview!==!0,i)return;const s=r;p.has(s.config)||(s.config=c(s.config)),Array.isArray(s.auxiliaryWorkers)&&(s.auxiliaryWorkers=s.auxiliaryWorkers.map(u=>p.has(u.config)?u:{...u,config:c(u.config)}))},enforce:"pre",name:"lunora:local-ai-binding"}},he=(r,e)=>({config(t,o){if(o.command!=="serve")return;const{services:i}=Y(e),a=Array.isArray(r.auxiliaryWorkers)?r.auxiliaryWorkers:[],c=new Set(a.map(n=>n.configPath===void 0?"":X(e,n.configPath))),l=[...new Set(i.map(n=>n.wranglerPath))].filter(n=>!c.has(n)).map(n=>({configPath:n}));l.length>0&&(r.auxiliaryWorkers=[...a,...l])},enforce:"pre",name:"lunora:service-workers"}),we=r=>{if(r===!1)return!1;const e=r===!0||r===void 0?{}:r;return{...e,forwardedConsoleMethods:e.forwardedConsoleMethods??["error","warn"],solutionFinders:[...Z,...e.solutionFinders??[]]}},Se=(r,e)=>{const t=W(r,e);if(!E(t)){const o=_();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: ${o.join(", ")}`)}return t},ke=r=>{const e=r??{},t=e.schemaDir??"lunora";let o;e.cloudflare===!1?o=!1:e.cloudflare===!0||e.cloudflare===void 0?o={}:o=e.cloudflare;const i=e.projectRoot??process.cwd(),a=Se(i,e.target);return{allowUnauthenticatedShardAccess:e.allowUnauthenticatedShardAccess??!1,apiSpec:e.apiSpec??"openapi",cloudflare:o,studio:e.studio??!0,generatedDir:`${t}/_generated`,overlay:we(e.overlay),projectRoot:i,schemaDir:t,shard:e.shard??{},target:a,validateWrangler:e.validateWrangler??!0}},Ve=r=>{const e=ke(r),t=fe(),o=[me(e,t),q(e,t),G(e),ne(e),H(e),z(),K(e),te(e),de(e),J()];e.studio&&o.push(ee(e)),e.validateWrangler&&o.push(oe(e)),e.overlay!==!1&&o.push(D(e.overlay)),o.push(M(e));const i=e.cloudflare===!1?void 0:{...e.cloudflare};if(o.push(Q(i,{projectRoot:e.projectRoot})),i!==void 0){o.push(he(i,e.projectRoot));const a=C(e.target),c=ae(e.projectRoot,e.target),l=()=>a&&c().runs;o.push(...le([ve(i,{projectRoot:e.projectRoot}),...re(k(i))],l)),a&&o.push(ue(e.projectRoot,l),{apply:(n,s)=>s.command==="serve"&&s.isPreview!==!0&&!l(),configureServer(n){n.config.logger.warn(`[lunora] target "${e.target}": vite dev serves the worker in workerd, not on ${e.target} — ${c().reason??"it cannot run this project"}. \`vite build\` then \`lunora deploy\` ships it to ${e.target}.`)},name:"lunora:target-runtime-notice"})}return o},He=S(import.meta.url)("../package.json").version;export{Xe as CLASS_A_WIRING,Ge as GENERATED_CLASS_MODULES,mr as LUNORA_API_UPDATED_EVENT,Ye as LUNORA_WORKER_VIRTUAL_ID,hr as STUDIO_PATH,He as VERSION,dr as WORKER_STARTUP_HINT,fr as augmentWorkerStartupError,cr as buildStudioUrl,Ze as buildWorkerEntrySource,or as checkLunoraProxy,H as codegenPlugin,M as containerLogsPlugin,qe as detectFramework,K as devStatePlugin,G as devVariablesPlugin,q as frameworkComposePlugin,er as isAutoComposable,gr as isWorkerEntryEvalError,z as logStreamPlugin,Ve as lunora,sr as lunoraSolutionFinder,Z as lunoraSolutionFinders,nr as planViteRemoteBindings,J as proxyCheckPlugin,Je as reconcileWranglerCrons,Q as remoteBindingsPlugin,we as resolveOverlayOption,ee as studioPlugin,ir as withRemoteBindings,re as withWorkerStartupHint,oe as wranglerValidatorPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{discoverContainerInfo as l,streamContainerLogs as m}from"@lunora/config";import{lunoraLine as i}from"@lunora/config/cli";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};
|
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.348",
|
|
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.63.1",
|
|
49
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
50
|
-
"@lunora/config": "1.0.0-alpha.
|
|
49
|
+
"@lunora/codegen": "1.0.0-alpha.315",
|
|
50
|
+
"@lunora/config": "1.0.0-alpha.363",
|
|
51
51
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
52
52
|
"@visulima/vite-overlay": "2.0.41"
|
|
53
53
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{discoverContainerInfo as l,streamContainerLogs as u,lunoraLine as i}from"@lunora/config";const v=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=u({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{v as default};
|