@lunora/vite 1.0.0-alpha.282 → 1.0.0-alpha.284
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 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-
|
|
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-BAnDZbel.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-BAnDZbel.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
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};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import{existsSync as $}from"node:fs";import{resolve as
|
|
1
|
+
import{existsSync as $}from"node:fs";import{resolve as E,join as k}from"node:path";import{loadProjectConfig as C,findProjectConfigFile as L}from"@lunora/codegen";import{GENERATED_CLASS_MODULES as _}from"@lunora/config";import{LunoraError as y}from"@lunora/errors";const f="virtual:lunora/worker",I="\0",p=`${I}${f}`,M=`// @lunora/vite — the composed worker entry is worker-only and unavailable in the client environment.
|
|
2
2
|
export default {};
|
|
3
|
-
`,
|
|
3
|
+
`,D=/\/$/,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";'}},u=r=>{const e=r.framework;return e?.class==="A"&&m[e.framework]!==void 0},O=(r,e,o={})=>{const{allowUnauthenticatedShardAccess:a=!1,appConfigModule:n,classModules:s=[],shard:l={}}=o,i=m[r];if(i===void 0)throw new y("INTERNAL",`[lunora] no class-A worker wiring for framework "${r}"`);const c=e.replaceAll("\\","/"),h=s.map(t=>`
|
|
4
4
|
export * from "${c}/${t}";
|
|
5
5
|
`).join(""),v=s.includes("scheduler")?`
|
|
6
|
-
.scheduler({ namespace: (env) => env.SCHEDULER })`:"",
|
|
7
|
-
|
|
6
|
+
.scheduler({ namespace: (env) => env.SCHEDULER })`:"",R=s.includes("shardRegistry")?`
|
|
7
|
+
.shardRegistry((env) => env.SHARD_REGISTRY)`:"",w=n===void 0?"":`
|
|
8
|
+
import lunoraConfig from "${n}";`,[A,S]=n===void 0?["",""]:["lunoraConfig.app(",")"],g=Object.entries(l).filter(([,t])=>t!==void 0).toSorted(([t],[d])=>t.localeCompare(d)).map(([t,d])=>`
|
|
8
9
|
.${t}(${JSON.stringify(d)})`).join("");return`// Generated by @lunora/vite — class-A worker composition (PLAN4 M2).
|
|
9
10
|
// Do not edit: emitted from the detected framework (${r}). Point your
|
|
10
11
|
// wrangler \`main\` here (or re-export it) instead of hand-wiring createWorker.
|
|
@@ -12,12 +13,12 @@ ${i.imports}
|
|
|
12
13
|
import { defineApp } from "${c}/app";${w}
|
|
13
14
|
|
|
14
15
|
const app = ${A}defineApp()
|
|
15
|
-
.shard((env) => env.SHARD)${v}${R}
|
|
16
|
-
.httpRouter(${i.handler})${
|
|
16
|
+
.shard((env) => env.SHARD)${v}${R}${S}
|
|
17
|
+
.httpRouter(${i.handler})${g}${a?`
|
|
17
18
|
.extend(() => ({ allowUnauthenticatedShardAccess: true }))`:""}
|
|
18
19
|
.build();
|
|
19
20
|
|
|
20
21
|
export const ShardDO = app.ShardDO;
|
|
21
22
|
${h}
|
|
22
23
|
export default app;
|
|
23
|
-
`},
|
|
24
|
+
`},U=async r=>{const{config:e,error:o}=await C(r);return o!==void 0?{error:o}:typeof e?.app!="function"?{}:{specifier:L(r)?.replaceAll("\\","/")}},H=(r,e)=>{const o=E(r.projectRoot,r.generatedDir.replace(D,""));return{async load(a){if(a===p&&u(e)&&e.framework!==void 0){if(this.environment.name==="client")return M;const n=_.filter(i=>$(k(o,`${i}.ts`))),{error:s,specifier:l}=await U(r.projectRoot);return s!==void 0&&this.warn(`[lunora] lunora.config could not be loaded, so its \`app\` hook was not composed: ${s}`),O(e.framework.framework,o,{allowUnauthenticatedShardAccess:r.allowUnauthenticatedShardAccess,appConfigModule:l,classModules:n,shard:r.shard})}},name:"lunora:framework-compose",resolveId(a){if(a===f&&u(e))return p}}};export{m as CLASS_A_WIRING,f as LUNORA_WORKER_VIRTUAL_ID,p as RESOLVED_LUNORA_WORKER_ID,O as buildWorkerEntrySource,H as frameworkComposePlugin,u as isAutoComposable};
|
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.284",
|
|
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.
|
|
50
|
-
"@lunora/config": "1.0.0-alpha.
|
|
49
|
+
"@lunora/codegen": "1.0.0-alpha.241",
|
|
50
|
+
"@lunora/config": "1.0.0-alpha.286",
|
|
51
51
|
"@lunora/errors": "1.0.0-alpha.47",
|
|
52
52
|
"@visulima/vite-overlay": "2.0.20"
|
|
53
53
|
},
|