@lunora/config 1.0.0-alpha.282 → 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/cloudflare/index.d.mts +94 -93
- package/dist/cloudflare/index.d.ts +94 -93
- package/dist/cloudflare/index.mjs +1 -1
- package/dist/index.d.mts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/{BINDING_MANIFEST_VERSION-B8dwEKLn.mjs → BINDING_MANIFEST_VERSION-B4Tu8Ytd.mjs} +1 -1
- package/dist/packem_shared/CLOUDFLARE_DRIVER-DUE6r-Pg.mjs +1 -0
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-5R-BECOC.mjs +1 -0
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-CtEZtsUF.mjs +2 -0
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-g_1F-n2X.mjs +1 -0
- package/dist/packem_shared/UNEXPORTED_CLASS_MARKER-Bc302QS4.mjs +1 -0
- package/dist/packem_shared/addArgsFor-CYZKhNIo.mjs +1 -0
- package/dist/packem_shared/{assertWranglerSatisfiesSchema-DHITzU7H.mjs → assertWranglerSatisfiesSchema-B24XPKq7.mjs} +1 -1
- package/dist/packem_shared/collectExportGaps-BmEGzQQc.mjs +2 -0
- package/dist/packem_shared/inferLunoraBindings-GaAITuz-.mjs +1 -0
- package/dist/packem_shared/{interpretRemote-CQ06qpjM.mjs → interpretRemote-Da32GcUi.mjs} +1 -1
- package/dist/packem_shared/mergeWranglerEnvironment-BIcLqPfv.mjs +1 -0
- package/dist/packem_shared/reconcileBindingsSafely-DOqY2zb2.mjs +1 -0
- package/dist/packem_shared/{runPostCodegenHook-CVrOTiGB.mjs → runPostCodegenHook-B0T1q2YI.mjs} +1 -1
- package/dist/packem_shared/{schema-info.d-DvKkJ7HJ.d.mts → schema-info.d-C3DeuUmC.d.mts} +111 -51
- package/dist/packem_shared/{schema-info.d-DvKkJ7HJ.d.ts → schema-info.d-C3DeuUmC.d.ts} +111 -51
- package/dist/packem_shared/validate-bindings-D6-vb6if.mjs +1 -0
- package/dist/packem_shared/withTailConsumer-DaP3r6ia.mjs +1 -0
- package/dist/packem_shared/{wranglerToAlchemy-SDoS_XY0.mjs → wranglerToAlchemy-DZOim9As.mjs} +1 -1
- package/package.json +3 -3
- package/dist/packem_shared/CLOUDFLARE_DRIVER-Ci9oJMYb.mjs +0 -1
- package/dist/packem_shared/COMPOSED_WORKER_ENTRY-Bj793dir.mjs +0 -1
- package/dist/packem_shared/DEFAULT_DEPLOY_TARGET-B-e9mqgX.mjs +0 -1
- package/dist/packem_shared/REQUIRED_COMPATIBILITY_DATE-SdRHaUwh.mjs +0 -1
- package/dist/packem_shared/addArgsFor-CWb4cPij.mjs +0 -1
- package/dist/packem_shared/collectExportGaps-BJw9LdRV.mjs +0 -2
- package/dist/packem_shared/reconcileBindingsSafely-Ds107djO.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as s,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as
|
|
1
|
+
import{AGENT_MODE_ENV as o,detectAiAgent as t}from"./packem_shared/AGENT_MODE_ENV-D8MvSwPE.mjs";import{discoverAgentInfo as E}from"./packem_shared/discoverAgentInfo-CTdCSfYM.mjs";import{AGENT_RULES_DIR as s,AGENT_RULES_HINT as n,AGENT_RULES_HINT_ENV as l,LUNORA_SKILL_NAMES as _,ROOT_SKILL_NAME as p,claimAgentRulesHint as c,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-C54Ta_vz.mjs";import{CODEGEN_ENV as D,isCodegenDisabled as m}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as f}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as v}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as R,projectUsesUmbrella as g,readProjectDependencyNames as T}from"./packem_shared/detectFramework-CUiVEHDQ.mjs";import{DEV_BINDINGS_FILE as x,DEV_DAEMON_ENV as I,DEV_HANDOFF_ENV as u,DEV_LOG_FILE as O,DEV_LOG_FILE_ENV as P,DEV_STATE_DIR as F,DEV_STATE_FILE as C,claimDevServerState as U,clearDevServerState as G,isDevServerReady as b,isProcessAlive as M,isRecordedProcessCurrent as y,readDevServerState as k,readLiveDevServerState as B,updateDevServerState as K,writeDevServerState as w}from"./packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs";import{DEV_VARS_EXAMPLE_FILE as j,DEV_VARS_FILE as H,DEV_VARS_KEY_PATTERN as W,escapeRegExp as Y,parseDevVariableEntries as J,removeDevVariableLine as q,upsertDevVariableLine as X}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEV_WORKER_ENV_VALUE as Q,DEV_WORKER_ENV_VAR as Z,ensureDevWorkerEnv as $}from"./packem_shared/DEV_WORKER_ENV_VALUE-DwGANZVw.mjs";import{DEFAULT_DEPLOY_TARGET as re,deployTargetIds as oe,isRunnableTarget as te,planToolchainInvocation as ae,resolveDeployDriver as Ee,runnableTargetIds as ie,targetRunsOwnDevServer as se}from"./packem_shared/DEFAULT_DEPLOY_TARGET-CtEZtsUF.mjs";import{inferLunoraBindings as le,packageNamesFromBindings as _e}from"./packem_shared/inferLunoraBindings-GaAITuz-.mjs";import{LINKED_PROJECT_DIR as ce,LINKED_PROJECT_FILE as de,readLinkedProject as Ae,writeLinkedProject as De}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as Se,applyLintIgnores as fe,detectLintTools as Le}from"./packem_shared/LUNORA_IGNORED_PATHS-BHABA9u-.mjs";import{LUNORA_TAG as Ne,advisoryLine as Re,blockingFindingsMessage as ge,lunoraLine as Te,reportCodegenFindings as Ve}from"./packem_shared/LUNORA_TAG-CiQM3BkI.mjs";import{LUNORA_EVENT_SOURCE as Ie,formatLunoraEvent as ue}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as Pe}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as Ce,detectInstalledManagers as Ue,detectPackageManager as Ge,execArgsFor as be,installArgsFor as Me,runScriptArgsFor as ye,runScriptCommand as ke,toolchainExecArgs as Be}from"./packem_shared/addArgsFor-CYZKhNIo.mjs";import{P as we,s as he}from"./packem_shared/package-secrets-registry-DvtTiK4b.mjs";import{runPostCodegenHook as He}from"./packem_shared/runPostCodegenHook-B0T1q2YI.mjs";import{interpretRemote as Ye,readProjectRemotePreference as Je,readProjectTarget as qe,resolveProjectTarget as Xe,resolveTargetOrThrow as ze}from"./packem_shared/interpretRemote-Da32GcUi.mjs";import{createConfirm as Ze,isInteractive as $e,promptMultiSelect as er,promptSelect as rr,promptText as or,promptYesNo as tr}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{buildPackageSecretsBlock as Er,ensureDevVariables as ir,ensureDevVarsExample as sr,fillDevSecrets as nr,generateSecretValue as lr,isMintableSecretKey as _r,isPlaceholderValue as pr,planDevSecretsFill as cr,planDevVariablesAugment as dr,planDevVariablesScaffold as Ar,requiredSecrets as Dr,writeDevVariablesFileAtomically as mr}from"./packem_shared/buildPackageSecretsBlock-yv9mjKEW.mjs";import{applyAdditiveEdit as fr,classifyEdit as Lr}from"./packem_shared/applyAdditiveEdit-CH0VhMJ2.mjs";import{parseSchema as Nr}from"./packem_shared/parseSchema-D1Wbr1qv.mjs";import{classifyPolicyEdit as gr,resolveServerModule as Tr,scaffoldPolicyFile as Vr,wireRlsIntoProcedure as xr}from"./packem_shared/classifyPolicyEdit-D8NwrHxR.mjs";import{discoverSchemaInfo as ur}from"./packem_shared/discoverSchemaInfo-DJvevsCm.mjs";import{ACCENT as Pr,BADGES as Fr,BADGE_COLUMN_WIDTH as Cr,LUNA_ART as Ur,LUNA_BUNNY as Gr,LUNA_NAME as br,LUNA_SIGNOFF as Mr,STEP_BADGE_NAMES as yr,badgeLead as kr,badgeWidth as Br,padBadge as Kr,paintAnswer as wr,paintBadge as hr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{COMPOSED_WORKER_ENTRY as Hr,GENERATED_CLASS_MODULES as Wr}from"./packem_shared/COMPOSED_WORKER_ENTRY-5R-BECOC.mjs";import{discoverWorkflowInfo as Jr}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{Pr as ACCENT,o as AGENT_MODE_ENV,s as AGENT_RULES_DIR,n as AGENT_RULES_HINT,l as AGENT_RULES_HINT_ENV,Fr as BADGES,Cr as BADGE_COLUMN_WIDTH,D as CODEGEN_ENV,Hr as COMPOSED_WORKER_ENTRY,re as DEFAULT_DEPLOY_TARGET,x as DEV_BINDINGS_FILE,I as DEV_DAEMON_ENV,u as DEV_HANDOFF_ENV,O as DEV_LOG_FILE,P as DEV_LOG_FILE_ENV,F as DEV_STATE_DIR,C as DEV_STATE_FILE,j as DEV_VARS_EXAMPLE_FILE,H as DEV_VARS_FILE,W as DEV_VARS_KEY_PATTERN,Q as DEV_WORKER_ENV_VALUE,Z as DEV_WORKER_ENV_VAR,Wr as GENERATED_CLASS_MODULES,ce as LINKED_PROJECT_DIR,de as LINKED_PROJECT_FILE,Ur as LUNA_ART,Gr as LUNA_BUNNY,br as LUNA_NAME,Mr as LUNA_SIGNOFF,Ie as LUNORA_EVENT_SOURCE,Se as LUNORA_IGNORED_PATHS,_ as LUNORA_SKILL_NAMES,Ne as LUNORA_TAG,Pe as LunoraReporter,we as PACKAGE_SECRETS_REGISTRY,p as ROOT_SKILL_NAME,yr as STEP_BADGE_NAMES,Ce as addArgsFor,Re as advisoryLine,fr as applyAdditiveEdit,fe as applyLintIgnores,kr as badgeLead,Br as badgeWidth,ge as blockingFindingsMessage,Er as buildPackageSecretsBlock,c as claimAgentRulesHint,U as claimDevServerState,Lr as classifyEdit,gr as classifyPolicyEdit,G as clearDevServerState,Ze as createConfirm,oe as deployTargetIds,d as detectAgentRules,t as detectAiAgent,R as detectFramework,Ue as detectInstalledManagers,Le as detectLintTools,Ge as detectPackageManager,E as discoverAgentInfo,f as discoverContainerInfo,ur as discoverSchemaInfo,Jr as discoverWorkflowInfo,ir as ensureDevVariables,sr as ensureDevVarsExample,$ as ensureDevWorkerEnv,Y as escapeRegExp,be as execArgsFor,nr as fillDevSecrets,ue as formatLunoraEvent,lr as generateSecretValue,le as inferLunoraBindings,Me as installArgsFor,Ye as interpretRemote,m as isCodegenDisabled,b as isDevServerReady,$e as isInteractive,_r as isMintableSecretKey,pr as isPlaceholderValue,M as isProcessAlive,y as isRecordedProcessCurrent,te as isRunnableTarget,Te as lunoraLine,_e as packageNamesFromBindings,Kr as padBadge,wr as paintAnswer,hr as paintBadge,J as parseDevVariableEntries,Nr as parseSchema,cr as planDevSecretsFill,dr as planDevVariablesAugment,Ar as planDevVariablesScaffold,ae as planToolchainInvocation,g as projectUsesUmbrella,er as promptMultiSelect,rr as promptSelect,or as promptText,tr as promptYesNo,k as readDevServerState,Ae as readLinkedProject,B as readLiveDevServerState,T as readProjectDependencyNames,Je as readProjectRemotePreference,qe as readProjectTarget,q as removeDevVariableLine,Ve as reportCodegenFindings,Dr as requiredSecrets,Ee as resolveDeployDriver,Xe as resolveProjectTarget,Tr as resolveServerModule,ze as resolveTargetOrThrow,He as runPostCodegenHook,ye as runScriptArgsFor,ke as runScriptCommand,ie as runnableTargetIds,Vr as scaffoldPolicyFile,he as secretsForPackages,v as streamContainerLogs,se as targetRunsOwnDevServer,Be as toolchainExecArgs,K as updateDevServerState,X as upsertDevVariableLine,xr as wireRlsIntoProcedure,w as writeDevServerState,mr as writeDevVariablesFileAtomically,De as writeLinkedProject};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sqliteClasses as c}from"./wranglerToAlchemy-
|
|
1
|
+
import{sqliteClasses as c}from"./wranglerToAlchemy-DZOim9As.mjs";const u=1,l=new Set(["$schema","account_id","compatibility_date","compatibility_flags","keep_vars","main","migrations","minify","name","observability","placement","routes","rules","triggers","upload_source_maps","vars","workers_dev"]),p=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),a=[{bindingKey:"binding",field:"analytics_engine_datasets",resourceKey:"dataset",type:"analytics_engine"},{bindingKey:"class_name",field:"containers",resourceKey:"image",type:"container"},{bindingKey:"binding",field:"d1_databases",resourceIdKey:"database_id",resourceKey:"database_name",type:"d1"},{bindingKey:"binding",field:"hyperdrive",resourceIdKey:"id",type:"hyperdrive"},{bindingKey:"binding",field:"kv_namespaces",resourceIdKey:"id",type:"kv"},{bindingKey:"binding",field:"pipelines",resourceKey:"pipeline",type:"pipeline"},{bindingKey:"binding",field:"r2_buckets",resourceKey:"bucket_name",type:"r2"},{bindingKey:"binding",field:"vectorize",resourceKey:"index_name",type:"vectorize"},{bindingKey:"binding",field:"workflows",resourceKey:"name",type:"workflow"}],d=[{field:"ai",type:"ai"},{field:"assets",type:"assets"},{field:"browser",type:"browser"},{field:"images",type:"images"}],y=new Set([...a.map(e=>e.field),...d.map(e=>e.field),"durable_objects","queues"]),o=(e,t)=>{const s=t===void 0?void 0:e[t];return typeof s=="string"&&s!==""?s:void 0},b=(e,t)=>{const s=[];for(const n of a)for(const i of e[n.field]??[]){const r=o(i,n.bindingKey);if(r===void 0){t.push(n.field);continue}s.push({binding:r,className:o(i,"class_name"),resource:o(i,n.resourceKey),resourceId:o(i,n.resourceIdKey),type:n.type})}return s},m=(e,t)=>{const s=c(e),n=[];for(const i of e.durable_objects?.bindings??[]){if(i.name===void 0||i.name===""){t.push("durable_objects");continue}n.push({binding:i.name,className:i.class_name,sqlite:i.script_name===void 0&&i.class_name!==void 0?s.has(i.class_name):void 0,type:"durable_object"})}return n},_=(e,t)=>{const s=[];for(const n of e.queues?.producers??[]){if(n.binding===void 0||n.binding===""){t.push("queues.producers");continue}s.push({binding:n.binding,resource:n.queue,type:"queue_producer"})}for(const n of e.queues?.consumers??[]){if(n.queue===void 0||n.queue===""){t.push("queues.consumers");continue}s.push({binding:n.queue,resource:n.queue,type:"queue_consumer"})}return s},g=(e,t)=>[...b(e,t),...m(e,t),..._(e,t),...d.filter(s=>e[s.field]?.binding!==void 0).map(s=>({binding:e[s.field]?.binding,type:s.type}))],v=e=>{const t=[],s=g(e,t).map(i=>p(i)).toSorted((i,r)=>i.type.localeCompare(r.type)||i.binding.localeCompare(r.binding)),n=[...Object.keys(e).filter(i=>!l.has(i)&&!y.has(i)),...t.map(i=>`${i} (entry with no binding name)`)].toSorted((i,r)=>i.localeCompare(r));return{bindings:s,...e.compatibility_date===void 0?{}:{compatibilityDate:e.compatibility_date},...e.compatibility_flags===void 0?{}:{compatibilityFlags:e.compatibility_flags},crons:e.triggers?.crons??[],...e.name===void 0?{}:{name:e.name},unknown:n,vars:Object.keys(e.vars??{}).toSorted((i,r)=>i.localeCompare(r)),version:u}};export{u as BINDING_MANIFEST_VERSION,v as buildBindingManifest};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n={devServer:"workerd",prebuildsContainerImages:!0,deploy:o=>{const r=o.preview===!0?["versions","upload"]:["deploy"];return o.entry!==void 0&&r.push(o.entry),o.environment!==void 0&&r.push("--env",o.environment),o.temporary===!0&&r.push("--temporary"),o.dryRun===!0&&r.push("--dry-run"),o.outDir!==void 0&&r.push("--outdir",o.outDir,"--metafile"),{args:r,tool:"wrangler"}},dev:o=>{const r=["dev"];return o.configPath!==void 0&&r.push("--config",o.configPath),o.environment!==void 0&&r.push("--env",o.environment),r.push(...o.extraArgs??[]),{args:r,tool:"wrangler"}},secretList:o=>{const r=["secret","list","--format","json"];return o.environment!==void 0&&r.push("--env",o.environment),o.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}},secretPut:o=>{const r=["secret","put",o.key??""];return o.environment!==void 0&&r.push("--env",o.environment),o.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}},tail:o=>{const r=["tail"];return o.worker!==void 0&&r.push(o.worker),o.environment!==void 0&&r.push("--env",o.environment),o.format!==void 0&&r.push("--format",o.format),o.status!==void 0&&r.push("--status",o.status),o.search!==void 0&&r.push("--search",o.search),o.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}}},i={id:"cloudflare",name:"Cloudflare",toolchain:n};export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as i,existsSync as E}from"node:fs";import{parse as S}from"es-module-lexer";import{WRANGLER_FILES as O,readWranglerJsonc as d}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{escapeRegExp as R}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{join as p}from"node:path";const x="_generated",b=["src/server.ts","src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],_=new Set(["build","coverage","dist",x,"node_modules","out","target"]),g=new Set([".client",".server"]),w=/[/\\]/u,h=t=>{const e=[];for(const r of t.split(w))r===""||r==="."||(r===".."&&e.length>0&&e.at(-1)!==".."?e.pop():e.push(r));return e},D=t=>h(t).slice(0,-1).some(e=>_.has(e)||e.startsWith(".")&&!g.has(e)),l={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD"},u=Object.keys(l),U=t=>Object.hasOwn(l,t),T="virtual:lunora/worker",v=["ShardDO"],B=["agents","containers","scheduler","workflows"],A="src/worker.ts",P=t=>{for(const e of O){const r=p(t,e);if(!E(r))continue;const{parsed:s}=d(r),o=s?.main;if(o===T)return{composed:!0};const a=p(t,A);if(E(a))return{composed:!1,path:a};if(typeof o=="string"&&!D(o)&&E(p(t,o)))return{composed:!1,path:p(t,o)};break}for(const e of b){const r=p(t,e);if(E(r))return{composed:!1,path:r}}return{composed:!1}},C=/(?:^|[\s,{])type$/u,m=(t,e)=>{const r=e.ls>=0?e.ls:e.s;return C.test(t.slice(0,r).trimEnd())},f=(t,e)=>{const r=R(e);return new RegExp(String.raw`\bexport\s+type\s+${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${r}\b`,"u").test(t)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${r}\b`,"u").test(t)},W=t=>{const e=i(t,"utf8");let r;try{const[,s]=S(e);r=new Set(s.filter(o=>!m(e,o)).map(o=>o.n))}catch{r=new Set(u.filter(s=>new RegExp(String.raw`\bexport\b[^\n;]*\b${s}\b`,"u").test(e)&&!f(e,s)))}return u.filter(s=>r.has(s)).map(s=>({binding:l[s],className:s}))},$=(t,e,r)=>{if(e.length===0)return[];if(t.composed)return e.map(n=>({...n,exported:!0}));if(t.path===void 0)return e.map(n=>({...n,exported:!1}));const s=i(t.path,"utf8"),o=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${r}(?:\.js)?["']`).test(s);let a;try{const[,n]=S(s);a=new Set(n.filter(c=>!m(s,c)).map(c=>c.n))}catch{a=new Set(e.map(n=>n.className).filter(n=>new RegExp(String.raw`\bexport\b[^\n;]*\b${R(n)}\b`,"u").test(s)&&!f(s,n)))}return e.map(n=>{const c=o||a.has(n.className);return{...n,exported:c}})};export{v as COMPOSED_ENTRY_DURABLE_OBJECTS,A as COMPOSED_WORKER_ENTRY,l as DURABLE_OBJECT_BINDINGS,B as GENERATED_CLASS_MODULES,x as GENERATED_DIRECTORY,T as LUNORA_WORKER_VIRTUAL_ID,_ as NON_SOURCE_DIRECTORIES,g as SOURCE_DOT_DIRECTORIES,b as WORKER_ENTRY_FALLBACKS,$ as detectClassExports,W as detectExportedDurableObjects,U as isFrameworkDurableObject,D as isGeneratedOutput,P as resolveWorkerEntry};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{writeFileSync as $,rmSync as N,existsSync as v,readFileSync as D}from"node:fs";import{dirname as y,resolve as d,join as h,sep as p,relative as w}from"node:path";import{findWranglerFile as k,readWranglerJsonc as V}from"./WRANGLER_FILES-UNW-xY5u.mjs";import W from"./CLOUDFLARE_DRIVER-DUE6r-Pg.mjs";const Y=".celld.wrangler.json",F=h(".wrangler","deploy","config.json"),U=new Set(["$schema","assets","compatibility_date","compatibility_flags","containers","d1_databases","define","durable_objects","kv_namespaces","main","migrations","name","no_bundle","queues","r2_buckets","rules","services","triggers","vars","worker_loaders","workflows"]),B=new Set(["class_name","image","instance_type","max_instances","name","runtime"]),K=new Set(["CompiledWasm","Data","Text"]),x=/\r?\n/u,G=/[!*?[]/u,J=/[.[]/u,M=["deleted_classes","new_classes","renamed_classes","transferred_classes"],l=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),P=e=>Array.isArray(e)&&e.length===0||l(e)&&Object.values(e).every(r=>P(r)),H=e=>Array.isArray(e)?e.map(r=>{if(!l(r))return r;const n=M.find(t=>r[t]!==void 0);if(n!==void 0)throw new Error(`migration "${String(r.tag)}" uses \`${n}\`, which celld refuses — celld accepts only \`new_sqlite_classes\` migrations`);return{new_sqlite_classes:r.new_sqlite_classes,tag:r.tag}}):e,X=(e,r)=>Array.isArray(e)?e.map((n,t)=>l(n)?Object.fromEntries(Object.entries(n).filter(([o])=>{const s=B.has(o);return s||r.push(`containers[${String(t)}].${o}`),s})):n):e,q=(e,r)=>Array.isArray(e)?e.filter((n,t)=>{const o=l(n)&&typeof n.type=="string"&&K.has(n.type);return o||r.push(`rules[${String(t)}]`),o}):e,z=e=>{const r=[],n={};for(const[t,o]of Object.entries(e)){if(!U.has(t)){P(o)||r.push(t);continue}switch(t){case"containers":{n[t]=X(o,r);break}case"migrations":{n[t]=H(o);break}case"rules":{n[t]=q(o,r);break}default:n[t]=o}}return{config:n,dropped:r}},Q=e=>{const[r=[],...n]=e.map(o=>d(o).split(p));let t=0;for(;t<r.length&&n.every(o=>o[t]===r[t]);)t+=1;return r.slice(0,t).join(p)||p},Z=(e,r,n)=>{const t=s=>w(n,d(r,s)).split(p).join("/"),o={...e};return typeof e.main=="string"&&(o.main=t(e.main)),l(e.assets)&&typeof e.assets.directory=="string"&&(o.assets={...e.assets,directory:t(e.assets.directory)}),o},ee=e=>{const r=h(e,".assetsignore");if(!v(r))return;const n=D(r,"utf8").split(x).map(t=>t.trim()).filter(t=>t!==""&&!t.startsWith("#")).filter(t=>G.test(t)||v(h(e,t)));if(n.length>0)throw new Error(`${r} hides ${n.join(", ")} from the assets, and celld has no .assetsignore — remove those files from ${e} first`);return r},re=(e,r)=>{const n=h(e,F);if(!v(n))throw new Error(`wrangler \`main\` is the Vite virtual module "${r}", so celld deploys the Vite build output — and there is none yet. Run the project's build (\`vite build\`) first`);const{configPath:t}=JSON.parse(D(n,"utf8"));if(typeof t!="string")throw new TypeError(`${n} names no configPath`);return d(y(n),t)},S=e=>{const{parsed:r}=V(e);if(r===void 0)throw new Error(`${e} is not valid JSONC`);return r},te=(e,r,n,t)=>{const{d1_databases:o}=e;if(!Array.isArray(o)||t===n)return e;const s=Array.isArray(r.d1_databases)?r.d1_databases.filter(a=>l(a)):[];return{...e,d1_databases:o.map(a=>{if(!l(a))return a;const i=s.find(m=>m.binding===a.binding)?.migrations_dir,c=d(n,typeof i=="string"?i:"migrations");return v(c)?{...a,migrations_dir:w(t,c).split(p).join("/")}:a})}},ne=(e,r,n,t)=>{const{main:o}=n;if(typeof o!="string"||!o.startsWith("virtual:"))return{fromBuild:!1,source:n,sourcePath:r};if(t==="dev")throw new Error(`wrangler \`main\` is the Vite virtual module "${o}", which only a Vite build can resolve — \`celld dev\` rebuilds from a source file. Use \`vite dev\` for the dev loop and \`lunora deploy\` to ship the build to celld, or point \`main\` at a worker file`);const s=re(e,o);return{fromBuild:!0,source:S(s),sourcePath:s}},oe=(e,r,n,t,o)=>{const s=r.filter(c=>Object.hasOwn(n,c.split(J)[0]??c));let a=e;e.no_bundle!==void 0&&(a=Object.fromEntries(Object.entries(e).filter(([c])=>c!=="no_bundle")),s.push("no_bundle (celld re-bundles the build output)"));const i=t===void 0?void 0:ee(t);return i!==void 0&&s.push(`${w(o,i)} (matched no files)`),{assetsIgnore:i,projected:a,reported:s}},se=e=>{const r=l(e.vars)?e.vars:{};return{...e,vars:{WORKER_ENV:"development",...r}}},ie=(e,r)=>{const n=k(e);if(n===void 0)throw new Error(`no wrangler.jsonc or wrangler.json in ${e} — celld deploys from the project's Wrangler config`);const t=S(n),{fromBuild:o,source:s,sourcePath:a}=ne(e,n,t,r),i=y(a),{config:c,dropped:m}=z(s),{assets:g}=s,_=l(g)&&typeof g.directory=="string"?d(i,g.directory):void 0,I=typeof s.main=="string"?y(d(i,s.main)):void 0,f=Q([i,I,_].filter(L=>L!==void 0));if(!o&&f!==i)throw new Error(`wrangler \`main\` and \`assets.directory\` must sit inside ${i} — celld resolves everything against the config's directory`);const b=te(Z(c,i,f),t,e,f),u=o?oe(b,m,t,_,f):{assetsIgnore:void 0,projected:b,reported:m},R=r==="dev"?se(u.projected):u.projected,j=h(f,Y),T=`${JSON.stringify(R,void 0,4)}
|
|
2
|
+
`;return{configPath:j,dropped:u.reported,write:()=>{$(j,T),u.assetsIgnore!==void 0&&N(u.assetsIgnore)}}},ae=[["entry","`celld deploy` deploys the config's `main`; a composed framework entry has no celld equivalent yet"],["environment","celld has no Wrangler environments — deploy a separate config per environment"],["outDir","`celld deploy` does not write its bundle to disk"],["preview","celld has no preview versions — a deploy replaces the fleet's current deployment"],["temporary","celld has no short-lived accounts — it deploys to the fleet bucket in CELLD_BUCKET"]],O=e=>{if(e===void 0)throw new Error("the celld driver runs the projected wrangler config — pass `configPath` from `projectConfig`");return e},ce={deploy:e=>{const r=ae.find(([n])=>e[n]!==void 0&&e[n]!==!1);if(r!==void 0)throw new Error(r[1]);return{args:["deploy",O(e.configPath),...e.dryRun===!0?["--dry-run"]:[]],onPath:!0,tool:"celld"}},devServer:"own",prebuildsContainerImages:!1,dev:e=>{if(e.environment!==void 0)throw new Error("celld has no Wrangler environments — `celld dev` runs the top-level config");return{args:["dev",O(e.configPath),...e.extraArgs??[]],onPath:!0,tool:"celld"}}},le={id:"celld",name:"celld",projectConfig:ie,toolchain:ce},de={id:"node",name:"Node"},fe="cloudflare",E={celld:le,cloudflare:W,node:de},A=()=>Object.keys(E).toSorted((e,r)=>e.localeCompare(r)),C=(e=fe)=>{const r=E[e];if(r===void 0)throw new Error(`unknown deploy target "${e}" — available targets: ${A().join(", ")}`);return r},ue=e=>Object.hasOwn(E,e)&&C(e).toolchain!==void 0,ge=()=>A().filter(e=>ue(e)),ye=e=>C(e).toolchain?.devServer==="own",we=(e,r,n,t)=>{const o=e.projectConfig?.(r,n);return{command:t(o?.configPath),commit:()=>o?.write(),projection:o===void 0?void 0:{configPath:o.configPath,dropped:o.dropped}}};export{fe as DEFAULT_DEPLOY_TARGET,A as deployTargetIds,ue as isRunnableTarget,we as planToolchainInvocation,C as resolveDeployDriver,ge as runnableTargetIds,ye as targetRunsOwnDevServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as g,v as _,a as b,b as f,c as E,d as m,e as d,f as h,H as D,g as R,R as S,S as p,h as I,W as y,i as B}from"./validate-bindings-D6-vb6if.mjs";import{validateTailConsumers as L,validateSendEmail as O,validateLogpush as T,validateLimits as C,validatePlacement as N,validateObservability as w,validateAssets as A,validateCache as $,validateExports as j,validateCorsVariables as U,validateSchedulerOrigin as k}from"./withTailConsumer-DaP3r6ia.mjs";import{isCacheEnabled as W,WORKERS_CACHE_MIN_DATE as c}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{mergeWranglerEnvironment as G}from"./mergeWranglerEnvironment-BIcLqPfv.mjs";const v="2026-04-07",K="web_socket_auto_reply_to_close",u=/^\d{4}-\d{2}-\d{2}$/,H=(o,r,l)=>{const{error:e,merged:i,unverifiedKeys:n}=G(o,r);return e!==void 0?{error:e,wrangler:i}:(n.length>0&&l.push(`env.${String(r)} overrides ${n.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${n.length===1?"it":"them"} by hand for "${String(r)}".`),{wrangler:i})},F=(o,r,l)=>{const e=[],i=[];if(!o||typeof o!="object")return e.push("wrangler config is not a valid object"),{errors:e,valid:!1,warnings:i};const{error:n,wrangler:a}=H(o,l,i);if(n!==void 0)return e.push(n),{errors:e,valid:!1,warnings:i};g(a.durable_objects?.bindings).find(t=>t.name==="SHARD"&&t.class_name==="ShardDO")||e.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — your dev server auto-reconciles this on startup, or add the binding manually'),_(a,e);const s=a.compatibility_date??"";s&&!u.test(s)?e.push(`compatibility_date must be in YYYY-MM-DD format (got "${s}")`):s<v&&e.push(`compatibility_date must be >= "${v}" (got "${s||"<missing>"}")`),W(a)&&u.test(s)&&s<c&&e.push(`cache.enabled requires compatibility_date >= "${c}" (got "${s||"<missing>"}")`),b(a,r,e),f(a,e),E(a,r?.vectorIndexNames??[],e),L(a,e),m(a,e,i),d(a.workflows,"workflows",y,e),h(a,e),d(a.secrets_store_secrets,"secrets_store_secrets",B,e);for(const t of D)R(a,t,e,i);for(const t of S)d(a[t.key],t.key,t,e);for(const t of p)I(a,t,e);return O(a,e,i),T(a,e),C(a,e),N(a,e),w(a,e),A(a,e),$(a,e),j(a,e),U(a,e),k(a,l,i),{errors:e,valid:e.length===0,warnings:i}},q=F;export{v as REQUIRED_COMPATIBILITY_DATE,K as REQUIRED_FLAG,q as validateWrangler,F as validateWranglerConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as f,readFileSync as O,readdirSync as W}from"node:fs";import{join as p,dirname as y,extname as w,basename as _}from"node:path";import{discoverSchemaInfo as P}from"./discoverSchemaInfo-DJvevsCm.mjs";import{COMPOSED_WORKER_ENTRY as L,LUNORA_WORKER_VIRTUAL_ID as g,isGeneratedOutput as F,WORKER_ENTRY_FALLBACKS as M,GENERATED_DIRECTORY as U,COMPOSED_ENTRY_DURABLE_OBJECTS as D,GENERATED_CLASS_MODULES as A,SOURCE_DOT_DIRECTORIES as B,NON_SOURCE_DIRECTORIES as G,isFrameworkDurableObject as Y}from"./COMPOSED_WORKER_ENTRY-5R-BECOC.mjs";import{o as K}from"./validate-bindings-D6-vb6if.mjs";import{Project as X,Node as l}from"ts-morph";import{mergeWranglerEnvironment as J}from"./mergeWranglerEnvironment-BIcLqPfv.mjs";import{findWranglerFile as V,readWranglerJsonc as q}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{validateWranglerConfig as z}from"./REQUIRED_COMPATIBILITY_DATE-g_1F-n2X.mjs";const E=[".ts",".tsx",".mts",".cts"],b=new Set(E),H=new Set([".cjs",".js",".mjs"]),v="default",x={".cjs":[".cts"],".js":[".ts",".tsx"],".mjs":[".mts"]},Q=250,Z=(e,s,t)=>{const r=p(s,L);if(f(r))return{origin:"declared",path:r};if(e===g)return{origin:"composed"};const n=()=>{const i=M.map(a=>p(s,a)).find(a=>f(a));return i===void 0?void 0:{origin:"probed",path:i}};if(typeof e!="string"||e.length===0||F(e))return n();const o=p(y(t),e),c=w(o);if(!(!b.has(c)&&!H.has(c)))return f(o)?{origin:"declared",path:o}:{origin:"absent",path:o}},T=(e,s)=>{if(l.isIdentifier(e)){s.add(e.getText());return}if(l.isObjectBindingPattern(e)||l.isArrayBindingPattern(e))for(const t of e.getElements())l.isBindingElement(t)&&T(t.getNameNode(),s)},ee=(e,s)=>{const t=[];for(const r of e.getExportDeclarations())if(!r.isTypeOnly()){if(r.isNamespaceExport()){const n=r.getNamespaceExport();n===void 0?t.push(r.getModuleSpecifierValue()??""):s.add(n.getName());continue}for(const n of r.getNamedExports())n.isTypeOnly()||s.add(n.getAliasNode()?.getText()??n.getName())}return t},te=(e,s)=>{for(const t of e.getVariableStatements().filter(r=>r.getExportKeyword()!==void 0))for(const r of t.getDeclarations())T(r.getNameNode(),s);for(const t of[...e.getClasses(),...e.getFunctions(),...e.getEnums()]){if(t.getExportKeyword()===void 0)continue;const r=t.isDefaultExport()?v:t.getName();r!==void 0&&s.add(r)}e.getExportAssignments().length>0&&s.add(v)},$=(e,s)=>{const t=new X({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}),r=t.createSourceFile(e,s,{overwrite:!0});return t.getProgram().compilerObject.getSyntacticDiagnostics(r.compilerNode).length>0?void 0:r},re=(e,s)=>{if(!s.startsWith("./")&&!s.startsWith("../"))return;const t=p(y(e),s),r=w(t),n=b.has(r)||x[r]!==void 0,o=n?t.slice(0,-r.length):t;return[...b.has(r)?[t]:[],...(x[r]??[]).map(i=>`${o}${i}`),...n?[]:E.map(i=>`${t}${i}`),...n||r.length===0?E.map(i=>p(o,`index${i}`)):[]].find(i=>f(i))},j=e=>{const s=new Set,t=new Set([e]),r=[e];for(;r.length>0;){if(t.size-1>Q)return;const n=r.pop();let o;try{o=O(n,"utf8")}catch{return}const c=$(_(n),o);if(c===void 0)return;const i=ee(c,s);te(c,s);for(const a of i){const d=re(n,a);if(d===void 0)return;t.has(d)||(t.add(d),r.push(d))}}return s},oe=(e,s)=>{const t={exports:void 0,kind:"composed",path:g},r=p(e,s,U);if(!f(r))return t;const n=new Set(D);for(const o of A){const c=p(r,`${o}.ts`);if(!f(c))continue;const i=j(c);if(i===void 0)return t;for(const a of i)n.add(a)}return{exports:n,kind:"composed",path:g}},se=(e,s,t)=>{if(e===void 0||e.origin==="absent")return;if(e.origin==="composed")return oe(s,t);const r=j(e.path);if(!(e.origin==="probed"&&r!==void 0&&!r.has(v)))return{exports:r,kind:"authored",path:e.path}},ne=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ie=2e3,R="defineTable",N="defineApp",ae=e=>{const s=[],t=[];let r;try{r=W(e,{withFileTypes:!0})}catch{return{files:s,subdirectories:t}}for(const n of r)n.isDirectory()?n.name.startsWith(".")&&!B.has(n.name)||G.has(n.name)||t.push(p(e,n.name)):ne.has(w(n.name))&&s.push(p(e,n.name));return{files:s,subdirectories:t}},k=(e,s)=>{const t=new Set;for(const r of e.getImportDeclarations())for(const n of r.getNamedImports())!n.isTypeOnly()&&n.getName()===s&&t.add(n.getAliasNode()?.getText()??n.getName());return t},ce=(e,s)=>{let t=!1;return e.forEachDescendant((r,n)=>{if(!l.isCallExpression(r))return;const o=r.getExpression();l.isIdentifier(o)&&s.has(o.getText())&&(t=!0,n.stop())}),t},de=e=>{let s=e;for(;l.isCallExpression(s)||l.isPropertyAccessExpression(s);)s=s.getExpression();return s},le=(e,s)=>{const t=de(e);return l.isIdentifier(t)&&s.has(t.getText())},C={global:/\.\s*global\s*\(/u,hyperdriveGlobal:/\.\s*hyperdriveGlobal\s*\(/u,vectors:/\.\s*vectors\s*\(/u},pe=e=>Object.hasOwn(C,e),fe=(e,s)=>{const t=new Set,r=new Set([R,...k(e,R)]);return e.forEachDescendant(n=>{if(!l.isCallExpression(n))return;const o=n.getExpression();if(!l.isPropertyAccessExpression(o)||le(o,r))return;const c=o.getName();pe(c)&&s.has(c)&&t.add(c)}),t},he=(e,s)=>{let t;try{t=O(e,"utf8")}catch{return}const r=new Set([...s].filter(o=>C[o].test(t)));if(r.size===0&&!t.includes(N))return;const n=$(_(e),t);return n===void 0?{chained:r,composes:!1}:{chained:fe(n,r),composes:ce(n,k(n,N))}},ue=(e,s)=>{const t=[e],r=new Set;let n=0,o;const c=i=>{if(n+=1,n>ie)return!1;const a=he(i,s);for(const d of a?.chained??[])r.add(d);return a?.composes&&(o??=i),!0};for(;t.length>0;){const i=t.pop(),{files:a,subdirectories:d}=ae(i);t.push(...d);for(const m of a){if(!c(m))return;if(o!==void 0&&r.size===s.size)return{chained:r,site:o}}}return o===void 0?void 0:{chained:r,site:o}},I=e=>Array.isArray(e)?e:[],me=(e,s,t)=>{const r=[];for(const n of I(e)){const o=n?.image;typeof o!="string"||!(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.includes("Dockerfile"))||f(o.startsWith("/")?o:p(s,o))||r.push(`containers image "${o}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`)}return r},ge=(e,s)=>{const t=e?.vectorIndexNames??[],r=[];if(t.length>0&&r.push({message:o=>`schema declares vector index(es) ${t.map(c=>`"${c}"`).join(", ")} but nothing chains .vectors(...) onto defineApp() (composed in: ${o}) — \`ctx.vectors\` is then a throwing stub and buildWorkerOptions rejects EVERY request, /_lunora/health included. Add \`.vectors((env) => ({ ${String(t[0])}: env.<BINDING> }))\` to the chain.`,method:"vectors"}),e?.hasD1GlobalTable&&r.push({message:o=>`schema declares .global() table(s) but nothing chains .global(...) onto defineApp() (composed in: ${o}) — the shard then has no global writer, so every read or write of a global table throws INTERNAL ("requires a globalDb writer"). Add \`.global({ d1: (env) => env.DB })\` to the chain.`,method:"global"}),e?.hasHyperdriveGlobalTable&&r.push({message:o=>`schema declares .global({ backend: "hyperdrive" }) table(s) but nothing chains .hyperdriveGlobal(...) onto defineApp() (composed in: ${o}) — the shard then has no global writer, so every read or write of those tables throws INTERNAL. Add \`.hyperdriveGlobal({ engine: "postgres", exec: (env) => buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString))) })\` to the chain (\`buildPgExec\` from \`@lunora/hyperdrive/global\`, \`fromPostgresJs\` from \`@lunora/hyperdrive\`).`,method:"hyperdriveGlobal"}),r.length===0)return[];const n=ue(s,new Set(r.map(o=>o.method)));return n===void 0?[]:r.filter(o=>!n.chained.has(o.method)).map(o=>o.message(n.site))},Ee="does not export it",be=(e,s)=>{if(s!=="composed")return`Re-export it from the module that defines it (\`export { ${e} } from "./…";\`), or add it to the app builder's own export (\`export const { ${e} } = app;\`).`;const t=`it exports ${D.join(", ")}, SchedulerDO when its binding is declared, and every class codegen emits from your ${A.map(r=>`${r}.ts`).join(" / ")} declarations`;return Y(e)?`\`@lunora/vite\` generates that entry — ${t}, and ${e} is not among them. Class-A composition does not carry ${e}, so drop the binding; a project that needs it has to own its worker entry (add \`src/worker.ts\`, which \`lunora deploy\` bundles in place of \`main\`, and compose \`defineApp()\` there).`:`\`@lunora/vite\` generates that entry, so there is no file to add a re-export to: ${t}. Declare "${e}" in one of those and re-run \`lunora codegen\`, or drop the binding.`},ve=(e,s)=>{const t=s.exports;if(t===void 0)return[];const r=[];for(const o of K(e.durable_objects?.bindings))typeof o.class_name=="string"&&o.class_name.length>0&&o.script_name===void 0&&r.push({className:o.class_name,label:"durable_objects.bindings"});for(const o of I(e.workflows))typeof o?.class_name=="string"&&o.class_name.length>0&&o.script_name===void 0&&r.push({className:o.class_name,label:"workflows"});return r.filter(o=>!t.has(o.className)).map(o=>`${o.label} declares class "${o.className}" but the ${s.kind==="composed"?"composed class-A worker entry":"worker entry"} (${s.path}) ${Ee} — wrangler refuses to bundle a Worker whose ${o.label==="workflows"?"Workflow":"Durable Object"} classes are not exported. ${be(o.className,s.kind)}`)},ye=e=>e?.origin!=="absent"?[]:[`main is set but no readable file is there (looked in ${e.path}) — wrangler cannot resolve the worker entry, so a deploy will fail there. Point main at the entry that composes your app, or remove it to fall back to the conventional locations.`],Te=e=>{const s=e.schemaDir??"lunora",t=V(e.projectRoot);if(!t){const h=`wrangler.jsonc not found in ${e.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[h],report:{errors:[h],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:r}=q(t);if(r===void 0){const h=`failed to parse ${t} as JSONC.`;return{problems:[h],report:{errors:[h],valid:!1,warnings:[]},wranglerPath:t}}const{error:n,merged:o}=J(r,e.environment);if(n!==void 0)return{problems:[n],report:{errors:[n],valid:!1,warnings:[]},wranglerPath:t};const{error:c,info:i}=P(e.projectRoot,s),a=z(r,i,e.environment);c!==void 0&&a.warnings.push(`schema parse failed in ${s}/schema.ts: ${c}`);const d=y(t),m=Z(o.main,e.projectRoot,t),S=se(m,e.projectRoot,s);a.errors.push(...me(o.containers??[],d,t)),a.warnings.push(...ye(m)),S!==void 0&&a.errors.push(...ve(o,S)),a.errors.push(...ge(i,e.projectRoot));const u=o.assets?.directory;if(typeof u=="string"&&u.length>0){const h=u.startsWith("/")?u:p(d,u);f(h)||a.warnings.push(`assets.directory "${u}" does not exist yet — it is created by the client build; run the build before deploy`)}return a.valid=a.errors.length===0,{problems:a.errors,report:a,wranglerPath:t}};export{Ee as UNEXPORTED_CLASS_MARKER,Te as validateWranglerProject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawnSync as o}from"node:child_process";import{LunoraError as s}from"@lunora/errors";import{findPackageManagerSync as i,identifyInitiatingPackageManager as c}from"@visulima/package/package-manager";const a=["pnpm","bun","yarn","npm"],u=new Set(a),d=r=>u.has(r),l=r=>{try{return o(r,["--version"],{shell:process.platform==="win32",stdio:"ignore",timeout:5e3}).status===0}catch{return!1}},m=(r=l)=>a.filter(n=>r(n)),y=r=>({args:["install"],command:r}),E=(r,n,t={})=>{const e=t.dev===!0;return r==="npm"?{args:["install",...e?["--save-dev"]:[],...n],command:"npm"}:r==="bun"?{args:["add",...e?["-d"]:[],...n],command:"bun"}:{args:["add",...e?["-D"]:[],...n],command:r}},M=r=>{try{return i(r).packageManager}catch{}const n=c();if(n!==void 0){const e=n.name==="cnpm"?"npm":n.name;if(d(e))return e}const[t]=m();if(t!==void 0)return t;throw new s("INTERNAL","Could not detect a package manager: no lock file or `packageManager` field was found, and none (pnpm, bun, yarn, npm) is installed on PATH.")},g=(r,n,t)=>r==="yarn"?{args:[n,...t],command:"yarn"}:r==="bun"?{args:["x",n,...t],command:"bun"}:r==="npm"?{args:["--",n,...t],command:"npx"}:{args:["exec",n,...t],command:"pnpm"},b=(r,n)=>n.onPath===!0?{args:[...n.args],command:n.tool}:g(r,n.tool,n.args),P=(r,n)=>({args:["run",n],command:r}),h=(r,n)=>r==="npm"?`npm run ${n}`:r==="bun"?`bun run ${n}`:`${r} ${n}`;export{E as addArgsFor,m as detectInstalledManagers,M as detectPackageManager,g as execArgsFor,y as installArgsFor,P as runScriptArgsFor,h as runScriptCommand,b as toolchainExecArgs};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-CiQM3BkI.mjs";import{validateWranglerProject as l}from"./
|
|
1
|
+
import{LunoraError as n}from"@lunora/errors";import{lunoraLine as i}from"./LUNORA_TAG-CiQM3BkI.mjs";import{validateWranglerProject as l}from"./UNEXPORTED_CLASS_MARKER-Bc302QS4.mjs";const m=(e,a,t)=>{const r=l({projectRoot:e.projectRoot,schemaDir:e.schemaDir});if(!r.wranglerPath)throw new n("INTERNAL",["[lunora] wrangler.jsonc not found.",` searched in: ${e.projectRoot}`," create a wrangler.jsonc declaring at least the SHARD durable object binding."].join(`
|
|
2
2
|
`));for(const o of r.report.warnings)a(i(`wrangler validator: ${o}`));if(r.problems.length>0)throw new n("INTERNAL",["[lunora] wrangler configuration is missing bindings required by your schema.",` file: ${r.wranglerPath}`,"",...r.problems.map(o=>` - ${o}`),"",` ${t}`].join(`
|
|
3
3
|
`))};export{m as assertWranglerSatisfiesSchema};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{readFileSync as R,writeFileSync as T}from"node:fs";import{containerBuildTag as M}from"@lunora/container";import{a as _}from"./jsonc-edit-BZgQIdAH.mjs";import{a as W,r as L}from"./lunora-manifest-V77OcyFC.mjs";import{parseTree as Q,findNodeAtLocation as K}from"jsonc-parser";import{join as U}from"node:path";import{DEV_VARS_FILE as Y,parseDevVariableEntries as F}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{o as q,s as k}from"./validate-bindings-D6-vb6if.mjs";import{findWranglerFile as G,readWranglerJsonc as H}from"./WRANGLER_FILES-UNW-xY5u.mjs";const J=[["maxBatchSize","max_batch_size"],["maxBatchTimeout","max_batch_timeout"],["maxRetries","max_retries"],["deadLetterQueue","dead_letter_queue"],["retryDelay","retry_delay"]],D=e=>Object.fromEntries(J.filter(([n])=>e.tuning[n]!==void 0).map(([n,s])=>[s,e.tuning[n]])),A="queueTuning",V=/^[\t ]*(?:,[\t ]*)?(?:\/\/[^\n\r]*)?\r?\n/u,z=/^[\t ]*,/u,X=(e,n)=>{const s=Q(e),t=s===void 0?void 0:K(s,[...n])?.parent;if(t?.type==="property"){const a=t.offset+t.length,o=e.lastIndexOf(`
|
|
2
|
+
`,t.offset-1)+1,c=V.exec(e.slice(a));if(c!==null&&e.slice(o,t.offset).trim()===""){const d=t.parent?.children??[],p=d.indexOf(t),r=p===d.length-1&&p>0?d[p-1]:void 0,l=r===void 0?void 0:z.exec(e.slice(r.offset+r.length))??void 0;return(l===void 0||r===void 0?e.slice(0,o):e.slice(0,r.offset+r.length)+e.slice(r.offset+r.length+l[0].length,o))+e.slice(a+c[0].length)}}return _(e,n,void 0)},I=(e,n,s,t,a,o=new Set)=>{const c=s.join("."),d={},p=[],r=[];let l=e;return{entries:n.map((u,f)=>{const g=t(u);if(g===void 0||u.queue===void 0)return u;const v=Object.fromEntries(Object.entries(D(g)).filter(([m])=>!o.has(m))),w=Object.entries(a[u.queue]??{}).filter(([m])=>!Object.hasOwn(v,m)),x=Object.entries(v).filter(([m,i])=>u[m]!==i),y=w.filter(([m,i])=>u[m]===i).map(([m])=>m),E=Object.fromEntries(Object.entries({...u,...v}).filter(([m])=>!y.includes(m)));for(const[m,i]of x)l=_(l,[...s,f,m],i);for(const m of y)l=X(l,[...s,f,m]);for(const[m,i]of w){const h=u[m];h!==void 0&&h!==i&&r.push(`${c}/${u.queue}: ${m} is no longer declared by defineQueue, but it was changed by hand to ${JSON.stringify(h)} from the declared ${JSON.stringify(i)}, so it was kept. Delete it from wrangler.jsonc if it should go.`)}return(x.length>0||y.length>0)&&p.push(`${c}/${u.queue} (${[...x.map(([m])=>m),...y.map(m=>`removed ${m}`)].join(", ")})`),Object.keys(v).length>0&&(d[u.queue]=v),E}),owned:d,text:l,updated:p,warnings:r}},Z=(e,n,s,t)=>{const a=n.queues??{},o=a.producers??[],c=a.consumers??[],d=new Set(o.map(g=>g.binding)),p=new Set(c.map(g=>g.queue)),r=s.filter(g=>!d.has(g.bindingName)),l=s.filter(g=>!p.has(g.name)),b=I(e,c,["queues","consumers"],g=>s.find(v=>v.name===g.queue),t);let u=b.text;const f={...b.owned};if(r.length>0||l.length>0){const g=[...o,...r.map(w=>({binding:w.bindingName,queue:w.name}))],v=[...b.entries,...l.map(w=>({queue:w.name,...w.mode==="pull"?{type:"http_pull"}:{},...D(w)}))];for(const w of l){const x=D(w);Object.keys(x).length>0&&(f[w.name]=x)}u=_(u,["queues"],{consumers:v,producers:g})}return{added:[...r.map(g=>`queues.producers/${g.bindingName}`),...l.map(g=>`queues.consumers/${g.name}`)],owned:f,text:u,updated:b.updated,warnings:b.warnings}},ee=(e,n,s,t,a)=>{const o=n.env?.[t],c=o?.queues?.consumers??[],d=o?.queues?.producers??[],p=u=>{const f=d.find(g=>g.queue===u.queue)?.binding;return f!==void 0?s.find(g=>g.bindingName===f):s.find(g=>g.name===u.queue&&!d.some(v=>v.binding===g.bindingName))},r=I(e,c,["env",t,"queues","consumers"],p,a,new Set(["dead_letter_queue"])),l=c.filter(u=>u.queue!==void 0&&p(u)===void 0).map(u=>`env.${t}.queues.consumers/${String(u.queue)}: no defineQueue export matches it — this block declares no producer mapping one of their bindings to "${String(u.queue)}", and no export is named that — so it was not retuned. A consumer for a queue another worker produces is skipped the same way.`),b=c.flatMap(u=>{const f=p(u)?.tuning.deadLetterQueue;return f===void 0||u.dead_letter_queue!==void 0?[]:[`env.${t}.queues.consumers/${String(u.queue)}: defineQueue declares deadLetterQueue "${f}", but this consumer has no dead_letter_queue, so its exhausted messages are dropped. Queue names differ per environment, so reconcile does not write it here; add it by hand.`]});return{added:[],owned:r.owned,text:r.text,updated:r.updated,warnings:[...r.warnings,...b,...l]}},ne=(e,n)=>{if(e?.lunoraIsForeign===!0)return n.push(`${e.path}: \`lunora\` is not an object, so the queue tuning ownership record cannot be read or written — an option removed from defineQueue stays deployed.`),{};const s=e?.lunora?.[A],t=a=>typeof a=="object"&&a!==null&&!Array.isArray(a);return s===void 0?{}:!t(s)||!Object.values(s).every(a=>t(a)&&Object.values(a).every(o=>t(o)))?(n.push(`${e?.path??"package.json"}: \`lunora.${A}\` is not a map of scope → queue → fields, so it is ignored — an option removed from defineQueue stays deployed until the next pass records it again.`),{}):s},se=(e,n,s)=>{const t=Object.fromEntries(Object.entries({...n,...s}).filter(([,a])=>Object.keys(a).length>0));W(e,A,Object.keys(t).length===0?void 0:t)},S="PIPELINES",te=(e,n)=>{const s=e.flagshipBinding!==void 0&&!(n?.flagship??[]).some(o=>o.binding===e.flagshipBinding),t=e.usesPipelines&&!(n?.pipelines??[]).some(o=>o.binding===S);return[[e.usesKv&&(n?.kv_namespaces?.length??0)===0,"@lunora/bindings/kv is used but no kv_namespaces binding exists; add a kv_namespaces entry ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned."],[e.usesHyperdrive&&(n?.hyperdrive?.length??0)===0,"@lunora/hyperdrive is used but no hyperdrive binding exists; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned."],[t,`ctx.pipelines is used but no "${S}" pipelines binding exists; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding: "${S}", pipeline }) — codegen resolves this one name, and the pipeline resource can't be auto-provisioned.`],[s,`lunora/flags.ts uses Flagship in binding mode but no flagship binding "${e.flagshipBinding??""}" exists; add a flagship entry ({ binding: "${e.flagshipBinding??""}", app_id }) — the app_id can't be auto-provisioned.`]].filter(([o])=>o).map(([,o])=>o)},oe=e=>[[e.usesX402Charge,"@lunora/x402/charge is used; set the recipient wallet address as a [vars] entry (the var name is your choice) and pass it to the charge config — the x402 facilitator settles USDC to that address."],[e.usesX402Pay,"@lunora/x402/pay is used (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding holding the agent wallet key (binding name == signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars."]].filter(([s])=>s).map(([,s])=>s),O=(e,n,s)=>s.filter(t=>!t.exported).map(t=>`${e} "${t.exportName}" is declared but ${t.className} is not exported by the worker entry; add \`export * from "./lunora/_generated/${n}"\` so its binding can be provisioned.`),ae=(e,n)=>{const s=new Set([...e.workflows,...e.agents].map(t=>t.className));return s.size===0?[]:(n.workflows??[]).flatMap(t=>{const a=t.class_name;return a===void 0||s.has(a)?[]:[`wrangler.jsonc declares workflows[] entry "${a}" but no defineWorkflow/defineAgent export generates that class — a leftover from a rename will fail the deploy (wrangler rejects a class_name the worker does not export). Remove it if it is not hand-wired.`]})},ie=(e,n)=>{if(e.queues.length===0)return[];const s=new Set(e.queues.map(a=>a.name)),t=new Set(e.queues.map(a=>a.bindingName));return[...(n.queues?.consumers??[]).flatMap(a=>{const{queue:o}=a;return o===void 0||s.has(o)?[]:[`wrangler.jsonc subscribes queues.consumers[] to "${o}" but no defineQueue export declares that queue — a leftover from a rename keeps delivering batches this worker has no handler for (they retry to exhaustion, then drop or dead-letter). Remove it if it is not hand-wired.`]}),...(n.queues?.producers??[]).flatMap(a=>{const{binding:o}=a;return o===void 0||t.has(o)?[]:[`wrangler.jsonc declares queues.producers[] binding "${o}" but no defineQueue export declares it — a leftover from a rename. Remove it if it is not hand-wired.`]})]},re=(e,n)=>[...ae(e,n),...ie(e,n)],j=[{keys:["STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"],label:"Stripe"},{keys:["POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"],label:"Polar"},{keys:["CREEM_API_KEY","CREEM_WEBHOOK_SECRET"],label:"Creem"},{keys:["AUTUMN_SECRET_KEY","AUTUMN_WEBHOOK_SECRET"],label:"Autumn"},{keys:["DODO_PAYMENTS_API_KEY","DODO_PAYMENTS_WEBHOOK_KEY"],label:"Dodo Payments"}],de=()=>j.map(({keys:e,label:n})=>`${e[0]} + ${e[1]} (${n})`).join(" or "),ce=e=>{let n;try{n=R(U(e,Y),"utf8")}catch{return!1}const s=new Map(F(n).map(t=>[t.key,t.value]));return j.some(({keys:t})=>t.every(a=>(s.get(a)??"")!==""))},N=(e,n,s)=>{const t=new Set(e.durableObjects.map(d=>d.className)),a=[],o=(s?.r2_buckets?.length??0)>0,c=(s?.d1_databases?.some(d=>d.binding==="DB")??!1)||e.needsD1;return e.usesStorage&&!o&&a.push("@lunora/storage is used but R2 bucket bindings have user-defined names; add an r2_buckets entry and pass env.<BINDING> to createStorage()."),e.usesAuth&&!t.has("SessionDO")&&!c&&a.push("@lunora/auth is used but the worker entry exports no SessionDO; sessions are D1-backed, or export SessionDO to enable DO-backed sessions."),e.usesScheduler&&!t.has("SchedulerDO")&&a.push("@lunora/scheduler is used but the worker entry exports no SchedulerDO; export it so the SCHEDULER binding can be provisioned."),a.push(...O("container","containers",e.containers),...O("workflow","workflows",e.workflows),...O("agent","agents",e.agents)),e.containers.length>0&&s?.observability?.enabled===!1&&a.push("containers are declared but observability is explicitly disabled in wrangler.jsonc — container logs will not be captured."),e.usesPayment&&!ce(n)&&a.push(`@lunora/payment is used; set one provider's secret pair in .dev.vars — ${de()}.`),a.push(...oe(e),...te(e,s)),s!==void 0&&a.push(...re(e,s)),a},P="<replace-with-d1-create-id>",ue=e=>[["container","containers",e.containers],["workflow","workflows",e.workflows],["agent","agents",e.agents]].flatMap(([s,t,a])=>a.filter(o=>!o.exported).map(({className:o,exportName:c})=>({className:o,exportName:c,kind:s,module:t}))),le=e=>{const n=new Set(q(e).map(t=>t.tag));let s=1;for(;n.has(`v${String(s)}`);)s+=1;return`v${String(s)}`},ge=e=>{const n=new Set;for(const s of q(e)){for(const t of k(s.deleted_classes))n.delete(t);for(const{from:t,to:a}of q(s.renamed_classes))t!==void 0&&n.delete(t),a!==void 0&&n.add(a);for(const t of[...k(s.new_classes),...k(s.new_sqlite_classes)])n.add(t)}return n},me=(e,n,s)=>{const t=n.durable_objects?.bindings??[],a=new Set(t.map(l=>l.name)),o=s.filter(l=>!a.has(l.binding));let c=e;const d=[];if(o.length>0){const l=[...t,...o.map(b=>({class_name:b.className,name:b.binding}))];c=_(c,["durable_objects","bindings"],l),d.push(...o.map(b=>`${b.binding}/${b.className}`))}const p=n.migrations??[],r=s.map(l=>l.className).filter(l=>!ge(p).has(l));if(r.length>0){const l=[...p,{new_sqlite_classes:r,tag:le(p)}];c=_(c,["migrations"],l)}return{added:d,text:c}},pe=(e,n)=>{const s=n.d1_databases??[];if(s.some(o=>o.binding==="DB"))return{added:[],text:e};const t=typeof n.name=="string"&&n.name.length>0?n.name:"lunora",a=[...s,{binding:"DB",database_id:P,database_name:t}];return{added:["DB (D1)"],text:_(e,["d1_databases"],a)}},$=(e,n,s,t,a)=>{const o=n[s]?.binding;return typeof o=="string"&&o.length>0?{added:[],text:e}:{added:[a],text:_(e,[s],{binding:t})}},be=(e,n)=>(n.analytics_engine_datasets?.length??0)>0?{added:[],text:e}:{added:["ANALYTICS (Analytics Engine)"],text:_(e,["analytics_engine_datasets"],[{binding:"ANALYTICS",dataset:"ANALYTICS"}])},he=(e,n)=>{const s=n.worker_loaders??[];return s.some(t=>t.binding==="LOADER")?{added:[],text:e}:{added:["LOADER (Worker Loader)"],text:_(e,["worker_loaders"],[...s,{binding:"LOADER"}])}},fe=e=>{if(typeof e=="string")return e;const n={};return e.diskMb!==void 0&&(n.disk_mb=e.diskMb),e.memoryMib!==void 0&&(n.memory_mib=e.memoryMib),e.vcpu!==void 0&&(n.vcpu=e.vcpu),n},ve=e=>e.image.kind==="dockerfile"?e.image.dockerfilePath:e.image.kind==="registry"?e.image.reference:M(e.exportName),we=e=>{const n={class_name:e.className,image:ve(e)};return e.image.kind==="dockerfile"&&(n.image_build_context=e.image.buildContext),e.buildArgs!==void 0&&e.image.kind!=="registry"&&(n.image_vars=e.buildArgs),e.instanceType!==void 0&&(n.instance_type=fe(e.instanceType)),e.maxInstances!==void 0&&(n.max_instances=e.maxInstances),e.name!==void 0&&(n.name=e.name),e.rollout?.stepPercentage!==void 0&&(n.rollout_step_percentage=e.rollout.stepPercentage),e.rollout?.gracePeriodSeconds!==void 0&&(n.rollout_active_grace_period=e.rollout.gracePeriodSeconds),n},_e=(e,n,s)=>{const t=n.containers??[],a=new Set(t.map(d=>d.class_name)),o=s.filter(d=>!a.has(d.className));if(o.length===0)return{added:[],text:e};const c=_(e,["containers"],[...t,...o.map(d=>we(d))]);return{added:o.map(d=>`containers/${d.className}`),text:c}},xe=(e,n)=>{if(n.observability!==void 0)return{added:[],text:e};const s=_(e,["observability"],{enabled:!0,head_sampling_rate:1});return{added:["observability"],text:s}},B=e=>({binding:e.bindingName,class_name:e.className,name:e.name}),ye=(e,n,s,t=[])=>{const a=n.workflows??[],o=new Set(a.map(r=>r.class_name)),c=s.filter(r=>!o.has(r.className)),d=t.filter(r=>!o.has(r.className));if(c.length===0&&d.length===0)return{added:[],text:e};const p=_(e,["workflows"],[...a,...c.map(r=>B(r)),...d.map(r=>B(r))]);return{added:[...c.map(r=>`workflows/${r.className}`),...d.map(r=>`workflows/${r.className}`)],text:p}},Ce=(e,n,s)=>{const t=G(e),a=ue(n);if(!t)return{added:[],changed:!1,exportGaps:a,reason:"wrangler.jsonc not found",updated:[],warnings:N(n,e)};const{parsed:o,text:c}=H(t);if(o===void 0)return{added:[],changed:!1,exportGaps:a,reason:`failed to parse ${t} as JSONC`,updated:[],warnings:N(n,e),wranglerPath:t};const d=N(n,e,o);if(s!==void 0){const i=o.env?.[s]!==void 0;d.push(i?`auto-provisioned bindings are written to the top level of wrangler.jsonc only (queue consumers "env.${s}" already declares are retuned, nothing is added) — "env.${s}" has its own (non-inheritable) bindings and must be reconciled by hand; \`lunora deploy --env ${s}\` now validates them, so a gap here will be reported at deploy time.`:`--env "${s}" was requested but wrangler.jsonc declares no "env.${s}" block — auto-provisioned bindings are written to the top level only and will not apply to that environment.`)}const p=n.containers.filter(i=>i.exported),r=n.agents.filter(i=>i.exported&&i.voice===!0&&i.voiceBindingName!==void 0&&i.voiceClassName!==void 0),l=[...n.durableObjects,...p.map(i=>({binding:i.bindingName,className:i.className})),...r.map(i=>({binding:i.voiceBindingName,className:i.voiceClassName}))],b=n.workflows.filter(i=>i.exported),u=n.agents.filter(i=>i.exported),f=L(e),g=ne(f,d),v={},w=[{enabled:!0,run:i=>me(i,o,l)},{enabled:n.needsD1,run:i=>pe(i,o)},{enabled:n.usesAi,run:i=>$(i,o,"ai","AI","AI (Workers AI)")},{enabled:n.usesBrowser,run:i=>$(i,o,"browser","BROWSER","BROWSER (Browser Rendering)")},{enabled:n.usesImages,run:i=>$(i,o,"images","IMAGES","IMAGES (Cloudflare Images)")},{enabled:n.usesAnalytics,run:i=>be(i,o)},{enabled:n.usesWorkerLoader,run:i=>he(i,o)},{enabled:!0,run:i=>xe(i,o)},{enabled:p.length>0,run:i=>_e(i,o,p)},{enabled:b.length>0||u.length>0,run:i=>ye(i,o,b,u)},{enabled:n.queues.length>0,run:i=>{const h=Z(i,o,n.queues,g.queues??{});return v.queues=h.owned,h}},...s===void 0||o.env?.[s]===void 0?[]:[{enabled:n.queues.length>0,run:i=>{const h=`env.${s}.queues`,C=ee(i,o,n.queues,s,g[h]??{});return v[h]=C.owned,C}}]];let x=c;const y=[],E=[];for(const i of w){if(!i.enabled)continue;const h=i.run(x);x=h.text,y.push(...h.added),E.push(...h.updated??[]),d.push(...h.warnings??[])}const m=i=>{if(!(f===void 0||Object.keys(v).length===0))try{se(f,g,v)}catch(h){d.push(`${i?"wrangler.jsonc was updated, but ":""}recording the queue tuning reconcile owns in ${f.path} (lunora.queueTuning) failed: ${h instanceof Error?h.message:String(h)}. Until it is recorded, an option removed from defineQueue stays deployed.`)}};return y.includes("DB (D1)")&&d.push(`wrote a DB binding with a placeholder database_id ("${P}") — run \`wrangler d1 create <name>\` and replace it before deploying.`),x===c?(m(!1),{added:[],changed:!1,exportGaps:a,reason:"bindings already in sync",updated:[],warnings:d,wranglerPath:t}):(T(t,x,"utf8"),m(!0),{added:y,changed:!0,exportGaps:a,updated:E,warnings:d,wranglerPath:t})};export{ue as collectExportGaps,Ce as reconcileWranglerBindings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as y,statSync as T,readFileSync as O,readdirSync as $}from"node:fs";import{parse as D,init as F}from"es-module-lexer";import{discoverAgentInfo as Y}from"./discoverAgentInfo-CTdCSfYM.mjs";import{discoverContainerInfo as U}from"./discoverContainerInfo-EhZtEBQs.mjs";import{discoverFlags as W,FLAGS_FILENAME as K,discoverQueues as M,QUEUES_FILENAME as X}from"@lunora/codegen";import{d as C}from"./discover-info-Vj9d4qYt.mjs";import{escapeRegExp as q}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{discoverSchemaInfo as G}from"./discoverSchemaInfo-DJvevsCm.mjs";import{resolveWorkerEntry as H,COMPOSED_ENTRY_DURABLE_OBJECTS as Q,GENERATED_DIRECTORY as w,DURABLE_OBJECT_BINDINGS as V,detectExportedDurableObjects as J,detectClassExports as h}from"./COMPOSED_WORKER_ENTRY-5R-BECOC.mjs";import{discoverWorkflowInfo as z}from"./discoverWorkflowInfo-BsPvlo6O.mjs";import{join as u}from"node:path";const Z=(e,s)=>{const{error:o,value:r}=C(e,s,K,W);return o===void 0?{flags:r}:{error:o}},k=/^\s*import\s+type\b/,ee=new Set(["@lunora/agent","@lunora/agent/sandbox"]),m=["browserTool","jsCodeTool"],E=Object.fromEntries(m.map(e=>{const s=q(e);return[e,{fallback:new RegExp(String.raw`import\s+\{[^}]*\b${s}\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']`,"u"),name:new RegExp(String.raw`\b${s}\b`,"u"),typeSpecifier:new RegExp(String.raw`\btype\s+${s}\b`,"u")}]})),se=e=>{const s=e.indexOf("{");if(s===-1)return"";const o=e.indexOf("}",s+1);return o===-1?e.slice(s+1):e.slice(s+1,o)},re=(e,s)=>{if(k.test(e))return!1;const o=se(e);return E[s].name.test(o)&&!E[s].typeSpecifier.test(o)},oe=e=>{let s;try{const[o]=D(e);s=o.filter(r=>r.n!==void 0&&ee.has(r.n)).map(r=>e.slice(r.ss,r.se))}catch{s=void 0}return Object.fromEntries(m.map(o=>[o,s===void 0?E[o].fallback.test(e):s.some(r=>re(r,o))]))},te=(e,s)=>{const{error:o,value:r}=C(e,s,X,M);return o===void 0?{queues:r??[]}:{error:o,queues:[]}},ne=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),ae=new Set([".git",".lunora-cache",".wrangler","dist",w,"node_modules"]),ie=["lunora","src"],ce=/\benv\s*\.\s*DB\b/,de=/\benv\s*\.\s*AI\b/,L=/\bctx\s*\.\s*pipelines\b/,P=/\bctx\s*\.\s*r2sql\b/,f={usesAi:{pattern:/\bfrom\s+["']@lunora\/ai["']/,source:"@lunora/ai"},usesAnalytics:{pattern:/\bfrom\s+["']@lunora\/bindings\/analytics["']/,source:"@lunora/bindings/analytics"},usesAuth:{pattern:/\bfrom\s+["']@lunora\/auth["']/,source:"@lunora/auth"},usesBrowser:{pattern:/\bfrom\s+["']@lunora\/browser["']/,source:"@lunora/browser"},usesHyperdrive:{pattern:/\bfrom\s+["']@lunora\/hyperdrive["']/,source:"@lunora/hyperdrive"},usesImages:{pattern:/\bfrom\s+["']@lunora\/bindings\/images["']/,source:"@lunora/bindings/images"},usesKv:{pattern:/\bfrom\s+["']@lunora\/bindings\/kv["']/,source:"@lunora/bindings/kv"},usesMail:{pattern:/\bfrom\s+["']@lunora\/mail["']/,source:"@lunora/mail"},usesNotify:{pattern:/\bfrom\s+["']@lunora\/notify["']/,source:"@lunora/notify"},usesPayment:{pattern:/\bfrom\s+["']@lunora\/payment["']/,source:"@lunora/payment"},usesPipelines:{pattern:L,source:"@lunora/bindings/pipelines"},usesR2sql:{pattern:P,source:"@lunora/bindings/r2sql"},usesScheduler:{pattern:/\bfrom\s+["']@lunora\/scheduler["']/,source:"@lunora/scheduler"},usesStorage:{pattern:/\bfrom\s+["']@lunora\/storage["']/,source:"@lunora/storage"},usesX402Charge:{pattern:/\bfrom\s+["']@lunora\/x402\/charge["']/,source:"@lunora/x402/charge"},usesX402Pay:{pattern:/\bfrom\s+["']@lunora\/x402\/pay["']/,source:"@lunora/x402/pay"}},l=Object.keys(f),ue="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",B=[...l,"needsD1","usesWorkerLoader"],le=()=>{const e={};for(const s of B)e[s]=!1;return e},d=Object.freeze(le()),S=(e,s)=>{const o={};for(const r of B)o[r]=e[r]||s[r];return o},pe=e=>{for(const s of l)if(f[s].source===e)return{...d,[s]:!0};return d},me=e=>{const[s]=D(e);let o=d;for(const r of s){const t=r.n;!t||k.test(e.slice(r.ss,r.se))||(o=S(o,pe(t)))}return o},fe=e=>{const s={...d};for(const o of l)s[o]=f[o].pattern.test(e);return s},be=e=>{let s;try{s=me(e)}catch{s=fe(e)}return S(s,{...d,needsD1:ce.test(e),usesAi:de.test(e),usesPipelines:L.test(e),usesR2sql:P.test(e)})},_=(e,s)=>{let o;try{o=$(e,{withFileTypes:!0})}catch{return}for(const r of o){if(r.isDirectory()){ae.has(r.name)||_(u(e,r.name),s);continue}const t=r.name.lastIndexOf(".");t!==-1&&ne.has(r.name.slice(t))&&s.push(u(e,r.name))}},ge=(e,s)=>G(e,s).info?.hasD1GlobalTable??!1,he=(e,s)=>{let o=d;for(const r of s){const t=u(e,r);if(!y(t)||!T(t).isDirectory())continue;const n=[];_(t,n);for(const a of n)o=S(o,be(O(a,"utf8")))}return o},Ee=(e,s)=>{const o=u(e,s),r=Object.fromEntries(m.map(n=>[n,!1]));if(!y(o)||!T(o).isDirectory())return r;const t=[];_(o,t);for(const n of t){const a=oe(O(n,"utf8"));for(const i of m)r[i]||=a[i]}return r},ye=(e,s,o)=>[...e.map(r=>r.exported?`${r.bindingName}/${r.className} (container "${r.exportName}" declared and exported)`:`hint: container "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/containers"\``),...s.map(r=>r.exported?`${r.bindingName}/${r.className} (workflow "${r.exportName}" declared and exported)`:`hint: workflow "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/workflows"\``),...o.map(r=>r.exported?`${r.bindingName}/${r.className} (agent "${r.exportName}" declared and exported)`:`hint: agent "${r.exportName}" is declared but ${r.className} is not exported by the worker entry — add \`export * from "./lunora/_generated/agents"\``)],Se=(e,s)=>[[e.usesAi,"AI (@lunora/ai imported or env.AI used)"],[e.usesAuth&&!s.has("SessionDO"),"hint: @lunora/auth is imported; its tables are D1-backed by default. For DO-backed auth (what @better-auth/scim needs), pass `namespace` to .auth() and export the generated auth DO class"],[e.usesScheduler&&!s.has("SchedulerDO"),"hint: @lunora/scheduler is imported but no SchedulerDO is exported by the worker entry"],[e.usesStorage,"hint: @lunora/storage is imported; add an r2_buckets binding (bucket binding names are user-defined)"],[e.usesMail,"hint: @lunora/mail is imported; set RESEND_API_KEY in .dev.vars (obtain at https://resend.com/api-keys)"],[e.usesPayment,`hint: @lunora/payment is imported; set the provider secrets in .dev.vars — ${ue}`],[e.usesBrowser,"browser (@lunora/browser imported) — self-describing { binding: BROWSER }"],[e.usesImages,"images (@lunora/bindings/images imported) — self-describing { binding: IMAGES }"],[e.usesAnalytics,"analytics_engine_datasets (@lunora/bindings/analytics imported) — self-describing { binding: ANALYTICS, dataset }"],[e.usesWorkerLoader,"worker_loaders (jsCodeTool imported in lunora/) — self-describing { binding: LOADER }"],[e.usesKv,"hint: @lunora/bindings/kv is imported; add a kv_namespaces binding ({ binding, id }) and pass env.<BINDING> to createKv() — the namespace id can't be auto-provisioned"],[e.usesHyperdrive,"hint: @lunora/hyperdrive is imported; run 'wrangler hyperdrive create' and add a 'hyperdrive' binding ({ binding, id }) — the id can't be auto-provisioned"],[e.usesPipelines,"hint: ctx.pipelines is used; run 'wrangler pipelines create <name>' and add a 'pipelines' binding ({ binding, pipeline }) — the pipeline resource can't be auto-provisioned"],[e.usesX402Charge,"hint: @lunora/x402/charge is imported; set the recipient wallet address as a [vars] entry (the var name is yours to choose) and pass it to the charge config — the x402 facilitator settles USDC to that address"],[e.usesX402Pay,"hint: @lunora/x402/pay is imported (ActionCtx-only, spends real funds); add a secrets_store_secrets[] binding for the agent wallet key (name it to match signer.secretName) and pair the pay rail with a spend policy — ctx.secrets reads a Secrets Store binding, not .dev.vars, so the key can't be auto-provisioned"]].filter(([r])=>r).map(([,r])=>r),_e=(e,s,o,r=[],t=[],n=[])=>{const a=new Set(e.map(c=>c.className)),i=e.map(c=>`${c.binding}/${c.className} (exported by worker entry)`);return s&&i.push("DB (.global() table declared)"),i.push(...ye(r,t,n),...Se(o,a)),i},ke=async e=>{await F;const s=e.schemaDir??"lunora",o=e.scanDirs??ie,r=he(e.projectRoot,o),t=Ee(e.projectRoot,s),n={...r,usesBrowser:r.usesBrowser||t.browserTool,usesWorkerLoader:t.jsCodeTool},a=H(e.projectRoot);let i;a.composed?i=[...Q,...y(u(e.projectRoot,s,w,"scheduler.ts"))?["SchedulerDO"]:[]].map(A=>({binding:V[A],className:A})):i=a.path===void 0?[]:J(a.path);const c=n.needsD1||ge(e.projectRoot,s),v=h(a,U(e.projectRoot,s).containers,"containers"),x=h(a,z(e.projectRoot,s).workflows,"workflows"),I=h(a,Y(e.projectRoot,s).agents,"agents"),j=[...te(e.projectRoot,s).queues],{flags:p}=Z(e.projectRoot,s),b=p?.provider==="flagship"&&p.mode==="binding"?p.bindingName:void 0,R={};for(const g of l)R[g]=n[g];const N=_e(i,c,n,v,x,I);return b!==void 0&&N.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${b}", app_id }) — the app_id can't be auto-provisioned`),{agents:I,containers:v,durableObjects:i,flagshipBinding:b,needsD1:c,queues:j,signals:N,usesFlags:p!==void 0,usesWorkerLoader:n.usesWorkerLoader,workflows:x,...R}},Le=e=>{const s=[];for(const o of l)e[o]&&s.push(f[o].source);return s};export{ke as inferLunoraBindings,Le as packageNamesFromBindings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readProjectConfigLiterals as o,readProjectTarget as n}from"@lunora/codegen";import{DEFAULT_DEPLOY_TARGET as c,resolveDeployDriver as a}from"./DEFAULT_DEPLOY_TARGET-
|
|
1
|
+
import{readProjectConfigLiterals as o,readProjectTarget as n}from"@lunora/codegen";import{DEFAULT_DEPLOY_TARGET as c,resolveDeployDriver as a}from"./DEFAULT_DEPLOY_TARGET-CtEZtsUF.mjs";const s=e=>{if(typeof e=="boolean")return e;if(e!==null&&typeof e=="object")return!0},g=e=>s(o(e).remote),i=e=>n(e),T=(e,r)=>r??i(e)??c,j=(e,r)=>{const t=T(e,r);return a(t),t};export{s as interpretRemote,g as readProjectRemotePreference,i as readProjectTarget,T as resolveProjectTarget,j as resolveTargetOrThrow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const c=["containers","d1_databases","durable_objects","kv_namespaces","queues","r2_buckets","secrets_store_secrets","services","tail_consumers","vars","vectorize","workflows"],i=["assets","compatibility_date","exports","logpush","main","migrations","observability","placement"],m=(s,o)=>{if(o===void 0)return{merged:s,unverifiedKeys:[]};const n=s.env?.[o];if(n===void 0){const e=Object.keys(s.env??{}).toSorted((v,f)=>v.localeCompare(f)),l=e.length>0?` (declared: ${e.join(", ")}).`:" (no environments are declared).";return{error:`--env "${o}" names no environment declared in wrangler.jsonc's "env" block${l}`,merged:s,unverifiedKeys:[]}}const t={...s},r=Object.keys(n).filter(e=>e!=="env");for(const e of r)i.includes(e)&&(t[e]=n[e]);for(const e of c)t[e]=n[e];const a=new Set([...c,...i]),d=r.filter(e=>!a.has(e)).map(String);return{merged:t,unverifiedKeys:d}};export{m as mergeWranglerEnvironment};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{inferLunoraBindings as d}from"./inferLunoraBindings-GaAITuz-.mjs";import{LUNORA_TAG as r}from"./LUNORA_TAG-CiQM3BkI.mjs";import{reconcileWranglerBindings as f}from"./collectExportGaps-BmEGzQQc.mjs";import{reconcileWranglerCompatibilityDate as p}from"./reconcileWranglerCompatibilityDate-7OO_xaKR.mjs";import{reconcileWranglerCrons as g,describePreservedCrons as $}from"./describePreservedCrons-Ci5r2aph.mjs";const b=async(i,a,t)=>{try{const n=await d({projectRoot:i.projectRoot,schemaDir:i.schemaDir}),e=f(i.projectRoot,n),o=e.wranglerPath??"wrangler.jsonc";e.added.length>0&&a.info?.(`${r} inferred bindings → ${e.added.join(", ")} (written to ${o})`),e.updated.length>0&&a.info?.(`${r} updated bindings → ${e.updated.join(", ")} (written to ${o})`);for(const s of e.warnings)a.warn(`${r} ${s}`);e.exportGaps.length>0&&t?.(e.exportGaps)}catch(n){const e=n instanceof Error?n.message:String(n);a.warn(`${r} binding inference skipped: ${e}`)}},c=new Map,j=(i,a,t)=>{try{const n=g(i,a);n.changed&&t.info?.(`${r} synced ${a.length.toFixed(0)} cron trigger(s) into ${n.wranglerPath??"wrangler.jsonc"}`);for(const s of n.warnings)t.warn(`${r} ${s}`);const e=n.preserved.join("\0"),o=$(n.preserved);o!==void 0&&(n.changed||c.get(i)!==e)&&t.info?.(`${r} ${o}`),c.set(i,e)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${r} cron trigger sync skipped: ${e}`)}try{const n=p(i);n.changed&&t.info?.(`${r} bumped compatibility_date to ${n.date??"unknown"} (Workers Cache enabled) → ${n.wranglerPath??"wrangler.jsonc"}`)}catch(n){const e=n instanceof Error?n.message:String(n);t.warn(`${r} compatibility date sync skipped: ${e}`)}};export{b as reconcileBindingsSafely,j as reconcileWranglerExtras};
|
package/dist/packem_shared/{runPostCodegenHook-CVrOTiGB.mjs → runPostCodegenHook-B0T1q2YI.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn as i}from"node:child_process";import{existsSync as d,readFileSync as u}from"node:fs";import{join as f}from"node:path";import{runScriptArgsFor as g,detectPackageManager as m}from"./addArgsFor-
|
|
1
|
+
import{spawn as i}from"node:child_process";import{existsSync as d,readFileSync as u}from"node:fs";import{join as f}from"node:path";import{runScriptArgsFor as g,detectPackageManager as m}from"./addArgsFor-CYZKhNIo.mjs";const o="postcodegen",l=r=>new Promise((n,s)=>{const e=i(r.command,[...r.args],{cwd:r.cwd??process.cwd(),shell:process.platform==="win32",stdio:["inherit",r.stdoutToStderr===!0?2:"inherit","inherit"]});e.on("error",s),e.on("close",a=>{n({code:a??1})})}),p=r=>{const n=f(r,"package.json");if(!d(n))return!1;try{const e=JSON.parse(u(n,"utf8"))?.scripts;return typeof e?.[o]=="string"&&e[o]!==""}catch{return!1}},P=async r=>{const{cwd:n,logger:s}=r;if(!p(n))return{ran:!1};const e=t=>(s.error(t),{error:t,ran:!0});let a;try{a=g(m(n),o)}catch(t){return e(`cannot run \`${o}\`: ${t instanceof Error?t.message:String(t)}`)}s.info(`running \`${o}\``);let c;try{c=await(r.spawner??l)({args:a.args,command:a.command,cwd:n,stdoutToStderr:r.stdoutToStderr})}catch(t){return e(`\`${o}\` failed to start: ${t instanceof Error?t.message:String(t)}`)}return c.code!==0?e(`\`${o}\` exited ${String(c.code)}`):{ran:!0}};export{P as runPostCodegenHook};
|
|
@@ -14,10 +14,10 @@ import { AgentIR, ContainerIR, QueueIR, WorkflowIR } from '@lunora/codegen';
|
|
|
14
14
|
* `temporary` are concepts, not wrangler flags. A second host maps the same
|
|
15
15
|
* request onto its own CLI without the caller changing.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* which has none — it is a codegen target, and
|
|
20
|
-
* refuse it at selection.
|
|
17
|
+
* Three drivers are registered: Cloudflare (`cloudflare/cloudflare-driver.ts`)
|
|
18
|
+
* and celld (`celld/celld-driver.ts`), which ship toolchains, and Node
|
|
19
|
+
* (`node/node-driver.ts`), which has none — it is a codegen target, and
|
|
20
|
+
* `lunora deploy` / `lunora dev` refuse it at selection.
|
|
21
21
|
*
|
|
22
22
|
* **What this seam deliberately does NOT carry: configuration inference.** It
|
|
23
23
|
* used to, through an `infer`/`provision` pair over a provider-neutral
|
|
@@ -36,17 +36,28 @@ import { AgentIR, ContainerIR, QueueIR, WorkflowIR } from '@lunora/codegen';
|
|
|
36
36
|
* A host CLI invocation, described but not run.
|
|
37
37
|
*
|
|
38
38
|
* `tool` is the binary name only (`"wrangler"`); the caller resolves how to
|
|
39
|
-
* execute it through the project's package manager
|
|
40
|
-
* driver never has to know whether the project uses
|
|
39
|
+
* execute it through the project's package manager (see `toolchainExecArgs`).
|
|
40
|
+
* Keeping that split means a driver never has to know whether the project uses
|
|
41
|
+
* pnpm, npm, yarn, or bun.
|
|
41
42
|
*/
|
|
42
43
|
interface ToolchainCommand {
|
|
43
44
|
/** Arguments for {@link ToolchainCommand.tool}. */
|
|
44
45
|
args: ReadonlyArray<string>;
|
|
46
|
+
/**
|
|
47
|
+
* The tool is a standalone binary installed on `PATH`, not a project
|
|
48
|
+
* dependency: run it directly. Going through the package manager would be
|
|
49
|
+
* wrong for it — `npx --` / `bun x` fetch an npm package of the same name
|
|
50
|
+
* when none is installed locally, which for a non-npm binary is somebody
|
|
51
|
+
* else's code.
|
|
52
|
+
*/
|
|
53
|
+
onPath?: boolean;
|
|
45
54
|
/** The host CLI binary, e.g. `"wrangler"`. */
|
|
46
55
|
tool: string;
|
|
47
56
|
}
|
|
48
57
|
/** Neutral options for a deploy. */
|
|
49
58
|
interface DeployRequest {
|
|
59
|
+
/** Host config file to deploy, when the flow uses a projected one (see {@link DeployDriver.projectConfig}). */
|
|
60
|
+
configPath?: string;
|
|
50
61
|
/** Validate and bundle without publishing — nothing ships. */
|
|
51
62
|
dryRun?: boolean;
|
|
52
63
|
/** Deploy this entry file instead of the host config's default (framework composition). */
|
|
@@ -97,18 +108,53 @@ interface SecretRequest {
|
|
|
97
108
|
* The host's command-line surface. Optional as a whole: a host with no vendor
|
|
98
109
|
* CLI (the Node target; a hypothetical API-driven one) declares none, and
|
|
99
110
|
* `isRunnableTarget` refuses it for the commands that would have to shell out.
|
|
111
|
+
*
|
|
112
|
+
* `deploy` and `dev` are what make a target runnable. The secret and tail
|
|
113
|
+
* commands are optional on their own, because a runnable host can simply not
|
|
114
|
+
* have them — celld keeps configuration in plain `vars` and has no log tail —
|
|
115
|
+
* and the commands that need one say so rather than guessing a substitute.
|
|
100
116
|
*/
|
|
101
117
|
interface DriverToolchain {
|
|
102
118
|
/** The command that deploys the app. */
|
|
103
119
|
deploy: (request: DeployRequest) => ToolchainCommand;
|
|
104
120
|
/** The command that runs a local dev server. */
|
|
105
121
|
dev: (request: DevRequest) => ToolchainCommand;
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Where `lunora dev` runs the worker. `"workerd"`: `wrangler dev`, or the
|
|
124
|
+
* Vite plugin's `@cloudflare/vite-plugin`, whichever flavor the project
|
|
125
|
+
* picks. `"own"`: the host's dev server ({@link DriverToolchain.dev}) on
|
|
126
|
+
* the projected config, always the standalone flavor — neither Vite nor a
|
|
127
|
+
* framework sidecar can serve the worker on that runtime.
|
|
128
|
+
*/
|
|
129
|
+
readonly devServer: "own" | "workerd";
|
|
130
|
+
/**
|
|
131
|
+
* Whether `lunora deploy` builds and pushes container images itself
|
|
132
|
+
* (railpack, into the host's registry) before `deploy`. `false` when the
|
|
133
|
+
* host CLI builds each image from its Dockerfile during the deploy.
|
|
134
|
+
*/
|
|
135
|
+
readonly prebuildsContainerImages: boolean;
|
|
136
|
+
/** The command that lists remote secret names, when the host has a secret store. */
|
|
137
|
+
secretList?: (request: SecretRequest) => ToolchainCommand;
|
|
138
|
+
/** The command that writes one secret, when the host has a secret store. Its value is passed on stdin, never argv. */
|
|
139
|
+
secretPut?: (request: SecretRequest) => ToolchainCommand;
|
|
140
|
+
/** The command that tails live logs, when the host has one. */
|
|
141
|
+
tail?: (request: TailRequest) => ToolchainCommand;
|
|
142
|
+
}
|
|
143
|
+
/** What a {@link DeployDriver.projectConfig} projection is for — a dev server may need a different source than a deploy. */
|
|
144
|
+
type ProjectionPurpose = "deploy" | "dev";
|
|
145
|
+
/**
|
|
146
|
+
* The result of {@link DeployDriver.projectConfig}: a plan, not yet on disk.
|
|
147
|
+
* The caller validates the request it is for (the toolchain's argv builder
|
|
148
|
+
* refuses unsupported options), then calls `write` — so a refused command
|
|
149
|
+
* changes nothing.
|
|
150
|
+
*/
|
|
151
|
+
interface ProjectedConfig {
|
|
152
|
+
/** Where the projection goes, to pass as the request's `configPath`. */
|
|
153
|
+
configPath: string;
|
|
154
|
+
/** Every key removed, as a dotted path (`observability`, `containers[0].rollout_step_percentage`). */
|
|
155
|
+
dropped: ReadonlyArray<string>;
|
|
156
|
+
/** Write the projection (and any build-artifact cleanup it planned). */
|
|
157
|
+
write: () => void;
|
|
112
158
|
}
|
|
113
159
|
/** A deploy target's implementation: an identity the registry resolves, and the host CLI surface (if any) behind it. */
|
|
114
160
|
interface DeployDriver {
|
|
@@ -116,6 +162,18 @@ interface DeployDriver {
|
|
|
116
162
|
readonly id: string;
|
|
117
163
|
/** Human-readable target name, for logs. */
|
|
118
164
|
readonly name: string;
|
|
165
|
+
/**
|
|
166
|
+
* Rewrite the project's wrangler config into the form this host's CLI
|
|
167
|
+
* accepts, and return the file to hand `deploy`/`dev` as `configPath`.
|
|
168
|
+
* Absent when the host reads the project's config as-is (Cloudflare).
|
|
169
|
+
*
|
|
170
|
+
* Needed because Lunora's reconcilers and templates write Cloudflare-only
|
|
171
|
+
* keys (`observability`, `limits`, …) that a Workers-compatible host with a
|
|
172
|
+
* strict config reader refuses outright. `dropped` names what was removed,
|
|
173
|
+
* so the caller can say so instead of silently deploying less than the
|
|
174
|
+
* config describes.
|
|
175
|
+
*/
|
|
176
|
+
readonly projectConfig?: (projectRoot: string, purpose: ProjectionPurpose) => ProjectedConfig;
|
|
119
177
|
/**
|
|
120
178
|
* The host's command-line surface, or `undefined` for a host that has none.
|
|
121
179
|
* Pure: these build argv, they never spawn.
|
|
@@ -126,6 +184,44 @@ interface DurableObjectSpec {
|
|
|
126
184
|
binding: string;
|
|
127
185
|
className: string;
|
|
128
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* The `_generated/` modules that hold a generated Durable Object / Workflow
|
|
189
|
+
* class — one per class kind a project can declare. wrangler validates every
|
|
190
|
+
* `class_name` against the worker's exports, so this is the set a worker entry
|
|
191
|
+
* re-exports (and the set the composed class-A entry star-re-exports for the
|
|
192
|
+
* kinds the project has).
|
|
193
|
+
*
|
|
194
|
+
* Owned here because four places need it and they must not drift:
|
|
195
|
+
* `@lunora/vite` emits one star re-export per entry, the wrangler validator
|
|
196
|
+
* DECIDES the composed entry's exports from it, `reconcile-bindings` types its
|
|
197
|
+
* export-gap `module` field on it, and this module's own `detectClassExports`
|
|
198
|
+
* probes the same names.
|
|
199
|
+
*
|
|
200
|
+
* `scheduler` carries no `define*` declarations of its own — codegen writes it
|
|
201
|
+
* off `hasScheduler` purely so the composed class-A entry has a `SchedulerDO`
|
|
202
|
+
* to forward. Its presence is therefore the ONLY signal the plugin and the
|
|
203
|
+
* validator need, and it is the same signal that decides whether the builder
|
|
204
|
+
* has a `.scheduler()` method at all. `@lunora/vite` depends on `@lunora/config`, so config
|
|
205
|
+
* owning it is the direction the dependency graph allows.
|
|
206
|
+
*/
|
|
207
|
+
declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "workflows"];
|
|
208
|
+
/** One {@link GENERATED_CLASS_MODULES} entry. */
|
|
209
|
+
type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
|
|
210
|
+
/**
|
|
211
|
+
* The class-B composed entry. `lunora deploy` passes this file to wrangler as
|
|
212
|
+
* the positional script whenever it exists, overriding `wrangler.main` — so it
|
|
213
|
+
* is what actually gets bundled and what wrangler checks its DO/Workflow
|
|
214
|
+
* bindings against. `main` in a class-B project names the framework adapter's
|
|
215
|
+
* build output (`.svelte-kit/cloudflare/_worker.js`, `dist/_worker.js`), which
|
|
216
|
+
* exists after `vite build` and exports only the SSR fetch handler. Lexing that
|
|
217
|
+
* instead read every declared class as unexported: nothing provisioned, plus a
|
|
218
|
+
* "add `export * from …`" warning the user cannot silence.
|
|
219
|
+
*
|
|
220
|
+
* Exported, not documented-as-duplicated: the CLI's `resolveComposedWorkerEntry`
|
|
221
|
+
* imports this constant, so the deploy's positional entry and the file this
|
|
222
|
+
* module lexes for exported classes cannot drift apart.
|
|
223
|
+
*/
|
|
224
|
+
declare const COMPOSED_WORKER_ENTRY = "src/worker.ts";
|
|
129
225
|
/**
|
|
130
226
|
* A `defineContainer` declaration plus whether its generated DO class is
|
|
131
227
|
* exported by the worker entry. Only exported containers are safe to
|
|
@@ -213,6 +309,8 @@ interface InferredBindings {
|
|
|
213
309
|
usesScheduler: boolean;
|
|
214
310
|
/** `@lunora/storage` is imported (R2 bucket binding name is user-defined). */
|
|
215
311
|
usesStorage: boolean;
|
|
312
|
+
/** `jsCodeTool` is imported from `@lunora/agent` in `lunora/` → self-describing `worker_loaders` binding (`LOADER`). */
|
|
313
|
+
usesWorkerLoader: boolean;
|
|
216
314
|
/** `@lunora/x402/charge` is imported — the charge rail settles USDC to a recipient address (a public `[vars]` entry, user-named; hint-only). */
|
|
217
315
|
usesX402Charge: boolean;
|
|
218
316
|
/** `@lunora/x402/pay` is imported — the agent-wallet pay rail signs from a Secrets Store binding paired with a spend policy (ActionCtx-only; hint-only). */
|
|
@@ -227,44 +325,6 @@ interface InferOptions {
|
|
|
227
325
|
/** Lunora source directory holding `schema.ts`. Defaults to `lunora`. */
|
|
228
326
|
schemaDir?: string;
|
|
229
327
|
}
|
|
230
|
-
/**
|
|
231
|
-
* The `_generated/` modules that hold a generated Durable Object / Workflow
|
|
232
|
-
* class — one per class kind a project can declare. wrangler validates every
|
|
233
|
-
* `class_name` against the worker's exports, so this is the set a worker entry
|
|
234
|
-
* re-exports (and the set the composed class-A entry star-re-exports for the
|
|
235
|
-
* kinds the project has).
|
|
236
|
-
*
|
|
237
|
-
* Owned here because four places need it and they must not drift:
|
|
238
|
-
* `@lunora/vite` emits one star re-export per entry, the wrangler validator
|
|
239
|
-
* DECIDES the composed entry's exports from it, `reconcile-bindings` types its
|
|
240
|
-
* export-gap `module` field on it, and this module's own `detectClassExports`
|
|
241
|
-
* probes the same names.
|
|
242
|
-
*
|
|
243
|
-
* `scheduler` carries no `define*` declarations of its own — codegen writes it
|
|
244
|
-
* off `hasScheduler` purely so the composed class-A entry has a `SchedulerDO`
|
|
245
|
-
* to forward. Its presence is therefore the ONLY signal the plugin and the
|
|
246
|
-
* validator need, and it is the same signal that decides whether the builder
|
|
247
|
-
* has a `.scheduler()` method at all. `@lunora/vite` depends on `@lunora/config`, so config
|
|
248
|
-
* owning it is the direction the dependency graph allows.
|
|
249
|
-
*/
|
|
250
|
-
declare const GENERATED_CLASS_MODULES: readonly ["agents", "containers", "scheduler", "workflows"];
|
|
251
|
-
/** One {@link GENERATED_CLASS_MODULES} entry. */
|
|
252
|
-
type GeneratedClassModule = (typeof GENERATED_CLASS_MODULES)[number];
|
|
253
|
-
/**
|
|
254
|
-
* The class-B composed entry. `lunora deploy` passes this file to wrangler as
|
|
255
|
-
* the positional script whenever it exists, overriding `wrangler.main` — so it
|
|
256
|
-
* is what actually gets bundled and what wrangler checks its DO/Workflow
|
|
257
|
-
* bindings against. `main` in a class-B project names the framework adapter's
|
|
258
|
-
* build output (`.svelte-kit/cloudflare/_worker.js`, `dist/_worker.js`), which
|
|
259
|
-
* exists after `vite build` and exports only the SSR fetch handler. Lexing that
|
|
260
|
-
* instead read every declared class as unexported: nothing provisioned, plus a
|
|
261
|
-
* "add `export * from …`" warning the user cannot silence.
|
|
262
|
-
*
|
|
263
|
-
* Exported, not documented-as-duplicated: the CLI's `resolveComposedWorkerEntry`
|
|
264
|
-
* imports this constant, so the deploy's positional entry and the file this
|
|
265
|
-
* module lexes for exported classes cannot drift apart.
|
|
266
|
-
*/
|
|
267
|
-
declare const COMPOSED_WORKER_ENTRY = "src/worker.ts";
|
|
268
328
|
/**
|
|
269
329
|
* Scan a Lunora project and report which Cloudflare bindings its code implies.
|
|
270
330
|
* Read-only: performs no writes. Binding provisioning is driven by the worker
|
|
@@ -328,4 +388,4 @@ interface DiscoverSchemaInfoResult {
|
|
|
328
388
|
* parse failure is a warning (validator) or simply ignorable (inference).
|
|
329
389
|
*/
|
|
330
390
|
declare const discoverSchemaInfo: (projectRoot: string, schemaDirectory: string) => DiscoverSchemaInfoResult;
|
|
331
|
-
export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, SchemaInfo as S,
|
|
391
|
+
export { COMPOSED_WORKER_ENTRY as C, DeployDriver as D, GeneratedClassModule as G, InferredBindings as I, ProjectionPurpose as P, SchemaInfo as S, ToolchainCommand as T, DeployRequest as a, DevRequest as b, DiscoverSchemaInfoResult as c, DriverToolchain as d, GENERATED_CLASS_MODULES as e, InferOptions as f, InferredAgent as g, InferredContainer as h, InferredWorkflow as i, ProjectedConfig as j, SecretRequest as k, TailRequest as l, discoverSchemaInfo as m, inferLunoraBindings as n, packageNamesFromBindings as p };
|