@lunora/vite 1.0.0-alpha.293 → 1.0.0-alpha.295
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 p}from"node:module";import{cloudflare as m}from"@cloudflare/vite-plugin";import{detectAgentRules as v,claimAgentRulesHint as h,lunoraLine as d,AGENT_RULES_HINT as S,resolveDeployDriver as w,startCelldDevSession as k,formatLunoraEvent as P,detectFramework as R,targetRunsOwnDevServer as y,resolveTargetOrThrow as x,isRunnableTarget as E,runnableTargetIds as A}from"@lunora/config";import{GENERATED_CLASS_MODULES as br,detectFramework as Cr}from"@lunora/config";import _ from"@visulima/vite-overlay";import{reconcileBindingsSafely as D,findWranglerFile as O,readWranglerJsonc as T}from"@lunora/config/cloudflare";import{reconcileWranglerCrons as Ur}from"@lunora/config/cloudflare";import{r as W,a as $}from"./packem_shared/server-close-DWiO4Vxb.mjs";import b from"./packem_shared/codegenPlugin-eWUCZzQt.mjs";import C from"./packem_shared/containerLogsPlugin-67PZ8zmb.mjs";import L from"./packem_shared/devStatePlugin
|
|
1
|
+
import{createRequire as p}from"node:module";import{cloudflare as m}from"@cloudflare/vite-plugin";import{detectAgentRules as v,claimAgentRulesHint as h,lunoraLine as d,AGENT_RULES_HINT as S,resolveDeployDriver as w,startCelldDevSession as k,formatLunoraEvent as P,detectFramework as R,targetRunsOwnDevServer as y,resolveTargetOrThrow as x,isRunnableTarget as E,runnableTargetIds as A}from"@lunora/config";import{GENERATED_CLASS_MODULES as br,detectFramework as Cr}from"@lunora/config";import _ from"@visulima/vite-overlay";import{reconcileBindingsSafely as D,findWranglerFile as O,readWranglerJsonc as T}from"@lunora/config/cloudflare";import{reconcileWranglerCrons as Ur}from"@lunora/config/cloudflare";import{r as W,a as $}from"./packem_shared/server-close-DWiO4Vxb.mjs";import b from"./packem_shared/codegenPlugin-eWUCZzQt.mjs";import C from"./packem_shared/containerLogsPlugin-67PZ8zmb.mjs";import L from"./packem_shared/devStatePlugin-CF4GDvBn.mjs";import U from"./packem_shared/devVariablesPlugin-DbD6cSF0.mjs";import{frameworkComposePlugin as N}from"./packem_shared/CLASS_A_WIRING-BAnDZbel.mjs";import{CLASS_A_WIRING as Fr,LUNORA_WORKER_VIRTUAL_ID as Ir,buildWorkerEntrySource as Br,isAutoComposable as Vr}from"./packem_shared/CLASS_A_WIRING-BAnDZbel.mjs";import F from"./packem_shared/logStreamPlugin-EMXiy6pI.mjs";import{proxyCheckPlugin as I}from"./packem_shared/checkLunoraProxy-BNPgNWtV.mjs";import{checkLunoraProxy as Hr}from"./packem_shared/checkLunoraProxy-BNPgNWtV.mjs";import{remoteBindingsPlugin as B}from"./packem_shared/planViteRemoteBindings-ByOliZuE.mjs";import{planViteRemoteBindings as Kr,withRemoteBindings as Gr}from"./packem_shared/planViteRemoteBindings-ByOliZuE.mjs";import{resolve as V}from"node:path";import{readServiceBindings as j}from"@lunora/codegen";import{lunoraSolutionFinders as H}from"./packem_shared/lunoraSolutionFinder--J0x2mAM.mjs";import{lunoraSolutionFinder as Jr}from"./packem_shared/lunoraSolutionFinder--J0x2mAM.mjs";import{studioPlugin as M}from"./packem_shared/buildStudioUrl-DMMWpguZ.mjs";import{buildStudioUrl as Qr}from"./packem_shared/buildStudioUrl-DMMWpguZ.mjs";import{withWorkerStartupHint as K}from"./packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs";import{WORKER_STARTUP_HINT as Yr,augmentWorkerStartupError as Zr,isWorkerEntryEvalError as re}from"./packem_shared/WORKER_STARTUP_HINT-COlRTY32.mjs";import{wranglerValidatorPlugin as G}from"./packem_shared/wranglerValidatorPlugin-BlGHjTXZ.mjs";import{default as oe}from"./packem_shared/LUNORA_API_UPDATED_EVENT-CO2Rv2re.mjs";import{STUDIO_PATH as ne}from"@lunora/config/studio-host";const q=e=>({apply:"serve",configureServer(r){return()=>{v(e.projectRoot).installed||!h()||r.config.logger.warn(`
|
|
2
2
|
${d(S)}
|
|
3
3
|
`)}},name:"lunora:agent-rules-hint"}),J=e=>({async config(r,t){t.isPreview!==!0&&await D(e,{info:o=>{console.info(o)},warn:o=>{console.warn(o)}})},enforce:"pre",name:"lunora:bindings-provision"}),f="/_lunora",z=8787,c=new Map,g=e=>e.command==="serve"&&e.isPreview!==!0,Q=(e,r)=>{let t;return()=>{if(t===void 0)try{w(r).projectConfig?.(e,"dev"),t={runs:!0}}catch(o){t={reason:o instanceof Error?o.message:String(o),runs:!1}}return t}},X=e=>{const r=O(e),t=r===void 0?void 0:T(r).parsed?.dev?.port;return typeof t=="number"?t:z},Y=(e,r)=>e.map(t=>{const o=t.apply;return{...t,apply:(n,a)=>g(a)&&r()?!1:typeof o=="function"?o(n,a):o===void 0||o===a.command}}),Z=(e,r,{stream:t,tag:o})=>{const n=P(r);n!==void 0?e[n.level](`[lunora] ${n.text}`):t==="stderr"?e.warn(`[${o}] ${r}`):e.info(`[${o}] ${r}`)},rr=(e,r)=>{const t=X(e),o=new Map;return{apply:(n,a)=>g(a)&&r(),buildEnd(){$(o,this.environment)},config:n=>{if(n.server?.proxy?.[f]===void 0)return{server:{proxy:{[f]:{changeOrigin:!0,target:`http://127.0.0.1:${String(t)}`,ws:!0}}}}},async configureServer(n){const{logger:a}=n.config;await c.get(e)?.stop(),c.delete(e),a.info(`[lunora] starting the worker on celld at http://127.0.0.1:${String(t)} …`);const s=await k({log:(i,u)=>{Z(a,i,u)},port:t,projectRoot:e});c.set(e,s);const l=i=>{a.error(`[lunora] the worker on celld exited (code ${String(i)}) — restart vite dev to bring it back`)};s.exited.then(l).catch(()=>{}),W(n,o,()=>{c.get(e)===s&&c.delete(e),s.stop().catch(i=>{a.error(`[lunora] stopping celld failed: ${i instanceof Error?i.message:String(i)}`)})})},name:"lunora:celld-dev"}},er=()=>({}),or={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)"},tr=e=>{const r=or[e.framework];return e.framework==="none"?d("no meta-framework detected — running standalone."):e.class==="B"?d(`detected ${r} — composition is handled by the framework adapter.`):d(`detected ${r} — composing the Lunora worker into one Cloudflare Worker.`)},nr=(e,r)=>{let t=!1;const o=()=>{r.framework??=R(e.projectRoot)};return{config(){o()},configResolved(){o()},configureServer(){o(),!t&&r.framework!==void 0&&(t=!0,console.info(tr(r.framework)))},name:"lunora:framework-detect"}},ir=(e,r)=>({config(t,o){if(o.command!=="serve")return;const{services:n}=j(r),a=Array.isArray(e.auxiliaryWorkers)?e.auxiliaryWorkers:[],s=new Set(a.map(i=>i.configPath===void 0?"":V(r,i.configPath))),l=[...new Set(n.map(i=>i.wranglerPath))].filter(i=>!s.has(i)).map(i=>({configPath:i}));l.length>0&&(e.auxiliaryWorkers=[...a,...l])},enforce:"pre",name:"lunora:service-workers"}),ar=e=>{if(e===!1)return!1;const r=e===!0||e===void 0?{}:e;return{...r,forwardedConsoleMethods:r.forwardedConsoleMethods??["error","warn"],solutionFinders:[...H,...r.solutionFinders??[]]}},sr=(e,r)=>{const t=x(e,r);if(!E(t)){const o=A();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},lr=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(),a=sr(n,r.target);return{allowUnauthenticatedShardAccess:r.allowUnauthenticatedShardAccess??!1,apiSpec:r.apiSpec??"openapi",cloudflare:o,studio:r.studio??!0,generatedDir:`${t}/_generated`,overlay:ar(r.overlay),projectRoot:n,schemaDir:t,shard:r.shard??{},target:a,validateWrangler:r.validateWrangler??!0}},Or=e=>{const r=lr(e),t=er(),o=[nr(r,t),N(r,t),U(r),J(r),b(r),F(),L(r),q(r),I()];r.studio&&o.push(M(r)),r.validateWrangler&&o.push(G(r)),r.overlay!==!1&&o.push(_(r.overlay)),o.push(C(r));const n=r.cloudflare===!1?void 0:{...r.cloudflare};if(o.push(B(n,{projectRoot:r.projectRoot})),n!==void 0){o.push(ir(n,r.projectRoot));const a=y(r.target),s=Q(r.projectRoot,r.target),l=()=>a&&s().runs;o.push(...Y(K(m(n)),l)),a&&o.push(rr(r.projectRoot,l),{apply:(i,u)=>u.command==="serve"&&u.isPreview!==!0&&!l(),configureServer(i){i.config.logger.warn(`[lunora] target "${r.target}": vite dev serves the worker in workerd, not on ${r.target} — ${s().reason??"it cannot run this project"}. \`vite build\` then \`lunora deploy\` ships it to ${r.target}.`)},name:"lunora:target-runtime-notice"})}return o},Tr=p(import.meta.url)("../package.json").version;export{Fr as CLASS_A_WIRING,br as GENERATED_CLASS_MODULES,oe as LUNORA_API_UPDATED_EVENT,Ir as LUNORA_WORKER_VIRTUAL_ID,ne as STUDIO_PATH,Tr as VERSION,Yr as WORKER_STARTUP_HINT,Zr as augmentWorkerStartupError,Qr as buildStudioUrl,Br as buildWorkerEntrySource,Hr as checkLunoraProxy,b as codegenPlugin,C as containerLogsPlugin,Cr as detectFramework,L as devStatePlugin,U as devVariablesPlugin,N as frameworkComposePlugin,Vr as isAutoComposable,re as isWorkerEntryEvalError,F as logStreamPlugin,Or as lunora,Jr as lunoraSolutionFinder,H as lunoraSolutionFinders,Kr as planViteRemoteBindings,I as proxyCheckPlugin,Ur as reconcileWranglerCrons,B as remoteBindingsPlugin,ar as resolveOverlayOption,M as studioPlugin,Gr as withRemoteBindings,K as withWorkerStartupHint,G as wranglerValidatorPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEV_HANDOFF_ENV as c,claimDevServerState as p,DEV_LOG_FILE_ENV as u,DEV_DAEMON_ENV as v,lunoraLine as f,readDevServerState as g,clearDevServerState as S}from"@lunora/config";import{a as m,r as D}from"./server-close-DWiO4Vxb.mjs";const E=/\/$/,U=o=>{const r=o.resolvedUrls?.local[0];if(r!==void 0)return r.replace(E,"");const n=o.httpServer?.address();if(n!==null&&typeof n=="object")return`http://localhost:${String(n.port)}`};let s;const O=o=>{let r=!1;const n=new Map;return{apply:"serve",configureServer(e){const l=o.projectRoot,a=()=>{if(r)return;const t=U(e);if(t===void 0)return;const d=Number(process.env[c]),i=p(l,{background:process.env[v]==="1",logFile:process.env[u],mode:"vite",pid:process.pid,readyAt:new Date().toISOString(),startedAt:new Date().toISOString(),...s===void 0?{}:{tunnelUrl:s},url:t},Number.isInteger(d)&&d>0?{supersedePid:d}:void 0);if(!i.ok){i.existing!==void 0&&e.config.logger.warn(f(`another dev server is already recorded at ${i.existing.url} (pid ${String(i.existing.pid)}) — leaving .lunora/dev.json untouched`));return}r=!0,s=void 0};return D(e,n,()=>{if(r){const t=g(l);s=t?.pid===process.pid?t.tunnelUrl:void 0,S(l,process.pid),r=!1}}),()=>{if(typeof e.printUrls=="function"){const t=e.printUrls.bind(e);e.printUrls=()=>{t(),a()}}e.httpServer?.once("listening",()=>{setTimeout(a,0)})}},buildEnd(){m(n,this.environment)},name:"lunora:dev-state"}};export{O 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.295",
|
|
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.62.1",
|
|
49
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
50
|
-
"@lunora/config": "1.0.0-alpha.
|
|
49
|
+
"@lunora/codegen": "1.0.0-alpha.254",
|
|
50
|
+
"@lunora/config": "1.0.0-alpha.297",
|
|
51
51
|
"@lunora/errors": "1.0.0-alpha.50",
|
|
52
52
|
"@visulima/vite-overlay": "2.0.20"
|
|
53
53
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DEV_HANDOFF_ENV as a,claimDevServerState as c,DEV_LOG_FILE_ENV as p,DEV_DAEMON_ENV as u,lunoraLine as v,clearDevServerState as f}from"@lunora/config";import{a as g,r as S}from"./server-close-DWiO4Vxb.mjs";const m=/\/$/,D=n=>{const r=n.resolvedUrls?.local[0];if(r!==void 0)return r.replace(m,"");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,d=()=>{if(r)return;const o=D(e);if(o===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,readyAt:new Date().toISOString(),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(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 o=e.printUrls.bind(e);e.printUrls=()=>{o(),d()}}e.httpServer?.once("listening",()=>{setTimeout(d,0)})}},buildEnd(){g(t,this.environment)},name:"lunora:dev-state"}};export{_ as default};
|