@lunora/config 1.0.0-alpha.177 → 1.0.0-alpha.178

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.
@@ -1 +1 @@
1
- import{BINDING_MANIFEST_VERSION as o,buildBindingManifest as a}from"../packem_shared/BINDING_MANIFEST_VERSION-Cd00jVOf.mjs";import{C as n}from"../packem_shared/cloudflare-driver-DkF7wRh1.mjs";import{collectExportGaps as i,reconcileWranglerBindings as E}from"../packem_shared/collectExportGaps-DHLZ7ulq.mjs";import{reconcileWranglerCompatibilityDate as c}from"../packem_shared/reconcileWranglerCompatibilityDate-7OO_xaKR.mjs";import{reconcileWranglerCrons as R}from"../packem_shared/reconcileWranglerCrons-COMb6ICf.mjs";import{REMOTE_ELIGIBLE_KEYS as f,injectRemoteFlags as p,isRemoteEnvEnabled as I,materializeRemoteWranglerConfig as W,planRemoteBindings as d,resolveRemoteEnabled as x}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-DKlqkz1w.mjs";import{WORKERS_CACHE_MIN_DATE as C,isCacheEnabled as A}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{WRANGLER_FILES as L,findWranglerFile as T,readWranglerJsonc as b}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{collectWranglerSecretVariables as S,scanWranglerVariablesForSecrets as B}from"../packem_shared/collectWranglerSecretVariables-WNirpc4n.mjs";import{wranglerToAlchemy as v}from"../packem_shared/wranglerToAlchemy-CX9nCwtu.mjs";import{REQUIRED_COMPATIBILITY_DATE as M,REQUIRED_FLAG as O,validateWrangler as V,validateWranglerConfig as h,validateWranglerProject as U,withTailConsumer as j}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-BM4qXyjS.mjs";export{o as BINDING_MANIFEST_VERSION,n as CLOUDFLARE_DRIVER,f as REMOTE_ELIGIBLE_KEYS,M as REQUIRED_COMPATIBILITY_DATE,O as REQUIRED_FLAG,C as WORKERS_CACHE_MIN_DATE,L as WRANGLER_FILES,a as buildBindingManifest,i as collectExportGaps,S as collectWranglerSecretVariables,T as findWranglerFile,p as injectRemoteFlags,A as isCacheEnabled,I as isRemoteEnvEnabled,W as materializeRemoteWranglerConfig,d as planRemoteBindings,b as readWranglerJsonc,E as reconcileWranglerBindings,c as reconcileWranglerCompatibilityDate,R as reconcileWranglerCrons,x as resolveRemoteEnabled,B as scanWranglerVariablesForSecrets,V as validateWrangler,h as validateWranglerConfig,U as validateWranglerProject,j as withTailConsumer,v as wranglerToAlchemy};
1
+ import{BINDING_MANIFEST_VERSION as o,buildBindingManifest as a}from"../packem_shared/BINDING_MANIFEST_VERSION-Cd00jVOf.mjs";import{C as n}from"../packem_shared/cloudflare-driver-BRcsrarS.mjs";import{collectExportGaps as i,reconcileWranglerBindings as E}from"../packem_shared/collectExportGaps-DHLZ7ulq.mjs";import{reconcileWranglerCompatibilityDate as c}from"../packem_shared/reconcileWranglerCompatibilityDate-7OO_xaKR.mjs";import{reconcileWranglerCrons as R}from"../packem_shared/reconcileWranglerCrons-COMb6ICf.mjs";import{REMOTE_ELIGIBLE_KEYS as f,injectRemoteFlags as p,isRemoteEnvEnabled as I,materializeRemoteWranglerConfig as W,planRemoteBindings as d,resolveRemoteEnabled as x}from"../packem_shared/REMOTE_ELIGIBLE_KEYS-D-edJjVY.mjs";import{WORKERS_CACHE_MIN_DATE as C,isCacheEnabled as A}from"../packem_shared/WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{WRANGLER_FILES as L,findWranglerFile as T,readWranglerJsonc as b}from"../packem_shared/WRANGLER_FILES-UNW-xY5u.mjs";import{collectWranglerSecretVariables as S,scanWranglerVariablesForSecrets as B}from"../packem_shared/collectWranglerSecretVariables-WNirpc4n.mjs";import{wranglerToAlchemy as v}from"../packem_shared/wranglerToAlchemy-CX9nCwtu.mjs";import{REQUIRED_COMPATIBILITY_DATE as M,REQUIRED_FLAG as O,validateWrangler as V,validateWranglerConfig as h,validateWranglerProject as U,withTailConsumer as j}from"../packem_shared/REQUIRED_COMPATIBILITY_DATE-Lkm0xwgo.mjs";export{o as BINDING_MANIFEST_VERSION,n as CLOUDFLARE_DRIVER,f as REMOTE_ELIGIBLE_KEYS,M as REQUIRED_COMPATIBILITY_DATE,O as REQUIRED_FLAG,C as WORKERS_CACHE_MIN_DATE,L as WRANGLER_FILES,a as buildBindingManifest,i as collectExportGaps,S as collectWranglerSecretVariables,T as findWranglerFile,p as injectRemoteFlags,A as isCacheEnabled,I as isRemoteEnvEnabled,W as materializeRemoteWranglerConfig,d as planRemoteBindings,b as readWranglerJsonc,E as reconcileWranglerBindings,c as reconcileWranglerCompatibilityDate,R as reconcileWranglerCrons,x as resolveRemoteEnabled,B as scanWranglerVariablesForSecrets,V as validateWrangler,h as validateWranglerConfig,U as validateWranglerProject,j as withTailConsumer,v as wranglerToAlchemy};
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 p,AGENT_RULES_HINT_ENV as n,LUNORA_SKILL_NAMES as _,ROOT_SKILL_NAME as l,claimAgentRulesHint as c,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-3-Sx1gHU.mjs";import{CODEGEN_ENV as A,isCodegenDisabled as D}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as f}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as N}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as I,readProjectDependencyNames as R}from"./packem_shared/detectFramework-DOn4PtpP.mjs";import{DEV_BINDINGS_FILE as g,DEV_DAEMON_ENV as x,DEV_HANDOFF_ENV as V,DEV_LOG_FILE as P,DEV_LOG_FILE_ENV as F,DEV_STATE_DIR as u,DEV_STATE_FILE as O,claimDevServerState as C,clearDevServerState as G,isDevServerReady as U,isProcessAlive as b,isRecordedProcessCurrent as y,readDevServerState as M,readLiveDevServerState as k,updateDevServerState as B,writeDevServerState as w}from"./packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs";import{DEV_VARS_EXAMPLE_FILE as K,DEV_VARS_FILE as j,DEV_VARS_KEY_PATTERN as h,escapeRegExp as Y,parseDevVariableEntries as W,removeDevVariableLine as J,upsertDevVariableLine as q}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEFAULT_DEPLOY_TARGET as z,deployTargetIds as Q,resolveDeployDriver as Z}from"./packem_shared/DEFAULT_DEPLOY_TARGET-dS2wApDX.mjs";import{inferLunoraBindings as ee,packageNamesFromBindings as re}from"./packem_shared/inferLunoraBindings-KST9XCEe.mjs";import{LINKED_PROJECT_DIR as te,LINKED_PROJECT_FILE as ae,readLinkedProject as Ee,writeLinkedProject as ie}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as pe,applyLintIgnores as ne,detectLintTools as _e}from"./packem_shared/LUNORA_IGNORED_PATHS-BGbVUqw_.mjs";import{LUNORA_EVENT_SOURCE as ce,formatLunoraEvent as de}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as Ae}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as Se,detectInstalledManagers as fe,detectPackageManager as Le,execArgsFor as Ne,installArgsFor as ve,runScriptArgsFor as Ie,runScriptCommand as Re}from"./packem_shared/addArgsFor-B4D4zvM0.mjs";import{PACKAGE_SECRETS_REGISTRY as ge,secretsForPackages as xe}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-BgmvEPA-.mjs";import{runPostCodegenHook as Pe}from"./packem_shared/runPostCodegenHook-BF3XTBFz.mjs";import{LUNORA_CONFIG_FILE as ue,interpretRemote as Oe,readProjectRemotePreference as Ce,readProjectTarget as Ge,resolveProjectTarget as Ue,resolveTargetOrThrow as be}from"./packem_shared/LUNORA_CONFIG_FILE-GOH3iIA4.mjs";import{createConfirm as Me,isInteractive as ke,promptMultiSelect as Be,promptSelect as we,promptText as He,promptYesNo as Ke}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{buildPackageSecretsBlock as he,ensureDevVariables as Ye,ensureDevVarsExample as We,fillDevSecrets as Je,generateSecretValue as qe,isMintableSecretKey as Xe,isPlaceholderValue as ze,planDevSecretsFill as Qe,planDevVariablesAugment as Ze,planDevVariablesScaffold as $e,requiredSecrets as er,writeDevVariablesFileAtomically as rr}from"./packem_shared/buildPackageSecretsBlock-J7bP1P-6.mjs";import{applyAdditiveEdit as tr,classifyEdit as ar}from"./packem_shared/applyAdditiveEdit-DPhNZsf2.mjs";import{parseSchema as ir}from"./packem_shared/parseSchema-B4nFDPzZ.mjs";import{classifyPolicyEdit as pr,scaffoldPolicyFile as nr,wireRlsIntoProcedure as _r}from"./packem_shared/classifyPolicyEdit-BfSiVpv-.mjs";import{discoverSchemaInfo as cr}from"./packem_shared/discoverSchemaInfo-Bg2CUZXG.mjs";import{ACCENT as mr,BADGES as Ar,BADGE_COLUMN_WIDTH as Dr,LUNA_ART as Sr,LUNA_BUNNY as fr,LUNA_NAME as Lr,LUNA_SIGNOFF as Nr,STEP_BADGE_NAMES as vr,badgeLead as Ir,badgeWidth as Rr,padBadge as Tr,paintAnswer as gr,paintBadge as xr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{discoverWorkflowInfo as Pr}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{mr as ACCENT,o as AGENT_MODE_ENV,s as AGENT_RULES_DIR,p as AGENT_RULES_HINT,n as AGENT_RULES_HINT_ENV,Ar as BADGES,Dr as BADGE_COLUMN_WIDTH,A as CODEGEN_ENV,z as DEFAULT_DEPLOY_TARGET,g as DEV_BINDINGS_FILE,x as DEV_DAEMON_ENV,V as DEV_HANDOFF_ENV,P as DEV_LOG_FILE,F as DEV_LOG_FILE_ENV,u as DEV_STATE_DIR,O as DEV_STATE_FILE,K as DEV_VARS_EXAMPLE_FILE,j as DEV_VARS_FILE,h as DEV_VARS_KEY_PATTERN,te as LINKED_PROJECT_DIR,ae as LINKED_PROJECT_FILE,Sr as LUNA_ART,fr as LUNA_BUNNY,Lr as LUNA_NAME,Nr as LUNA_SIGNOFF,ue as LUNORA_CONFIG_FILE,ce as LUNORA_EVENT_SOURCE,pe as LUNORA_IGNORED_PATHS,_ as LUNORA_SKILL_NAMES,Ae as LunoraReporter,ge as PACKAGE_SECRETS_REGISTRY,l as ROOT_SKILL_NAME,vr as STEP_BADGE_NAMES,Se as addArgsFor,tr as applyAdditiveEdit,ne as applyLintIgnores,Ir as badgeLead,Rr as badgeWidth,he as buildPackageSecretsBlock,c as claimAgentRulesHint,C as claimDevServerState,ar as classifyEdit,pr as classifyPolicyEdit,G as clearDevServerState,Me as createConfirm,Q as deployTargetIds,d as detectAgentRules,t as detectAiAgent,I as detectFramework,fe as detectInstalledManagers,_e as detectLintTools,Le as detectPackageManager,E as discoverAgentInfo,f as discoverContainerInfo,cr as discoverSchemaInfo,Pr as discoverWorkflowInfo,Ye as ensureDevVariables,We as ensureDevVarsExample,Y as escapeRegExp,Ne as execArgsFor,Je as fillDevSecrets,de as formatLunoraEvent,qe as generateSecretValue,ee as inferLunoraBindings,ve as installArgsFor,Oe as interpretRemote,D as isCodegenDisabled,U as isDevServerReady,ke as isInteractive,Xe as isMintableSecretKey,ze as isPlaceholderValue,b as isProcessAlive,y as isRecordedProcessCurrent,re as packageNamesFromBindings,Tr as padBadge,gr as paintAnswer,xr as paintBadge,W as parseDevVariableEntries,ir as parseSchema,Qe as planDevSecretsFill,Ze as planDevVariablesAugment,$e as planDevVariablesScaffold,Be as promptMultiSelect,we as promptSelect,He as promptText,Ke as promptYesNo,M as readDevServerState,Ee as readLinkedProject,k as readLiveDevServerState,R as readProjectDependencyNames,Ce as readProjectRemotePreference,Ge as readProjectTarget,J as removeDevVariableLine,er as requiredSecrets,Z as resolveDeployDriver,Ue as resolveProjectTarget,be as resolveTargetOrThrow,Pe as runPostCodegenHook,Ie as runScriptArgsFor,Re as runScriptCommand,nr as scaffoldPolicyFile,xe as secretsForPackages,N as streamContainerLogs,B as updateDevServerState,q as upsertDevVariableLine,_r as wireRlsIntoProcedure,w as writeDevServerState,rr as writeDevVariablesFileAtomically,ie as writeLinkedProject};
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 p,AGENT_RULES_HINT_ENV as n,LUNORA_SKILL_NAMES as _,ROOT_SKILL_NAME as l,claimAgentRulesHint as c,detectAgentRules as d}from"./packem_shared/AGENT_RULES_DIR-3-Sx1gHU.mjs";import{CODEGEN_ENV as A,isCodegenDisabled as D}from"./packem_shared/CODEGEN_ENV-ZsCxV1kP.mjs";import{discoverContainerInfo as f}from"./packem_shared/discoverContainerInfo-EhZtEBQs.mjs";import{streamContainerLogs as N}from"./packem_shared/streamContainerLogs-0nko1qpv.mjs";import{detectFramework as I,readProjectDependencyNames as R}from"./packem_shared/detectFramework-DOn4PtpP.mjs";import{DEV_BINDINGS_FILE as g,DEV_DAEMON_ENV as x,DEV_HANDOFF_ENV as V,DEV_LOG_FILE as P,DEV_LOG_FILE_ENV as F,DEV_STATE_DIR as u,DEV_STATE_FILE as O,claimDevServerState as C,clearDevServerState as G,isDevServerReady as U,isProcessAlive as b,isRecordedProcessCurrent as y,readDevServerState as M,readLiveDevServerState as k,updateDevServerState as B,writeDevServerState as w}from"./packem_shared/DEV_BINDINGS_FILE-pyOiNLP4.mjs";import{DEV_VARS_EXAMPLE_FILE as K,DEV_VARS_FILE as j,DEV_VARS_KEY_PATTERN as h,escapeRegExp as Y,parseDevVariableEntries as W,removeDevVariableLine as J,upsertDevVariableLine as q}from"./packem_shared/DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{DEFAULT_DEPLOY_TARGET as z,deployTargetIds as Q,resolveDeployDriver as Z}from"./packem_shared/DEFAULT_DEPLOY_TARGET-BRFEtEoC.mjs";import{inferLunoraBindings as ee,packageNamesFromBindings as re}from"./packem_shared/inferLunoraBindings-7kPfAt6p.mjs";import{LINKED_PROJECT_DIR as te,LINKED_PROJECT_FILE as ae,readLinkedProject as Ee,writeLinkedProject as ie}from"./packem_shared/LINKED_PROJECT_DIR-Ba5qPEwo.mjs";import{LUNORA_IGNORED_PATHS as pe,applyLintIgnores as ne,detectLintTools as _e}from"./packem_shared/LUNORA_IGNORED_PATHS-BGbVUqw_.mjs";import{LUNORA_EVENT_SOURCE as ce,formatLunoraEvent as de}from"./packem_shared/LUNORA_EVENT_SOURCE-DYdcDU9G.mjs";import{default as Ae}from"./packem_shared/LunoraReporter-f277GLNT.mjs";import{addArgsFor as Se,detectInstalledManagers as fe,detectPackageManager as Le,execArgsFor as Ne,installArgsFor as ve,runScriptArgsFor as Ie,runScriptCommand as Re}from"./packem_shared/addArgsFor-B4D4zvM0.mjs";import{PACKAGE_SECRETS_REGISTRY as ge,secretsForPackages as xe}from"./packem_shared/PACKAGE_SECRETS_REGISTRY-BgmvEPA-.mjs";import{runPostCodegenHook as Pe}from"./packem_shared/runPostCodegenHook-BF3XTBFz.mjs";import{LUNORA_CONFIG_FILE as ue,interpretRemote as Oe,readProjectRemotePreference as Ce,readProjectTarget as Ge,resolveProjectTarget as Ue,resolveTargetOrThrow as be}from"./packem_shared/LUNORA_CONFIG_FILE-gaSaOW1e.mjs";import{createConfirm as Me,isInteractive as ke,promptMultiSelect as Be,promptSelect as we,promptText as He,promptYesNo as Ke}from"./packem_shared/createConfirm-D5mKTMHj.mjs";import{buildPackageSecretsBlock as he,ensureDevVariables as Ye,ensureDevVarsExample as We,fillDevSecrets as Je,generateSecretValue as qe,isMintableSecretKey as Xe,isPlaceholderValue as ze,planDevSecretsFill as Qe,planDevVariablesAugment as Ze,planDevVariablesScaffold as $e,requiredSecrets as er,writeDevVariablesFileAtomically as rr}from"./packem_shared/buildPackageSecretsBlock-J7bP1P-6.mjs";import{applyAdditiveEdit as tr,classifyEdit as ar}from"./packem_shared/applyAdditiveEdit-DPhNZsf2.mjs";import{parseSchema as ir}from"./packem_shared/parseSchema-B4nFDPzZ.mjs";import{classifyPolicyEdit as pr,scaffoldPolicyFile as nr,wireRlsIntoProcedure as _r}from"./packem_shared/classifyPolicyEdit-BfSiVpv-.mjs";import{discoverSchemaInfo as cr}from"./packem_shared/discoverSchemaInfo-Bg2CUZXG.mjs";import{ACCENT as mr,BADGES as Ar,BADGE_COLUMN_WIDTH as Dr,LUNA_ART as Sr,LUNA_BUNNY as fr,LUNA_NAME as Lr,LUNA_SIGNOFF as Nr,STEP_BADGE_NAMES as vr,badgeLead as Ir,badgeWidth as Rr,padBadge as Tr,paintAnswer as gr,paintBadge as xr}from"./packem_shared/ACCENT-CotPTfv7.mjs";import{discoverWorkflowInfo as Pr}from"./packem_shared/discoverWorkflowInfo-BsPvlo6O.mjs";export{mr as ACCENT,o as AGENT_MODE_ENV,s as AGENT_RULES_DIR,p as AGENT_RULES_HINT,n as AGENT_RULES_HINT_ENV,Ar as BADGES,Dr as BADGE_COLUMN_WIDTH,A as CODEGEN_ENV,z as DEFAULT_DEPLOY_TARGET,g as DEV_BINDINGS_FILE,x as DEV_DAEMON_ENV,V as DEV_HANDOFF_ENV,P as DEV_LOG_FILE,F as DEV_LOG_FILE_ENV,u as DEV_STATE_DIR,O as DEV_STATE_FILE,K as DEV_VARS_EXAMPLE_FILE,j as DEV_VARS_FILE,h as DEV_VARS_KEY_PATTERN,te as LINKED_PROJECT_DIR,ae as LINKED_PROJECT_FILE,Sr as LUNA_ART,fr as LUNA_BUNNY,Lr as LUNA_NAME,Nr as LUNA_SIGNOFF,ue as LUNORA_CONFIG_FILE,ce as LUNORA_EVENT_SOURCE,pe as LUNORA_IGNORED_PATHS,_ as LUNORA_SKILL_NAMES,Ae as LunoraReporter,ge as PACKAGE_SECRETS_REGISTRY,l as ROOT_SKILL_NAME,vr as STEP_BADGE_NAMES,Se as addArgsFor,tr as applyAdditiveEdit,ne as applyLintIgnores,Ir as badgeLead,Rr as badgeWidth,he as buildPackageSecretsBlock,c as claimAgentRulesHint,C as claimDevServerState,ar as classifyEdit,pr as classifyPolicyEdit,G as clearDevServerState,Me as createConfirm,Q as deployTargetIds,d as detectAgentRules,t as detectAiAgent,I as detectFramework,fe as detectInstalledManagers,_e as detectLintTools,Le as detectPackageManager,E as discoverAgentInfo,f as discoverContainerInfo,cr as discoverSchemaInfo,Pr as discoverWorkflowInfo,Ye as ensureDevVariables,We as ensureDevVarsExample,Y as escapeRegExp,Ne as execArgsFor,Je as fillDevSecrets,de as formatLunoraEvent,qe as generateSecretValue,ee as inferLunoraBindings,ve as installArgsFor,Oe as interpretRemote,D as isCodegenDisabled,U as isDevServerReady,ke as isInteractive,Xe as isMintableSecretKey,ze as isPlaceholderValue,b as isProcessAlive,y as isRecordedProcessCurrent,re as packageNamesFromBindings,Tr as padBadge,gr as paintAnswer,xr as paintBadge,W as parseDevVariableEntries,ir as parseSchema,Qe as planDevSecretsFill,Ze as planDevVariablesAugment,$e as planDevVariablesScaffold,Be as promptMultiSelect,we as promptSelect,He as promptText,Ke as promptYesNo,M as readDevServerState,Ee as readLinkedProject,k as readLiveDevServerState,R as readProjectDependencyNames,Ce as readProjectRemotePreference,Ge as readProjectTarget,J as removeDevVariableLine,er as requiredSecrets,Z as resolveDeployDriver,Ue as resolveProjectTarget,be as resolveTargetOrThrow,Pe as runPostCodegenHook,Ie as runScriptArgsFor,Re as runScriptCommand,nr as scaffoldPolicyFile,xe as secretsForPackages,N as streamContainerLogs,B as updateDevServerState,q as upsertDevVariableLine,_r as wireRlsIntoProcedure,w as writeDevServerState,rr as writeDevVariablesFileAtomically,ie as writeLinkedProject};
@@ -1 +1 @@
1
- import"./inferLunoraBindings-KST9XCEe.mjs";import{C as a}from"./cloudflare-driver-DkF7wRh1.mjs";import"./collectExportGaps-DHLZ7ulq.mjs";import"./reconcileWranglerCompatibilityDate-7OO_xaKR.mjs";import"./reconcileWranglerCrons-COMb6ICf.mjs";export{a as default};
1
+ import"./inferLunoraBindings-7kPfAt6p.mjs";import{C as a}from"./cloudflare-driver-BRcsrarS.mjs";import"./collectExportGaps-DHLZ7ulq.mjs";import"./reconcileWranglerCompatibilityDate-7OO_xaKR.mjs";import"./reconcileWranglerCrons-COMb6ICf.mjs";export{a as default};
@@ -1 +1 @@
1
- import{t,C as c}from"./cloudflare-driver-DkF7wRh1.mjs";import{inferLunoraBindings as a}from"./inferLunoraBindings-KST9XCEe.mjs";const l=[{detect:e=>e.containers.length>0,warning:"containers have no Node equivalent in @lunora/platform-node — ctx.containers will be unavailable"}],d={id:"node",infer:async e=>t(await a({projectRoot:e.projectRoot}),e.crons??[]),name:"Node",provision:async e=>{let r;try{r=t(await a({projectRoot:e.projectRoot}),e.crons??[])}catch(n){const s=n instanceof Error?n.message:String(n);return{added:[],changed:!1,warnings:[`requirement inference skipped: ${s}`]}}const o=l.filter(n=>n.detect(r)).map(n=>n.warning);return r.crons.length>0&&o.push(`${String(r.crons.length)} cron expression(s) will be registered at runtime via SchedulerHost.cron rather than written to a config file`),{added:[],changed:!1,warnings:o}}},p="cloudflare",i={cloudflare:c,node:d},g=()=>Object.keys(i).toSorted((e,r)=>e.localeCompare(r)),h=(e=p)=>{const r=i[e];if(r===void 0)throw new Error(`unknown deploy target "${e}" — available targets: ${g().join(", ")}`);return r};export{p as DEFAULT_DEPLOY_TARGET,g as deployTargetIds,h as resolveDeployDriver};
1
+ import{t,C as c}from"./cloudflare-driver-BRcsrarS.mjs";import{inferLunoraBindings as a}from"./inferLunoraBindings-7kPfAt6p.mjs";const l=[{detect:e=>e.containers.length>0,warning:"containers have no Node equivalent in @lunora/platform-node — ctx.containers will be unavailable"}],d={id:"node",infer:async e=>t(await a({projectRoot:e.projectRoot}),e.crons??[]),name:"Node",provision:async e=>{let r;try{r=t(await a({projectRoot:e.projectRoot}),e.crons??[])}catch(n){const s=n instanceof Error?n.message:String(n);return{added:[],changed:!1,warnings:[`requirement inference skipped: ${s}`]}}const o=l.filter(n=>n.detect(r)).map(n=>n.warning);return r.crons.length>0&&o.push(`${String(r.crons.length)} cron expression(s) will be registered at runtime via SchedulerHost.cron rather than written to a config file`),{added:[],changed:!1,warnings:o}}},p="cloudflare",i={cloudflare:c,node:d},g=()=>Object.keys(i).toSorted((e,r)=>e.localeCompare(r)),h=(e=p)=>{const r=i[e];if(r===void 0)throw new Error(`unknown deploy target "${e}" — available targets: ${g().join(", ")}`);return r};export{p as DEFAULT_DEPLOY_TARGET,g as deployTargetIds,h as resolveDeployDriver};
@@ -1 +1 @@
1
- import{existsSync as c,readFileSync as i}from"node:fs";import{readProjectTarget as s}from"@lunora/codegen";import{parse as a}from"jsonc-parser";import{DEFAULT_DEPLOY_TARGET as f,resolveDeployDriver as m}from"./DEFAULT_DEPLOY_TARGET-dS2wApDX.mjs";import{join as p}from"node:path";const l="lunora.json",d=r=>{if(typeof r=="boolean")return r;if(r!==null&&typeof r=="object")return!0},u=r=>{const e=p(r,l);if(!c(e))return;let t;try{t=i(e,"utf8")}catch{return}const n=[],o=a(t,n,{allowTrailingComma:!0});if(!(n.length>0||o===null||typeof o!="object"))return o},h=r=>d(u(r)?.remote),g=r=>s(r),j=(r,e)=>e??g(r)??f,D=(r,e)=>{const t=j(r,e);return m(t),t};export{l as LUNORA_CONFIG_FILE,d as interpretRemote,h as readProjectRemotePreference,g as readProjectTarget,j as resolveProjectTarget,D as resolveTargetOrThrow};
1
+ import{existsSync as c,readFileSync as i}from"node:fs";import{readProjectTarget as s}from"@lunora/codegen";import{parse as a}from"jsonc-parser";import{DEFAULT_DEPLOY_TARGET as f,resolveDeployDriver as m}from"./DEFAULT_DEPLOY_TARGET-BRFEtEoC.mjs";import{join as p}from"node:path";const l="lunora.json",d=r=>{if(typeof r=="boolean")return r;if(r!==null&&typeof r=="object")return!0},u=r=>{const e=p(r,l);if(!c(e))return;let t;try{t=i(e,"utf8")}catch{return}const n=[],o=a(t,n,{allowTrailingComma:!0});if(!(n.length>0||o===null||typeof o!="object"))return o},h=r=>d(u(r)?.remote),g=r=>s(r),j=(r,e)=>e??g(r)??f,D=(r,e)=>{const t=j(r,e);return m(t),t};export{l as LUNORA_CONFIG_FILE,d as interpretRemote,h as readProjectRemotePreference,g as readProjectTarget,j as resolveProjectTarget,D as resolveTargetOrThrow};
@@ -0,0 +1 @@
1
+ import{writeFileSync as d,rmSync as f}from"node:fs";import{a as g}from"./jsonc-edit-BZgQIdAH.mjs";import{findWranglerFile as m,readWranglerJsonc as b}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{join as y}from"node:path";const u={ai:{label:"AI",shape:"object"},d1_databases:{label:"D1",shape:"array"},kv_namespaces:{label:"KV",shape:"array"},queues:{label:"Queue",shape:"producers"},r2_buckets:{label:"R2",shape:"array"},services:{label:"Service",shape:"array"},vectorize:{label:"Vectorize",shape:"array"}},h=Object.keys(u),p=(e,r)=>typeof e.binding=="string"?e.binding:r,l=(e,r,n,a)=>{const t=[];for(const[o,s]of r.entries())s!=null&&t.push({binding:p(s,`#${String(o)}`),kind:n,path:[...a,o],section:e});return t},E=(e,r)=>{const{label:n,shape:a}=u[e];if(a==="array"){const o=r[e]??[];return l(e,o,n,[])}if(a==="producers")return l(e,r.queues?.producers??[],n,["producers"]);const t=r.ai;return t==null?[]:[{binding:p(t,e),kind:n,path:[],section:e}]},v=e=>h.flatMap(r=>E(r,e)),R=(e,r)=>{let n=e;for(const a of r)n=g(n,[a.section,...a.path,"remote"],!0);return n},i=()=>{},S=e=>{let r=!1;return()=>{if(!r){r=!0;try{f(e,{force:!0,recursive:!0})}catch{}}}};let c=0;const B=()=>(c+=1,`.wrangler.lunora-remote.${String(process.pid)}.${String(c)}.jsonc`),w=e=>{if(!e.enabled)return{cleanup:i,enabled:!1,remoteBindings:[]};const r=m(e.projectRoot);if(!r)return{cleanup:i,enabled:!0,reason:"wrangler.jsonc not found",remoteBindings:[]};const{parsed:n,text:a}=b(r);if(n===void 0)return{cleanup:i,enabled:!0,reason:`failed to parse ${r} as JSONC`,remoteBindings:[]};const t=v(n);if(t.length===0)return{cleanup:i,enabled:!0,reason:"no remote-eligible bindings to proxy",remoteBindings:[]};const o=y(e.projectRoot,B());return d(o,R(a,t),"utf8"),{cleanup:S(o),configPath:o,enabled:!0,remoteBindings:t}},j=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},x=e=>e.flag===!0||j(e.envValue)?!0:e.configPreference??!1;export{u as REMOTE_ELIGIBLE_KEYS,R as injectRemoteFlags,j as isRemoteEnvEnabled,w as materializeRemoteWranglerConfig,v as planRemoteBindings,x as resolveRemoteEnabled};
@@ -1 +1 @@
1
- import{existsSync as f,readFileSync as M}from"node:fs";import{dirname as A,join as p}from"node:path";import{WORKER_ENTRY_FALLBACKS as O}from"./inferLunoraBindings-KST9XCEe.mjs";import{discoverSchemaInfo as D}from"./discoverSchemaInfo-Bg2CUZXG.mjs";import{isCacheEnabled as x,WORKERS_CACHE_MIN_DATE as _}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{findWranglerFile as N,readWranglerJsonc as I}from"./WRANGLER_FILES-UNW-xY5u.mjs";const v="2026-04-07",Ie="web_socket_auto_reply_to_close",$=/^\d{4}-\d{2}-\d{2}$/,E=["d1_databases","durable_objects","kv_namespaces","queues","r2_buckets","secrets_store_secrets","services","tail_consumers","vars","vectorize","workflows"],S=["assets","compatibility_date","exports","logpush","main","migrations","observability","placement"],R=(e,s)=>{if(s===void 0)return{merged:e,unverifiedKeys:[]};const t=e.env?.[s];if(t===void 0){const c=Object.keys(e.env??{}).toSorted((r,l)=>r.localeCompare(l)),d=c.length>0?` (declared: ${c.join(", ")}).`:" (no environments are declared).";return{error:`--env "${s}" names no environment declared in wrangler.jsonc's "env" block${d}`,merged:e,unverifiedKeys:[]}}const n={...e},a=Object.keys(t).filter(c=>c!=="env");for(const c of a)S.includes(c)&&(n[c]=t[c]);for(const c of E)n[c]=t[c];const i=new Set([...E,...S]),o=a.filter(c=>!i.has(c)).map(String);return{merged:n,unverifiedKeys:o}},C=(e,s,t)=>{if(s.length===0)return;const n=e.vectorize??[],a=new Set(n.filter(Boolean).map(i=>i?.index_name));for(const i of s)a.has(i)||t.push(`schema declares vector index "${i}"; wrangler "vectorize" must include a binding with index_name "${i}"`)},L=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),T={disk_mb:2e4,memory_mib:12288,vcpu:4},B=(e,s,t)=>{const n=e.instance_type;if(n===void 0)return;if(typeof n=="string"){L.has(n)||t.push(`${s} has unknown instance_type "${n}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[c,d]of Object.entries(T)){const r=n[c];r!==void 0&&(typeof r!="number"||r<=0||r>d)&&t.push(`${s} custom instance_type ${c} must be a positive number ≤ ${String(d)} (got ${String(r)})`)}const{disk_mb:a,memory_mib:i,vcpu:o}=n;if(typeof o=="number"&&typeof i=="number"&&i<o*3072&&t.push(`${s} custom instance_type needs ≥ 3 GiB (3072 MiB) memory per vCPU (got ${String(i)} MiB for ${String(o)} vCPU)`),typeof i=="number"&&typeof a=="number"){const c=Math.floor(i/1024*2e3);a>c&&t.push(`${s} custom instance_type allows ≤ 2 GB disk per GiB memory (≤ ${String(c)} MB for ${String(i)} MiB memory; got ${String(a)} MB)`)}},W=(e,s,t)=>{const{boundClasses:n,errors:a,nonSqliteClasses:i,sqliteClasses:o,warnings:c}=t;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){a.push(`${s} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}(typeof e.image!="string"||e.image.length===0)&&a.push(`${s} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),n.has(e.class_name)||a.push(`${s} class "${e.class_name}" has no matching durable_objects binding — run \`lunora dev\` to auto-reconcile wrangler.jsonc, or add { "name": "...", "class_name": "${e.class_name}" }`),o.has(e.class_name)||a.push(i.has(e.class_name)?`${s} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${s} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),B(e,`${s} ("${e.class_name}")`,a),e.max_instances===void 0&&c.push(`${s} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},m=e=>typeof e=="string"&&e.length>0,b=e=>Array.isArray(e)?e.filter(s=>s!==null&&typeof s=="object"):[],h=e=>Array.isArray(e)?e.filter(s=>m(s)):[],q=e=>{const s=new Set;for(const t of b(e)){for(const n of h(t.new_classes))s.add(n);for(const n of h(t.new_sqlite_classes))s.add(n);for(const n of b(t.renamed_classes))m(n.from)&&m(n.to)&&(s.delete(n.from),s.add(n.to));for(const n of h(t.deleted_classes))s.delete(n)}return s},U=(e,s)=>{const t=q(e.migrations);for(const n of b(e.durable_objects?.bindings))n.script_name===void 0&&m(n.class_name)&&!t.has(n.class_name)&&s.push(`durable_objects.bindings declares class "${n.class_name}" but it is missing from migrations — add a migration entry with "new_sqlite_classes": ["${n.class_name}"] (or "new_classes" for a non-SQLite-backed class), or run \`lunora dev\` to auto-reconcile wrangler.jsonc`)},F=(e,s,t)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){s.push("containers must be an array of { class_name, image, ... } entries");return}const n=e.containers;if(n.length===0)return;const a=new Set(b(e.durable_objects?.bindings).map(d=>d.class_name)),i=e.migrations??[],o=new Set(i.flatMap(d=>[...d?.new_sqlite_classes??[]])),c=new Set(i.flatMap(d=>[...d?.new_classes??[]]));for(const[d,r]of n.entries())W(r,`containers[${String(d)}]`,{boundClasses:a,errors:s,nonSqliteClasses:c,sqliteClasses:o,warnings:t});e.observability?.enabled!==!0&&t.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},y=e=>e,g=(e,s,t,n)=>{if(e!==void 0){if(!Array.isArray(e)){n.push(t.arrayMessage);return}for(const[a,i]of y(e).entries()){const o=`${s}[${String(a)}]`;if(!i||typeof i!="object"){n.push(t.objectMessage(o));continue}for(const c of t.fields)m(i[c.field])||n.push(c.message(o))}}},P={arrayMessage:"workflows must be an array of { name, binding, class_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Workflow binding (e.g. WORKFLOW_ORDER_PIPELINE)`},{field:"class_name",message:e=>`${e} must have a non-empty "class_name" naming the exported WorkflowEntrypoint class`},{field:"name",message:e=>`${e} must have a non-empty "name" naming the deployed workflow`}],objectMessage:e=>`${e} must be a { name, binding, class_name } object`},K={arrayMessage:"queues.producers must be an array of { binding, queue } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Queue producer (e.g. QUEUE_EMAIL)`},{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the deployed queue`}],objectMessage:e=>`${e} must be a { binding, queue } object`},G={arrayMessage:"queues.consumers must be an array of { queue } entries",fields:[{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the consumed queue`}],objectMessage:e=>`${e} must be a { queue } object`},Y=(e,s)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){s.push("queues must be a { producers, consumers } object");return}g(e.queues.producers,"queues.producers",K,s),g(e.queues.consumers,"queues.consumers",G,s)}},H={arrayMessage:"secrets_store_secrets must be an array of { binding, store_id, secret_name } entries",fields:["binding","store_id","secret_name"].map(e=>({field:e,message:s=>`${s} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},Q=[{arrayMessage:"kv_namespaces must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the KV namespace binding`,hintField:"id",hintMessage:(e,s)=>`${e} ("${s}") has no "id" — run \`wrangler kv namespace create\` and set the namespace id, or the binding can't resolve`,key:"kv_namespaces"},{arrayMessage:"flagship must be an array of { binding, app_id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Flagship binding`,hintField:"app_id",hintMessage:(e,s)=>`${e} ("${s}") has no "app_id" — create a Flagship app and set its id, or the binding can't resolve`,key:"flagship"},{arrayMessage:"hyperdrive must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Hyperdrive binding`,hintField:"id",hintMessage:(e,s)=>`${e} ("${s}") has no "id" — run \`wrangler hyperdrive create\` and set the id, or the binding can't connect`,key:"hyperdrive"},{arrayMessage:"pipelines must be an array of { binding, stream } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Pipelines binding`,hintField:["stream","pipeline"],hintMessage:(e,s)=>`${e} ("${s}") has no "stream" — run \`wrangler pipelines create <name>\` and set the stream name, or the binding can't resolve`,key:"pipelines"},{arrayMessage:"analytics_engine_datasets must be an array of { binding, dataset } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Analytics Engine binding`,hintField:"dataset",hintMessage:(e,s)=>`${e} ("${s}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],V=(e,s,t,n)=>{const a=e[s.key];if(a!==void 0){if(!Array.isArray(a)){t.push(s.arrayMessage);return}for(const[i,o]of y(a).entries()){const c=`${s.key}[${String(i)}]`;if(!o||typeof o!="object"||!m(o.binding)){t.push(s.bindingMessage(c));continue}(typeof s.hintField=="string"?[s.hintField]:s.hintField).some(r=>m(o[r]))||n.push(s.hintMessage(c,o.binding))}}},z=[{key:"browser",message:'browser must be an object with a non-empty "binding" (e.g. { "binding": "BROWSER" })'},{key:"images",message:'images must be an object with a non-empty "binding" (e.g. { "binding": "IMAGES" })'}],X=(e,s,t)=>{const n=e[s.key];n!==void 0&&(typeof n!="object"||Array.isArray(n)||!m(n.binding))&&t.push(s.message)},J=[{arrayMessage:"services must be an array of { binding, service, entrypoint? } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the service binding`},{field:"service",message:e=>`${e} must have a non-empty "service" naming the target Worker`}],key:"services",objectMessage:e=>`${e} must be a { binding, service, entrypoint? } object`},{arrayMessage:"dispatch_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the dispatch namespace`}],key:"dispatch_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"mtls_certificates must be an array of { binding, certificate_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"certificate_id",message:e=>`${e} must have a non-empty "certificate_id" (upload via \`wrangler mtls-certificate upload\`)`}],key:"mtls_certificates",objectMessage:e=>`${e} must be a { binding, certificate_id } object`},{arrayMessage:"r2_buckets must be an array of { binding, bucket_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the R2 bucket binding`},{field:"bucket_name",message:e=>`${e} must have a non-empty "bucket_name" naming the deployed bucket`}],key:"r2_buckets",objectMessage:e=>`${e} must be a { binding, bucket_name } object`}],Z=(e,s)=>{const{d1_databases:t}=e;if(t!==void 0){if(!Array.isArray(t)){s.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[n,a]of y(t).entries()){const i=`d1_databases[${String(n)}]`;if(!a||typeof a!="object"){s.push(`${i} must be a { binding, database_id | database_name } object`);continue}m(a.binding)||s.push(`${i} must have a non-empty "binding" naming the D1 binding`),!m(a.database_id)&&!m(a.database_name)&&s.push(`${i} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},ee=(e,s,t)=>{const n=e.send_email;if(n===void 0)return;if(!Array.isArray(n)){s.push("send_email must be an array of { name, destination_address? } entries");return}const a=n;for(const[i,o]of a.entries())(!o||typeof o!="object"||typeof o.name!="string"||o.name.length===0)&&t.push(`send_email[${String(i)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},se=(e,s)=>{e.logpush!==void 0&&typeof e.logpush!="boolean"&&s.push('logpush must be a boolean (set "logpush": true to enable Cloudflare Logpush)')},ne=(e,s)=>{const{placement:t}=e;if(t!==void 0){if(typeof t!="object"||Array.isArray(t)){s.push('placement must be an object (e.g. { "mode": "smart" })');return}t.mode!==void 0&&t.mode!=="smart"&&s.push('placement.mode must be "smart" (the only supported Smart Placement mode)')}},te=(e,s)=>{const{observability:t}=e;if(t===void 0)return;if(typeof t!="object"||Array.isArray(t)){s.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}const n=(a,i)=>{a!==void 0&&(typeof a!="number"||Number.isNaN(a)||a<0||a>1)&&s.push(`${i} must be a number in [0, 1] (the fraction of requests sampled)`)};n(t.head_sampling_rate,"observability.head_sampling_rate"),t.logs!==void 0&&(typeof t.logs!="object"||Array.isArray(t.logs)?s.push("observability.logs must be an object"):n(t.logs.head_sampling_rate,"observability.logs.head_sampling_rate"))},ae=(e,s)=>{const{cache:t}=e;if(t!==void 0){if(typeof t!="object"||t===null||Array.isArray(t)){s.push('cache must be an object (e.g. { "enabled": true })');return}t.enabled!==void 0&&typeof t.enabled!="boolean"&&s.push("cache.enabled must be a boolean (true or false)")}},ie=(e,s)=>{const{exports:t}=e;if(t!==void 0){if(typeof t!="object"||t===null||Array.isArray(t)){s.push("exports must be an object keyed by entrypoint name");return}for(const[n,a]of Object.entries(t)){if(typeof a!="object"||a===null){s.push(`exports["${n}"] must be an object`);continue}a.type!==void 0&&typeof a.type!="string"&&s.push(`exports["${n}"].type must be a string`),a.cache!==void 0&&(typeof a.cache!="object"||a.cache===null||Array.isArray(a.cache)?s.push(`exports["${n}"].cache must be an object`):a.cache.enabled!==void 0&&typeof a.cache.enabled!="boolean"&&s.push(`exports["${n}"].cache.enabled must be a boolean`))}}},oe=(e,s)=>{const{assets:t}=e;if(t!==void 0){if(typeof t!="object"||Array.isArray(t)){s.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof t.directory!="string"||t.directory.length===0)&&s.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),t.binding!==void 0&&(typeof t.binding!="string"||t.binding.length===0)&&s.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),t.html_handling!==void 0&&typeof t.html_handling!="string"&&s.push("assets.html_handling must be a string"),t.not_found_handling!==void 0&&typeof t.not_found_handling!="string"&&s.push("assets.not_found_handling must be a string")}},re=(e,s)=>{const t=e.tail_consumers;if(t===void 0)return;if(!Array.isArray(t)){s.push("tail_consumers must be an array of { service, environment? } entries");return}const n=t;for(const[a,i]of n.entries())(!i||typeof i!="object"||typeof i.service!="string"||i.service.length===0)&&s.push(`tail_consumers[${String(a)}] must have a non-empty "service" naming the consumer Worker`)},Ce=(e,s)=>{const t=e.tail_consumers??[];return t.some(a=>!!a&&a?.service===s.service&&a?.environment===s.environment)?e:{...e,tail_consumers:[...t,s]}},ce=new Set(["1","enabled","on","true","yes"]),de=(e,s)=>{const{vars:t}=e;if(!t||typeof t!="object")return;const n=t.LUNORA_ALLOWED_ORIGINS,a=t.LUNORA_CORS_ALLOW_CREDENTIALS,i=typeof n=="string"&&n.split(",").some(c=>c.trim()==="*"),o=typeof a=="string"&&ce.has(a.trim().toLowerCase());i&&o&&s.push('vars.LUNORA_ALLOWED_ORIGINS includes a "*" wildcard while vars.LUNORA_CORS_ALLOW_CREDENTIALS is on — browsers reject this combination and it defeats the allowlist; name explicit origins or drop credentials')},le=(e,s,t)=>{const{error:n,merged:a,unverifiedKeys:i}=R(e,s);return n!==void 0?{error:n,wrangler:a}:(i.length>0&&t.push(`env.${String(s)} overrides ${i.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${i.length===1?"it":"them"} by hand for "${String(s)}".`),{wrangler:a})},k=(e,s,t)=>{const n=[],a=[];if(!e||typeof e!="object")return n.push("wrangler config is not a valid object"),{errors:n,valid:!1,warnings:a};const{error:i,wrangler:o}=le(e,t,a);if(i!==void 0)return n.push(i),{errors:n,valid:!1,warnings:a};b(o.durable_objects?.bindings).find(l=>l.name==="SHARD"&&l.class_name==="ShardDO")||n.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — run `lunora dev` to auto-reconcile wrangler.jsonc, or add the binding manually'),U(o,n);const r=o.compatibility_date??"";r&&!$.test(r)?n.push(`compatibility_date must be in YYYY-MM-DD format (got "${r}")`):r<v&&n.push(`compatibility_date must be >= "${v}" (got "${r||"<missing>"}")`),x(o)&&$.test(r)&&r<_&&n.push(`cache.enabled requires compatibility_date >= "${_}" (got "${r||"<missing>"}")`),s?.hasGlobalTable&&(b(o.d1_databases).find(w=>w.binding==="DB")||n.push('schema declares .global() tables; d1_databases must include a binding named "DB" — run `lunora dev` to auto-reconcile wrangler.jsonc, or add the binding manually')),Z(o,n),C(o,s?.vectorIndexNames??[],n),re(o,n),F(o,n,a),g(o.workflows,"workflows",P,n),Y(o,n),g(o.secrets_store_secrets,"secrets_store_secrets",H,n);for(const l of Q)V(o,l,n,a);for(const l of J)g(o[l.key],l.key,l,n);for(const l of z)X(o,l,n);return ee(o,n,a),se(o,n),ne(o,n),te(o,n),oe(o,n),ae(o,n),ie(o,n),de(o,n),{errors:n,valid:n.length===0,warnings:a}},Le=k,me=(e,s,t)=>{const n=[];for(const a of e){const i=a?.image;typeof i!="string"||!(i.startsWith("./")||i.startsWith("../")||i.startsWith("/")||i.includes("Dockerfile"))||f(i.startsWith("/")?i:p(s,i))||n.push(`containers image "${i}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`)}return n},ue=(e,s,t)=>{if(typeof e=="string"&&e.length>0){const n=p(A(t),e);return f(n)?n:void 0}return O.map(n=>p(s,n)).find(n=>f(n))},be=/\/\/[^\n]*|\/\*.*?\*\/|"[^"\n]*"|'[^'\n]*'|`[^`]*`/gsu,ge=e=>e.replaceAll(be,s=>s.replaceAll(/[^\n]/gu," ")),fe=/\bexport\s*\*\s*(?:as\s+\w+\s*)?from\b/u,pe=/\bexport\b/gu,he=/^\s*(?:(?:abstract|async|declare|default)\s+)*/u,ye=/^(?:class|const|function|let|var)\s+(?<name>[$A-Z_a-z][\w$]*)/u,_e=/^\s*(?:const|let|var)\s*\{/u,ve=/^[$A-Z_a-z][\w$]*/u,$e=/^type\b/u,Ee=/\s+/u,Se=e=>{const s=[];for(const t of e.split(",")){const n=t.trim().split(Ee).filter(Boolean),a=n.at(-1);a!==void 0&&n[0]!=="type"&&s.push(a)}return s},je=e=>{const s=[];for(const t of e.split(",")){const n=t.includes(":")?t.slice(t.indexOf(":")+1):t,a=ve.exec(n.trim());a&&s.push(a[0])}return s},j=e=>{const s=e.indexOf("{"),t=e.indexOf("}",s);return s===-1||t===-1?void 0:e.slice(s+1,t)},Ae=e=>{const s=e.trimStart();if($e.test(s))return[];if(s.startsWith("{")){const n=j(s);return n===void 0?[]:Se(n)}if(_e.test(e)){const n=j(e);return n===void 0?[]:je(n)}const t=ye.exec(e.replace(he,""));return t?.groups?.name===void 0?[]:[t.groups.name]},Re=e=>{const s=new Set;for(const t of e.matchAll(pe))for(const n of Ae(e.slice(t.index+6)))s.add(n);return s},ke=(e,s,t)=>{const n=ue(e.main,s,t);if(n===void 0)return[];let a;try{a=M(n,"utf8")}catch{return[]}const i=ge(a);if(fe.test(i))return[];const o=[];for(const r of b(e.durable_objects?.bindings))typeof r.class_name=="string"&&r.class_name.length>0&&r.script_name===void 0&&o.push({className:r.class_name,label:"durable_objects.bindings"});for(const r of e.workflows??[])typeof r?.class_name=="string"&&r.class_name.length>0&&r.script_name===void 0&&o.push({className:r.class_name,label:"workflows"});const c=Re(i);return o.filter(r=>!c.has(r.className)).map(r=>`${r.label} declares class "${r.className}" but the worker entry (${n}) does not export it — wrangler refuses to bundle a Worker whose Durable Object classes are not exported. Add \`export { ${r.className} } from "…";\` to the entry.`)},Te=e=>{const s=e.schemaDir??"lunora",t=N(e.projectRoot);if(!t){const u=`wrangler.jsonc not found in ${e.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[u],report:{errors:[u],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:n}=I(t);if(n===void 0){const u=`failed to parse ${t} as JSONC.`;return{problems:[u],report:{errors:[u],valid:!1,warnings:[]},wranglerPath:t}}const{error:a,merged:i}=R(n,e.environment);if(a!==void 0)return{problems:[a],report:{errors:[a],valid:!1,warnings:[]},wranglerPath:t};const{error:o,info:c}=D(e.projectRoot,s),d=k(n,c,e.environment);o!==void 0&&d.warnings.push(`schema parse failed in ${s}/schema.ts: ${o}`);const r=A(t);d.errors.push(...me(i.containers??[],r,t)),d.warnings.push(...ke(i,e.projectRoot,t));const l=i.assets?.directory;if(typeof l=="string"&&l.length>0){const u=l.startsWith("/")?l:p(r,l);f(u)||d.warnings.push(`assets.directory "${l}" does not exist yet — it is created by the client build; run the build before deploy`)}return d.valid=d.errors.length===0,{problems:d.errors,report:d,wranglerPath:t}};export{v as REQUIRED_COMPATIBILITY_DATE,Ie as REQUIRED_FLAG,Le as validateWrangler,k as validateWranglerConfig,Te as validateWranglerProject,Ce as withTailConsumer};
1
+ import{existsSync as f,readFileSync as M}from"node:fs";import{dirname as A,join as p}from"node:path";import{WORKER_ENTRY_FALLBACKS as O}from"./inferLunoraBindings-7kPfAt6p.mjs";import{discoverSchemaInfo as D}from"./discoverSchemaInfo-Bg2CUZXG.mjs";import{isCacheEnabled as x,WORKERS_CACHE_MIN_DATE as _}from"./WORKERS_CACHE_MIN_DATE-0k9ABJtF.mjs";import{findWranglerFile as N,readWranglerJsonc as I}from"./WRANGLER_FILES-UNW-xY5u.mjs";const v="2026-04-07",Ie="web_socket_auto_reply_to_close",$=/^\d{4}-\d{2}-\d{2}$/,E=["d1_databases","durable_objects","kv_namespaces","queues","r2_buckets","secrets_store_secrets","services","tail_consumers","vars","vectorize","workflows"],S=["assets","compatibility_date","exports","logpush","main","migrations","observability","placement"],R=(e,s)=>{if(s===void 0)return{merged:e,unverifiedKeys:[]};const t=e.env?.[s];if(t===void 0){const c=Object.keys(e.env??{}).toSorted((r,l)=>r.localeCompare(l)),d=c.length>0?` (declared: ${c.join(", ")}).`:" (no environments are declared).";return{error:`--env "${s}" names no environment declared in wrangler.jsonc's "env" block${d}`,merged:e,unverifiedKeys:[]}}const n={...e},a=Object.keys(t).filter(c=>c!=="env");for(const c of a)S.includes(c)&&(n[c]=t[c]);for(const c of E)n[c]=t[c];const i=new Set([...E,...S]),o=a.filter(c=>!i.has(c)).map(String);return{merged:n,unverifiedKeys:o}},C=(e,s,t)=>{if(s.length===0)return;const n=e.vectorize??[],a=new Set(n.filter(Boolean).map(i=>i?.index_name));for(const i of s)a.has(i)||t.push(`schema declares vector index "${i}"; wrangler "vectorize" must include a binding with index_name "${i}"`)},L=new Set(["basic","dev","lite","standard","standard-1","standard-2","standard-3","standard-4"]),T={disk_mb:2e4,memory_mib:12288,vcpu:4},B=(e,s,t)=>{const n=e.instance_type;if(n===void 0)return;if(typeof n=="string"){L.has(n)||t.push(`${s} has unknown instance_type "${n}" — expected lite, basic, standard-1..4, or a custom { vcpu, memory_mib, disk_mb } object`);return}for(const[c,d]of Object.entries(T)){const r=n[c];r!==void 0&&(typeof r!="number"||r<=0||r>d)&&t.push(`${s} custom instance_type ${c} must be a positive number ≤ ${String(d)} (got ${String(r)})`)}const{disk_mb:a,memory_mib:i,vcpu:o}=n;if(typeof o=="number"&&typeof i=="number"&&i<o*3072&&t.push(`${s} custom instance_type needs ≥ 3 GiB (3072 MiB) memory per vCPU (got ${String(i)} MiB for ${String(o)} vCPU)`),typeof i=="number"&&typeof a=="number"){const c=Math.floor(i/1024*2e3);a>c&&t.push(`${s} custom instance_type allows ≤ 2 GB disk per GiB memory (≤ ${String(c)} MB for ${String(i)} MiB memory; got ${String(a)} MB)`)}},W=(e,s,t)=>{const{boundClasses:n,errors:a,nonSqliteClasses:i,sqliteClasses:o,warnings:c}=t;if(!e||typeof e!="object"||typeof e.class_name!="string"||e.class_name.length===0){a.push(`${s} must have a non-empty "class_name" naming its container-enabled Durable Object class`);return}(typeof e.image!="string"||e.image.length===0)&&a.push(`${s} ("${e.class_name}") must have an "image" — a Dockerfile path or a registry reference`),n.has(e.class_name)||a.push(`${s} class "${e.class_name}" has no matching durable_objects binding — run \`lunora dev\` to auto-reconcile wrangler.jsonc, or add { "name": "...", "class_name": "${e.class_name}" }`),o.has(e.class_name)||a.push(i.has(e.class_name)?`${s} class "${e.class_name}" is registered via "new_classes" but containers require SQLite-backed DOs — move it to "new_sqlite_classes"`:`${s} class "${e.class_name}" is missing from migrations — add a migration entry with "new_sqlite_classes": ["${e.class_name}"]`),B(e,`${s} ("${e.class_name}")`,a),e.max_instances===void 0&&c.push(`${s} ("${e.class_name}") declares no max_instances — set a cap so a traffic spike can't fan out unbounded container spend`)},m=e=>typeof e=="string"&&e.length>0,b=e=>Array.isArray(e)?e.filter(s=>s!==null&&typeof s=="object"):[],h=e=>Array.isArray(e)?e.filter(s=>m(s)):[],q=e=>{const s=new Set;for(const t of b(e)){for(const n of h(t.new_classes))s.add(n);for(const n of h(t.new_sqlite_classes))s.add(n);for(const n of b(t.renamed_classes))m(n.from)&&m(n.to)&&(s.delete(n.from),s.add(n.to));for(const n of h(t.deleted_classes))s.delete(n)}return s},U=(e,s)=>{const t=q(e.migrations);for(const n of b(e.durable_objects?.bindings))n.script_name===void 0&&m(n.class_name)&&!t.has(n.class_name)&&s.push(`durable_objects.bindings declares class "${n.class_name}" but it is missing from migrations — add a migration entry with "new_sqlite_classes": ["${n.class_name}"] (or "new_classes" for a non-SQLite-backed class), or run \`lunora dev\` to auto-reconcile wrangler.jsonc`)},F=(e,s,t)=>{if(e.containers===void 0)return;if(!Array.isArray(e.containers)){s.push("containers must be an array of { class_name, image, ... } entries");return}const n=e.containers;if(n.length===0)return;const a=new Set(b(e.durable_objects?.bindings).map(d=>d.class_name)),i=e.migrations??[],o=new Set(i.flatMap(d=>[...d?.new_sqlite_classes??[]])),c=new Set(i.flatMap(d=>[...d?.new_classes??[]]));for(const[d,r]of n.entries())W(r,`containers[${String(d)}]`,{boundClasses:a,errors:s,nonSqliteClasses:c,sqliteClasses:o,warnings:t});e.observability?.enabled!==!0&&t.push('containers are configured but observability is not enabled — container logs will not be captured (add { "observability": { "enabled": true } })')},y=e=>e,g=(e,s,t,n)=>{if(e!==void 0){if(!Array.isArray(e)){n.push(t.arrayMessage);return}for(const[a,i]of y(e).entries()){const o=`${s}[${String(a)}]`;if(!i||typeof i!="object"){n.push(t.objectMessage(o));continue}for(const c of t.fields)m(i[c.field])||n.push(c.message(o))}}},P={arrayMessage:"workflows must be an array of { name, binding, class_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Workflow binding (e.g. WORKFLOW_ORDER_PIPELINE)`},{field:"class_name",message:e=>`${e} must have a non-empty "class_name" naming the exported WorkflowEntrypoint class`},{field:"name",message:e=>`${e} must have a non-empty "name" naming the deployed workflow`}],objectMessage:e=>`${e} must be a { name, binding, class_name } object`},K={arrayMessage:"queues.producers must be an array of { binding, queue } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the Queue producer (e.g. QUEUE_EMAIL)`},{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the deployed queue`}],objectMessage:e=>`${e} must be a { binding, queue } object`},G={arrayMessage:"queues.consumers must be an array of { queue } entries",fields:[{field:"queue",message:e=>`${e} must have a non-empty "queue" naming the consumed queue`}],objectMessage:e=>`${e} must be a { queue } object`},Y=(e,s)=>{if(e.queues!==void 0){if(typeof e.queues!="object"||Array.isArray(e.queues)){s.push("queues must be a { producers, consumers } object");return}g(e.queues.producers,"queues.producers",K,s),g(e.queues.consumers,"queues.consumers",G,s)}},H={arrayMessage:"secrets_store_secrets must be an array of { binding, store_id, secret_name } entries",fields:["binding","store_id","secret_name"].map(e=>({field:e,message:s=>`${s} must have a non-empty "${e}"`})),objectMessage:e=>`${e} must be a { binding, store_id, secret_name } object`},Q=[{arrayMessage:"kv_namespaces must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the KV namespace binding`,hintField:"id",hintMessage:(e,s)=>`${e} ("${s}") has no "id" — run \`wrangler kv namespace create\` and set the namespace id, or the binding can't resolve`,key:"kv_namespaces"},{arrayMessage:"flagship must be an array of { binding, app_id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Flagship binding`,hintField:"app_id",hintMessage:(e,s)=>`${e} ("${s}") has no "app_id" — create a Flagship app and set its id, or the binding can't resolve`,key:"flagship"},{arrayMessage:"hyperdrive must be an array of { binding, id } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Hyperdrive binding`,hintField:"id",hintMessage:(e,s)=>`${e} ("${s}") has no "id" — run \`wrangler hyperdrive create\` and set the id, or the binding can't connect`,key:"hyperdrive"},{arrayMessage:"pipelines must be an array of { binding, stream } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Pipelines binding`,hintField:["stream","pipeline"],hintMessage:(e,s)=>`${e} ("${s}") has no "stream" — run \`wrangler pipelines create <name>\` and set the stream name, or the binding can't resolve`,key:"pipelines"},{arrayMessage:"analytics_engine_datasets must be an array of { binding, dataset } entries",bindingMessage:e=>`${e} must have a non-empty "binding" naming the Analytics Engine binding`,hintField:"dataset",hintMessage:(e,s)=>`${e} ("${s}") has no "dataset" — it defaults to the binding name; set it explicitly to avoid drift`,key:"analytics_engine_datasets"}],V=(e,s,t,n)=>{const a=e[s.key];if(a!==void 0){if(!Array.isArray(a)){t.push(s.arrayMessage);return}for(const[i,o]of y(a).entries()){const c=`${s.key}[${String(i)}]`;if(!o||typeof o!="object"||!m(o.binding)){t.push(s.bindingMessage(c));continue}(typeof s.hintField=="string"?[s.hintField]:s.hintField).some(r=>m(o[r]))||n.push(s.hintMessage(c,o.binding))}}},z=[{key:"browser",message:'browser must be an object with a non-empty "binding" (e.g. { "binding": "BROWSER" })'},{key:"images",message:'images must be an object with a non-empty "binding" (e.g. { "binding": "IMAGES" })'}],X=(e,s,t)=>{const n=e[s.key];n!==void 0&&(typeof n!="object"||Array.isArray(n)||!m(n.binding))&&t.push(s.message)},J=[{arrayMessage:"services must be an array of { binding, service, entrypoint? } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the service binding`},{field:"service",message:e=>`${e} must have a non-empty "service" naming the target Worker`}],key:"services",objectMessage:e=>`${e} must be a { binding, service, entrypoint? } object`},{arrayMessage:"dispatch_namespaces must be an array of { binding, namespace } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"namespace",message:e=>`${e} must have a non-empty "namespace" naming the dispatch namespace`}],key:"dispatch_namespaces",objectMessage:e=>`${e} must be a { binding, namespace } object`},{arrayMessage:"mtls_certificates must be an array of { binding, certificate_id } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding"`},{field:"certificate_id",message:e=>`${e} must have a non-empty "certificate_id" (upload via \`wrangler mtls-certificate upload\`)`}],key:"mtls_certificates",objectMessage:e=>`${e} must be a { binding, certificate_id } object`},{arrayMessage:"r2_buckets must be an array of { binding, bucket_name } entries",fields:[{field:"binding",message:e=>`${e} must have a non-empty "binding" naming the R2 bucket binding`},{field:"bucket_name",message:e=>`${e} must have a non-empty "bucket_name" naming the deployed bucket`}],key:"r2_buckets",objectMessage:e=>`${e} must be a { binding, bucket_name } object`}],Z=(e,s)=>{const{d1_databases:t}=e;if(t!==void 0){if(!Array.isArray(t)){s.push("d1_databases must be an array of { binding, database_id | database_name } entries");return}for(const[n,a]of y(t).entries()){const i=`d1_databases[${String(n)}]`;if(!a||typeof a!="object"){s.push(`${i} must be a { binding, database_id | database_name } object`);continue}m(a.binding)||s.push(`${i} must have a non-empty "binding" naming the D1 binding`),!m(a.database_id)&&!m(a.database_name)&&s.push(`${i} must have a "database_id" or a "database_name" — run \`wrangler d1 create\` and set one, or the binding can't resolve`)}}},ee=(e,s,t)=>{const n=e.send_email;if(n===void 0)return;if(!Array.isArray(n)){s.push("send_email must be an array of { name, destination_address? } entries");return}const a=n;for(const[i,o]of a.entries())(!o||typeof o!="object"||typeof o.name!="string"||o.name.length===0)&&t.push(`send_email[${String(i)}] has no non-empty "name" naming the send-email binding — set one before deploying`)},se=(e,s)=>{e.logpush!==void 0&&typeof e.logpush!="boolean"&&s.push('logpush must be a boolean (set "logpush": true to enable Cloudflare Logpush)')},ne=(e,s)=>{const{placement:t}=e;if(t!==void 0){if(typeof t!="object"||Array.isArray(t)){s.push('placement must be an object (e.g. { "mode": "smart" })');return}t.mode!==void 0&&t.mode!=="smart"&&s.push('placement.mode must be "smart" (the only supported Smart Placement mode)')}},te=(e,s)=>{const{observability:t}=e;if(t===void 0)return;if(typeof t!="object"||Array.isArray(t)){s.push('observability must be an object (e.g. { "enabled": true, "head_sampling_rate": 1 })');return}const n=(a,i)=>{a!==void 0&&(typeof a!="number"||Number.isNaN(a)||a<0||a>1)&&s.push(`${i} must be a number in [0, 1] (the fraction of requests sampled)`)};n(t.head_sampling_rate,"observability.head_sampling_rate"),t.logs!==void 0&&(typeof t.logs!="object"||Array.isArray(t.logs)?s.push("observability.logs must be an object"):n(t.logs.head_sampling_rate,"observability.logs.head_sampling_rate"))},ae=(e,s)=>{const{cache:t}=e;if(t!==void 0){if(typeof t!="object"||t===null||Array.isArray(t)){s.push('cache must be an object (e.g. { "enabled": true })');return}t.enabled!==void 0&&typeof t.enabled!="boolean"&&s.push("cache.enabled must be a boolean (true or false)")}},ie=(e,s)=>{const{exports:t}=e;if(t!==void 0){if(typeof t!="object"||t===null||Array.isArray(t)){s.push("exports must be an object keyed by entrypoint name");return}for(const[n,a]of Object.entries(t)){if(typeof a!="object"||a===null){s.push(`exports["${n}"] must be an object`);continue}a.type!==void 0&&typeof a.type!="string"&&s.push(`exports["${n}"].type must be a string`),a.cache!==void 0&&(typeof a.cache!="object"||a.cache===null||Array.isArray(a.cache)?s.push(`exports["${n}"].cache must be an object`):a.cache.enabled!==void 0&&typeof a.cache.enabled!="boolean"&&s.push(`exports["${n}"].cache.enabled must be a boolean`))}}},oe=(e,s)=>{const{assets:t}=e;if(t!==void 0){if(typeof t!="object"||Array.isArray(t)){s.push('assets must be an object (e.g. { "directory": "./dist/client", "binding": "ASSETS" })');return}(typeof t.directory!="string"||t.directory.length===0)&&s.push('assets must declare a non-empty "directory" pointing at the built client output (e.g. "./dist/client")'),t.binding!==void 0&&(typeof t.binding!="string"||t.binding.length===0)&&s.push('assets.binding must be a non-empty string (e.g. "ASSETS")'),t.html_handling!==void 0&&typeof t.html_handling!="string"&&s.push("assets.html_handling must be a string"),t.not_found_handling!==void 0&&typeof t.not_found_handling!="string"&&s.push("assets.not_found_handling must be a string")}},re=(e,s)=>{const t=e.tail_consumers;if(t===void 0)return;if(!Array.isArray(t)){s.push("tail_consumers must be an array of { service, environment? } entries");return}const n=t;for(const[a,i]of n.entries())(!i||typeof i!="object"||typeof i.service!="string"||i.service.length===0)&&s.push(`tail_consumers[${String(a)}] must have a non-empty "service" naming the consumer Worker`)},Ce=(e,s)=>{const t=e.tail_consumers??[];return t.some(a=>!!a&&a?.service===s.service&&a?.environment===s.environment)?e:{...e,tail_consumers:[...t,s]}},ce=new Set(["1","enabled","on","true","yes"]),de=(e,s)=>{const{vars:t}=e;if(!t||typeof t!="object")return;const n=t.LUNORA_ALLOWED_ORIGINS,a=t.LUNORA_CORS_ALLOW_CREDENTIALS,i=typeof n=="string"&&n.split(",").some(c=>c.trim()==="*"),o=typeof a=="string"&&ce.has(a.trim().toLowerCase());i&&o&&s.push('vars.LUNORA_ALLOWED_ORIGINS includes a "*" wildcard while vars.LUNORA_CORS_ALLOW_CREDENTIALS is on — browsers reject this combination and it defeats the allowlist; name explicit origins or drop credentials')},le=(e,s,t)=>{const{error:n,merged:a,unverifiedKeys:i}=R(e,s);return n!==void 0?{error:n,wrangler:a}:(i.length>0&&t.push(`env.${String(s)} overrides ${i.join(", ")}, which this validator doesn't have a verified inheritance rule for — validated against the TOP-LEVEL value only. Double-check ${i.length===1?"it":"them"} by hand for "${String(s)}".`),{wrangler:a})},k=(e,s,t)=>{const n=[],a=[];if(!e||typeof e!="object")return n.push("wrangler config is not a valid object"),{errors:n,valid:!1,warnings:a};const{error:i,wrangler:o}=le(e,t,a);if(i!==void 0)return n.push(i),{errors:n,valid:!1,warnings:a};b(o.durable_objects?.bindings).find(l=>l.name==="SHARD"&&l.class_name==="ShardDO")||n.push('durable_objects.bindings must include { "name": "SHARD", "class_name": "ShardDO" } — run `lunora dev` to auto-reconcile wrangler.jsonc, or add the binding manually'),U(o,n);const r=o.compatibility_date??"";r&&!$.test(r)?n.push(`compatibility_date must be in YYYY-MM-DD format (got "${r}")`):r<v&&n.push(`compatibility_date must be >= "${v}" (got "${r||"<missing>"}")`),x(o)&&$.test(r)&&r<_&&n.push(`cache.enabled requires compatibility_date >= "${_}" (got "${r||"<missing>"}")`),s?.hasGlobalTable&&(b(o.d1_databases).find(w=>w.binding==="DB")||n.push('schema declares .global() tables; d1_databases must include a binding named "DB" — run `lunora dev` to auto-reconcile wrangler.jsonc, or add the binding manually')),Z(o,n),C(o,s?.vectorIndexNames??[],n),re(o,n),F(o,n,a),g(o.workflows,"workflows",P,n),Y(o,n),g(o.secrets_store_secrets,"secrets_store_secrets",H,n);for(const l of Q)V(o,l,n,a);for(const l of J)g(o[l.key],l.key,l,n);for(const l of z)X(o,l,n);return ee(o,n,a),se(o,n),ne(o,n),te(o,n),oe(o,n),ae(o,n),ie(o,n),de(o,n),{errors:n,valid:n.length===0,warnings:a}},Le=k,me=(e,s,t)=>{const n=[];for(const a of e){const i=a?.image;typeof i!="string"||!(i.startsWith("./")||i.startsWith("../")||i.startsWith("/")||i.includes("Dockerfile"))||f(i.startsWith("/")?i:p(s,i))||n.push(`containers image "${i}" does not exist (resolved relative to ${t}); create the Dockerfile or point image at a registry reference`)}return n},ue=(e,s,t)=>{if(typeof e=="string"&&e.length>0){const n=p(A(t),e);return f(n)?n:void 0}return O.map(n=>p(s,n)).find(n=>f(n))},be=/\/\/[^\n]*|\/\*.*?\*\/|"[^"\n]*"|'[^'\n]*'|`[^`]*`/gsu,ge=e=>e.replaceAll(be,s=>s.replaceAll(/[^\n]/gu," ")),fe=/\bexport\s*\*\s*(?:as\s+\w+\s*)?from\b/u,pe=/\bexport\b/gu,he=/^\s*(?:(?:abstract|async|declare|default)\s+)*/u,ye=/^(?:class|const|function|let|var)\s+(?<name>[$A-Z_a-z][\w$]*)/u,_e=/^\s*(?:const|let|var)\s*\{/u,ve=/^[$A-Z_a-z][\w$]*/u,$e=/^type\b/u,Ee=/\s+/u,Se=e=>{const s=[];for(const t of e.split(",")){const n=t.trim().split(Ee).filter(Boolean),a=n.at(-1);a!==void 0&&n[0]!=="type"&&s.push(a)}return s},je=e=>{const s=[];for(const t of e.split(",")){const n=t.includes(":")?t.slice(t.indexOf(":")+1):t,a=ve.exec(n.trim());a&&s.push(a[0])}return s},j=e=>{const s=e.indexOf("{"),t=e.indexOf("}",s);return s===-1||t===-1?void 0:e.slice(s+1,t)},Ae=e=>{const s=e.trimStart();if($e.test(s))return[];if(s.startsWith("{")){const n=j(s);return n===void 0?[]:Se(n)}if(_e.test(e)){const n=j(e);return n===void 0?[]:je(n)}const t=ye.exec(e.replace(he,""));return t?.groups?.name===void 0?[]:[t.groups.name]},Re=e=>{const s=new Set;for(const t of e.matchAll(pe))for(const n of Ae(e.slice(t.index+6)))s.add(n);return s},ke=(e,s,t)=>{const n=ue(e.main,s,t);if(n===void 0)return[];let a;try{a=M(n,"utf8")}catch{return[]}const i=ge(a);if(fe.test(i))return[];const o=[];for(const r of b(e.durable_objects?.bindings))typeof r.class_name=="string"&&r.class_name.length>0&&r.script_name===void 0&&o.push({className:r.class_name,label:"durable_objects.bindings"});for(const r of e.workflows??[])typeof r?.class_name=="string"&&r.class_name.length>0&&r.script_name===void 0&&o.push({className:r.class_name,label:"workflows"});const c=Re(i);return o.filter(r=>!c.has(r.className)).map(r=>`${r.label} declares class "${r.className}" but the worker entry (${n}) does not export it — wrangler refuses to bundle a Worker whose Durable Object classes are not exported. Add \`export { ${r.className} } from "…";\` to the entry.`)},Te=e=>{const s=e.schemaDir??"lunora",t=N(e.projectRoot);if(!t){const u=`wrangler.jsonc not found in ${e.projectRoot}; create one declaring at least the SHARD durable object binding.`;return{problems:[u],report:{errors:[u],valid:!1,warnings:[]},wranglerPath:void 0}}const{parsed:n}=I(t);if(n===void 0){const u=`failed to parse ${t} as JSONC.`;return{problems:[u],report:{errors:[u],valid:!1,warnings:[]},wranglerPath:t}}const{error:a,merged:i}=R(n,e.environment);if(a!==void 0)return{problems:[a],report:{errors:[a],valid:!1,warnings:[]},wranglerPath:t};const{error:o,info:c}=D(e.projectRoot,s),d=k(n,c,e.environment);o!==void 0&&d.warnings.push(`schema parse failed in ${s}/schema.ts: ${o}`);const r=A(t);d.errors.push(...me(i.containers??[],r,t)),d.warnings.push(...ke(i,e.projectRoot,t));const l=i.assets?.directory;if(typeof l=="string"&&l.length>0){const u=l.startsWith("/")?l:p(r,l);f(u)||d.warnings.push(`assets.directory "${l}" does not exist yet — it is created by the client build; run the build before deploy`)}return d.valid=d.errors.length===0,{problems:d.errors,report:d,wranglerPath:t}};export{v as REQUIRED_COMPATIBILITY_DATE,Ie as REQUIRED_FLAG,Le as validateWrangler,k as validateWranglerConfig,Te as validateWranglerProject,Ce as withTailConsumer};
@@ -1 +1 @@
1
- import{inferLunoraBindings as c}from"./inferLunoraBindings-KST9XCEe.mjs";import{reconcileWranglerBindings as p}from"./collectExportGaps-DHLZ7ulq.mjs";import{reconcileWranglerCompatibilityDate as g}from"./reconcileWranglerCompatibilityDate-7OO_xaKR.mjs";import{reconcileWranglerCrons as m}from"./reconcileWranglerCrons-COMb6ICf.mjs";const l=(n,r)=>{const e=n.durableObjects.map(o=>({className:o.className,exported:!0,name:o.binding})),a=n.queues.map(o=>({name:o.name})),i=n.workflows.map(o=>({exported:o.exported,name:o.exportName}));return{containers:n.containers.map(o=>({exported:o.exported,name:o.exportName})),crons:[...r],globalDatabase:n.needsD1,keyValueStore:n.usesKv,objectStorage:n.usesStorage,queues:a,shardNamespaces:e,signals:[...n.signals],workflows:i}},s=(n,r)=>{try{const e=r();return{added:e.added??[],changed:e.changed,configPath:e.wranglerPath,warnings:e.warnings??[]}}catch(e){const a=e instanceof Error?e.message:String(e);return{added:[],changed:!1,warnings:[`${n} skipped: ${a}`]}}},f={deploy:n=>{const r=n.preview===!0?["versions","upload"]:["deploy"];return n.entry!==void 0&&r.push(n.entry),n.environment!==void 0&&r.push("--env",n.environment),n.temporary===!0&&r.push("--temporary"),n.dryRun===!0&&r.push("--dry-run"),n.outDir!==void 0&&r.push("--outdir",n.outDir,"--metafile"),{args:r,tool:"wrangler"}},dev:n=>{const r=["dev"];return n.configPath!==void 0&&r.push("--config",n.configPath),n.environment!==void 0&&r.push("--env",n.environment),r.push(...n.extraArgs??[]),{args:r,tool:"wrangler"}},secretList:n=>{const r=["secret","list","--format","json"];return n.environment!==void 0&&r.push("--env",n.environment),n.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}},secretPut:n=>{const r=["secret","put",n.key??""];return n.environment!==void 0&&r.push("--env",n.environment),n.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}},tail:n=>{const r=["tail"];return n.worker!==void 0&&r.push(n.worker),n.environment!==void 0&&r.push("--env",n.environment),n.format!==void 0&&r.push("--format",n.format),n.status!==void 0&&r.push("--status",n.status),n.search!==void 0&&r.push("--search",n.search),n.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}}},w={id:"cloudflare",infer:async n=>{const r=await c({projectRoot:n.projectRoot});return l(r,n.crons??[])},name:"Cloudflare",provision:async n=>{const r=n.crons??[],e=await(async()=>{try{const o=await c({projectRoot:n.projectRoot});return s("binding inference",()=>p(n.projectRoot,o))}catch(o){const d=o instanceof Error?o.message:String(o);return{added:[],changed:!1,warnings:[`binding inference skipped: ${d}`]}}})(),a=s("compatibility date sync",()=>g(n.projectRoot)),i=s("cron trigger sync",()=>m(n.projectRoot,r)),t=[e,{...a,added:a.changed?["compatibility_date"]:[]},{...i,added:i.changed?[`${String(r.length)} cron trigger(s)`]:[]}];return{added:t.flatMap(o=>o.added),changed:t.some(o=>o.changed),configPath:t.find(o=>o.configPath!==void 0)?.configPath,warnings:t.flatMap(o=>o.warnings)}},toolchain:f};export{w as C,l as t};
1
+ import{inferLunoraBindings as c}from"./inferLunoraBindings-7kPfAt6p.mjs";import{reconcileWranglerBindings as p}from"./collectExportGaps-DHLZ7ulq.mjs";import{reconcileWranglerCompatibilityDate as g}from"./reconcileWranglerCompatibilityDate-7OO_xaKR.mjs";import{reconcileWranglerCrons as m}from"./reconcileWranglerCrons-COMb6ICf.mjs";const l=(n,r)=>{const e=n.durableObjects.map(o=>({className:o.className,exported:!0,name:o.binding})),a=n.queues.map(o=>({name:o.name})),i=n.workflows.map(o=>({exported:o.exported,name:o.exportName}));return{containers:n.containers.map(o=>({exported:o.exported,name:o.exportName})),crons:[...r],globalDatabase:n.needsD1,keyValueStore:n.usesKv,objectStorage:n.usesStorage,queues:a,shardNamespaces:e,signals:[...n.signals],workflows:i}},s=(n,r)=>{try{const e=r();return{added:e.added??[],changed:e.changed,configPath:e.wranglerPath,warnings:e.warnings??[]}}catch(e){const a=e instanceof Error?e.message:String(e);return{added:[],changed:!1,warnings:[`${n} skipped: ${a}`]}}},f={deploy:n=>{const r=n.preview===!0?["versions","upload"]:["deploy"];return n.entry!==void 0&&r.push(n.entry),n.environment!==void 0&&r.push("--env",n.environment),n.temporary===!0&&r.push("--temporary"),n.dryRun===!0&&r.push("--dry-run"),n.outDir!==void 0&&r.push("--outdir",n.outDir,"--metafile"),{args:r,tool:"wrangler"}},dev:n=>{const r=["dev"];return n.configPath!==void 0&&r.push("--config",n.configPath),n.environment!==void 0&&r.push("--env",n.environment),r.push(...n.extraArgs??[]),{args:r,tool:"wrangler"}},secretList:n=>{const r=["secret","list","--format","json"];return n.environment!==void 0&&r.push("--env",n.environment),n.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}},secretPut:n=>{const r=["secret","put",n.key??""];return n.environment!==void 0&&r.push("--env",n.environment),n.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}},tail:n=>{const r=["tail"];return n.worker!==void 0&&r.push(n.worker),n.environment!==void 0&&r.push("--env",n.environment),n.format!==void 0&&r.push("--format",n.format),n.status!==void 0&&r.push("--status",n.status),n.search!==void 0&&r.push("--search",n.search),n.temporary===!0&&r.push("--temporary"),{args:r,tool:"wrangler"}}},w={id:"cloudflare",infer:async n=>{const r=await c({projectRoot:n.projectRoot});return l(r,n.crons??[])},name:"Cloudflare",provision:async n=>{const r=n.crons??[],e=await(async()=>{try{const o=await c({projectRoot:n.projectRoot});return s("binding inference",()=>p(n.projectRoot,o))}catch(o){const d=o instanceof Error?o.message:String(o);return{added:[],changed:!1,warnings:[`binding inference skipped: ${d}`]}}})(),a=s("compatibility date sync",()=>g(n.projectRoot)),i=s("cron trigger sync",()=>m(n.projectRoot,r)),t=[e,{...a,added:a.changed?["compatibility_date"]:[]},{...i,added:i.changed?[`${String(r.length)} cron trigger(s)`]:[]}];return{added:t.flatMap(o=>o.added),changed:t.some(o=>o.changed),configPath:t.find(o=>o.configPath!==void 0)?.configPath,warnings:t.flatMap(o=>o.warnings)}},toolchain:f};export{w as C,l as t};
@@ -0,0 +1 @@
1
+ import{existsSync as p,statSync as v,readFileSync as f,readdirSync as B}from"node:fs";import{init as k,parse as g}from"es-module-lexer";import{discoverAgentInfo as $}from"./discoverAgentInfo-CTdCSfYM.mjs";import{WRANGLER_FILES as F,readWranglerJsonc as Y}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{discoverContainerInfo as j}from"./discoverContainerInfo-EhZtEBQs.mjs";import{escapeRegExp as T}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{discoverFlags as U,FLAGS_FILENAME as K,discoverQueues as W,QUEUES_FILENAME as M}from"@lunora/codegen";import{d as w}from"./discover-info-Vj9d4qYt.mjs";import{discoverSchemaInfo as X}from"./discoverSchemaInfo-Bg2CUZXG.mjs";import{discoverWorkflowInfo as G}from"./discoverWorkflowInfo-BsPvlo6O.mjs";import{join as c}from"node:path";const H=(e,s)=>{const{error:t,value:r}=w(e,s,K,U);return t===void 0?{flags:r}:{error:t}},V=(e,s)=>{const{error:t,value:r}=w(e,s,M,W);return t===void 0?{queues:r??[]}:{error:t,queues:[]}},q=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),J=new Set([".git",".lunora-cache",".wrangler","_generated","dist","node_modules"]),Q=["lunora","src"],z=["src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],_={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD"},N=Object.keys(_),Z={SchedulerDO:/\btype\s+SchedulerDO\b/,SessionDO:/\btype\s+SessionDO\b/,ShardDO:/\btype\s+ShardDO\b/},ee=/\benv\s*\.\s*DB\b/,se=/\benv\s*\.\s*AI\b/,D=/\bctx\s*\.\s*pipelines\b/,C=/^\s*import\s+type\b/,re=new Set(["@lunora/agent","@lunora/agent/sandbox"]),te=e=>{const s=e.indexOf("{");if(s===-1)return"";const t=e.indexOf("}",s+1);return t===-1?e.slice(s+1):e.slice(s+1,t)},ne=/\btype\s+browserTool\b/,oe=/\bbrowserTool\b/,ae=/import\s+\{[^}]*\bbrowserTool\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']/,ie=e=>{if(C.test(e))return!1;const s=te(e);return oe.test(s)&&!ne.test(s)},ce=e=>{try{const[s]=g(e);return s.some(t=>t.n!==void 0&&re.has(t.n)&&ie(e.slice(t.ss,t.se)))}catch{return ae.test(e)}},h={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"},usesPayment:{pattern:/\bfrom\s+["']@lunora\/payment["']/,source:"@lunora/payment"},usesPipelines:{pattern:D,source:"@lunora/bindings/pipelines"},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"}},m=Object.keys(h),ue="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",P=[...m,"needsD1"],de=()=>{const e={};for(const s of P)e[s]=!1;return e},d=Object.freeze(de()),x=(e,s)=>{const t={};for(const r of P)t[r]=e[r]||s[r];return t},le=e=>{for(const s of m)if(h[s].source===e)return{...d,[s]:!0};return d},pe=e=>{const[s]=g(e);let t=d;for(const r of s){const n=r.n;!n||C.test(e.slice(r.ss,r.se))||(t=x(t,le(n)))}return t},me=e=>{const s={...d};for(const t of m)s[t]=h[t].pattern.test(e);return s},be=e=>{let s;try{s=pe(e)}catch{s=me(e)}return x(s,{...d,needsD1:ee.test(e),usesAi:se.test(e),usesPipelines:D.test(e)})},y=(e,s)=>{let t;try{t=B(e,{withFileTypes:!0})}catch{return}for(const r of t){if(r.isDirectory()){J.has(r.name)||y(c(e,r.name),s);continue}const n=r.name.lastIndexOf(".");n!==-1&&q.has(r.name.slice(n))&&s.push(c(e,r.name))}},fe="virtual:lunora/worker",ge=["ShardDO"],he=e=>{for(const s of F){const t=c(e,s);if(!p(t))continue;const{parsed:r}=Y(t),n=r?.main;if(n===fe)return{composed:!0};if(typeof n=="string"&&p(c(e,n)))return{composed:!1,path:c(e,n)};break}for(const s of z){const t=c(e,s);if(p(t))return{composed:!1,path:t}}return{composed:!1}},Ee=e=>{const s=f(e,"utf8");let t;try{const[,r]=g(s);t=new Set(r.map(n=>n.n))}catch{t=new Set(N.filter(r=>new RegExp(String.raw`\bexport\b[^\n;]*\b${r}\b`).test(s)))}return N.filter(r=>t.has(r)&&!Z[r].test(s)).map(r=>({binding:_[r],className:r}))},Se=/(?:^|[\s,{])type$/u,_e=(e,s)=>{const t=s.ls>=0?s.ls:s.s;return Se.test(e.slice(0,t).trimEnd())},xe=(e,s)=>{const t=T(s);return new RegExp(String.raw`\bexport\s+type\s+${t}\b`,"u").test(e)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${t}\b`,"u").test(e)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${t}\b`,"u").test(e)},S=(e,s,t)=>{if(s.length===0)return[];if(e.composed)return s.map(o=>({...o,exported:!0}));if(e.path===void 0)return s.map(o=>({...o,exported:!1}));const r=f(e.path,"utf8"),n=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${t}(?:\.js)?["']`).test(r);let a;try{const[,o]=g(r);a=new Set(o.filter(i=>!_e(r,i)).map(i=>i.n))}catch{a=new Set(s.map(o=>o.className).filter(o=>new RegExp(String.raw`\bexport\b[^\n;]*\b${T(o)}\b`,"u").test(r)&&!xe(r,o)))}return s.map(o=>{const i=n||a.has(o.className);return{...o,exported:i}})},ye=(e,s)=>X(e,s).info?.hasGlobalTable??!1,Re=(e,s)=>{let t=d;for(const r of s){const n=c(e,r);if(!p(n)||!v(n).isDirectory())continue;const a=[];y(n,a);for(const o of a)t=x(t,be(f(o,"utf8")))}return t},Oe=(e,s)=>{const t=c(e,s);if(!p(t)||!v(t).isDirectory())return!1;const r=[];return y(t,r),r.some(n=>ce(f(n,"utf8")))},Ie=(e,s,t)=>[...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"\``),...t.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"\``)],Ae=(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.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),Ne=(e,s,t,r=[],n=[],a=[])=>{const o=new Set(e.map(u=>u.className)),i=e.map(u=>`${u.binding}/${u.className} (exported by worker entry)`);return s&&i.push("DB (.global() table declared)"),i.push(...Ie(r,n,a),...Ae(t,o)),i},Ye=async e=>{await k;const s=e.schemaDir??"lunora",t=e.scanDirs??Q,r=Re(e.projectRoot,t),n={...r,usesBrowser:r.usesBrowser||Oe(e.projectRoot,s)},a=he(e.projectRoot);let o;a.composed?o=ge.map(l=>({binding:_[l],className:l})):o=a.path===void 0?[]:Ee(a.path);const i=n.needsD1||ye(e.projectRoot,s),u=S(a,j(e.projectRoot,s).containers,"containers"),R=S(a,G(e.projectRoot,s).workflows,"workflows"),O=S(a,$(e.projectRoot,s).agents,"agents"),L=[...V(e.projectRoot,s).queues],{flags:b}=H(e.projectRoot,s),E=b?.provider==="flagship"&&b.mode==="binding"?b.bindingName:void 0,I={};for(const l of m)I[l]=n[l];const A=Ne(o,i,n,u,R,O);return E!==void 0&&A.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${E}", app_id }) — the app_id can't be auto-provisioned`),{agents:O,containers:u,durableObjects:o,flagshipBinding:E,needsD1:i,queues:L,signals:A,usesFlags:b!==void 0,workflows:R,...I}},je=e=>{const s=[];for(const t of m)e[t]&&s.push(h[t].source);return s};export{fe as LUNORA_WORKER_VIRTUAL_ID,z as WORKER_ENTRY_FALLBACKS,Ye as inferLunoraBindings,_e as isTypeOnlyExportEntry,je as packageNamesFromBindings,he as resolveWorkerEntry};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/config",
3
- "version": "1.0.0-alpha.177",
3
+ "version": "1.0.0-alpha.178",
4
4
  "description": "Internal shared CLI + Vite config layer for Lunora: wrangler.jsonc validation, binding inference, and .dev.vars scaffolding",
5
5
  "keywords": [
6
6
  "bindings",
@@ -54,10 +54,10 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@lunora/codegen": "1.0.0-alpha.143",
57
+ "@lunora/codegen": "1.0.0-alpha.144",
58
58
  "@lunora/container": "1.0.0-alpha.37",
59
59
  "@lunora/errors": "1.0.0-alpha.26",
60
- "@lunora/seed": "1.0.0-alpha.95",
60
+ "@lunora/seed": "1.0.0-alpha.96",
61
61
  "@visulima/colorize": "2.1.1",
62
62
  "@visulima/find-ai-runner": "1.0.1",
63
63
  "@visulima/package": "5.0.12",
@@ -1 +0,0 @@
1
- import{writeFileSync as p,rmSync as d}from"node:fs";import{a as f}from"./jsonc-edit-BZgQIdAH.mjs";import{findWranglerFile as m,readWranglerJsonc as g}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{join as b}from"node:path";const c={ai:{label:"AI",shape:"object"},d1_databases:{label:"D1",shape:"array"},kv_namespaces:{label:"KV",shape:"array"},queues:{label:"Queue",shape:"producers"},r2_buckets:{label:"R2",shape:"array"},services:{label:"Service",shape:"array"},vectorize:{label:"Vectorize",shape:"array"}},y=Object.keys(c),u=(e,r)=>typeof e.binding=="string"?e.binding:r,l=(e,r,n,a)=>{const t=[];for(const[o,i]of r.entries())i!=null&&t.push({binding:u(i,`#${String(o)}`),kind:n,path:[...a,o],section:e});return t},h=(e,r)=>{const{label:n,shape:a}=c[e];if(a==="array"){const o=r[e]??[];return l(e,o,n,[])}if(a==="producers")return l(e,r.queues?.producers??[],n,["producers"]);const t=r.ai;return t==null?[]:[{binding:u(t,e),kind:n,path:[],section:e}]},E=e=>y.flatMap(r=>h(r,e)),v=(e,r)=>{let n=e;for(const a of r)n=f(n,[a.section,...a.path,"remote"],!0);return n},s=()=>{},R=e=>{let r=!1;return()=>{if(!r){r=!0;try{d(e,{force:!0,recursive:!0})}catch{}}}},B=()=>`.wrangler.lunora-remote.${String(process.pid)}.jsonc`,L=e=>{if(!e.enabled)return{cleanup:s,enabled:!1,remoteBindings:[]};const r=m(e.projectRoot);if(!r)return{cleanup:s,enabled:!0,reason:"wrangler.jsonc not found",remoteBindings:[]};const{parsed:n,text:a}=g(r);if(n===void 0)return{cleanup:s,enabled:!0,reason:`failed to parse ${r} as JSONC`,remoteBindings:[]};const t=E(n);if(t.length===0)return{cleanup:s,enabled:!0,reason:"no remote-eligible bindings to proxy",remoteBindings:[]};const o=b(e.projectRoot,B());return p(o,v(a,t),"utf8"),{cleanup:R(o),configPath:o,enabled:!0,remoteBindings:t}},S=e=>{if(e===void 0)return!1;const r=e.trim().toLowerCase();return r==="1"||r==="true"},w=e=>e.flag===!0||S(e.envValue)?!0:e.configPreference??!1;export{c as REMOTE_ELIGIBLE_KEYS,v as injectRemoteFlags,S as isRemoteEnvEnabled,L as materializeRemoteWranglerConfig,E as planRemoteBindings,w as resolveRemoteEnabled};
@@ -1 +0,0 @@
1
- import{existsSync as l,statSync as v,readFileSync as b,readdirSync as B}from"node:fs";import{init as k,parse as f}from"es-module-lexer";import{discoverAgentInfo as $}from"./discoverAgentInfo-CTdCSfYM.mjs";import{WRANGLER_FILES as F,readWranglerJsonc as j}from"./WRANGLER_FILES-UNW-xY5u.mjs";import{discoverContainerInfo as Y}from"./discoverContainerInfo-EhZtEBQs.mjs";import{escapeRegExp as A}from"./DEV_VARS_EXAMPLE_FILE-CqLorAxT.mjs";import{discoverFlags as K,FLAGS_FILENAME as U,discoverQueues as W,QUEUES_FILENAME as M}from"@lunora/codegen";import{d as w}from"./discover-info-Vj9d4qYt.mjs";import{discoverSchemaInfo as X}from"./discoverSchemaInfo-Bg2CUZXG.mjs";import{discoverWorkflowInfo as G}from"./discoverWorkflowInfo-BsPvlo6O.mjs";import{join as c}from"node:path";const H=(e,s)=>{const{error:t,value:r}=w(e,s,U,K);return t===void 0?{flags:r}:{error:t}},q=(e,s)=>{const{error:t,value:r}=w(e,s,M,W);return t===void 0?{queues:r??[]}:{error:t,queues:[]}},Q=new Set([".cjs",".cts",".js",".jsx",".mjs",".mts",".ts",".tsx"]),V=new Set([".git",".lunora-cache",".wrangler","_generated","dist","node_modules"]),J=["lunora","src"],z=["src/server/index.ts","src/server/index.tsx","src/index.ts","src/worker.ts"],T={SchedulerDO:"SCHEDULER",SessionDO:"SESSION",ShardDO:"SHARD"},N=Object.keys(T),Z={SchedulerDO:/\btype\s+SchedulerDO\b/,SessionDO:/\btype\s+SessionDO\b/,ShardDO:/\btype\s+ShardDO\b/},ee=/\benv\s*\.\s*DB\b/,se=/\benv\s*\.\s*AI\b/,D=/\bctx\s*\.\s*pipelines\b/,P=/^\s*import\s+type\b/,re=new Set(["@lunora/agent","@lunora/agent/sandbox"]),te=e=>{const s=e.indexOf("{");if(s===-1)return"";const t=e.indexOf("}",s+1);return t===-1?e.slice(s+1):e.slice(s+1,t)},ne=/\btype\s+browserTool\b/,oe=/\bbrowserTool\b/,ae=/import\s+\{[^}]*\bbrowserTool\b[^}]*\}\s+from\s+["']@lunora\/agent(?:\/sandbox)?["']/,ie=e=>{if(P.test(e))return!1;const s=te(e);return oe.test(s)&&!ne.test(s)},ce=e=>{try{const[s]=f(e);return s.some(t=>t.n!==void 0&&re.has(t.n)&&ie(e.slice(t.ss,t.se)))}catch{return ae.test(e)}},g={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"},usesPayment:{pattern:/\bfrom\s+["']@lunora\/payment["']/,source:"@lunora/payment"},usesPipelines:{pattern:D,source:"@lunora/bindings/pipelines"},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"}},p=Object.keys(g),ue="STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET (Stripe) or POLAR_ACCESS_TOKEN + POLAR_WEBHOOK_SECRET (Polar)",C=[...p,"needsD1"],de=()=>{const e={};for(const s of C)e[s]=!1;return e},d=Object.freeze(de()),S=(e,s)=>{const t={};for(const r of C)t[r]=e[r]||s[r];return t},le=e=>{for(const s of p)if(g[s].source===e)return{...d,[s]:!0};return d},pe=e=>{const[s]=f(e);let t=d;for(const r of s){const n=r.n;!n||P.test(e.slice(r.ss,r.se))||(t=S(t,le(n)))}return t},me=e=>{const s={...d};for(const t of p)s[t]=g[t].pattern.test(e);return s},be=e=>{let s;try{s=pe(e)}catch{s=me(e)}return S(s,{...d,needsD1:ee.test(e),usesAi:se.test(e),usesPipelines:D.test(e)})},y=(e,s)=>{let t;try{t=B(e,{withFileTypes:!0})}catch{return}for(const r of t){if(r.isDirectory()){V.has(r.name)||y(c(e,r.name),s);continue}const n=r.name.lastIndexOf(".");n!==-1&&Q.has(r.name.slice(n))&&s.push(c(e,r.name))}},fe=e=>{for(const s of F){const t=c(e,s);if(!l(t))continue;const{parsed:r}=j(t),n=r?.main;if(typeof n=="string"&&l(c(e,n)))return c(e,n);break}for(const s of z){const t=c(e,s);if(l(t))return t}},ge=e=>{const s=b(e,"utf8");let t;try{const[,r]=f(s);t=new Set(r.map(n=>n.n))}catch{t=new Set(N.filter(r=>new RegExp(String.raw`\bexport\b[^\n;]*\b${r}\b`).test(s)))}return N.filter(r=>t.has(r)&&!Z[r].test(s)).map(r=>({binding:T[r],className:r}))},he=/(?:^|[\s,{])type$/u,Ee=(e,s)=>{const t=s.ls>=0?s.ls:s.s;return he.test(e.slice(0,t).trimEnd())},Se=(e,s)=>{const t=A(s);return new RegExp(String.raw`\bexport\s+type\s+${t}\b`,"u").test(e)||new RegExp(String.raw`\bexport\s+type\s*\{[^}]*\b${t}\b`,"u").test(e)||new RegExp(String.raw`\bexport\s+\{[^}]*\btype\s+${t}\b`,"u").test(e)},E=(e,s,t)=>{if(s.length===0)return[];if(e===void 0)return s.map(o=>({...o,exported:!1}));const r=b(e,"utf8"),n=new RegExp(String.raw`\bexport\s*\*\s*from\s*["'][^"']*_generated\/${t}(?:\.js)?["']`).test(r);let a;try{const[,o]=f(r);a=new Set(o.filter(i=>!Ee(r,i)).map(i=>i.n))}catch{a=new Set(s.map(o=>o.className).filter(o=>new RegExp(String.raw`\bexport\b[^\n;]*\b${A(o)}\b`,"u").test(r)&&!Se(r,o)))}return s.map(o=>{const i=n||a.has(o.className);return{...o,exported:i}})},ye=(e,s)=>X(e,s).info?.hasGlobalTable??!1,xe=(e,s)=>{let t=d;for(const r of s){const n=c(e,r);if(!l(n)||!v(n).isDirectory())continue;const a=[];y(n,a);for(const o of a)t=S(t,be(b(o,"utf8")))}return t},_e=(e,s)=>{const t=c(e,s);if(!l(t)||!v(t).isDirectory())return!1;const r=[];return y(t,r),r.some(n=>ce(b(n,"utf8")))},Re=(e,s,t)=>[...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"\``),...t.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"\``)],Ie=(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.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),Oe=(e,s,t,r=[],n=[],a=[])=>{const o=new Set(e.map(u=>u.className)),i=e.map(u=>`${u.binding}/${u.className} (exported by worker entry)`);return s&&i.push("DB (.global() table declared)"),i.push(...Re(r,n,a),...Ie(t,o)),i},$e=async e=>{await k;const s=e.schemaDir??"lunora",t=e.scanDirs??J,r=xe(e.projectRoot,t),n={...r,usesBrowser:r.usesBrowser||_e(e.projectRoot,s)},a=fe(e.projectRoot),o=a?ge(a):[],i=n.needsD1||ye(e.projectRoot,s),u=E(a,Y(e.projectRoot,s).containers,"containers"),x=E(a,G(e.projectRoot,s).workflows,"workflows"),_=E(a,$(e.projectRoot,s).agents,"agents"),L=[...q(e.projectRoot,s).queues],{flags:m}=H(e.projectRoot,s),h=m?.provider==="flagship"&&m.mode==="binding"?m.bindingName:void 0,R={};for(const O of p)R[O]=n[O];const I=Oe(o,i,n,u,x,_);return h!==void 0&&I.push(`hint: lunora/flags.ts uses Flagship in binding mode; add a flagship binding ({ binding: "${h}", app_id }) — the app_id can't be auto-provisioned`),{agents:_,containers:u,durableObjects:o,flagshipBinding:h,needsD1:i,queues:L,signals:I,usesFlags:m!==void 0,workflows:x,...R}},Fe=e=>{const s=[];for(const t of p)e[t]&&s.push(g[t].source);return s};export{z as WORKER_ENTRY_FALLBACKS,$e as inferLunoraBindings,Ee as isTypeOnlyExportEntry,Fe as packageNamesFromBindings,fe as resolveWorkerEntry};