eser 4.1.13 → 4.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -3
- package/chunks/add-4LRHVBEC.js +7 -0
- package/chunks/anthropic-GBDSASP5.js +1 -0
- package/chunks/approve-364KOMLB.js +1 -0
- package/chunks/ask-752YJEHO.js +2 -0
- package/chunks/block-JVJQU723.js +1 -0
- package/chunks/browser-6UKLTPJO.js +1 -0
- package/chunks/build-VKOO2WEA.js +6 -0
- package/chunks/bun-N3TIWBPP.js +1 -0
- package/chunks/changelog-gen-ZCNNOY7G.js +7 -0
- package/chunks/chunk-2R4MK2KR.js +2 -0
- package/chunks/chunk-2TRQKCFC.js +1 -0
- package/chunks/chunk-34GCQZ3Z.js +3 -0
- package/chunks/chunk-3APERFKY.js +18 -0
- package/chunks/chunk-3DMTTLUJ.js +1 -0
- package/chunks/chunk-3TYZYY77.js +1 -0
- package/chunks/chunk-4HMEWMWL.js +1 -0
- package/chunks/chunk-4HNB3UTC.js +1 -0
- package/chunks/chunk-4OIKB2P5.js +1 -0
- package/chunks/chunk-4Q3SEHPE.js +1 -0
- package/chunks/chunk-4S7QYPS6.js +1 -0
- package/chunks/chunk-5C7ZQN6X.js +3 -0
- package/chunks/chunk-5O7V5P53.js +1 -0
- package/chunks/chunk-5UGVJVIQ.js +1 -0
- package/chunks/chunk-6FMPNAZ3.js +1 -0
- package/chunks/chunk-6U2VEZEM.js +1 -0
- package/chunks/chunk-6YRN6OJC.js +2 -0
- package/chunks/chunk-7GS5KPVF.js +1 -0
- package/chunks/chunk-7M3ONEMO.js +32 -0
- package/chunks/chunk-7QNRH7OR.js +3 -0
- package/chunks/chunk-A2GDVOQP.js +1 -0
- package/chunks/chunk-AK3OJD4W.js +1 -0
- package/chunks/chunk-ATLUGTI7.js +2 -0
- package/chunks/chunk-BK2BDHKB.js +1 -0
- package/chunks/chunk-BKVQBSFV.js +6 -0
- package/chunks/chunk-BP2MZX2P.js +2 -0
- package/chunks/chunk-C3OSYHJY.js +2 -0
- package/chunks/chunk-CDLEA2PD.js +1 -0
- package/chunks/chunk-DDLQMSA7.js +0 -0
- package/chunks/chunk-DLVQNMNV.js +1 -0
- package/chunks/chunk-DOV5776P.js +3 -0
- package/chunks/chunk-DQAEQEXD.js +1 -0
- package/chunks/chunk-DRQWYJMH.js +1 -0
- package/chunks/chunk-DXB73IDG.js +1 -0
- package/chunks/chunk-DZD6MI45.js +5 -0
- package/chunks/chunk-EW5NCPPE.js +3 -0
- package/chunks/chunk-FGDJVQG3.js +32 -0
- package/chunks/chunk-FKF2SWQM.js +18 -0
- package/chunks/chunk-GETSWLMF.js +4 -0
- package/chunks/chunk-GLSCZGXA.js +1 -0
- package/chunks/chunk-GRTR6TNJ.js +1 -0
- package/chunks/chunk-GXPLME3K.js +14 -0
- package/chunks/chunk-H2JGLZIR.js +1 -0
- package/chunks/chunk-HGNGFAAY.js +60 -0
- package/chunks/chunk-HPPFA3XU.js +1 -0
- package/chunks/chunk-HPVL4BVQ.js +2 -0
- package/chunks/chunk-HVMMNGY5.js +7 -0
- package/chunks/chunk-IA7GIU76.js +14 -0
- package/chunks/chunk-IAWIWTDY.js +1 -0
- package/chunks/chunk-JQHMDTPL.js +1 -0
- package/chunks/chunk-L2BYHWDC.js +1 -0
- package/chunks/chunk-LRL56YFE.js +1 -0
- package/chunks/chunk-LU3DHXOC.js +2 -0
- package/chunks/chunk-LXVBR775.js +1 -0
- package/chunks/chunk-M5TBBQQC.js +21 -0
- package/chunks/chunk-MQH4XBFN.js +1 -0
- package/chunks/chunk-NADES3GN.js +1 -0
- package/chunks/chunk-NIX3WX3O.js +1 -0
- package/chunks/chunk-NSZ4HGDI.js +1 -0
- package/chunks/chunk-NUSNMQPL.js +1 -0
- package/chunks/chunk-NZFUFGOC.js +1 -0
- package/chunks/chunk-OBIEQJDE.js +4 -0
- package/chunks/chunk-OLM5RTFK.js +1 -0
- package/chunks/chunk-PBSR4XR2.js +335 -0
- package/chunks/chunk-PLJNPQFC.js +1 -0
- package/chunks/chunk-PLRSDG6G.js +2 -0
- package/chunks/chunk-Q7QMINSQ.js +0 -0
- package/chunks/chunk-QIUIPRJP.js +1 -0
- package/chunks/chunk-QXTK62N4.js +1 -0
- package/chunks/chunk-R6F4EK2B.js +4 -0
- package/chunks/chunk-RGUC6KAZ.js +1 -0
- package/chunks/chunk-SCCNNGD4.js +2 -0
- package/chunks/chunk-SCULX2ND.js +1 -0
- package/chunks/chunk-SJQWPBMJ.js +1 -0
- package/chunks/chunk-TMFPDVYN.js +127 -0
- package/chunks/chunk-UJX2S56V.js +1 -0
- package/chunks/chunk-USCAYIWL.js +1 -0
- package/chunks/chunk-V5HTJPFW.js +3 -0
- package/chunks/chunk-VFMYWG2I.js +3 -0
- package/chunks/chunk-VGFZXQMW.js +1 -0
- package/chunks/chunk-VTQ72OK7.js +1 -0
- package/chunks/chunk-WE7PSSAQ.js +91 -0
- package/chunks/chunk-WUJUQPHI.js +1 -0
- package/chunks/chunk-X4ZCYXOT.js +1 -0
- package/chunks/chunk-XJ3VEVYL.js +3 -0
- package/chunks/chunk-XMTGT2NJ.js +10 -0
- package/chunks/chunk-XWYLEYLY.js +1 -0
- package/chunks/chunk-Y6DLCHJN.js +1 -0
- package/chunks/chunk-Y6DZEK4W.js +1 -0
- package/chunks/chunk-YUXQ7JNG.js +1 -0
- package/chunks/chunk-Z7742D7Q.js +1 -0
- package/chunks/chunk-ZE5T64HQ.js +1 -0
- package/chunks/chunk-ZF2XYULB.js +1 -0
- package/chunks/chunk-ZOZYBQX2.js +0 -0
- package/chunks/chunk-ZTLJ775S.js +1 -0
- package/chunks/chunk-ZY72QNKZ.js +3 -0
- package/chunks/claude-code-PWTLM554.js +1 -0
- package/chunks/clone-DASXIL35.js +5 -0
- package/chunks/commitmsg-SQRQONCS.js +10 -0
- package/chunks/deno-PZXN5K3J.js +1 -0
- package/chunks/dev-FLO2KEPZ.js +3 -0
- package/chunks/file-tools-shared-ESMPLZVJ.js +1 -0
- package/chunks/fileFromPath-4UEDFJ4U.js +6 -0
- package/chunks/gemini-I6F5N7PS.js +1 -0
- package/chunks/gh-Y4BXDXR5.js +4 -0
- package/chunks/gh-contributors-5SHGJHAQ.js +11 -0
- package/chunks/init-GXBXQGGV.js +1 -0
- package/chunks/init-UFJL24PW.js +12 -0
- package/chunks/install-Q2KQZM62.js +2 -0
- package/chunks/kiro-NMTIFMT4.js +1 -0
- package/chunks/list-B7L4FZKG.js +2 -0
- package/chunks/list-MN7OUE52.js +1 -0
- package/chunks/list-UZKWSA4S.js +1 -0
- package/chunks/load-config-TSM3AAQ6.js +1 -0
- package/chunks/main-WVXCURBF.js +5 -0
- package/chunks/manifest-VJQJG2LS.js +1 -0
- package/chunks/mod-3PJAIZ2O.js +1 -0
- package/chunks/mod-6P2JPEHC.js +1 -0
- package/chunks/mod-7X3BOO5H.js +1 -0
- package/chunks/mod-CI56JMO4.js +43 -0
- package/chunks/mod-FKPTF5D5.js +1 -0
- package/chunks/mod-GZ6BSK2P.js +1 -0
- package/chunks/mod-JTBNNSZZ.js +1 -0
- package/chunks/mod-MKMQWZ6G.js +1 -0
- package/chunks/mod-PEAFMI6F.js +1 -0
- package/chunks/mod-QODEWK3G.js +9 -0
- package/chunks/mod-STKIZYZ3.js +27 -0
- package/chunks/new-W5YBJFGW.js +4 -0
- package/chunks/next-773GX25N.js +3 -0
- package/chunks/node-RWYXITVV.js +59 -0
- package/chunks/node-VPHAK3FD.js +1 -0
- package/chunks/ollama-DQ5VM4HI.js +1 -0
- package/chunks/openai-EKIA3VP3.js +19 -0
- package/chunks/openai-XMIVMDDL.js +1 -0
- package/chunks/opencode-IZMQZ4ZK.js +1 -0
- package/chunks/recipe-applier-F2REROYS.js +1 -0
- package/chunks/registry-fetcher-ZJ76EHBA.js +1 -0
- package/chunks/release-YJOLKWDT.js +8 -0
- package/chunks/release-notes-Z53AFCII.js +3 -0
- package/chunks/release-tag-QRIKYVQB.js +1 -0
- package/chunks/reset-5LQGIOGB.js +1 -0
- package/chunks/rule-K42YEAMO.js +2 -0
- package/chunks/run-7JXDS75G.js +4 -0
- package/chunks/scripts-RSK5XDRW.js +1 -0
- package/chunks/sdk-5JGXLIO5.js +18 -0
- package/chunks/serve-U6IXMGXQ.js +3 -0
- package/chunks/server-PXE4DB3V.js +69 -0
- package/chunks/spec-5446CSQC.js +1 -0
- package/chunks/status-HK3P6J6G.js +1 -0
- package/chunks/sync-4FSA5257.js +1 -0
- package/chunks/system-3MH6OCP6.js +1 -0
- package/chunks/system-KWFBSQYQ.js +1 -0
- package/chunks/unstable_chmod-WRDBWEC2.js +1 -0
- package/chunks/update-QD5S73WT.js +5 -0
- package/chunks/validate-bom-IVALGNGE.js +1 -0
- package/chunks/validate-case-conflict-LKECKLD5.js +1 -0
- package/chunks/validate-circular-deps-PXFPCBXA.js +1 -0
- package/chunks/validate-commit-msg-77CBKGOF.js +1 -0
- package/chunks/validate-docs-3UGB7LN7.js +1 -0
- package/chunks/validate-eof-ZSIYNHO5.js +1 -0
- package/chunks/validate-export-names-BPSCBX7B.js +1 -0
- package/chunks/validate-filenames-G4XJ2LHN.js +1 -0
- package/chunks/validate-json-YRCFW2O7.js +1 -0
- package/chunks/validate-large-files-MWWSFDOE.js +1 -0
- package/chunks/validate-licenses-Q2YA2MND.js +1 -0
- package/chunks/validate-line-endings-C6NHWHGI.js +1 -0
- package/chunks/validate-merge-conflict-KTBL4FUY.js +1 -0
- package/chunks/validate-mod-exports-LQIIQRIS.js +1 -0
- package/chunks/validate-package-configs-36PYXIWC.js +1 -0
- package/chunks/validate-secrets-UFDJ7ITY.js +1 -0
- package/chunks/validate-shebangs-3UO4MDMZ.js +1 -0
- package/chunks/validate-submodules-YA654D3B.js +1 -0
- package/chunks/validate-symlinks-R2PNE5TG.js +1 -0
- package/chunks/validate-toml-7H2N5AKI.js +1 -0
- package/chunks/validate-trailing-whitespace-HXO7M3ED.js +1 -0
- package/chunks/validate-yaml-ZJJCQVBB.js +1 -0
- package/chunks/versions-CWT5S7G4.js +1 -0
- package/chunks/vertexai-2SMP54AR.js +1 -0
- package/chunks/workerd-NXKZMQPV.js +1 -0
- package/eser.js +1 -986
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as t}from"./chunk-DXB73IDG.js";var L={};t(L,{blue:()=>I,bold:()=>d,codeBlock:()=>x,color:()=>o,cyan:()=>m,dim:()=>i,gray:()=>C,green:()=>h,group:()=>s,italic:()=>S,list:()=>T,magenta:()=>b,nl:()=>u,normalize:()=>a,plainLength:()=>p,red:()=>k,strikethrough:()=>y,table:()=>B,text:()=>r,underline:()=>c,white:()=>w,yellow:()=>g});var a=n=>n.map(e=>typeof e=="string"?r(e):e),r=n=>({kind:"text",value:n}),d=(...n)=>({kind:"bold",children:a(n)}),i=(...n)=>({kind:"dim",children:a(n)}),S=(...n)=>({kind:"italic",children:a(n)}),c=(...n)=>({kind:"underline",children:a(n)}),y=(...n)=>({kind:"strikethrough",children:a(n)}),s=(...n)=>({kind:"group",children:a(n)}),u=()=>({kind:"newline"}),o=(n,...e)=>({kind:"color",color:n,children:a(e)}),k=(...n)=>o("red",...n),h=(...n)=>o("green",...n),g=(...n)=>o("yellow",...n),I=(...n)=>o("blue",...n),b=(...n)=>o("magenta",...n),m=(...n)=>o("cyan",...n),C=(...n)=>o("gray",...n),w=(...n)=>o("white",...n),x=(n,e)=>({kind:"code-block",language:e,value:n}),B=(n,e)=>({kind:"table",headers:a(n),rows:e.map(l=>a(l))}),T=n=>({kind:"list",items:n.map(e=>a(e))}),p=n=>{switch(n.kind){case"text":return n.value.length;case"newline":return 1;case"bold":case"dim":case"italic":case"underline":case"strikethrough":case"color":case"group":return n.children.reduce((e,l)=>e+p(l),0);case"code-block":return n.value.length;case"table":case"list":return 0}};export{a,r as b,d as c,i as d,k as e,h as f,g,I as h,b as i,m as j,C as k,B as l,p as m,L as n};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as l,c as p,d as u}from"./chunk-LRL56YFE.js";var f=e=>e==="assistant"?"model":e==="tool"?"user":e,g=e=>{switch(e.kind){case"text":return{text:e.text};case"image":{if(e.image.data!==void 0)return{inlineData:{mimeType:e.image.mimeType??"image/png",data:d(e.image.data)}};if(e.image.url!==void 0){if(l(e.image.url)){let t=p(e.image.url);if(t!==null)return{inlineData:{mimeType:t.mimeType,data:d(t.data)}}}return{fileData:{mimeType:e.image.mimeType??u(e.image.url)??"image/png",fileUri:e.image.url}}}return{text:"[unsupported image]"}}case"audio":return e.audio.data!==void 0?{inlineData:{mimeType:e.audio.mimeType??"audio/mpeg",data:d(e.audio.data)}}:e.audio.url!==void 0?{fileData:{mimeType:e.audio.mimeType??u(e.audio.url)??"audio/mpeg",fileUri:e.audio.url}}:{text:"[unsupported audio]"};case"file":return{fileData:{mimeType:e.file.mimeType??"application/octet-stream",fileUri:e.file.uri}};case"tool_call":return{functionCall:{name:e.toolCall.name,args:e.toolCall.arguments}};case"tool_result":return{functionResponse:{name:e.toolResult.toolCallId,response:{content:e.toolResult.content}}}}},T=e=>{let t=null,n=[];for(let a of e){if(a.role==="system"){let o=[];for(let r of a.content)r.kind==="text"&&o.push(r.text);t=o.join(`
|
|
2
|
+
`);continue}let s=a.content.map(g);n.push({role:f(a.role),parts:s})}return{contents:n,systemInstruction:t}},x=e=>e.map(t=>({functionDeclarations:[{name:t.name,description:t.description,parameters:t.parameters}]})),C=(e,t)=>{let n=[],a="end_turn",s=e?.candidates??[];if(s.length>0){let r=s[0],c=r?.content?.parts??[];for(let i of c)i.text!==void 0&&n.push({kind:"text",text:i.text}),i.functionCall!==void 0&&(n.push({kind:"tool_call",toolCall:{id:i.functionCall.name,name:i.functionCall.name,arguments:i.functionCall.args??{}}}),a="tool_use");let m=r?.finishReason;m==="MAX_TOKENS"?a="max_tokens":m==="STOP"&&(a="end_turn")}let o=e?.usageMetadata;return{content:n,stopReason:a,usage:{inputTokens:o?.promptTokenCount??0,outputTokens:o?.candidatesTokenCount??0,totalTokens:o?.totalTokenCount??0},modelId:t,rawResponse:e}},R=e=>e?.status!==void 0?e.status:e?.code!==void 0?e.code:500,d=e=>{let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)};export{f as a,g as b,T as c,x as d,C as e,R as f};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-VFMYWG2I.js";import{t}from"./chunk-GRTR6TNJ.js";var e=a({name:"validate-submodules",description:"Detect new git submodules",canFix:!1,stacks:[],defaults:{},async checkAll(n,i){let o=t.path.join(i.root,".gitmodules");if(!await t.fs.exists(o))return[];let s=((await t.fs.readTextFile(o)).match(/\[submodule\s/g)??[]).length;return s>0?[{path:o,message:`found ${s} submodule(s) \u2014 submodules are not allowed`}]:[]}}),p=e.run,f=e.validator,x=e.main;export{e as a,p as b,f as c,x as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=class extends Error{capability;runtimeName;constructor(e,r){super(`Capability "${e}" is not available on runtime "${r}"`),this.name="RuntimeCapabilityError",this.capability=e,this.runtimeName=r}},o=class extends Error{path;constructor(e){super(`No such file or directory: ${e}`),this.name="NotFoundError",this.path=e}},s=class extends Error{path;constructor(e){super(`File or directory already exists: ${e}`),this.name="AlreadyExistsError",this.path=e}},a=class extends Error{cmd;code;stderr;constructor(e,r,n){super(`Command "${e}" failed with exit code ${r}: ${n}`),this.name="ProcessError",this.cmd=e,this.code=r,this.stderr=n}};export{i as a,o as b,s as c,a as d};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{b as k}from"./chunk-5UGVJVIQ.js";import{d as F,f as T,h as C,j as d,k as L,n as u}from"./chunk-GLSCZGXA.js";import{a as g}from"./chunk-ZE5T64HQ.js";import{t as D}from"./chunk-GRTR6TNJ.js";var R={USE_CLIENT:"use client",USE_SERVER:"use server",USE_STRICT:"use strict"},M=[/node_modules/,/\.test\./,/\.spec\./],G=(t,e)=>{let r=t.split(`
|
|
2
|
+
`),i=e.toLowerCase(),o=!1;for(let s=0;s<Math.min(50,r.length);s++){let n=r[s]?.trim()??"";if(o){n.includes("*/")&&(o=!1);continue}if(n===""||n.startsWith("//"))continue;if(n.startsWith("/*")){n.includes("*/")||(o=!0);continue}let f=`"${i}";`,a=`'${i}';`,l=n.toLowerCase();if(l===f||l===a)return!0;if(n.startsWith("import")||n.startsWith("export")||n.startsWith("const")||n.startsWith("let")||n.startsWith("var")||n.startsWith("function")||n.startsWith("class"))break}return!1},W=t=>{let e=new Set,r=t.matchAll(/export\s+(?:async\s+)?function\s+(\w+)/g);for(let n of r)n[1]!==void 0&&e.add(n[1]);let i=t.matchAll(/export\s+(?:const|let)\s+(\w+)\s*=/g);for(let n of i)n[1]!==void 0&&e.add(n[1]);let o=t.matchAll(/export\s+class\s+(\w+)/g);for(let n of o)n[1]!==void 0&&e.add(n[1]);/export\s+default\s+/.test(t)&&e.add("default");let s=t.matchAll(/export\s*\{([\w\s,]+)\}/g);for(let n of s)if(n[1]!==void 0){let f=n[1].split(",").map(a=>{let l=a.trim().split(/ {1,10}as {1,10}/);return(l[1]??l[0])?.trim()});for(let a of f)a!==void 0&&a!==""&&e.add(a)}return[...e]},O=async t=>{try{return await D.fs.readTextFile(t)}catch{return null}},Q=async(t,e,r={})=>{let i=r.extensions??k,o=r.skip??M,s=r.projectRoot??t,n=[];for await(let f of D.fs.walk(t,{exts:[...i],skip:[...o]})){if(!f.isFile)continue;let a=await O(f.path);if(a!==null&&G(a,e)){let l=D.path.relative(s,f.path),m=W(a);n.push({filePath:f.path,relativePath:l,directive:e,exports:m})}}return n},Y=(t,e={})=>Q(t,R.USE_CLIENT,e),X=(t,e)=>{let r=`"${e}"`,i=`'${e}'`;return t.includes(r)||t.includes(i)},Z=async(t,e={})=>{let r=e.extensions??k,i=e.skip??M,o=e.projectRoot??t,s=[];for await(let n of D.fs.walk(t,{exts:[...r],skip:[...i]})){if(!n.isFile)continue;let f=await O(n.path);if(f!==null&&X(f,R.USE_SERVER)){let a=D.path.relative(o,n.path),l=W(f);s.push({filePath:n.path,relativePath:a,directive:R.USE_SERVER,exports:l})}}return s};function w(t){return t.isFile?"file":t.isDirectory?"dir":t.isSymlink?"symlink":void 0}async function x(t){try{let e=await Deno.stat(t);_(e);return}catch(e){if(!(e instanceof Deno.errors.NotFound))throw e}try{await Deno.mkdir(t,{recursive:!0})}catch(e){if(!(e instanceof Deno.errors.AlreadyExists))throw e;let r=await Deno.stat(t);_(r)}}function _(t){if(!t.isDirectory)throw new Error(`Failed to ensure directory exists: expected 'dir', got '${w(t)}'`)}function c(t){return t instanceof URL?C(t):t}function P(t,e,r=T){if(t=c(t),e=c(e),u(t)===u(e))return!1;let i=t.split(r),o=e.split(r);return i.every((s,n)=>o[n]===s)}function S(t,e){if(t===null)throw new Error(`${e} is unavailable`)}async function I(t,e,r){let i;try{i=await Deno.lstat(e)}catch(o){if(o instanceof Deno.errors.NotFound)return;throw o}if(r.isFolder&&!i.isDirectory)throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'`);if(!r.overwrite)throw new Deno.errors.AlreadyExists(`'${e}' already exists.`);return i}async function N(t,e,r){if(await I(t,e,r),await Deno.copyFile(t,e),r.preserveTimestamps){let i=await Deno.stat(t);S(i.atime,"statInfo.atime"),S(i.mtime,"statInfo.mtime"),await Deno.utime(e,i.atime,i.mtime)}}async function U(t,e,r){await I(t,e,r);let i=await Deno.readLink(t),o=w(await Deno.lstat(t));if(g?await Deno.symlink(i,e,{type:o==="dir"?"dir":"file"}):await Deno.symlink(i,e),r.preserveTimestamps){let s=await Deno.lstat(t);S(s.atime,"statInfo.atime"),S(s.mtime,"statInfo.mtime"),await Deno.utime(e,s.atime,s.mtime)}}async function j(t,e,r){if(await I(t,e,{...r,isFolder:!0})||await x(e),r.preserveTimestamps){let s=await Deno.stat(t);S(s.atime,"statInfo.atime"),S(s.mtime,"statInfo.mtime"),await Deno.utime(e,s.atime,s.mtime)}t=c(t),e=c(e);let o=[];for await(let s of Deno.readDir(t)){let n=d(t,s.name),f=d(e,F(n));s.isSymlink?o.push(U(n,f,r)):s.isDirectory?o.push(j(n,f,r)):s.isFile&&o.push(N(n,f,r))}await Promise.all(o)}async function wt(t,e,r={}){if(t=u(c(t)),e=u(c(e)),t===e)throw new Error("Source and destination cannot be the same");let i=await Deno.lstat(t);if(i.isDirectory&&P(t,e))throw new Error(`Cannot copy '${t}' to a subdirectory of itself: '${e}'`);i.isSymlink?await U(t,e,r):i.isDirectory?await j(t,e,r):i.isFile&&await N(t,e,r)}async function Ft(t){try{let e=await Array.fromAsync(Deno.readDir(t));await Promise.all(e.map(r=>{if(r&&r.name){let i=d(c(t),r.name);return Deno.remove(i,{recursive:!0})}}))}catch(e){if(!(e instanceof Deno.errors.NotFound))throw e;await Deno.mkdir(t,{recursive:!0})}}async function A(t){t=c(t),t=L(t);let e=F(t),r=await Deno.stat(t);return{path:t,name:e,isFile:r.isFile,isDirectory:r.isDirectory,isSymlink:r.isSymlink}}function E(t,e,r,i){return!(e&&!e.some(o=>t.endsWith(o))||r&&!r.some(o=>!!t.match(o))||i&&i.some(o=>!!t.match(o)))}async function*V(t,e){let{maxDepth:r=1/0,includeFiles:i=!0,includeDirs:o=!0,includeSymlinks:s=!0,followSymlinks:n=!1,canonicalize:f=!0,exts:a=void 0,match:l=void 0,skip:m=void 0}=e??{};if(!(r<0)&&(t=c(t),a&&(a=a.map(y=>y.startsWith(".")?y:`.${y}`)),o&&E(t,a,l,m)&&(yield await A(t)),!(r<1||!E(t,void 0,void 0,m))))for await(let y of Deno.readDir(t)){let p=d(t,y.name),{isSymlink:v,isDirectory:$}=y;if(v){if(!n){s&&E(p,a,l,m)&&(yield{path:p,...y});continue}let h=await Deno.realPath(p);f&&(p=h),{isSymlink:v,isDirectory:$}=await Deno.lstat(h)}if(v||$){let h={maxDepth:r-1,includeFiles:i,includeDirs:o,includeSymlinks:s,followSymlinks:n};a!==void 0&&(h.exts=a),l!==void 0&&(h.match=l),m!==void 0&&(h.skip=m),yield*V(p,h)}else i&&E(p,a,l,m)&&(yield{path:p,...y})}}var ue=globalThis.Deno?.build.os==="windows"?"`":"\\";var B=`
|
|
3
|
+
`,J=`\r
|
|
4
|
+
`,xe=globalThis.Deno?.build.os==="windows"?J:B;export{G as a,W as b,Y as c,Z as d,Ft as e,x as f,V as g,wt as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as c}from"./chunk-5UGVJVIQ.js";import{t as u}from"./chunk-GRTR6TNJ.js";var n=e=>{let a=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");return new RegExp(`^${a}$`)};async function*f(e,a,s){let o=u.fs.walk(e,{includeDirs:!1,includeFiles:!0,exts:c,skip:[s]});for await(let r of o){let t=u.path.relative(e,r.path);a!==void 0&&!n(a).test(t)||(yield t)}}var F=new RegExp("[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]"),A=new RegExp("[\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65]");export{f as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as o}from"./chunk-VFMYWG2I.js";var r=o({name:"validate-trailing-whitespace",description:"Remove trailing whitespace from lines",canFix:!0,stacks:[],defaults:{},checkFile(a,i){if(i===void 0)return[];let t=[],n=i.split(`
|
|
2
|
+
`);for(let e=0;e<n.length;e++)/[ \t]+$/.test(n[e])&&t.push({path:a.path,line:e+1,message:"trailing whitespace"});return t},fixFile(a,i){let t=i.replace(/[ \t]+$/gm,"");if(t!==i)return{path:a.path,oldContent:i,newContent:t}}}),c=r.run,u=r.validator,d=r.main;export{r as a,c as b,u as c,d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=["registry/v1"],h=["file","folder"],w=["local","github"],m=r=>r==="project"||r==="structure"||r==="utility",R=r=>{if(typeof r!="object"||r===null)return!1;let e=r;return!(typeof e.source!="string"||typeof e.target!="string"||e.kind!==void 0&&!h.includes(e.kind)||e.provider!==void 0&&!w.includes(e.provider))},$=r=>{if(typeof r!="object"||r===null)return!1;let e=r;return!(e.go!==void 0&&!Array.isArray(e.go)||e.jsr!==void 0&&!Array.isArray(e.jsr)||e.npm!==void 0&&!Array.isArray(e.npm))},b=r=>{if(typeof r!="object"||r===null)return!1;let e=r;return!(typeof e.name!="string"||e.name===""||typeof e.description!="string"||e.default!==void 0&&typeof e.default!="string"||e.prompt!==void 0&&typeof e.prompt!="string")},f=r=>{if(typeof r!="object"||r===null)return!1;let e=r;if(typeof e.name!="string"||e.name===""||typeof e.description!="string"||typeof e.language!="string"||!m(e.scale)||!Array.isArray(e.files)||e.files.length===0)return!1;for(let t of e.files)if(!R(t))return!1;if(e.dependencies!==void 0&&!$(e.dependencies)||e.tags!==void 0&&!Array.isArray(e.tags))return!1;if(e.requires!==void 0){if(!Array.isArray(e.requires))return!1;for(let t of e.requires)if(typeof t!="string")return!1}if(e.variables!==void 0){if(!Array.isArray(e.variables))return!1;for(let t of e.variables)if(!b(t))return!1}if(e.postInstall!==void 0){if(!Array.isArray(e.postInstall))return!1;for(let t of e.postInstall)if(typeof t!="string")return!1}return!0},d=r=>{if(typeof r!="object"||r===null)throw new Error("Registry manifest must be a JSON object");let e=r;if(e.$schema!==void 0){let i=String(e.$schema);g.some(s=>i.includes(s))||console.warn(`Warning: Registry uses unknown schema "${i}". This CLI supports v1.`)}if(typeof e.name!="string"||e.name==="")throw new Error("Registry manifest requires a non-empty 'name' field");if(typeof e.description!="string")throw new Error("Registry manifest requires a 'description' field");if(typeof e.author!="string")throw new Error("Registry manifest requires an 'author' field");if(typeof e.registryUrl!="string"||e.registryUrl==="")throw new Error("Registry manifest requires a non-empty 'registryUrl' field");if(!Array.isArray(e.recipes))throw new Error("Registry manifest requires a 'recipes' array");for(let i of e.recipes)if(!f(i)){let o=typeof i=="object"&&i!==null?i.name??"<unknown>":"<invalid>";throw new Error(`Invalid recipe definition: '${o}'`)}let t=e.recipes,n=new Set;for(let i of t){if(n.has(i.name))throw new Error(`Duplicate recipe name '${i.name}' in registry`);n.add(i.name)}return r},p=r=>{if(!f(r))throw new Error("Invalid recipe definition");return r},u=(r,e)=>{let t=r.replace(/\/+$/,""),n=e.replace(/^\/+/,"");return`${t}/${n}`};var F=3e4,S="https://raw.githubusercontent.com/eser/stack/main/etc/registry/eser-registry.json",k="etc/registry/eser-registry.json",l=async r=>await globalThis.fetch(r,{signal:AbortSignal.timeout(F)}),A=async()=>{let r=Deno.cwd();for(let e=0;e<10;e++){let t=`${r}/${k}`;try{return await Deno.stat(t),t}catch{let n=r.replace(/\/[^/]+$/,"");if(n===r)break;r=n}}},j=async(r,e)=>{let t=r??S;if(e?.local===!0&&r===void 0){let s=await A();s!==void 0&&(t=s,e?.verbose===!0&&console.log(`Using local registry: ${s}`))}let n=t.startsWith("http://")||t.startsWith("https://");e?.verbose===!0&&console.log(`Fetching registry from: ${t}`);let i;if(n){let s=await l(t);if(!s.ok)throw new Error(`Could not reach registry at ${t}. HTTP ${s.status}`);i=await s.text()}else try{i=await Deno.readTextFile(t)}catch{throw new Error(`Could not read registry file at ${t}`)}let o;try{o=JSON.parse(i)}catch{throw new Error(`Registry at ${t} is not valid JSON`)}return d(o)},I=async(r,e)=>{let t=u(r,e),n=await l(t);if(!n.ok)throw new Error(`Could not fetch recipe file at ${t}. HTTP ${n.status}`);return await n.text()},P=r=>{let e=r.match(/^https:\/\/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/([^/]+)(?:\/(.*))?$/);if(e!==null)return{owner:e[1],repo:e[2],ref:e[3],basePath:e[4]??""}},U=async(r,e)=>{let t=P(r);if(t===void 0)throw new Error(`Cannot fetch folder: registry URL '${r}' is not a GitHub raw URL`);let n=t.basePath?`${t.basePath}/${e}`.replace(/\/+/g,"/"):e,i=`https://api.github.com/repos/${t.owner}/${t.repo}/contents/${n}?ref=${t.ref}`,o=await l(i);if(!o.ok)throw new Error(`Could not list folder '${n}' from ${t.owner}/${t.repo}. HTTP ${o.status}`);let s=await o.json();if(!Array.isArray(s))throw new Error(`Expected directory listing for '${n}', got a file instead`);let y=s.filter(a=>a.type==="file").map(async a=>{if(a.download_url===null)throw new Error(`File '${a.path}' has no download URL (may be too large)`);let c=await l(a.download_url);if(!c.ok)throw new Error(`Could not fetch file '${a.path}'. HTTP ${c.status}`);return{path:a.path.startsWith(n)?a.path.slice(n.length).replace(/^\//,""):a.path,content:await c.text()}});return await Promise.all(y)},_=async(r,e,t="main",n="recipe.json")=>{let i=`https://raw.githubusercontent.com/${r}/${e}/${t}/${n}`,o=await l(i);if(!o.ok)throw new Error(`Could not fetch recipe from ${r}/${e}@${t}/${n}. HTTP ${o.status}`);let s;try{s=JSON.parse(await o.text())}catch{throw new Error(`Recipe file at ${r}/${e}@${t}/${n} is not valid JSON`)}return p(s)};export{F as a,S as b,k as c,l as d,A as e,j as f,I as g,P as h,U as i,_ as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b,b as w,d as F,f as D}from"./chunk-ATLUGTI7.js";import{a as C}from"./chunk-6U2VEZEM.js";import{a as h}from"./chunk-JQHMDTPL.js";import{f as R}from"./chunk-NUSNMQPL.js";import{b as l,e as m,f as k,g as A,h as g}from"./chunk-PLJNPQFC.js";import{g as d}from"./chunk-DQAEQEXD.js";var x=(e,r)=>{let o={},t=e.length;for(let s=0;s<t;s++){let n=e[s],a=r(n);o[a]===void 0?o[a]=[n]:o[a].push(n)}return o};var u=h(),P=(e,r)=>e===r?!0:typeof e!=typeof r||typeof e!="object"||e===null||r===null?!1:JSON.stringify(e)===JSON.stringify(r),O=(e,r)=>e[r],j=e=>e.startsWith("npm:@jsr/"),B=e=>{let r=e.slice(9),o=r.indexOf("__");if(o===-1)throw new Error(`Invalid npm JSR format: ${e}`);let t=r.slice(0,o),s=r.slice(o+2),n=s.indexOf("@"),a,p;return n===-1?(a=s,p=""):(a=s.slice(0,n),p=s.slice(n)),`jsr:@${t}/${a}${p}`},_=(e,r)=>j(r)?B(r):r.startsWith("npm:")?r:`npm:${e}@${r}`,S=e=>e==="workspace:*"||e.startsWith("workspace:"),M=(e,r,o)=>{let t=[],s=r.dependencies??{},n=r.devDependencies??{},a={...s,...n},p=o.imports??{};for(let[y,c]of Object.entries(a)){if(S(c))continue;let f=_(y,c),i=p[y];i===void 0?t.push({packageName:e,dependencyName:y,issue:"missing_in_deno",expected:f}):i!==f&&t.push({packageName:e,dependencyName:y,issue:"version_mismatch",expected:f,actual:i})}for(let[y,c]of Object.entries(p))a[y]===void 0&&t.push({packageName:e,dependencyName:y,issue:"missing_in_package",actual:p[y]});return t},G=async(e,r)=>{let o=[],t=[],s=await w({baseDir:e,includeFiles:[b.DenoJson,b.PackageJson]}),n=s._loadedFiles.find(c=>c.fileType===b.DenoJson),a=s._loadedFiles.find(c=>c.fileType===b.PackageJson);if(n===void 0||a===void 0)return{inconsistencies:[],dependencyInconsistencies:[]};let p=["name","version","exports"];for(let c of p){let f=O(n.content,c),i=O(a.content,c);f===void 0||i===void 0||P(f,i)||o.push({packageName:r,field:c,denoValue:f,packageValue:i})}let y=M(r,a.content,n.content);return t.push(...y),{inconsistencies:o,dependencyInconsistencies:t}},K=async(e={})=>{let{root:r=".",failFast:o=!1}=e,[t,s]=await D(r),n=[],a=[],p=0;for(let c of s){let f=F(c.config);try{let i=await G(f,c.name);if(p++,i.inconsistencies.length>0&&n.push(...i.inconsistencies),i.dependencyInconsistencies.length>0&&a.push(...i.dependencyInconsistencies),o&&(i.inconsistencies.length>0||i.dependencyInconsistencies.length>0))return{isConsistent:!1,inconsistencies:n,dependencyInconsistencies:a,packagesChecked:p}}catch{continue}}return{isConsistent:!(n.length>0||a.length>0),inconsistencies:n,dependencyInconsistencies:a,packagesChecked:p}},v=e=>typeof e=="string"?`"${e}"`:JSON.stringify(e,null,2),H=e=>{switch(e.issue){case"missing_in_deno":return`Missing in deno.json imports. Expected: ${e.expected}`;case"missing_in_package":return`Extra in deno.json imports (not in package.json): ${e.actual}`;case"version_mismatch":return`Version mismatch. Expected: ${e.expected}, Actual: ${e.actual}`}},L=e=>R.fromPromise(()=>K(e)),$=e=>d.ok({root:"."}),N=e=>{if(d.isFail(e))return u.writeln(m("\u2717"),l(" "+String(e.error))),d.fail({exitCode:1});let{value:r}=e;if(u.writeln(g("\u2139"),l(` Checked ${r.packagesChecked} packages.`)),!r.isConsistent){if(r.inconsistencies.length>0){u.writeln(m("\u2717"),l(` Found ${r.inconsistencies.length} field inconsistencies:`));let o=x(r.inconsistencies,t=>t.packageName);for(let[t,s]of Object.entries(o)){u.writeln(A("\u26A0"),l(" "+t));for(let n of s)u.writeln(m("\u2717"),l(` ${n.field} mismatch:`)),u.writeln(g("\u2139"),l(` deno.json: ${v(n.denoValue)}`)),u.writeln(g("\u2139"),l(` package.json: ${v(n.packageValue)}`))}}if(r.dependencyInconsistencies.length>0){u.writeln(m("\u2717"),l(` Found ${r.dependencyInconsistencies.length} dependency inconsistencies:`));let o=x(r.dependencyInconsistencies,t=>t.packageName);for(let[t,s]of Object.entries(o)){u.writeln(A("\u26A0"),l(" "+t));for(let n of s)u.writeln(m("\u2717"),l(` ${n.dependencyName}:`)),u.writeln(g("\u2139"),l(` ${H(n)}`))}}return d.fail({exitCode:1})}return u.writeln(k("\u2713"),l(" All package configs are consistent.")),d.ok(void 0)},J=C.createTrigger({handler:L,adaptInput:$,adaptOutput:N}),qn=async e=>await J({command:"validate-package-configs",args:[],flags:{}});export{K as a,L as b,J as c,qn as d};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import{a as ge,b as me,d as X,e as Qe,f as Ye,g as et,h as U}from"./chunk-R6F4EK2B.js";import{n as Be}from"./chunk-7M3ONEMO.js";import{a as tt}from"./chunk-RGUC6KAZ.js";import{c as fe}from"./chunk-ATLUGTI7.js";import{a as pe,b as re,c as z}from"./chunk-5UGVJVIQ.js";import{e as S}from"./chunk-OBIEQJDE.js";import{c as Ze,t as o}from"./chunk-GRTR6TNJ.js";import{a as H}from"./chunk-VTQ72OK7.js";var I=S.getLogger(["laroux-bundler","server-action-transform"]);function gn(e,t){return`${e.replace(/\.[cm]?[jt]sx?$/,"")}#${t}`}function mn(e,t){let n=gn(e,t);return`Object.defineProperties(${t}, {
|
|
2
|
+
$$typeof: { value: Symbol.for("react.server.reference"), enumerable: false },
|
|
3
|
+
$$id: { value: "${n}", enumerable: false },
|
|
4
|
+
$$bound: { value: null, enumerable: false, writable: true }
|
|
5
|
+
});`}async function hn(e,t){let n;try{n=await o.fs.readTextFile(e)}catch(u){return I.warn(`Failed to read file: ${e}`,{error:u}),null}if(!ge(n,"use server"))return I.debug(`Skipping ${e} - no file-level "use server"`),null;let r=me(n);if(r.length===0)return I.debug(`Skipping ${e} - no exports found`),null;let s=r.filter(u=>u!=="default");if(s.length===0)return I.debug(`Skipping ${e} - only default export`),null;I.debug(`Transforming ${e} with ${s.length} export(s)`);let i=s.map(u=>mn(t,u)).join(`
|
|
6
|
+
`),a=n.split(`
|
|
7
|
+
`);a.push(""),a.push("// Auto-generated React server reference markers"),a.push(i);let c=a.join(`
|
|
8
|
+
`);return await o.fs.writeTextFile(e,c),I.debug(`Transformed ${e}: marked ${s.length} action(s) with server reference symbols`),s}async function nt(e){if(I.debug(`Scanning for server actions in: ${e}`),!await o.fs.exists(e))return I.debug(`Directory does not exist: ${e}`),[];let n=await X(e,{projectRoot:e});if(n.length===0)return I.debug("No server action files found"),[];I.info(`Found ${n.length} server action file(s) to transform`);let r=[];for(let s of n){let i=await hn(s.filePath,s.relativePath);i!==null&&i.length>0&&r.push({filePath:s.filePath,relativePath:s.relativePath,transformedActions:i})}return I.info(`Transformed ${r.length} server action file(s)`),r}var L=S.getLogger(["laroux-bundler","client-action-stub"]);function yn(e,t){return`${e.replace(/\.[cm]?[jt]sx?$/,"")}#${t}`}function xn(e,t){let n=yn(e,t);return`export const ${t} = Object.assign(
|
|
9
|
+
async function ${t}(...args) {
|
|
10
|
+
if (typeof globalThis.__callServer !== "function") {
|
|
11
|
+
throw new Error("Server actions not initialized. Ensure client bootstrap provides __callServer.");
|
|
12
|
+
}
|
|
13
|
+
return globalThis.__callServer("${n}", args);
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
$$typeof: Symbol.for("react.server.reference"),
|
|
17
|
+
$$id: "${n}",
|
|
18
|
+
$$bound: null
|
|
19
|
+
}
|
|
20
|
+
);`}function wn(e,t){let n=`/**
|
|
21
|
+
* Auto-generated client stubs for server actions
|
|
22
|
+
* Original file: ${e}
|
|
23
|
+
*
|
|
24
|
+
* These stubs call the server's /action endpoint with the correct action ID.
|
|
25
|
+
* Action ID format: path/to/file#exportName
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
`,r=t.map(s=>xn(e,s)).join(`
|
|
29
|
+
|
|
30
|
+
`);return n+r+`
|
|
31
|
+
`}async function bn(e,t){let n;try{n=await o.fs.readTextFile(e)}catch(a){return L.warn(`Failed to read file: ${e}`,{error:a}),null}if(!ge(n,"use server"))return null;let r=me(n);if(r.length===0)return L.debug(`Skipping ${e} - no exports found`),null;let s=r.filter(a=>a!=="default");if(s.length===0)return L.debug(`Skipping ${e} - only default export`),null;L.debug(`Generating stubs for ${e} with ${s.length} export(s)`);let i=wn(t,s);return await o.fs.writeTextFile(e,i),L.debug(`Generated client stubs: ${s.join(", ")}`),s}async function rt(e,t){if(L.debug(`Scanning for server actions in: ${e}`),!await o.fs.exists(e))return L.debug(`Directory does not exist: ${e}`),[];let r=await X(e,{projectRoot:t});if(r.length===0)return L.debug("No server action files found"),[];L.info(`Found ${r.length} server action file(s) to generate stubs for`);let s=[];for(let i of r){let a=await bn(i.filePath,i.relativePath);a!==null&&a.length>0&&s.push({filePath:i.filePath,relativePath:i.relativePath,exportedActions:a})}return L.info(`Generated stubs for ${s.length} server action file(s)`),s}var V="0123456789ABCDEFGHJKMNPQRSTVWXYZ",se=V.length,$e=Math.pow(2,48)-1,Ee=10,ot=16,Cn=Ee+ot;function st(e,t,n){return e.substring(0,t)+n+e.substring(t+1)}function he(e){if(!Number.isInteger(e)||e<0||e>$e)throw new RangeError(`Time must be a positive integer less than ${$e}`);let t="";for(let n=Ee;n>0;n--){let r=e%se;t=V[r]+t,e=Math.floor(e/se)}return t}function Oe(){let e="",t=crypto.getRandomValues(new Uint8Array(ot));for(let n of t)e+=V[n%se];return e}function vn(e){let t=e.length,n,r,s=se-1;for(;--t>=0;){if(n=e[t],r=V.indexOf(n),r===-1)throw new TypeError("Incorrectly encoded string");if(r===s){e=st(e,t,V[0]);continue}return st(e,t,V[r+1])}throw new Error("Cannot increment this string")}function it(e=Oe){let t=0,n;return function(s=Date.now()){if(s<=t){let a=n=vn(n);return he(t)+a}t=s;let i=n=e();return he(s)+i}}var Nr=it();function at(e=Date.now()){return he(e)+Oe()}var lt={name:"noop",analyzeClientComponents:()=>Promise.resolve([]),getAllComponents:()=>Promise.resolve([]),transformClientComponents:()=>Promise.resolve([])};var oe=class extends Error{constructor(n,r,s){super(n);this.code=r;this.hint=s;this.name="BuildError"}},ut={cssError:e=>new oe(`CSS processing failed: ${e}`,"BUILD104","Check your CSS files and configuration."),moduleNotFound:e=>new oe(`Module not found: ${e}`,"BUILD100","Check that the file exists and the import path is correct."),buildFailed:e=>new oe(`Build failed: ${e}`,"BUILD101","Check the error details above and fix any syntax or type errors.")};import{transform as Sn}from"lightningcss";var ie=S.getLogger(["laroux-bundler","css"]);async function De(e){let{input:t,output:n,minify:r=!1,projectRoot:s,plugin:i}=e;if(!await o.fs.exists(t)){ie.warn(`CSS input file not found: ${t}`);return}let a=o.path.resolve(n,"..");await o.fs.ensureDir(a);let c=await o.fs.readTextFile(t);ie.debug(`Processing CSS: ${t} \u2192 ${n}`);let u={projectRoot:s,cssPath:t,isModule:!1};try{(i?.shouldProcess?.(c,u)??!!i)&&i?.compile?c=await i.compile(c,u):c=await ct(c,r),await o.fs.writeTextFile(n,c),ie.debug(`\u2713 CSS processed successfully: ${n}`)}catch(l){let p=l instanceof Error?l.message:String(l);throw ie.error(`CSS processing failed: ${p}`),ut.cssError(p)}}function ct(e,t){try{let n=Sn({filename:"styles.css",code:new TextEncoder().encode(e),minify:t,targets:{chrome:5898240,firefox:5767168,safari:917504},unusedSymbols:[]});return new TextDecoder().decode(n.code)}catch(n){return ie.warn(`Lightning CSS post-processing failed: ${n instanceof Error?n.message:String(n)}`),e}}var Te=S.getLogger(["laroux-bundler","import-map"]),Rn=new Set(["npm:","jsr:","node:"]),Pn=new Set(["npm:","jsr:","node:","http:","https:","file:","data:"]),kn=12;function Z(e){if(URL.canParse(e))return new URL(e).protocol;let t=e.indexOf(":");return t>0&&t<kn?e.slice(0,t+1):null}function ae(e){return e.startsWith("./")||e.startsWith("../")||e.startsWith("/")}function ye(e){let t=Z(e);return t!==null&&Pn.has(t)?!1:!ae(e)}function Mn(e){let t=Z(e);return t==="npm:"||t===null&&!ae(e)}function Fn(e){return Z(e)==="jsr:"}function Bn(e){return ae(e)||Z(e)==="file:"}function $n(e){let t=[];for(let[n,r]of Object.entries(e))t.push({specifier:n,target:r,source:"deno.json",isNpmPackage:Mn(r),isJsrPackage:Fn(r),isLocalPath:Bn(r)});return t}function En(e){let t=[];for(let[n,r]of Object.entries(e)){let s=Z(r);s==="workspace:"||s==="file:"||t.push({specifier:n,target:`npm:${n}@${r}`,source:"package.json",isNpmPackage:!0,isJsrPackage:!1,isLocalPath:!1})}return t}async function On(e){let t=o.path.join(e,"deno.json");try{if(!await o.fs.exists(t)){let s=o.path.join(e,"deno.jsonc");if(!await o.fs.exists(s))return null;let a=await o.fs.readTextFile(s);return JSON.parse(a)}let r=await o.fs.readTextFile(t);return JSON.parse(r)}catch(n){return Te.debug(`Failed to load deno.json: ${n instanceof Error?n.message:String(n)}`),null}}async function Dn(e){let t=o.path.join(e,"package.json");try{if(!await o.fs.exists(t))return null;let r=await o.fs.readTextFile(t);return JSON.parse(r)}catch(n){return Te.debug(`Failed to load package.json: ${n instanceof Error?n.message:String(n)}`),null}}async function dt(e){let t=new Map,n=[],r=await On(e),s=await Dn(e);if(s!==null){let i={...s.peerDependencies,...s.devDependencies,...s.dependencies};for(let a of En(i))t.set(a.specifier,a),(a.isNpmPackage||a.isJsrPackage)&&n.push(a.specifier)}if(r?.imports!==void 0)for(let i of $n(r.imports))t.set(i.specifier,i),(i.isNpmPackage||i.isJsrPackage)&&(n.includes(i.specifier)||n.push(i.specifier));return Te.debug(`Loaded import map: ${t.size} entries, ${n.length} externals`),{entries:t,externals:n,projectRoot:e,hasDenoJson:r!==null,hasPackageJson:s!==null}}function pt(e,t){let n=t.entries.get(e);if(n!==void 0)return n.target;for(let[r,s]of t.entries){if(r.endsWith("/")&&e.startsWith(r)){let i=e.slice(r.length);return s.target.endsWith("/")?`${s.target}${i}`:`${s.target}/${i}`}if(e.startsWith(`${r}/`)){let i=e.slice(r.length);return`${s.target}${i}`}}return null}function ft(e,t){let n=Z(e);if(n!==null&&Rn.has(n))return!0;let r=t.entries.get(e);if(r!==void 0)return r.isNpmPackage||r.isJsrPackage;for(let[s,i]of t.entries)if(e.startsWith(`${s}/`))return i.isNpmPackage||i.isJsrPackage;return!1}async function Tn(e,t){let n=o.path.join(t,"node_modules",".deno");try{if(!(await o.fs.stat(n).catch(()=>null))?.isDirectory)return null;let s=e.split("/"),i=e.startsWith("@")?s.slice(0,2).join("/"):s[0]??e,a=e.startsWith("@")?s.slice(2).join("/"):s.slice(1).join("/");for await(let c of o.fs.readDir(n))if(c.isDirectory&&c.name.startsWith(`${i}@`)){let u=o.path.join(n,c.name,"node_modules",i);if(!(await o.fs.stat(u).catch(()=>null))?.isDirectory)continue;if(a){let m=o.path.join(u,a);if(await o.fs.stat(m).catch(()=>null))return m;let y=`${m}.js`;if(await o.fs.stat(y).catch(()=>null))return y;continue}let p=await fe({baseDir:u});if(p!==void 0){let m;if(p.exports!==void 0){let h=p.exports.value;if(typeof h=="string")m=h;else if(typeof h=="object"&&h["."]!==void 0){let y=h["."];if(typeof y=="string")m=y;else if(typeof y=="object"){let C=y;m=C.import??C.module??C.default??C.require}}}if(m===void 0)for(let h of p._loadedFiles){let y=h.content,C=y.module,R=y.main;if(m=C??R,m!==void 0)break}return m??="index.js",o.path.join(u,m)}let f=o.path.join(u,"index.js");if(await o.fs.stat(f).catch(()=>null))return f}}catch{}return null}var M=S.getLogger(["laroux-bundler","import-map-resolver"]);function gt(e){let t=e.cache??new Map,n=e.importMap??null,r=e.autoMarkExternal??!0,s=e.externals??[],i=c=>{for(let u of s)if(c===u||c.startsWith(`${u}/`))return!0;return!1},a={...e.browserShims.jsr,...e.browserShims.nodeBuiltins};return{name:"import-map-resolver",async setup(c){n===null&&(n=await dt(e.projectRoot),M.debug(`Loaded import map: ${n.entries.size} entries, ${n.externals.length} externals`)),c.onResolve({filter:/^[^./]/},async u=>{let l=u.path;if(!ye(l))return{};let p=t.get(l);if(p!==void 0)return p==="external"?{external:!0}:{path:p};if(i(l))return t.set(l,"external"),M.debug(`Marking ${l} as external (explicit)`),{external:!0};if(a[l]!==void 0)return M.debug(`Using browser shim for ${l}`),{path:`\0virtual:${l}`,namespace:"browser-shim"};let f=pt(l,n);if(f!==null){if(r&&ft(l,n))return t.set(l,"external"),M.debug(`Marking ${l} as external`),{external:!0};try{if(ae(f)){let m=o.path.resolve(n.projectRoot,f);return t.set(l,m),M.debug(`Resolved ${l} \u2192 ${m}`),{path:m}}let d=import.meta.resolve(f);if(d.startsWith("file://")){let m=new URL(d).pathname;return t.set(l,m),M.debug(`Resolved ${l} \u2192 ${m}`),{path:m}}return r?(t.set(l,"external"),M.debug(`Marking ${l} as external (remote: ${d})`),{external:!0}):(M.debug(`Letting bundler resolve ${l} from node_modules`),{})}catch(d){M.debug(`Failed to resolve ${f}: ${d instanceof Error?d.message:String(d)}`)}}if(r&&ye(l))return t.set(l,"external"),M.debug(`Marking ${l} as external (bare import not in import map)`),{external:!0};if(!r&&ye(l)){let d=await Tn(l,e.projectRoot);if(d!==null)return t.set(l,d),M.debug(`Resolved npm transitive dependency ${l} \u2192 ${d}`),{path:d}}return{}}),c.onResolve({filter:/^jsr:/},u=>{let l=u.path,p=t.get(l);if(p!==void 0)return p==="external"?{external:!0}:{path:p};try{let f=import.meta.resolve(l);if(f.startsWith("file://")){let d=new URL(f).pathname;return t.set(l,d),M.debug(`Resolved ${l} \u2192 ${d}`),{path:d}}return t.set(l,"external"),M.debug(`Marking ${l} as external (remote JSR)`),{external:!0}}catch(f){return M.debug(`Failed to resolve ${l}: ${f instanceof Error?f.message:String(f)}`),{}}}),c.onResolve({filter:/^node:/},u=>{let l=u.path;return a[l]!==void 0?(M.debug(`Using browser shim for ${l}`),{path:`\0virtual:${l}`,namespace:"browser-shim"}):(M.warn(`Node builtin ${l} has no browser shim - marking as external`),{external:!0})}),c.onLoad({filter:/.*/,namespace:"browser-shim"},u=>{let l=u.path.replace("\0virtual:",""),p=a[l];return p!==void 0?{contents:p,loader:"js"}:{}})}}}var K=S.getLogger(["laroux-bundler","route-scanner"]),xe=null,je=0,jn=/(?:^|[/\\])(?:_[^/\\]*|.*\.test\.(?:[cm]?[jt]sx?))$/,yt=["page","layout","route","proxy"],Nn=new Set(yt.flatMap(e=>re.map(t=>`${e}.${t}`)));function In(e){for(let t of yt)if(e.startsWith(`${t}.`)&&pe.test(e))return t;return null}function xt(){xe=null,je=0,K.debug("Route cache invalidated")}async function wt(e,t,n=!1){if(!n&&xe)try{if(((await o.fs.stat(e)).mtime?.getTime()??0)<=je)return K.debug("Using cached route scan result"),xe}catch{}K.debug(`Scanning routes in: ${e}`);let r=new Map;for await(let d of tt(e,void 0,jn)){let m=o.path.basename(d);if(!Nn.has(m))continue;let h=o.path.dirname(d),y=r.get(h)??{},C=o.path.join(e,d),R=In(m);R==="page"?y.pagePath=C:R==="layout"?y.layoutPath=C:R==="route"?y.routePath=C:R==="proxy"&&(y.proxyPath=C),r.set(h,y)}let s=[],i=[],a=[],c=d=>{let m=d;for(;m&&m!==".";){let h=o.path.dirname(m);if(h===m)break;let y=r.get(h);if(y?.layoutPath)return o.path.relative(t,y.layoutPath);m=h}};for(let[d,m]of r){let h=An(d);if(m.pagePath){let y=o.path.relative(t,m.pagePath),C=m.layoutPath?o.path.relative(t,m.layoutPath):c(d);s.push({routePath:h,componentPath:y,layoutPath:C,isApiRoute:!1}),K.debug(`Found page: ${h} -> ${y}${C?` (layout: ${C})`:""}`)}if(m.routePath){let y=o.path.relative(t,m.routePath);i.push({routePath:h,componentPath:y,isApiRoute:!0}),K.debug(`Found API route: ${h} -> ${y}`)}if(m.proxyPath){let y=o.path.relative(t,m.proxyPath);a.push({pathPrefix:h||"/",modulePath:y}),K.debug(`Found proxy: ${h||"/"} -> ${y}`)}}let u=mt(s),l=mt(i),p=zn(a);K.debug(`Found ${u.length} page routes, ${l.length} API routes, ${p.length} proxies`);let f={routes:u,apiRoutes:l,proxies:p};try{je=(await o.fs.stat(e)).mtime?.getTime()??0}catch{}return xe=f,f}function An(e){return!e||e==="."||e==="home"?"/":`/${H(e)}`}function mt(e){return e.sort((t,n)=>{let r=ht(t.routePath),s=ht(n.routePath);return r!==s?s-r:n.routePath.length-t.routePath.length})}function ht(e){let t=0,n=e.split("/").filter(Boolean);t+=n.length*10;for(let r of n)r.startsWith("[...")?t-=100:r.startsWith("[")?t-=5:t+=3;return t}function zn(e){return e.sort((t,n)=>n.pathPrefix.length-t.pathPrefix.length)}var _=S.getLogger(["laroux-bundler","route-generator"]);async function bt(e){let{scanResult:t,outputPath:n,projectRoot:r}=e,{routes:s}=t;_.debug(`Generating routes file: ${n}`);let i=[],a=[],c=new Map;for(let l of s){let p=`./${z(l.componentPath,"")}.js`,f=o.path.join(r,l.componentPath),d=Un(l.componentPath),m=await Ln(f,d),h;if(l.layoutPath){let C=o.path.join(r,l.layoutPath),R=_n(l.layoutPath);h=await Wn(C,R)}if(c.has(l.componentPath)||(i.push(`import { ${m} } from "${p}";`),c.set(l.componentPath,m)),l.layoutPath&&h){let C=`./${z(l.layoutPath,"")}.js`;c.has(l.layoutPath)||(i.push(`import { ${h} } from "${C}";`),c.set(l.layoutPath,h))}let y=Jn(l,m,h);a.push(y)}let u=`// AUTO-GENERATED FILE - DO NOT EDIT
|
|
32
|
+
// Generated by laroux-bundler/route-generator.ts
|
|
33
|
+
// Run build to regenerate
|
|
34
|
+
|
|
35
|
+
import type { RouteDefinition } from "@eser/laroux/router";
|
|
36
|
+
${i.join(`
|
|
37
|
+
`)}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Auto-generated routes from file-based routing
|
|
41
|
+
* Routes are sorted by specificity (static > dynamic > catch-all)
|
|
42
|
+
*/
|
|
43
|
+
export const generatedRoutes: RouteDefinition[] = [
|
|
44
|
+
${a.map(l=>` ${l}`).join(`,
|
|
45
|
+
`)},
|
|
46
|
+
];
|
|
47
|
+
`;await o.fs.writeTextFile(n,u),_.debug(`Generated ${s.length} route(s)`)}async function Ct(e,t,n){let{apiRoutes:r}=e;if(r.length===0){_.debug("No API routes found, skipping generation");return}_.debug(`Generating API routes file: ${t}`);let s=[];for(let a of r){let c=o.path.dirname(t),u=kt(c,o.path.join(n,a.componentPath));s.push(` { path: "${a.routePath}", modulePath: "${u}" }`)}let i=`// AUTO-GENERATED FILE - DO NOT EDIT
|
|
48
|
+
// Generated by laroux-bundler/route-generator.ts
|
|
49
|
+
|
|
50
|
+
export type ApiRouteDefinition = {
|
|
51
|
+
path: string;
|
|
52
|
+
modulePath: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Auto-generated API routes from file-based routing
|
|
57
|
+
*/
|
|
58
|
+
export const apiRoutes: ApiRouteDefinition[] = [
|
|
59
|
+
${s.join(`,
|
|
60
|
+
`)},
|
|
61
|
+
];
|
|
62
|
+
`;await o.fs.writeTextFile(t,i),_.debug(`Generated ${r.length} API route(s)`)}async function vt(e,t,n){let{proxies:r}=e;if(r.length===0){_.debug("No proxies found, skipping generation");return}_.debug(`Generating proxy registry file: ${t}`);let s=[];for(let a of r){let c=o.path.dirname(t),u=kt(c,o.path.join(n,a.modulePath));s.push(` { pathPrefix: "${a.pathPrefix}", modulePath: "${u}" }`)}let i=`// AUTO-GENERATED FILE - DO NOT EDIT
|
|
63
|
+
// Generated by laroux-bundler/route-generator.ts
|
|
64
|
+
|
|
65
|
+
export type ProxyDefinition = {
|
|
66
|
+
pathPrefix: string;
|
|
67
|
+
modulePath: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Auto-generated proxy definitions from file-based routing
|
|
72
|
+
* Sorted by path prefix length (most specific first)
|
|
73
|
+
*/
|
|
74
|
+
export const proxyRegistry: ProxyDefinition[] = [
|
|
75
|
+
${s.join(`,
|
|
76
|
+
`)},
|
|
77
|
+
];
|
|
78
|
+
`;await o.fs.writeTextFile(t,i),_.debug(`Generated ${r.length} proxy definition(s)`)}async function St(e){try{let t=await o.fs.readTextFile(e),n=[],r=t.matchAll(/export\s+(?:async\s+)?function\s+(\w+)/g);for(let i of r)i[1]!==void 0&&n.push(i[1]);let s=t.matchAll(/export\s+const\s+(\w+)\s*=/g);for(let i of s)i[1]!==void 0&&n.push(i[1]);return t.match(/export\s+default\s+/)&&n.push("default"),[...new Set(n)]}catch{return[]}}async function Ln(e,t){let n=await St(e);if(n.length===0)return t;let r=n.find(i=>i!=="default"&&i.endsWith("Page"));if(r)return r;let s=n.find(i=>i!=="default");return s||t}async function Wn(e,t){let n=await St(e);if(n.length===0)return t;let r=n.find(i=>i!=="default"&&i.endsWith("Layout"));if(r)return r;let s=n.find(i=>i!=="default");return s||t}function Un(e){let t=o.path.basename(o.path.dirname(e));return`${Pt(Rt(t))}Page`}function _n(e){let t=o.path.basename(o.path.dirname(e));return`${Pt(Rt(t))}Layout`}function Rt(e){return e.startsWith("[...")?e.slice(4,-1):e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}function Pt(e){return e.split(/[-_\s]+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function kt(e,t){let n=H(o.path.relative(e,t));return n.startsWith(".")?n:`./${n}`}function Jn(e,t,n){let r=[`path: "${e.routePath}"`,`component: ${t}`];return n&&r.push(`layout: ${n}`),`{ ${r.join(", ")} }`}var Gn=/(?:node_modules|\/\.|^\.|\\\.)/,W=S.getLogger(["laroux-bundler","virtual-source"]),we="_bundle_src";function Hn(e,t){return o.path.relative(t,e)}async function Mt(e){let{projectRoot:t,distDir:n,srcDir:r,changedFiles:s}=e,i=Hn(r,t),a=o.path.resolve(n,we),c=o.path.resolve(a,i);W.debug(`Creating virtual source: ${a}`),W.debug(` Virtual src subdir: ${c}`);let u=await o.fs.exists(c);if(s&&s.size>0&&u)W.debug(`Incremental update: ${s.size} file(s) changed`),await Vn(s,r,c),W.debug(`Virtual source updated incrementally: ${s.size} file(s)`);else{try{await Qe(a)}catch{}await Kn(r,c,t),W.debug(`Virtual source created: ${a}`)}return{virtualSrcDir:a,cleanup:async()=>{W.debug(`Cleaning up virtual source: ${a}`);try{await o.fs.remove(a,{recursive:!0}),W.debug("Virtual source cleaned up")}catch(l){W.warn("Failed to clean up virtual source:",{error:l})}}}}async function Vn(e,t,n){let r=[...re.map(a=>`.${a}`),".json",".css"],s=0,i=0;for(let a of e){if(!a.startsWith(t))continue;let c=o.path.extname(a);if(!r.includes(c))continue;let u=o.path.relative(t,a),l=o.path.resolve(n,u);try{await o.fs.stat(a),await Ye(o.path.dirname(l)),await U(a,l,{overwrite:!0}),s++}catch{try{await o.fs.remove(l),i++}catch{}}}(s>0||i>0)&&W.debug(`Incremental update: ${s} copied, ${i} deleted`)}async function Kn(e,t,n){let r=0,s=[...re.map(i=>`.${i}`),".json",".css"];for await(let i of et(e,{includeDirs:!1})){let a=o.path.extname(i.path);if(!s.includes(a))continue;let c=o.path.relative(e,i.path);if(Gn.test(c))continue;let u=o.path.resolve(t,c);await o.fs.ensureDir(o.path.dirname(u)),await U(i.path,u),r++}W.debug(`Copied ${r} source file(s) to virtual source`)}function le(e,t,n,r){let s=o.path.relative(t,e),i=r??o.path.basename(t);return o.path.resolve(n,i,s)}function Ft(e,t,n){return e.map(r=>{let s=le(r.filePath,t,n),i=`${we}/${r.relativePath}`;return{...r,filePath:s,relativePath:i}})}var J=S.getLogger(["laroux-bundler","build-cache"]),Ie=class{clientComponentCache=new Map;cssModuleCache=new Map;routeCache=null;getClientComponent(t,n){let r=this.clientComponentCache.get(t);return r&&r.mtime>=n?(J.debug(`Cache hit: client component ${t}`),r):null}setClientComponent(t,n,r,s){this.clientComponentCache.set(t,{isClient:n,exportNames:r,mtime:s})}getCssModuleResult(t,n){let r=this.cssModuleCache.get(t);return r&&r.mtime>=n?(J.debug(`Cache hit: CSS module ${t}`),r):null}setCssModuleResult(t,n,r,s){this.cssModuleCache.set(t,{code:n,exports:r,mtime:s})}getRouteCache(t){return this.routeCache&&this.routeCache.mtime>=t?(J.debug("Cache hit: route scan"),this.routeCache):null}setRouteCache(t,n,r,s){this.routeCache={routes:t,apiRoutes:n,proxies:r,mtime:s}}invalidateFile(t){this.clientComponentCache.has(t)&&(this.clientComponentCache.delete(t),J.debug(`Invalidated: client component ${t}`)),this.cssModuleCache.has(t)&&(this.cssModuleCache.delete(t),J.debug(`Invalidated: CSS module ${t}`)),(t.includes("/routes/")||t.includes("\\routes\\"))&&(this.routeCache=null,xt(),J.debug("Invalidated: route cache"))}invalidateFiles(t){for(let n of t)this.invalidateFile(n)}clear(){this.clientComponentCache.clear(),this.cssModuleCache.clear(),this.routeCache=null,J.debug("All caches cleared")}getStats(){return{clientComponents:this.clientComponentCache.size,cssModules:this.cssModuleCache.size,hasRoutes:this.routeCache!==null}}},Ne=null;function Bt(){return Ne||(Ne=new Ie,J.debug("Created global build cache")),Ne}var qn=new TextEncoder().encode("0123456789abcdef"),$t=new Uint8Array(128).fill(16);qn.forEach((e,t)=>$t[e]=t);new TextEncoder().encode("ABCDEF").forEach((e,t)=>$t[e]=t+10);function Et(e){return e*2}function Ot(e,t,n,r){for(;t<e.length;++t){let s=e[t];e[n++]=r[s>>4],e[n++]=r[s&15]}return n}function Dt(e,t){let n=e.length;if(e.byteOffset){let r=new Uint8Array(e.buffer);r.set(e),e=r.subarray(0,n)}return e=new Uint8Array(e.buffer.transfer(t)),e.set(e.subarray(0,n),t-n),[e,t-n]}var Tt=new TextEncoder().encode("0123456789abcdef"),jt=new Uint8Array(128).fill(16);Tt.forEach((e,t)=>jt[e]=t);new TextEncoder().encode("ABCDEF").forEach((e,t)=>jt[e]=t+10);function be(e){typeof e=="string"?e=new TextEncoder().encode(e):e instanceof ArrayBuffer?e=new Uint8Array(e).slice():e=e.slice();let[t,n]=Dt(e,Et(e.length));return Ot(t,n,0,Tt),new TextDecoder().decode(t)}var Ce=(e,t)=>({success:!0,outputs:e,metafile:t?.metafile,entrypointManifest:t?.entrypointManifest,entrypoint:t?.entrypoint,totalSize:t?.totalSize}),Q=e=>({success:!1,outputs:new Map,errors:e});var ve=S.getLogger(["bundler","deno-bundler"]),Se=class{name="deno-bundler";options;constructor(t={}){this.options=t}async bundle(t){let n=await o.fs.makeTempDir({prefix:"deno-bundle-"});try{let r=Object.values(t.entrypoints),s=Object.keys(t.entrypoints),i=[...r];if(this.options.buildId!==void 0){let p=o.path.join(n,"_build-id-entry.ts");await o.fs.writeTextFile(p,`export const BUILD_ID = "${this.options.buildId}";
|
|
79
|
+
`),i.unshift(p)}let a=t.platform==="browser"?"browser":"deno",c=t.sourcemap===!0?"external":t.sourcemap===!1?void 0:t.sourcemap,u={entrypoints:i,outputDir:n,format:"esm",codeSplitting:t.codeSplitting,minify:t.minify,platform:a,sourcemap:c};t.external!==void 0&&(u.external=t.external),ve.debug("Calling Deno.bundle",{entrypoints:i.slice(0,3),outputDir:n,external:u.external,platform:u.platform});let l=await Deno.bundle(u);if(ve.debug("Deno.bundle result",{success:l.success,errors:l.errors?.length??0}),!l.success){let f=(l.errors??[]).map(d=>({message:d.text??this.extractErrorMessage(d),severity:"error"}));return Q(f)}return await this.processOutput(n,t,s,r)}catch(r){return Q([{message:r instanceof Error?r.message:String(r),severity:"fatal"}])}finally{try{await o.fs.remove(n,{recursive:!0})}catch{}}}watch(t,n){let r=!0,s=Object.values(t.entrypoints).map(u=>o.path.dirname(u)),i=[...new Set(s)],a=Deno.watchFs(i,{recursive:!0});return(async()=>{for await(let u of a){if(!r)break;let l=await this.bundle(t);n(l)}})().catch(u=>{console.error("Watch loop error:",u)}),Promise.resolve({stop:()=>(r=!1,a.close(),Promise.resolve())})}extractErrorMessage(t){return t==null?"Unknown error":typeof t=="object"&&"message"in t?String(t.message):String(t)}async processOutput(t,n,r,s){let i=this.options.entryName??"main",a=new Map,c={},u={},l=null,p=0,f=new Map,d=new Map;for(let b=0;b<s.length;b++){let w=s[b],x=r[b];if(w!==void 0&&x!==void 0){let P=o.path.basename(w).replace(/\.[^.]+$/,"");f.set(P,x),d.set(z(w,".js"),x)}}let m=o.path.join(t,"dist"),h=t;try{(await o.fs.stat(m)).isDirectory&&(h=m)}catch{}let y=[];ve.debug(`Scanning output dir: ${h}`);let C=async(b,w="")=>{for await(let x of o.fs.readDir(b)){let P=o.path.join(b,x.name),F=w?`${w}/${x.name}`:x.name;x.isDirectory?await C(P,F):x.isFile&&(x.name.endsWith(".js")||x.name.endsWith(".map"))&&y.push({name:F,path:P})}};if(await C(h),h!==t){for await(let b of o.fs.readDir(t))if(b.isFile&&(b.name.endsWith(".js")||b.name.endsWith(".map"))&&(b.name.startsWith("chunk-")||b.name.endsWith(".map"))){let w=o.path.join(t,b.name);y.some(x=>x.path===w)||y.push({name:b.name,path:w})}}ve.debug(`Found ${y.length} output files`,y.map(b=>b.name));let R=new Map;for(let b of y)if(b.name.endsWith(".map")){let w=await o.fs.readFile(b.path),x=b.name;b.name.startsWith("_client-entry")?x=`${i}.js.map`:b.name.startsWith("_build-id-entry")&&(x="build-id.js.map"),R.set(x,w)}for(let b of y){if(b.name.endsWith(".map"))continue;let w=await o.fs.readTextFile(b.path);n.basePath!==void 0&&(w=w.replace(/\/_lime\/alive/g,`${n.basePath}/_lime/alive`)),n.define!==void 0&&(w=Xn(w,n.define)),w=w.replace(/from\s*["']\.\.\/chunk-/g,'from"./chunk-'),w=w.replace(/from\s*["']\.\.chunk-/g,'from"./chunk-'),w=w.replace(/import\s*\(["']\.\.\/chunk-/g,'import("./chunk-'),w=w.replace(/import\s*\(["']\.\.chunk-/g,'import("./chunk-');let x=b.name,P=x.startsWith("_client-entry");if(P)x=`${i}.js`,l=`${i}.js`;else if(x.startsWith("_build-id-entry"))x="build-id.js";else if(!x.startsWith("chunk-")){let j;for(let[ee,Fe]of d)if(ee.endsWith(x)){j=Fe;break}if(j===void 0){let ee=o.path.basename(x).replace(/\.js$/,"");j=f.get(ee)}j!==void 0&&(x=`${j}.js`)}P&&R.has(`${i}.js.map`)&&(w=w.replace(/\/\/# sourceMappingURL=.*$/m,`//# sourceMappingURL=${i}.js.map`),w.includes("//# sourceMappingURL=")||(w+=`
|
|
80
|
+
//# sourceMappingURL=${i}.js.map`));let F=new TextEncoder().encode(w),de=await this.computeHash(F),D=this.parseImports(w),Me=`${x}.map`,Y=R.get(Me);a.set(x,{path:x,code:F,map:Y,size:F.length,hash:de,isEntry:!x.startsWith("chunk-")}),p+=F.length,c[x]={bytes:F.length,inputs:{},imports:D.map(j=>({path:j,kind:"import-statement"}))}}for(let[b,w]of R)if(!a.has(b)){let x=await this.computeHash(w);a.set(b,{path:b,code:w,size:w.length,hash:x,isEntry:!1}),p+=w.length}if(n.outputDir!==void 0){await o.fs.mkdir(n.outputDir,{recursive:!0});for(let[b,w]of a){let x=o.path.join(n.outputDir,b),P=o.path.dirname(x);P!==n.outputDir&&await o.fs.mkdir(P,{recursive:!0}),await o.fs.writeFile(x,w.code)}}for(let[b,w]of Object.entries(n.entrypoints)){if(b==="client"||b==="main")continue;let x=await this.findEntrypointChunks(b,h,t,a);x.length>0&&(u[w]=x)}return Ce(a,{metafile:{inputs:{},outputs:c},entrypointManifest:u,entrypoint:l??"main.js",totalSize:p})}async findEntrypointChunks(t,n,r,s){let i=z(t,".js"),a=o.path.join(n,i),c=null;try{c=await o.fs.readTextFile(a)}catch{try{let u=o.path.join(r,"dist",i);c=await o.fs.readTextFile(u)}catch{}}return c!==null?this.extractChunksFromProxyFile(c,s):this.findChunksForComponentName(t,s)}findChunksForComponentName(t,n){let r=[],s=o.path.basename(t).replace(/\.[^.]+$/,""),i=s.charAt(0).toUpperCase()+s.slice(1).replace(/-([a-z])/g,(a,c)=>c.toUpperCase());for(let[a,c]of n){if(!a.startsWith("chunk-")||!a.endsWith(".js"))continue;let u=new TextDecoder().decode(c.code);if([new RegExp(`export\\s*\\{[^}]*\\b${i}\\b[^}]*\\}`),new RegExp(`export\\s+(?:function|const|let|var|class)\\s+${i}\\b`),new RegExp(`\\b\\w+\\s+as\\s+${i}\\b`)].some(f=>f.test(u))){r.unshift(a);let f=/from\s*["']\.?\/?([^"']*chunk-[A-Z0-9]+\.js)["']/gi,d;for(;(d=f.exec(u))!==null;){let m=o.path.basename(d[1]??"");m&&!r.includes(m)&&r.push(m)}break}}return r}extractChunksFromProxyFile(t,n){let r=[],s=/import(?:\{[\w\s,]*\})?\s*from\s*["']([\w./-]*chunk-[A-Z0-9]+\.js)["']/gi,i=/import\s*["']([\w./-]*chunk-[A-Z0-9]+\.js)["']/gi,a;for(;(a=s.exec(t))!==null;){let u=a[1];if(u!==void 0){let l=o.path.basename(u);r.includes(l)||r.push(l)}}for(;(a=i.exec(t))!==null;){let u=a[1];if(u!==void 0){let l=o.path.basename(u);r.includes(l)||r.push(l)}}let c=t.match(/export\s*\{([\w\s,]+)\}/);if(c!==null){let p=c[1]?.match(/(\w+)(?:\s+as\s+\w+)?/)?.[1]??null;if(p!==null){let f=null;for(let[d,m]of n){if(!d.startsWith("chunk-")||!d.endsWith(".js"))continue;let h=new TextDecoder().decode(m.code);if([new RegExp(`export\\s*\\{[^}]*\\b${p}\\b[^}]*\\}`),new RegExp(`export\\s+(?:function|const|let|var|class)\\s+${p}\\b`),new RegExp(`\\b\\w+\\s+as\\s+${p}\\b`)].some(R=>R.test(h))){f=d;break}}if(f!==null){let d=r.indexOf(f);d>0?(r.splice(d,1),r.unshift(f)):d===-1&&r.unshift(f)}}}return r}async computeHash(t){let n=await crypto.subtle.digest("SHA-256",t);return be(new Uint8Array(n)).slice(0,16)}parseImports(t){let n=[],r=/import\s{1,10}(?:[\w\s{},*]{1,500})\s{1,10}from\s{0,10}["']([\w./@-]+)["']/g,s;for(;(s=r.exec(t))!==null;){let a=s[1];if(a!==void 0&&(a.startsWith("./")||a.startsWith("../")||a.startsWith("/"))){let c=a.startsWith("./")?a.slice(2):a.startsWith("../")?a:a.slice(1);n.push(c)}}let i=/import\s*\(\s*["']([^"']+)["']\s*\)/g;for(;(s=i.exec(t))!==null;){let a=s[1];if(a!==void 0&&(a.startsWith("./")||a.startsWith("../")||a.startsWith("/"))){let c=a.startsWith("./")?a.slice(2):a.startsWith("../")?a:a.slice(1);n.push(c)}}return[...new Set(n)]}};function Xn(e,t){let n=Object.keys(t);if(n.length===0)return e;n.sort((a,c)=>c.length-a.length);let r=!1;for(let a of n)if(e.includes(a)){r=!0;break}if(!r)return e;let s=n.map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\b(${s.join("|")})\\b`,"g");return e.replace(i,a=>t[a]??a)}var Ae=(e={})=>new Se(e);function Zn(e){let t=Object.keys(e).sort((s,i)=>i.length-s.length);if(t.length===0)return{name:"define"};let n=t.map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),r=new RegExp(`\\b(${n.join("|")})\\b`,"g");return{name:"define",transform(s,i){if(i.includes("node_modules"))return null;let a=!1;for(let u of t)if(s.includes(u)){a=!0;break}if(!a)return null;let c=s.replace(r,u=>e[u]??u);return c===s?null:{code:c}}}}var Re=class{name="rolldown";options;rolldownModule=null;constructor(t={}){this.options=t}async bundle(t){try{let n=await this.loadRolldown(),r=this.adaptPlugins(t.plugins);t.define!==void 0&&Object.keys(t.define).length>0&&r.push(Zn(t.define));let s=t.projectRoot!==void 0?[`${t.projectRoot}/node_modules`,"node_modules"]:["node_modules"],i=await n.rolldown({input:t.entrypoints,external:t.external,plugins:r,resolve:{modules:s}}),a=t.sourcemap===!0?!0:t.sourcemap==="inline"?"inline":t.sourcemap==="external"?!0:void 0,c={dir:t.outputDir,format:t.format,entryFileNames:"[name].js",chunkFileNames:"chunk-[hash].js",sourcemap:a,minify:t.minify,...this.options.advancedChunks!==void 0?{advancedChunks:{minSize:this.options.advancedChunks.minSize??2e4,groups:this.options.advancedChunks.groups?.map(l=>({name:l.name,test:l.test,priority:l.priority??0}))}}:{}},u=await i.write(c);return await i.close(),await this.processRolldownOutput(u,t)}catch(n){return Q([{message:n instanceof Error?n.message:String(n),severity:"fatal"}])}}async watch(t,n){let s=await(await this.loadRolldown()).watch({input:t.entrypoints,external:t.external,plugins:this.adaptPlugins(t.plugins),output:{dir:t.outputDir,format:t.format,entryFileNames:"[name].js",chunkFileNames:"chunk-[hash].js",sourcemap:t.sourcemap===!0||t.sourcemap==="external",minify:t.minify}});return s.on("event",async i=>{if(i.code==="BUNDLE_END"){let a=await this.bundle(t);n(a)}else i.code==="ERROR"&&n(Q([{message:i.error?.message??"Watch error",severity:"error"}]))}),{stop:async()=>{await s.close()}}}async loadRolldown(){if(this.rolldownModule!==null)return this.rolldownModule;try{let t=await import("npm:rolldown@latest"),n={rolldown:r=>t.rolldown(r),watch:r=>{let s=t.watch(r);return Promise.resolve(s)}};return this.rolldownModule=n,n}catch(t){throw new Error(`Failed to load Rolldown. Make sure it's installed: ${t instanceof Error?t.message:String(t)}`)}}adaptPlugins(t){return t===void 0||t.length===0?[]:t.map(n=>{let r={name:n.name},s={resolvers:[],loaders:[],transformers:[]},i=n.setup({onResolve:(a,c)=>{s.resolvers.push({options:a,callback:c})},onLoad:(a,c)=>{s.loaders.push({options:a,callback:c})},onTransform:(a,c)=>{s.transformers.push({options:a,callback:c})}});return i instanceof Promise&&(r.buildStart=async function(){await i}),r.resolveId=async(a,c)=>{for(let u of s.resolvers)if(u.options.filter.test(a)){let l=await u.callback({path:a,importer:c??"",namespace:u.options.namespace??"file",kind:"import-statement"});if(l?.path!==void 0||l?.external===!0)return{id:l.path??a,external:l.external}}return null},r.load=async a=>{for(let c of s.loaders)if(c.options.filter.test(a)){let u=await c.callback({path:a,namespace:c.options.namespace??"file"});if(u?.contents!==void 0)return{code:typeof u.contents=="string"?u.contents:new TextDecoder().decode(u.contents)}}return null},r.transform=async(a,c)=>{let u=a;for(let l of s.transformers)if(l.options.filter.test(c)){let p=await l.callback({path:c,code:u});p?.code!==void 0&&(u=p.code)}return u!==a?{code:u}:null},r})}async processRolldownOutput(t,n){let s=`${this.options.entryName??"main"}.js`,i=new Map,a={},c={},u=null,l=0;for(let d of t.output)if(d.type==="chunk"){let m=d.code;n.basePath!==void 0&&(m=m.replace(/\/_lime\/alive/g,`${n.basePath}/_lime/alive`));let h=new TextEncoder().encode(m),y=await this.computeHash(h),C={path:d.fileName,code:h,size:h.length,hash:y,isEntry:d.isEntry,...d.map!==void 0?{map:new TextEncoder().encode(JSON.stringify(d.map))}:{}};if(i.set(d.fileName,C),l+=h.length,d.isEntry&&(d.fileName===s||u===null)&&(u=d.fileName),d.isEntry&&d.facadeModuleId!==void 0){let R=[d.fileName];if(d.imports!==void 0)for(let E of d.imports)R.includes(E)||R.push(E);c[d.facadeModuleId]=R}a[d.fileName]={bytes:h.length,inputs:{},imports:(d.imports??[]).map(R=>({path:R,kind:"import-statement"})),...d.isEntry&&d.facadeModuleId!==void 0?{entryPoint:d.facadeModuleId}:{}}}else if(d.type==="asset"){let m=typeof d.source=="string"?new TextEncoder().encode(d.source):d.source,h=await this.computeHash(m);i.set(d.fileName,{path:d.fileName,code:m,size:m.length,hash:h}),l+=m.length}return Ce(i,{metafile:{inputs:{},outputs:a},entrypointManifest:c,entrypoint:u??s,totalSize:l})}async computeHash(t){let n=await crypto.subtle.digest("SHA-256",t);return be(new Uint8Array(n)).slice(0,16)}},ze=(e={})=>new Re(e);function Pe(e,t){if(typeof e=="object"&&e!==null&&"backend"in e){let r=e;return Pe(r.backend,r.options)}let n=e??"rolldown";switch(n){case"rolldown":return ze(t);case"deno-bundler":return Ae(t);default:throw new Error(`Unknown bundler backend: ${n}`)}}var O=S.getLogger(["laroux-bundler","bundler"]);function Qn(e,t){let n={},r=0;for(let[s,i]of e.outputs)n[s]={fileName:s,size:i.size},r+=i.size;return{entrypoint:e.entrypoint??"client.js",outputs:n,manifest:t,totalSize:e.totalSize??r}}function Yn(e){let t=Object.values(e.outputs);if(t.length===0)return{chunkCount:0,largestChunk:{name:"",size:0},smallestChunk:{name:"",size:0},averageChunkSize:0};let n=t.sort((i,a)=>a.size-i.size),r=n[0],s=n[n.length-1];return{chunkCount:t.length,largestChunk:r?{name:r.fileName,size:r.size}:{name:"",size:0},smallestChunk:s?{name:s.fileName,size:s.size}:{name:"",size:0},averageChunkSize:t.length>0?e.totalSize/t.length:0}}function It(e){let t=Yn(e);O.debug("\u{1F4CA} Bundle Statistics:",{totalSizeKB:(e.totalSize/1024).toFixed(2),chunkCount:t.chunkCount,largestChunk:{name:t.largestChunk.name,sizeKB:(t.largestChunk.size/1024).toFixed(2)},smallestChunk:{name:t.smallestChunk.name,sizeKB:(t.smallestChunk.size/1024).toFixed(2)},averageChunkSizeKB:(t.averageChunkSize/1024).toFixed(2)})}async function At(e,t,n){O.info(`\u{1F4E6} Using bundler backend: ${n}`),O.debug(`Bundling with @eser/bundler (${n})...`),O.debug(` Entrypoints: ${e.entrypoints.length}`),O.debug(` Output: ${e.outputDir}`),O.debug(`Creating bundler: ${n}`);let r=Pe(n,{entryName:"client"}),s={};for(let l=0;l<e.entrypoints.length;l++){let p=e.entrypoints[l];if(p!==void 0)if(l===0)s.client=p;else{let f=t.find(d=>d.filePath===p);f!==void 0?s[f.relativePath]=p:s[`entry-${l}`]=p}}let i=e.sourcemap===!0||e.sourcemap==="external"||e.sourcemap==="inline",a={entrypoints:s,outputDir:e.outputDir,projectRoot:e.projectRoot,format:"esm",platform:e.platform==="deno"?"node":"browser",codeSplitting:e.splitting!==!1,minify:e.minify??!1,sourcemap:i,plugins:e.plugins,define:e.define},c=await r.bundle(a);if(!c.success){let l=c.errors?.map(p=>p.message).join(`
|
|
81
|
+
`)??"Unknown error";throw new Error(`Bundle failed: ${l}`)}let u={};for(let l of t){let p=c.entrypointManifest?.[l.filePath]??[];p.length>0&&(u[l.filePath]=[...p])}return O.debug(` Outputs: ${c.outputs.size} files`),O.debug(` Total size: ${((c.totalSize??0)/1024).toFixed(2)} KB`),Qn(c,u)}async function zt(e,t){O.info(`\u{1F4E6} Bundling server components with ${t}`),O.debug(` Entrypoints: ${e.entrypoints.length}`),O.debug(` Output: ${e.outputDir}`),O.debug(` Externals: ${e.externals?.length??0}`);let n=Pe(t,{entryName:"server"}),r={};for(let c of e.entrypoints){let u=c.replace(e.projectRoot,"").replace(/^\//,"");u=z(u,""),r[u]=c}let s={entrypoints:r,outputDir:e.outputDir,format:"esm",platform:"node",codeSplitting:!1,minify:e.minify??!1,sourcemap:e.sourcemap??!1,external:e.externals,plugins:e.plugins},i=await n.bundle(s);if(!i.success){let c=i.errors?.map(u=>u.message).join(`
|
|
82
|
+
`)??"Unknown error";throw new Error(`Server bundle failed: ${c}`)}let a=new Map;for(let[c,u]of i.outputs)if(u.isEntry&&i.entrypointManifest!==void 0){for(let[l,p]of Object.entries(i.entrypointManifest))if(p.includes(c)){a.set(l,c);break}}return O.debug(` Outputs: ${i.outputs.size} files`),O.debug(` Total size: ${((i.totalSize??0)/1024).toFixed(2)} KB`),{outputMap:a,totalSize:i.totalSize??0,fileCount:i.outputs.size}}var $=S.getLogger(["laroux-bundler","chunk-manifest"]),er="1.0";function Wt(e,t,n,r,s="info",i=!1){$.debug("\u{1F4CB} Generating chunk manifest...");let a={version:er,buildId:e,timestamp:t,entrypoint:n.entrypoint,logLevel:s,hmrEnabled:i,chunks:{},files:{}};for(let[u,l]of Object.entries(n.outputs))a.files[l.fileName]={name:l.fileName,size:l.size,hash:rr(l.fileName)??void 0};let c=[];for(let u of r){let l=tr(u,n),[p,...f]=l;if(!p){$.warn(`No chunks found for ${u.relativePath}`);continue}let d=[p,...f];for(let y of d)a.files[y]||c.push(`${u.relativePath} references ${y}, but it's not in bundle outputs`);let m=sr(u.relativePath);a.chunks[m]={main:Lt(p),deps:f.map(Lt),size:nr(l,a.files)};let h=u.exportNames[0]??"default";h!=="default"&&(a.chunks[m].exportName=h),$.debug(` ${m} \u2192 main: ${p}, deps: [${f.join(", ")}]`)}if(c.length>0){$.error("\u274C Chunk manifest validation failed!"),$.error(" Missing chunks:");for(let u of c)$.error(` - ${u}`);throw $.error(` Available files: ${Object.keys(a.files).join(", ")}`),new Error(`Chunk manifest validation failed: ${c.length} chunk(s) referenced but not found in bundle outputs`)}return $.debug("\u2705 Manifest generated"),$.debug(` Components: ${Object.keys(a.chunks).length}`),$.debug(` Chunks: ${Object.keys(a.files).length}`),$.debug(" Validation: All referenced chunks exist"),a}function tr(e,t){let n=t.manifest[e.filePath];if(!n||n.length===0)throw $.error(`\u274C No chunk mapping found for component: ${e.filePath}`),$.error(` Available mappings: ${Object.keys(t.manifest).join(", ")}`),new Error(`Chunk manifest incomplete: No chunks found for ${e.relativePath}. This indicates the bundler failed to analyze the component's dependencies.`);return n}function nr(e,t){return e.reduce((n,r)=>{let s=t[r];return n+(s?.size??0)},0)}function rr(e){return e.match(/-([a-f0-9]+)\./i)?.[1]??null}function Lt(e){return e.replace(/^chunk-/,"").replace(/\.js$/,"")}function sr(e){let t=`${we}/`;return e.startsWith(t)?e.slice(t.length):e}async function Ut(e,t){await o.fs.writeTextFile(t,JSON.stringify(e,null,2)),$.debug(`\u{1F4DD} Chunk manifest saved: ${t}`)}function _t(e){$.debug("\u{1F4E6} Chunk Manifest:",{entrypoint:e.entrypoint,components:Object.keys(e.chunks).length,files:Object.keys(e.files).length,chunks:Object.fromEntries(Object.entries(e.chunks).map(([t,n])=>[t,{main:n.main,deps:n.deps,exportName:n.exportName,sizeKB:(n.size/1024).toFixed(2)}]))})}var ue={minify:!0,sourceMaps:!1,codeSplitting:!0,define:{"process.env.NODE_ENV":'"production"',"process.env.DEBUG":'"false"'}},Us={minify:!1,sourceMaps:!0,codeSplitting:!1,define:{"process.env.NODE_ENV":'"development"',"process.env.DEBUG":'"false"'}};import{transform as ir}from"lightningcss";import{Buffer as Jt}from"node:buffer";function ar(e){if(e===void 0)return{chrome:90<<16,firefox:88<<16,safari:917504};let t={};return e.chrome!==void 0&&(t.chrome=e.chrome),e.firefox!==void 0&&(t.firefox=e.firefox),e.safari!==void 0&&(t.safari=e.safari),e.edge!==void 0&&(t.edge=e.edge),t}function Gt(e){if(e==null)throw new TypeError(`Expected Uint8Array from Lightning CSS, got ${e===null?"null":"undefined"}`);if(Ze("node")&&typeof Jt<"u"&&Jt.isBuffer(e))return e.toString("utf-8");if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(typeof e=="string")return e;throw new TypeError(`Expected Uint8Array from Lightning CSS, got ${typeof e}`)}function Ht(e,t={}){let{filename:n="styles.css",minify:r=!1,targets:s,cssModules:i=!1,unusedSymbols:a=[]}=t,c={filename:n,code:new TextEncoder().encode(e),minify:r,targets:ar(s),cssModules:i,unusedSymbols:[...a]},u=ir(c),l;if(u.exports!==null&&u.exports!==void 0){l={};for(let[p,f]of Object.entries(u.exports))l[p]={name:f.name,composes:f.composes?.map(d=>({name:d.name,from:d.from!==void 0?String(d.from):void 0}))}}return{code:Gt(u.code),map:u.map!=null?Gt(u.map):void 0,exports:l}}function Le(e,t,n={}){return Ht(e,{...n,filename:t,cssModules:!0})}async function We(e,t={}){let{generateDts:n=!1,minify:r=!0,targets:s,tailwind:i}=t,a=await o.fs.readTextFile(e);if(i!==void 0){let f=await i.compile(a,e);f!==null&&(a=f.code)}let c=o.path.basename(e),u=Le(a,c,{minify:r,targets:s,nesting:!0}),l={};if(u.exports!==void 0)for(let[f,d]of Object.entries(u.exports))l[f]=d.name;let p=n?Ue(l):void 0;return{code:u.code,exports:l,dts:p}}function Ue(e){return`// This file is auto-generated by CSS modules processor
|
|
83
|
+
declare const styles: {
|
|
84
|
+
${Object.keys(e).map(r=>` readonly ${r}: string;`).join(`
|
|
85
|
+
`)}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default styles;
|
|
89
|
+
`}var lr="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";async function Vt(e,t){let n=await fetch(e);if(!n.ok)throw new Error(`Failed to download font from ${e}: ${n.status}`);let r=e.split("/"),s=r[r.length-1]??"font.woff2",i=s.includes(".")?s:`${s}.woff2`,a=o.path.join(t,i),c=await n.arrayBuffer();await o.fs.ensureDir(t),await o.fs.writeFile(a,new Uint8Array(c));let u=i.endsWith(".woff2")?"woff2":i.endsWith(".woff")?"woff":"truetype";return{url:e,localPath:a,filename:i,format:u}}async function Kt(e,t){return await Promise.all(e.map(n=>Vt(n,t)))}function qt(e){let t=[],n=/url\((["']?)([^"')]+)\1\)/g,r;for(;(r=n.exec(e))!==null;){let s=r[2];s!==void 0&&(s.includes(".woff2")||s.includes(".woff")||s.includes(".ttf"))&&t.push(s)}return t}async function Xt(e){let t=await fetch(e,{headers:{"User-Agent":lr}});if(!t.ok)throw new Error(`Failed to fetch Google Fonts CSS: ${t.status} ${t.statusText}`);return await t.text()}function Zt(e,t,n){let r=e;for(let s of t){let i=`${n}/${s.filename}`;r=r.replace(s.url,i)}return r}function Qt(e,t){return e.map(n=>`<link rel="preload" href="${`${t}/${n.filename}`}" as="font" type="font/${n.format}" crossorigin="anonymous" />`)}function _e(e){let t=e.match(/family=([^&]+)/);if(t===null)return[];let n=t[1];return n===void 0?[]:n.split("|").map(r=>{let s=r.split(":")[0]??r;return decodeURIComponent(s.replace(/\+/g," "))})}async function Je(e,t){let{outputDir:n,publicPath:r="/fonts",maxPreloadFonts:s=2}=t,i=await Xt(e),a=qt(i);if(a.length===0)return{fontFaceCSS:i,preloadHints:[],files:[],totalSize:0};let c=await Kt(a,n),u=0;for(let d of c)try{let m=await o.fs.stat(d.localPath);u+=m.size}catch{}let l=Zt(i,c,r),p=c.slice(0,Math.min(s,c.length)),f=Qt(p,r);return{fontFaceCSS:l,preloadHints:f,files:c,totalSize:u}}var q=S.getLogger(["laroux-bundler","font-optimizer"]);async function Ge(e,t,n="/fonts"){let r=_e(e);q.info(`\u{1F524} Optimizing Google Fonts: ${r.join(", ")||"unknown"}`),q.debug(` URL: ${e}`),q.debug(` Output: ${t}`),q.debug(` Public path: ${n}`);let s=await Je(e,{outputDir:t,publicPath:n,maxPreloadFonts:2});return q.info(` \u2705 Downloaded ${s.files.length} font file(s)`),q.debug(` Total size: ${(s.totalSize/1024).toFixed(2)} KB`),q.debug(` Generated ${s.preloadHints.length} preload hint(s) for critical fonts`),s}function Yt(e){return e.filter(t=>t.provider==="google")}function en(e){let t=Yt(e);if(t.length===0)return"";let r=t.map(i=>{let a=i.family.replace(/\s+/g,"+");if(i.weights&&i.weights.length>0){let c=i.styles??["normal"];if(c.includes("italic")&&c.includes("normal")){let u=[];for(let l of c){let p=l==="italic"?"1":"0";for(let f of i.weights)u.push(`${p},${f}`)}a+=`:ital,wght@${u.join(";")}`}else c.includes("italic")?a+=`:ital,wght@${i.weights.map(u=>`1,${u}`).join(";")}`:a+=`:wght@${i.weights.join(";")}`}return a}).map(i=>`family=${i}`).join("&"),s=t[0]?.display??"swap";return`https://fonts.googleapis.com/css2?${r}&display=${s}`}function He(e){return Yt(e).length===0?[]:[en(e)]}var ce=S.getLogger(["laroux-bundler","css-modules"]);async function cr(e,t={}){let{generateDTS:n=!1,projectRoot:r,minify:s=!0,plugin:i,globalCssPath:a="src/app/styles/global.css"}=t;ce.debug(`Processing CSS module: ${e}`);let c=await o.fs.readTextFile(e),u={projectRoot:r??o.process.cwd(),cssPath:e,isModule:!0},l=i??Be({globalCssPath:a}),p=c;if(l.shouldProcess?.(c,u)??!0){let d=l.preprocess?.(c,u);d!==void 0&&(p=await Promise.resolve(d))}let f=e.replace(/\.module\.css$/,".temp.module.css");await o.fs.writeTextFile(f,p);try{let d=await We(f,{generateDts:n,minify:s}),m=o.path.basename(e);return ce.debug(`Processed ${Object.keys(d.exports).length} class(es) in ${m}`),d}finally{await o.fs.remove(f).catch(()=>{})}}async function Ve(e,t={}){let{cache:n,projectRoot:r,minify:s=!0,globalCssPath:i="src/app/styles/global.css",...a}=t;ce.debug(`Processing ${e.length} CSS module(s)`);let c=Be({globalCssPath:i}),u=0,l=0;try{let p=await Promise.all(e.map(async f=>{if(n!==void 0)try{let h=(await o.fs.stat(f)).mtime?.getTime()??0,y=n.getCssModuleResult(f,h);if(y!=null)return u++,[f,{code:y.code,exports:y.exports}]}catch{}l++;let d=await cr(f,{...a,projectRoot:r,minify:s,plugin:c,globalCssPath:i});if(n!==void 0)try{let h=(await o.fs.stat(f)).mtime?.getTime()??0;n.setCssModuleResult(f,d.code,d.exports,h)}catch{}return[f,d]}));return n!==void 0&&(u>0||l>0)&&ce.debug(`CSS modules: ${u} cache hits, ${l} processed`),new Map(p)}finally{}}async function tn(e,t,n,r){let s=o.path.basename(e,".module.css"),i=e.startsWith(n)?n:r?.projectRoot??o.process.cwd(),a=o.path.relative(i,e),c=o.path.dirname(a),u=o.path.resolve(n,c);if(await o.fs.mkdir(u,{recursive:!0}),r?.skipCss!==!0){let p=o.path.resolve(u,`${s}.module.css`);await o.fs.writeTextFile(p,t.code)}let l=o.path.resolve(u,`${s}.module.css.json`);if(await o.fs.writeTextFile(l,JSON.stringify(t.exports,null,2)),t.dts!==void 0){let p=o.path.resolve(u,`${s}.module.css.d.ts`);await o.fs.writeTextFile(p,t.dts)}ce.debug(`Saved CSS module outputs to ${u}`)}var nn=S.getLogger(["laroux-bundler","server-externals"]);function dr(e,t){for(let n of t)if(e===n||e.startsWith(`${n}/`))return!0;return!1}function rn(e){let{externals:t}=e,n=t.map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),r=new RegExp(`^(${n.join("|")})($|\\/)`);return nn.debug(`Server externals plugin initialized with ${t.length} packages: ${t.join(", ")}`),{name:"server-externals",setup(s){s.onResolve({filter:r},i=>{let a=i.path;return dr(a,t)?(nn.debug(`Marking as external: ${a}`),{external:!0}):{}})}}}var g=S.getLogger(["laroux-bundler","build"]),ln="manifest.json",un="module-map.json",G="server",ke="client";function ii(e,t){let n=e.projectRoot,r=e.srcDir,s=e.distDir,i="",a=o.path.resolve(s,ln);return{config:e,projectRoot:n,srcDir:r,distDir:s,clientEntry:i,chunkManifestFile:a,bundlerBackend:t?.bundlerBackend,plugin:t?.framework??lt,cssPlugin:t?.css}}async function cn(e,t){let{srcDir:n,distDir:r,projectRoot:s}=e,i=performance.now(),a=at();g.info("\u{1F680} Starting RSC build..."),g.debug(`\u{1F194} Build ID: ${a}`);try{if(t?.cssOnly){g.debug("\u26A1 CSS-only rebuild (fast path)");let v=Date.now(),k=o.path.resolve(r,ke),T=e.cssPlugin;if(!T)return g.warn("\u26A0\uFE0F No CSS plugin provided, skipping CSS processing"),{success:!0,clientBundle:"",moduleMap:{},clientComponents:0,duration:performance.now()-i,timestamp:v};let N=await Ke(n);await sn(T,n,s,k),N.length>0&&await on(s,k,e.config,{cssModulePaths:N,cache:e.cache});let ne=performance.now()-i;return g.info(`\u26A1 CSS rebuild completed (${ne.toFixed(0)}ms)`),{success:!0,clientBundle:"",moduleMap:{},clientComponents:0,duration:ne,timestamp:v}}await Cr(r,t?.skipCss),await o.fs.ensureDir(r);let c=Date.now();g.debug("\u{1F50D} Step 3: Parallel scanning (routes, components, CSS modules)...");let u=o.path.resolve(n,"app/routes"),{plugin:l}=e,[p,f,d]=await Promise.all([wt(u,s),l.analyzeClientComponents?l.analyzeClientComponents(n,s,e.cache):Promise.resolve([]),Ke(n)]),m=o.path.resolve(r,G);await o.fs.ensureDir(m);let h=o.path.resolve(m,"_generated-routes.ts"),y=o.path.relative(s,n);if(await bt({scanResult:p,outputPath:h,projectRoot:s,srcDirName:y}),g.debug(`\u2713 Generated ${p.routes.length} page route(s) to dist/`),p.apiRoutes.length>0){let v=o.path.resolve(r,"server","api-routes.ts");await o.fs.ensureDir(o.path.dirname(v)),await Ct(p,v,s),g.debug(`\u2713 Generated ${p.apiRoutes.length} API route(s)`)}if(p.proxies.length>0){let v=o.path.resolve(r,"server","proxy-registry.ts");await o.fs.ensureDir(o.path.dirname(v)),await vt(p,v,s),g.debug(`\u2713 Generated ${p.proxies.length} proxy definition(s)`)}f.length===0&&g.warn("\u26A0\uFE0F Warning: No client components found!"),g.debug("\u{1F504} Step 4: Transforming client components...");let C=l.transformClientComponents?await l.transformClientComponents(f,o.path.resolve(r,G),s):[];l.generateTransformManifest&&await l.generateTransformManifest(C,o.path.resolve(r,"transform-manifest.json"),s),g.debug("\u270F\uFE0F Step 5: Rewriting server component imports...");let R=l.getAllComponents?await l.getAllComponents(n):[],E=new Set(f.map(v=>v.filePath)),A=R.filter(v=>!E.has(v));l.rewriteServerComponents&&await l.rewriteServerComponents(A,C,d,o.path.resolve(r,G),s),g.debug("\u{1F504} Step 5b: Transforming server actions with React symbols...");let b=o.path.resolve(r,G),w=await nt(b);if(w.length>0){let v=w.reduce((k,T)=>k+T.transformedActions.length,0);g.info(` \u2705 Transformed ${w.length} file(s) with ${v} action(s)`)}g.debug("\u{1F5FA}\uFE0F Step 6: Generating module map...");let x=o.path.resolve(r,ke);await o.fs.ensureDir(x);let P=l.createModuleMap?await l.createModuleMap(f):{};l.saveModuleMap&&await l.saveModuleMap(P,o.path.resolve(x,un)),l.createClientManifest&&await l.createClientManifest(f);let F=e.cssPlugin;!t?.skipCss&&F?(g.debug("\u{1F3A8} Step 7: Processing CSS with CSS plugin + Lightning CSS..."),await sn(F,n,s,x)):F?g.debug("\u23ED\uFE0F Skipping CSS processing (JS-only change)"):g.debug("\u23ED\uFE0F No CSS plugin provided, skipping CSS processing"),g.debug("\u{1F4C1} Step 8: Creating virtual source for bundling...");let de=await Mt({projectRoot:s,distDir:r,srcDir:n,changedFiles:t?.changedFiles}),D=de.virtualSrcDir;g.debug("\u{1F50C} Step 8b: Generating client action stubs in virtual source...");let Me=o.path.join(D,y),Y=await rt(Me,D);if(Y.length>0){let v=Y.reduce((k,T)=>k+T.exportedActions.length,0);g.info(` \u2705 Generated ${Y.length} stub file(s) with ${v} action(s)`)}let j;if(!t?.skipCss){g.debug("\u{1F3A8} Step 9: Processing CSS Modules to virtual source...");let v=d.map(N=>le(N,n,D)),k=await on(s,D,e.config,{skipCss:!0,cssModulePaths:v,cache:e.cache});j=new Map;let T=o.path.join(D,y);for(let[N,ne]of k){let pn=o.path.relative(T,N),fn=o.path.resolve(n,pn);j.set(fn,ne)}v.length>0&&(g.debug("\u270F\uFE0F Step 10: Rewriting CSS module imports in virtual source..."),l.rewriteCssModuleImports&&await l.rewriteCssModuleImports(T,v,s))}g.debug("\u{1F4E6} Step 11: Bundling client code from virtual source...");let ee=Ft(f,n,D),Fe=await gr({...e,srcDir:D},ee,a,c);if(!t?.skipCss&&d.length>0&&(g.debug(`\u{1F4CB} Step 12: Copying ${d.length} CSS Module JSON file(s) to client/...`),await an(d.map(v=>le(v,n,D)),D,x),g.debug(`\u{1F4CB} Step 13: Copying ${d.length} CSS Module JSON file(s) to server/...`),await an(d.map(v=>le(v,n,D)),D,o.path.resolve(r,G)),g.debug("\u{1F3A8} Step 14: Appending CSS modules to styles.css..."),await Sr(d,s,x,j)),g.debug("\u{1F9F9} Step 15: Cleaning up virtual source..."),await de.cleanup(),F){g.debug("\u2728 Step 16: Extracting critical CSS...");let v=await wr(F,x);v&&g.debug(` Critical: ${v.criticalPath}, Deferred: ${v.deferredPath}`),g.debug("\u{1F3A8} Step 17: Generating universal CSS...");let k=await br(F,x);k&&g.debug(` Universal: ${k}`)}g.debug("\u{1F524} Step 18: Optimizing Fonts..."),await vr(x,e.config.fonts),g.debug("\u{1F5BC}\uFE0F Step 19: Optimizing Images..."),await Rr(s,x,e.config),g.debug("\u{1F310} Step 20: Copying translation files..."),await xr(n,o.path.resolve(r,G),s);let te=o.path.resolve(r,G);if(await hr(s,te),g.info(`\u{1F4E6} Step 22: Server bundling check - components: ${A.length}`),A.length>0){g.info(`\u{1F4E6} Step 22: Bundling ${A.length} server component(s) with rolldown...`);let v=[];for(let k of A){let T=o.path.relative(s,k),N=o.path.join(te,T);await o.fs.exists(N)&&v.push(N)}if(g.info(` Found ${v.length} server entrypoints to bundle`),v.length>0){let k=e.config.serverExternals,T=rn({externals:k}),N=await zt({entrypoints:v,outputDir:te,projectRoot:te,sourcemap:!1,minify:!1,externals:k,plugins:[T]},e.bundlerBackend??"deno-bundler");g.info(` \u2705 Bundled ${N.fileCount} server file(s)`)}}g.debug("\u{1F4CB} Step 22b: Generating server actions manifest...");let qe=(await X(n,{projectRoot:s})).map(v=>z(v.relativePath,".js")),dn=o.path.resolve(te,"actions-manifest.json");await o.fs.writeTextFile(dn,JSON.stringify({actions:qe},null,2)),g.debug(`\u2713 Generated actions manifest: ${qe.length} action file(s)`),await yr(s,r);let Xe=performance.now()-i;return g.info("\u{1F4CA} Build Summary:"),g.info(` Client components: ${f.length}`),g.info(` Build time: ${Xe.toFixed(0)}ms`),{success:!0,clientBundle:Fe,moduleMap:P,clientComponents:f.length,duration:Xe,timestamp:c}}catch(c){let u=c instanceof Error?c.message:String(c),l=c instanceof Error?c.stack:null;return g.error("\u274C Build failed:"),g.error(` Error: ${u}`),l!==null&&g.error(` Stack trace:
|
|
90
|
+
${l}`),{success:!1,clientBundle:"",moduleMap:{},clientComponents:0,duration:performance.now()-i,timestamp:Date.now()}}}async function ai(e){return await pr(e)?(g.info("\u{1F504} Build needed, running build..."),await cn(e)):(g.info("\u2705 Build is up-to-date, skipping..."),await fr(e))}async function pr(e){let{distDir:t,chunkManifestFile:n,srcDir:r,clientEntry:s,projectRoot:i}=e;if(!await o.fs.exists(t)||!await o.fs.exists(n))return!0;let a=await o.fs.readTextFile(n),u=JSON.parse(a).timestamp,l=[];for await(let p of o.fs.readDir(r))p.isFile&&pe.test(p.name)&&l.push(o.path.resolve(r,p.name));l.push(s);for(let p of l)try{let f=await o.fs.stat(p);if(f.mtime&&f.mtime.getTime()>u)return g.debug(` Changed: ${o.path.relative(i,p)}`),!0}catch{}return!1}async function fr(e){let{chunkManifestFile:t,distDir:n}=e,r=await o.fs.readTextFile(t),s=JSON.parse(r),i=await o.fs.readTextFile(o.path.resolve(n,un)),a=JSON.parse(i);return{success:!0,clientBundle:o.path.resolve(n,"client.js"),moduleMap:a,clientComponents:Object.keys(a).length,duration:0,timestamp:s.timestamp}}function li(e,t){let{srcDir:n,distDir:r,projectRoot:s}=e;g.debug("\u{1F441}\uFE0F Watch mode enabled, monitoring for changes...");let i=Bt(),a={...e,cache:i},c=o.path.relative(s,r),u=[n],l=o.fs.watch(u),p=!1,f=!1,d=new Set,m=null,h=50;async function y(){if(p){f=!0;return}p=!0;do{f=!1;try{let C=Array.from(d);i.invalidateFiles(C.map(P=>o.path.resolve(s,P)));let R=C.some(P=>P.endsWith(".css")),E=C.some(P=>P.match(/\.(tsx?|jsx?)$/)),A=R&&!E,b=!R&&E,w=new Set(C.map(P=>o.path.resolve(s,P))),x=await cn(a,{skipCss:b,cssOnly:A,changedFiles:w});x.changedFiles=Array.from(d),g.debug(`\u2705 Rebuild complete (${x.duration.toFixed(0)}ms)`),t(x),d.clear()}catch(C){g.error("\u274C Rebuild failed:",{error:C})}}while(f);p=!1}return(async()=>{for await(let C of l)if(C.kind==="modify"||C.kind==="create"||C.kind==="remove"){let R=C.paths[0];if(!R)continue;let E=o.path.relative(s,R);if(!E.match(/\.(tsx?|jsx?|css)$/))continue;let A=H(E),b=H(c);if(A.startsWith(`${b}/`)||E.includes(".temp."))continue;g.debug(`\u{1F504} File changed: ${E}`),d.add(E),m!==null&&clearTimeout(m),m=setTimeout(()=>{m=null,y()},h)}})(),l}async function gr(e,t,n,r){let{config:s,projectRoot:i,distDir:a}=e,{plugin:c}=e;if(!c.createClientEntry)throw new Error("Framework plugin must implement createClientEntry");let u=await c.createClientEntry(t,i,a);try{let l=t.map(C=>C.filePath),p=o.path.resolve(a,ke),f=gt({projectRoot:i,browserShims:s.browserShims,autoMarkExternal:!1}),d={...ue.define};if(!e.bundlerBackend)throw new Error("Bundler backend is required for client bundling");let m=await At({entrypoints:[u,...l],outputDir:p,projectRoot:i,minify:ue.minify,splitting:ue.codeSplitting,platform:"browser",sourcemap:ue.sourceMaps,plugins:[f],define:d},t,e.bundlerBackend),h=Wt(n,r,m,t,s.logLevel,!1),y=o.path.resolve(p,ln);await Ut(h,y);try{await o.fs.remove(u)}catch{}return It(m),_t(h),o.path.resolve(a,m.entrypoint)}catch(l){try{await o.fs.remove(u)}catch{}throw l}}function mr(e,t){for(let[n,r]of Object.entries(e))typeof r=="string"&&(r.startsWith("./")||r.startsWith("../"))&&(e[n]=o.path.join(t,r))}async function hr(e,t){let n=await fe({baseDir:e});if(n===void 0){g.debug("No config files found to copy");return}let r=o.path.relative(t,e),s=0;for(let i of n._loadedFiles)try{let a=JSON.parse(JSON.stringify(i.content));a.imports!==void 0&&typeof a.imports=="object"&&a.imports!==null&&mr(a.imports,r);let c=o.path.join(t,i.fileType);await o.fs.writeTextFile(c,JSON.stringify(a,null,2)),s++}catch(a){g.debug(`Failed to copy ${i.fileType}: ${a instanceof Error?a.message:String(a)}`)}if(s>0){let i=s===1?"config file":"config files";g.info(` \u{1F4CB} Copied ${s} ${i} to dist/server for import resolution`)}}async function yr(e,t){let n=o.path.resolve(e,"public");if(await o.fs.exists(n))for await(let r of o.fs.readDir(n)){let s=o.path.resolve(n,r.name),i=o.path.resolve(t,r.name);await U(s,i,{overwrite:!0})}}async function xr(e,t,n){let r=0,s=o.path.relative(n,e),i=o.path.resolve(e,"app/messages"),a=o.path.resolve(t,s,"app/messages");if(await o.fs.exists(i)){await o.fs.ensureDir(a);for await(let l of o.fs.readDir(i))if(l.isFile&&l.name.endsWith(".json")){let p=o.path.resolve(i,l.name),f=o.path.resolve(a,l.name);await U(p,f,{overwrite:!0}),r++}}let c=o.path.resolve(e,"lib/i18n/messages"),u=o.path.resolve(t,s,"lib/i18n/messages");if(await o.fs.exists(c)){await o.fs.ensureDir(u);for await(let l of o.fs.readDir(c))if(l.isFile&&l.name.endsWith(".json")){let p=o.path.resolve(c,l.name),f=o.path.resolve(u,l.name);await U(p,f,{overwrite:!0}),r++}}r>0?g.debug(`\u2713 Copied ${r} translation file(s)`):g.debug("No messages directories found, skipping translation files")}async function sn(e,t,n,r){let s=o.path.resolve(t,"app/styles/global.css"),i=o.path.resolve(r,"styles.css");if(!await o.fs.exists(s)){g.debug("No CSS source file found, skipping CSS processing");return}try{await De({input:s,output:i,minify:!0,projectRoot:n,plugin:e}),g.debug("\u2713 CSS processed")}catch(a){throw g.error("CSS processing failed:",{error:a}),a}}async function wr(e,t){if(!e.extractCriticalCss)return g.debug("CSS plugin doesn't support critical CSS extraction, skipping"),null;let n=o.path.resolve(t,"styles.css");if(!await o.fs.exists(n))return g.debug("No styles.css found, skipping critical CSS extraction"),null;try{let r=await o.fs.readTextFile(n),i=e.extractCriticalCss(r,`
|
|
91
|
+
<!DOCTYPE html>
|
|
92
|
+
<html lang="en">
|
|
93
|
+
<head></head>
|
|
94
|
+
<body>
|
|
95
|
+
<div id="root" class="flex flex-col lg:flex-row min-h-screen bg-neutral-50">
|
|
96
|
+
<aside class="w-full lg:w-64 bg-surface border-b lg:border-b-0 lg:border-r border-neutral-200 flex-shrink-0">
|
|
97
|
+
<div class="lg:sticky lg:top-0 p-4 lg:p-6">
|
|
98
|
+
<nav class="space-y-4">
|
|
99
|
+
<a href="#" class="flex items-center gap-2 text-neutral-600 hover:text-primary-600">Link</a>
|
|
100
|
+
</nav>
|
|
101
|
+
</div>
|
|
102
|
+
</aside>
|
|
103
|
+
<div class="flex-1 flex flex-col">
|
|
104
|
+
<main class="flex-1">
|
|
105
|
+
<div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-8 sm:py-12 lg:py-20">
|
|
106
|
+
<h1 class="text-3xl sm:text-4xl lg:text-5xl font-bold text-neutral-900 mb-4">Title</h1>
|
|
107
|
+
<h2 class="text-lg font-bold text-neutral-900 mb-2">Subtitle</h2>
|
|
108
|
+
<p class="text-neutral-600 text-lg mb-6">Description</p>
|
|
109
|
+
<div class="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
|
110
|
+
<div class="bg-surface rounded-lg border border-neutral-200 p-4 shadow-sm">Card</div>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="flex flex-wrap gap-4 items-center justify-center">
|
|
113
|
+
<button class="btn" data-variant="primary">Primary</button>
|
|
114
|
+
<button class="btn" data-variant="secondary">Secondary</button>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</main>
|
|
118
|
+
<footer class="flex flex-wrap items-center justify-center gap-6 p-8 text-sm border-t border-neutral-200 bg-surface min-h-[5.5rem]">
|
|
119
|
+
<a href="#" class="flex items-center gap-2 text-neutral-600 hover:text-primary-600">Footer Link</a>
|
|
120
|
+
</footer>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</body>
|
|
124
|
+
</html>
|
|
125
|
+
`,{forceInclude:[/^\.flex/,/^\.grid/,/^\.block/,/^\.inline/,/^\.items-/,/^\.justify-/,/^\.gap-/,/^\.space-/,/^\.min-h-/,/^\.max-w-/,/^\.w-/,/^\.h-/,/^\.mx-/,/^\.my-/,/^\.px-/,/^\.py-/,/^\.p-/,/^\.m-/,/^\.mt-/,/^\.mb-/,/^\.ml-/,/^\.mr-/,/^\.pt-/,/^\.pb-/,/^\.pl-/,/^\.pr-/,/^\.sm:/,/^\.md:/,/^\.lg:/,/^\.xl:/,/^\.2xl:/,/^\.bg-neutral-/,/^\.bg-surface/,/^\.bg-primary-/,/^\.text-neutral-/,/^\.text-primary-/,/^\.text-white/,/^\.border/,/^\.rounded/,/^\.text-sm/,/^\.text-lg/,/^\.text-xl/,/^\.text-2xl/,/^\.text-3xl/,/^\.text-4xl/,/^\.text-5xl/,/^\.font-/,/^\.leading-/,/^\.overflow-/,/^\.visible/,/^\.invisible/,/^\.hidden/,/^\.relative/,/^\.absolute/,/^\.fixed/,/^\.sticky/,/^\.shadow/,/^html/,/^body/,/^#root/,/^\*/]}),a=o.path.resolve(t,"styles.critical.css"),c=o.path.resolve(t,"styles.deferred.css");await o.fs.writeTextFile(a,i.critical),await o.fs.writeTextFile(c,i.deferred);let u=i.stats;return u?g.debug(`\u2713 Critical CSS extracted: ${u.criticalSize} bytes critical, ${u.deferredSize} bytes deferred`):g.debug("\u2713 Critical CSS extracted"),{criticalPath:a,deferredPath:c}}catch(r){return g.error("Critical CSS extraction failed:",{error:r}),null}}async function br(e,t){if(!e.extractUniversalCss)return g.debug("CSS plugin doesn't support universal CSS extraction, skipping"),null;let n=o.path.resolve(t,"styles.css");if(!await o.fs.exists(n))return g.debug("No styles.css found, skipping universal CSS generation"),null;try{let r=await o.fs.readTextFile(n),s=e.extractUniversalCss(r),i=o.path.resolve(t,"styles.universal.css");return await o.fs.writeTextFile(i,s.css),g.debug(`\u2713 Universal CSS generated: ${s.css.length} bytes`),i}catch(r){return g.error("Universal CSS generation failed:",{error:r}),null}}async function Cr(e,t){if(await o.fs.exists(e))if(t){g.debug("\u{1F9F9} Cleaning build directory (preserving CSS)");let n=o.path.resolve(e,G);await o.fs.exists(n)&&await o.fs.remove(n,{recursive:!0});let r=o.path.resolve(e,ke);if(await o.fs.exists(r))for await(let s of o.fs.readDir(r)){if(s.name.endsWith(".css")||s.name==="fonts"||s.name==="fonts.css"||s.name==="font-preloads.json")continue;let i=o.path.resolve(r,s.name);await o.fs.remove(i,{recursive:!0})}}else await o.fs.remove(e,{recursive:!0}),g.debug("\u{1F9F9} Cleaned build directory")}async function vr(e,t){let r=He(t)[0];if(!r){g.debug("\u2713 No fonts configured, skipping font optimization");return}let s=o.path.resolve(e,"fonts"),i="/fonts";try{let a=await Ge(r,s,i),c=o.path.resolve(e,"fonts.css");await o.fs.writeTextFile(c,a.fontFaceCSS);let u=o.path.resolve(e,"font-preloads.json");await o.fs.writeTextFile(u,JSON.stringify(a.preloadHints,null,2)),g.debug(`\u2713 Fonts optimized: ${a.files.length} file(s), ${(a.totalSize/1024).toFixed(2)} KB`)}catch(a){g.error("Font optimization failed:",{error:a}),g.warn("Continuing build without font optimization")}}async function Ke(e){let t=[];async function n(r){for await(let s of o.fs.readDir(r)){let i=o.path.resolve(r,s.name);s.isDirectory?await n(i):s.isFile&&s.name.endsWith(".module.css")&&t.push(i)}}return await n(e),t}async function on(e,t,n,r){let s=r?.cssModulePaths??await Ke(n.srcDir);if(s.length===0)return g.debug("No CSS modules found, skipping CSS module processing"),new Map;g.debug(`Found ${s.length} CSS module(s)`);try{let i=await Ve(s,{generateDTS:n.cssModuleTypes,projectRoot:e,cache:r?.cache});for(let[a,c]of i)await tn(a,c,t,{skipCss:r?.skipCss,projectRoot:e});return g.debug(`\u2713 Processed ${s.length} CSS module(s)${n.cssModuleTypes?" with TypeScript definitions":""}`),i}catch(i){throw g.error("CSS module processing failed:",{error:i}),i}}async function an(e,t,n){let r=0;for(let s of e){let i=o.path.relative(t,s),a=o.path.basename(s)+".json",c=o.path.join(t,o.path.dirname(i),a),u=o.path.join(n,o.path.dirname(i),a);await o.fs.ensureDir(o.path.dirname(u));try{await U(c,u,{overwrite:!0}),r++}catch(l){g.warn(` \u26A0 Failed to copy JSON for ${o.path.relative(t,s)}:`,{error:l})}}r>0&&g.debug(`\u2713 Copied ${r} CSS module JSON file(s)`)}async function Sr(e,t,n,r){if(e.length===0)return;let s;r?s=r:s=await Ve(e,{generateDTS:!1,projectRoot:t});let i=[];for(let[,a]of s)i.push(a.code);if(i.length>0){let a=o.path.resolve(n,"styles.css"),c="";try{c=await o.fs.readTextFile(a)}catch{}c=c.replace(/\x1B\[[0-9;]*[a-zA-Z]/g,"");let u=i.map(p=>p.replace(/\x1B\[[0-9;]*[a-zA-Z]/g,"")),l=c+`
|
|
126
|
+
`+u.join(`
|
|
127
|
+
`);await o.fs.writeTextFile(a,l),g.debug(`\u2713 Appended ${i.length} CSS module(s) to styles.css`)}}async function Rr(e,t,n){let{optimizeImages:r,scanImages:s}=await import("./mod-3PJAIZ2O.js"),i=o.path.resolve(e,"public"),a=o.path.resolve(i,"images");if(!await o.fs.exists(a)){g.debug("\u2713 No images directory found, skipping image optimization");return}if((await s(a)).length===0){g.debug("\u2713 No images found, skipping image optimization");return}try{let u=o.path.resolve(t,"images"),l=await r(a,u,"/images",{formats:n.images.formats,widths:n.images.widths,quality:n.images.quality,generateBlurPlaceholder:n.images.placeholder==="blur"}),p=Object.keys(l.images).length;p>0&&g.debug(`\u2713 Optimized ${p} image(s)`)}catch(u){g.error("Image optimization failed:",{error:u}),g.warn("Continuing build without image optimization")}}export{Pe as a,Us as b,ii as c,cn as d,ai as e,li as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as _,c as b}from"./chunk-LRL56YFE.js";import{a as y,e as f}from"./chunk-OLM5RTFK.js";var h=class{capabilities=["text_generation","streaming","tool_calling","vision","batch_processing"];provider="anthropic";modelId;client;config;constructor(t,n){this.client=t,this.config=n,this.modelId=n.model}async generateText(t,n){let o=p(this.config,t);try{let a=await this.client.messages.create(o,{signal:n,timeout:this.config.requestTimeoutMs});return k(a,this.modelId)}catch(a){throw i(a)}}async*streamText(t,n){let o=p(this.config,t);try{let a=await this.client.messages.create({...o,stream:!0},{signal:n,timeout:this.config.requestTimeoutMs}),r=null,l=null,c="",d=0,u=0;for await(let s of a)if(s.type==="message_start")d=s.message?.usage?.input_tokens??0;else if(s.type==="content_block_start")s.content_block?.type==="tool_use"&&(r=s.content_block.id??null,l=s.content_block.name??null,c="");else if(s.type==="content_block_delta")s.delta?.type==="text_delta"?yield{kind:"content_delta",textDelta:s.delta.text}:s.delta?.type==="input_json_delta"&&(c+=s.delta.partial_json??"",yield{kind:"tool_call_delta",textDelta:s.delta.partial_json});else if(s.type==="content_block_stop"){if(r!==null&&l!==null){let m={};try{m=JSON.parse(c||"{}")}catch{}yield{kind:"tool_call_delta",toolCall:{id:r,name:l,arguments:m}},r=null,l=null,c=""}}else s.type==="message_delta"&&(u=s.usage?.output_tokens??u,yield{kind:"message_done",stopReason:x(s.delta?.stop_reason),usage:{inputTokens:d,outputTokens:u,totalTokens:d+u}})}catch(a){yield{kind:"error",error:i(a)}}}async submitBatch(t,n){let o=t.items.map(a=>({custom_id:a.customId,params:p(this.config,a.options)}));try{let a=await this.client.beta.messages.batches.create({requests:o},{signal:n});return g(a)}catch(a){throw i(a)}}async getBatchJob(t,n){try{let o=await this.client.beta.messages.batches.retrieve(t,{signal:n});return g(o)}catch(o){throw i(o)}}async listBatchJobs(t,n){try{let o=await this.client.beta.messages.batches.list({limit:t?.limit,after_id:t?.after},{signal:n}),a=[];for(let r of o.data??[])a.push(g(r));return a}catch(o){throw i(o)}}async downloadBatchResults(t,n){try{let o=await this.client.beta.messages.batches.results(t.id,{signal:n}),a=[];for await(let r of o)r.result?.type==="succeeded"?a.push({customId:r.custom_id,result:k(r.result.message,this.modelId)}):a.push({customId:r.custom_id,error:r.result?.error?.message??"Unknown error"});return a}catch(o){throw i(o)}}async cancelBatchJob(t,n){try{await this.client.beta.messages.batches.cancel(t,{signal:n})}catch(o){throw i(o)}}async close(){}getRawClient(){return this.client}},A={provider:"anthropic",async createModel(e){let{default:t}=await import("./sdk-5JGXLIO5.js"),n={};e.apiKey!==void 0&&(n.apiKey=e.apiKey),e.baseUrl!==void 0&&(n.baseURL=e.baseUrl);let o=new t(n);return new h(o,e)}},p=(e,t)=>{let n={model:e.model,max_tokens:t.maxTokens??e.maxTokens,messages:R(t.messages)};return t.system!==void 0&&(n.system=t.system),t.temperature!==void 0&&(n.temperature=t.temperature),t.topP!==void 0&&(n.top_p=t.topP),t.stopWords!==void 0&&(n.stop_sequences=t.stopWords),t.tools!==void 0&&(n.tools=t.tools.map(o=>({name:o.name,description:o.description,input_schema:o.parameters??{type:"object",properties:{}}}))),t.toolChoice!==void 0&&(n.tool_choice={type:t.toolChoice}),t.thinkingBudget!==void 0&&(n.thinking={type:"enabled",budget_tokens:t.thinkingBudget}),n},R=e=>{let t=[];for(let n of e){if(n.role==="system")continue;let o=n.content.map(C);t.push({role:n.role==="tool"?"user":n.role,content:o})}return t},C=e=>{switch(e.kind){case"text":return{type:"text",text:e.text};case"image":{if(e.image.data!==void 0)return{type:"image",source:{type:"base64",media_type:e.image.mimeType??"image/png",data:w(e.image.data)}};if(e.image.url!==void 0){if(_(e.image.url)){let t=b(e.image.url);if(t!==null)return{type:"image",source:{type:"base64",media_type:t.mimeType,data:w(t.data)}}}return{type:"image",source:{type:"url",url:e.image.url}}}return{type:"text",text:"[unsupported image]"}}case"tool_call":return{type:"tool_use",id:e.toolCall.id,name:e.toolCall.name,input:e.toolCall.arguments};case"tool_result":return{type:"tool_result",tool_use_id:e.toolResult.toolCallId,content:e.toolResult.content,is_error:e.toolResult.isError};default:return{type:"text",text:`[unsupported content: ${e.kind}]`}}},k=(e,t)=>{let n=[];for(let o of e.content??[])o.type==="text"?n.push({kind:"text",text:o.text}):o.type==="thinking"?n.push({kind:"text",text:`[thinking] ${o.thinking}`}):o.type==="tool_use"&&n.push({kind:"tool_call",toolCall:{id:o.id,name:o.name,arguments:o.input??{}}});return{content:n,stopReason:x(e.stop_reason),usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)},modelId:t,rawResponse:e}},x=e=>e==="end_turn"?"end_turn":e==="max_tokens"?"max_tokens":e==="tool_use"?"tool_use":e==="stop_sequence"?"stop":"end_turn",g=e=>({id:e.id,status:B(e.processing_status),createdAt:new Date(e.created_at),completedAt:e.ended_at!==void 0?new Date(e.ended_at):void 0,totalCount:e.request_counts?.total??0,doneCount:e.request_counts?.succeeded??0,failedCount:e.request_counts?.errored??0}),B=e=>e==="in_progress"?"processing":e==="ended"?"completed":e==="canceling"||e==="canceled"?"cancelled":"pending",i=e=>{if(e instanceof y)return e;let t=e instanceof Error?e:new Error(String(e)),n=e?.status??e?.statusCode??500;return f("anthropic",n,t)},w=e=>{let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)};export{h as a,A as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={Trace:1,Debug:5,Info:9,Notice:10,Warning:13,Error:17,Critical:21,Alert:22,Emergency:23},r={[e.Trace]:"Trace",[e.Debug]:"Debug",[e.Info]:"Info",[e.Notice]:"Notice",[e.Warning]:"Warning",[e.Error]:"Error",[e.Critical]:"Critical",[e.Alert]:"Alert",[e.Emergency]:"Emergency"};export{e as a,r as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as E,b as A,c as I}from"./chunk-DLVQNMNV.js";import{a as w}from"./chunk-6U2VEZEM.js";import{a as v}from"./chunk-JQHMDTPL.js";import{f as D}from"./chunk-NUSNMQPL.js";import{b as l,e as g,f as k,g as C,h}from"./chunk-PLJNPQFC.js";import{g as a}from"./chunk-DQAEQEXD.js";import{u as b}from"./chunk-GRTR6TNJ.js";var u=v(),O=/\/\*\*\s*([\s\S]*?)\s*\*\//g,R=/export\s+(const|function|class|type|interface)\s+(\w+)/g,$=/@example/,S=s=>{let n=[],i;for(R.lastIndex=0;(i=R.exec(s))!==null;){let e=i.index,t=i[2];if(t===void 0)continue;let c=s.substring(0,e).split(`
|
|
2
|
+
`).length,p=null,d=[...s.substring(0,e).matchAll(O)];if(d.length>0){let r=d[d.length-1];if(r!==void 0){let m=(r.index??0)+r[0].length,f=s.substring(m,e);/^\s*$/.test(f)&&(p=r[1]??null)}}n.push({jsdoc:p,symbolName:t,line:c})}return n},_=(s,n,i)=>{let e=[];if(s===null)return e.push("missing-description"),e;let t=s.split(`
|
|
3
|
+
`)[0]?.trim();return(!t||t.startsWith("@"))&&e.push("empty-description"),i&&!$.test(s)&&e.push("missing-example"),e},F=async(s={})=>{let{root:n=".",requireExamples:i=!1}=s,e=await E(n),t=[],o=0,c=0;for(let p of e){let y=await I(p.path);for(let d of y){let r=A(d,p.path),m;try{m=await b.current.fs.readTextFile(r)}catch{continue}o++;let f=S(m);for(let{jsdoc:T,symbolName:x,line:P}of f){c++;let M=_(T,x,i);for(let N of M)t.push({file:r,symbol:x,issue:N,line:P})}}}return{isValid:t.length===0,issues:t,filesChecked:o,symbolsChecked:c}},J=s=>{switch(s){case"missing-description":return"Missing JSDoc documentation";case"missing-param":return"Missing @param documentation";case"missing-returns":return"Missing @returns documentation";case"missing-example":return"Missing @example";case"empty-description":return"Empty description"}},j=s=>D.fromPromise(()=>F(s)),V=s=>a.ok({root:"."}),q=s=>{if(a.isFail(s))return u.writeln(g("\u2717"),l(" "+String(s.error))),a.fail({exitCode:1});let{value:n}=s;if(u.writeln(h("\u2139"),l(` Checked ${n.filesChecked} files, ${n.symbolsChecked} symbols.`)),!n.isValid){u.writeln(g("\u2717"),l(` Found ${n.issues.length} documentation issues:`));let i=new Map;for(let e of n.issues){let t=i.get(e.file)??[];t.push(e),i.set(e.file,t)}for(let[e,t]of i){u.writeln(C("\u26A0"),l(" "+e));for(let o of t){let c=o.line!==void 0?`:${o.line}`:"";u.writeln(h("\u2139"),l(` ${o.symbol}${c}: ${J(o.issue)}`))}}return a.fail({exitCode:1})}return u.writeln(k("\u2713"),l(" All documentation is valid.")),a.ok(void 0)},B=w.createTrigger({handler:j,adaptInput:V,adaptOutput:q}),Q=async s=>await B({command:"validate-docs",args:[],flags:{}});export{F as a,j as b,B as c,Q as d};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{b as T,c as f}from"./chunk-Y6DLCHJN.js";import{a as F,b as k}from"./chunk-JQHMDTPL.js";import{b as c,e as x,f as h}from"./chunk-PLJNPQFC.js";import{a as g}from"./chunk-HPPFA3XU.js";import{g as d}from"./chunk-DQAEQEXD.js";var m=F(),I=e=>{let y=async o=>{let i={root:o?.root??".",fix:o?.fix??!1,exclude:o?.exclude??[],...e.defaults,...o},r=o?._changedFiles,t={root:i.root,extensions:e.extensions,exclude:i.exclude,includeOnly:r!==void 0&&r.length>0?r:void 0},l=await T(t),n=[],u=[];if(e.checkAll!==void 0){let s=await e.checkAll(l,i);n.push(...s)}else if(e.checkFile!==void 0)for(let s of l){let a=await f(s),p=e.checkFile(s,a,i);n.push(...p)}if(i.fix&&e.canFix&&e.fixFile!==void 0)for(let s of l){let a=await f(s);if(a===void 0)continue;let p=e.fixFile(s,a,i);p!==void 0&&u.push(p)}return{name:e.name,issues:n,mutations:u,filesChecked:l.length}},w={name:e.name,description:e.description,requiredStacks:e.stacks,async validate(o){let i=o.options?.fix,r=o.options??{},t=await y({root:o.root,fix:i??!1,exclude:[],...r});return{name:e.name,passed:t.issues.length===0,issues:t.issues.map(l=>({severity:"error",message:`${l.message}${l.fixed?" (fixed)":""}`,file:l.path,line:l.line})),stats:{filesChecked:t.filesChecked,issuesFound:t.issues.length,fixedCount:t.mutations.length}}}},C=async o=>{let i=e.canFix&&o.flags.fix===!0,r=o.flags.root??".",t=o.flags.exclude,l=t!==void 0?Array.isArray(t)?t:[t]:[];try{let n=await y({root:r,fix:i,exclude:l});if(n.mutations.length>0){let{writeMutations:s}=await import("./file-tools-shared-ESMPLZVJ.js"),a=await s(n.mutations);m.writeln(h("\u2713"),c(` Fixed ${a} file(s) for ${e.name}.`))}if(n.issues.length===0&&n.mutations.length===0)return m.writeln(h("\u2713"),c(` ${e.name}: ${n.filesChecked} files checked, no issues.`)),d.ok(void 0);let u=n.issues.filter(s=>!s.fixed);if(u.length>0){for(let s of u){let a=s.line!==void 0?`${s.path}:${s.line}`:s.path;m.writeln(x("\u2717"),c(` ${a}: ${s.message}`))}return d.fail({exitCode:1})}return d.ok(void 0)}catch(n){return m.writeln(x("\u2717"),c(" "+(n instanceof Error?n.message:String(n)))),d.fail({exitCode:1})}};return{config:e,run:y,validator:w,main:async o=>{let i=e.canFix?["fix"]:[],r=g(o??[],{boolean:[...i,"help"],string:["root","exclude"],alias:{h:"help"}});if(r.help)return console.log(`eser codebase ${e.name} \u2014 ${e.description}
|
|
2
|
+
`),console.log(`Usage: eser codebase ${e.name} [options]
|
|
3
|
+
`),console.log("Options:"),e.canFix&&console.log(" --fix Auto-fix issues"),console.log(" --root <dir> Root directory (default: .)"),console.log(" --exclude <p> Exclude pattern"),console.log(" -h, --help Show this help"),d.ok(void 0);let t=k(e.name,r);return await C(t)}}};export{I as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-VFMYWG2I.js";var o=1024,i=a({name:"validate-large-files",description:"Detect files exceeding size limit",canFix:!1,stacks:[],defaults:{maxKb:o},checkAll(n,r){let t=r.maxKb??o,l=t*1024,s=[];for(let e of n)if(e.size>l){let c=Math.round(e.size/1024);s.push({path:e.path,message:`file is ${c}KB (max: ${t}KB)`})}return s}}),d=i.run,f=i.validator,x=i.main;export{i as a,d as b,f as c,x as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a="/",b=":",g=e=>e.replace(/\\/g,"/").replace(/\/+/g,"/"),A=e=>g(e),x=(...e)=>{if(e.length===0)return".";let t=e.filter(n=>n.length>0).join(a);return t.length===0?".":u(t)},c=(...e)=>{let t="",n=!1;for(let r=e.length-1;r>=0&&!n;r--){let s=e[r];s===void 0||s.length===0||(t=`${s}/${t}`,n=h(s))}return t=g(t),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),u(t)??"."},d=e=>{if(e.length===0)return".";for(e=g(e);e.length>1&&e.endsWith("/");)e=e.slice(0,-1);let t=e.lastIndexOf("/");return t===-1?".":t===0?"/":e.slice(0,t)},f=(e,t)=>{if(e.length===0)return"";for(e=g(e);e.length>1&&e.endsWith("/");)e=e.slice(0,-1);let n=e.lastIndexOf("/"),r=n===-1?e:e.slice(n+1);return t&&r.endsWith(t)&&(r=r.slice(0,-t.length)),r},m=e=>{let t=f(e),n=t.lastIndexOf(".");return n<=0||n===t.length-1?"":t.slice(n)},u=e=>{if(e.length===0)return".";e=g(e);let t=e.startsWith("/"),n=e.endsWith("/"),r=e.split("/").filter(l=>l.length>0),s=[];for(let l of r)l!=="."&&(l===".."?s.length>0&&s[s.length-1]!==".."?s.pop():t||s.push(".."):s.push(l));let i=s.join("/");return t&&(i=`/${i}`),n&&i.length>1&&(i+="/"),i??"."},h=e=>e.length===0?!1:!!(e.startsWith("/")||e.length>=3&&/^[a-zA-Z]:[/\\]/.test(e)),$=(e,t)=>{if(e===t||(e=c(e),t=c(t),e===t))return"";let n=e.split("/").filter(o=>o.length>0),r=t.split("/").filter(o=>o.length>0),s=0,i=Math.min(n.length,r.length);for(let o=0;o<i&&n[o]===r[o];o++)s++;let l=n.length-s,P=r.slice(s);return[...Array(l).fill(".."),...P].join("/")??"."},W=e=>{if(e.length===0)return{root:"",dir:"",base:"",ext:"",name:""};e=g(e);let t="",n="",r=f(e),s=m(e),i=s?r.slice(0,-s.length):r;return e.startsWith("/")?t="/":/^[a-zA-Z]:[/\\]/.test(e)&&(t=e.slice(0,3)),n=d(e),n==="."&&(n=""),{root:t,dir:n,base:r,ext:s,name:i}},I=e=>{let{root:t="",dir:n,base:r,ext:s="",name:i=""}=e,l=r??i+s;return n?n===t?`${n}${l}`:`${n}/${l}`:`${t}${l}`},j={join:x,resolve:c,dirname:d,basename:f,extname:m,normalize:u,isAbsolute:h,relative:$,parse:W,format:I,sep:a,delimiter:b};export{A as a,j as b};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import{a as u}from"./chunk-HPPFA3XU.js";import{a as p,b as f}from"./chunk-DQAEQEXD.js";import{t as x}from"./chunk-GRTR6TNJ.js";var h=t=>{let e=[],n=[],r={},s={};for(let i of t)i.type==="boolean"?e.push(i.name):n.push(i.name),i.short!==void 0&&(r[i.short]=i.name),i.default!==void 0&&(s[i.name]=i.default);return{boolean:e,string:n,alias:r,default:s}},T=t=>t!=null&&t.constructor===String,V={boolean:t=>!!t,number:t=>T(t)?Number(t):t,string:t=>String(t),"string[]":t=>Array.isArray(t)?t.map(String):[String(t)]},v=(t,e)=>{if(t!==void 0)return V[e]?.(t)??t},$=(t,e)=>{let n={};for(let r of e){let s=t[r.name];n[r.name]=v(s,r.type)}return n},re=(t,e)=>{let n=h(e),r=u(t,n);return{positional:r._,flags:$(r,e)}},_=(t,e)=>{let n=[];for(let r of e)if(r.required===!0){let s=t[r.name];(s===void 0||s===""||s===!1)&&n.push(`Required flag --${r.name} is missing`)}return n};var O=(t,e)=>t+" ".repeat(Math.max(0,e-t.length)),U=t=>{let e=t.short!==void 0?`-${t.short}, `:"",n=t.type!=="boolean"?` <${t.type}>`:"";return`${e}--${t.name}${n}`},q=(t,e)=>[t.description!==void 0?`${e} - ${t.description}`:e,""],B=(t,e)=>{if(t.usage!==void 0)return["Usage:",` ${t.usage}`,""];let n=t.children.length>0?" <command>":"",r=t.flags.length>0?" [options]":"";return["Usage:",` ${e}${n}${r}`,""]},I=t=>{if(t.length===0)return[];let e=Math.max(...t.map(r=>r.name.length));return["Commands:",...t.map(r=>` ${O(r.name,e+2)}${r.description??""}`),""]},Y=t=>{if(t.length===0)return[];let e=t.map(s=>({flag:U(s),desc:s.description})),n=Math.max(...e.map(s=>s.flag.length));return["Options:",...e.map(({flag:s,desc:i})=>` ${O(s,n+2)}${i}`),""]},Z=t=>t?.length?["Examples:",...t.map(e=>` ${e}`),""]:[],k=(t,e)=>{let n=e.join(" "),r=[...q(t,n),...B(t,n),...I(t.children),...Y(t.flags),...Z(t.examples)];return t.children.length>0&&r.push(`Run '${n} <command> --help' for more information on a command.`),r.join(`
|
|
2
|
+
`)};var w=t=>{let e=[];for(let n of t)e.push(`--${n.name}`),n.short!==void 0&&e.push(`-${n.short}`);return e.join(" ")},M=(t,e)=>{if(t.children===void 0||t.children.length===0)return"";let n=t.children.map(o=>o.name).join(" "),r=t.flags!==void 0?w(t.flags):"",s=[n,r].filter(o=>o.length>0).join(" "),i=` ${e})
|
|
3
|
+
`;i+=` COMPREPLY=( $(compgen -W "${s}" -- "\${cur}") )
|
|
4
|
+
`,i+=` return 0
|
|
5
|
+
`,i+=` ;;
|
|
6
|
+
`;for(let o of t.children)o.children!==void 0&&o.children.length>0&&(i+=M(o,`${e} ${o.name}`));return i},R=(t,e)=>{let n=e.children?.map(o=>o.name).join(" ")??"",r=e.flags!==void 0?w(e.flags):"",s=[n,r].filter(o=>o.length>0).join(" "),i="";if(e.children!==void 0)for(let o of e.children)i+=M(o,o.name);return`# ${t} bash completion
|
|
7
|
+
# Generated by @eser/shell/completions
|
|
8
|
+
|
|
9
|
+
_${t}_completions() {
|
|
10
|
+
local cur prev words cword
|
|
11
|
+
_init_completion || return
|
|
12
|
+
|
|
13
|
+
COMPREPLY=()
|
|
14
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
15
|
+
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
16
|
+
|
|
17
|
+
# Build the command path from words
|
|
18
|
+
local cmd_path=""
|
|
19
|
+
local i
|
|
20
|
+
for ((i=1; i<COMP_CWORD; i++)); do
|
|
21
|
+
case "\${COMP_WORDS[i]}" in
|
|
22
|
+
-*)
|
|
23
|
+
# Skip flags
|
|
24
|
+
;;
|
|
25
|
+
*)
|
|
26
|
+
if [[ -n "$cmd_path" ]]; then
|
|
27
|
+
cmd_path="$cmd_path \${COMP_WORDS[i]}"
|
|
28
|
+
else
|
|
29
|
+
cmd_path="\${COMP_WORDS[i]}"
|
|
30
|
+
fi
|
|
31
|
+
;;
|
|
32
|
+
esac
|
|
33
|
+
done
|
|
34
|
+
|
|
35
|
+
case "$cmd_path" in
|
|
36
|
+
${i} "")
|
|
37
|
+
COMPREPLY=( $(compgen -W "${s}" -- "\${cur}") )
|
|
38
|
+
return 0
|
|
39
|
+
;;
|
|
40
|
+
esac
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
complete -F _${t}_completions ${t}
|
|
44
|
+
`};var D=t=>t.replace(/'/g,"'\\''"),K=t=>{let e=[];for(let n of t){let r=D(n.description??`${n.name} flag`);n.takesValue===!0?(e.push(`'--${n.name}=[${r}]'`),n.short!==void 0&&e.push(`'-${n.short}=[${r}]'`)):(e.push(`'--${n.name}[${r}]'`),n.short!==void 0&&e.push(`'-${n.short}[${r}]'`))}return e},Q=t=>t.map(n=>{let r=D(n.description??n.name);return`'${n.name}:${r}'`}).join(`
|
|
45
|
+
`),P=(t,e,n)=>{let s=`${n.length===0?`_${t}`:`_${t}_${n.join("_")}`}() {
|
|
46
|
+
`;if(s+=` local -a commands
|
|
47
|
+
`,s+=` local -a flags
|
|
48
|
+
|
|
49
|
+
`,e.flags!==void 0&&e.flags.length>0){let i=K(e.flags);s+=` flags=(
|
|
50
|
+
${i.join(`
|
|
51
|
+
`)}
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
`}if(e.children!==void 0&&e.children.length>0){s+=` commands=(
|
|
55
|
+
`,s+=` ${Q(e.children)}
|
|
56
|
+
`,s+=` )
|
|
57
|
+
|
|
58
|
+
`,s+=` _arguments -C \\
|
|
59
|
+
`,e.flags!==void 0&&e.flags.length>0&&(s+=' "${flags[@]}" \\\n'),s+=` '1: :->command' \\
|
|
60
|
+
`,s+=` '*::arg:->args'
|
|
61
|
+
|
|
62
|
+
`,s+=` case "$state" in
|
|
63
|
+
`,s+=` command)
|
|
64
|
+
`,s+=` _describe -t commands 'command' commands
|
|
65
|
+
`,s+=` ;;
|
|
66
|
+
`,s+=` args)
|
|
67
|
+
`,s+=' case "${words[1]}" in\n';for(let i of e.children){let o=[...n,i.name],a=`_${t}_${o.join("_")}`;s+=` ${i.name})
|
|
68
|
+
`,s+=` ${a}
|
|
69
|
+
`,s+=` ;;
|
|
70
|
+
`}s+=` esac
|
|
71
|
+
`,s+=` ;;
|
|
72
|
+
`,s+=` esac
|
|
73
|
+
`}else e.flags!==void 0&&e.flags.length>0&&(s+=' _arguments "${flags[@]}"\n');if(s+=`}
|
|
74
|
+
|
|
75
|
+
`,e.children!==void 0)for(let i of e.children)s+=P(t,i,[...n,i.name]);return s},S=(t,e)=>{let n=`#compdef ${t}
|
|
76
|
+
`;return n+=`# ${t} zsh completion
|
|
77
|
+
`,n+=`# Generated by @eser/shell/completions
|
|
78
|
+
|
|
79
|
+
`,n+=P(t,e,[]),n};var H=t=>t.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),ee=(t,e,n)=>{let r="";for(let s of e){let i=H(s.description??`${s.name} flag`),o=`complete -c ${t} ${n}`;o+=` -l ${s.name}`,s.short!==void 0&&(o+=` -s ${s.short}`),s.takesValue===!0&&(o+=" -r"),o+=` -d '${i}'`,r+=o+`
|
|
80
|
+
`}return r},A=(t,e,n)=>{let r="",s;if(n.length===0?s="-n __fish_use_subcommand":s=`-n "${n.map(o=>`__fish_seen_subcommand_from ${o}`).join("; and ")}"`,e.children!==void 0&&e.children.length>0){for(let i of e.children){let o=H(i.description??i.name);if(n.length===0)r+=`complete -c ${t} -f ${s} `,r+=`-a "${i.name}" -d '${o}'
|
|
81
|
+
`;else{let a=`-n "__fish_seen_subcommand_from ${n[n.length-1]}"`;r+=`complete -c ${t} -f ${a} `,r+=`-a "${i.name}" -d '${o}'
|
|
82
|
+
`}}for(let i of e.children)r+=A(t,i,[...n,i.name])}return e.flags!==void 0&&e.flags.length>0&&(r+=ee(t,e.flags,s)),r},j=(t,e)=>{let n=`# ${t} fish completion
|
|
83
|
+
`;return n+=`# Generated by @eser/shell/completions
|
|
84
|
+
|
|
85
|
+
`,n+=`complete -c ${t} -f
|
|
86
|
+
|
|
87
|
+
`,n+=A(t,e,[]),n};var E=(t,e,n)=>{switch(t){case"bash":return R(e,n);case"zsh":return S(e,n);case"fish":return j(e,n)}};var N=class t{#e;#a;#d;#c=[];#u=[];#h=[];#g=[];#i=[];#s=new Map;#o=new Map;#n;#m;#p;#r={validation:"none"};#f;#t;constructor(e){this.#e=e}get name(){return this.#e}description(e){return this.#a=e,this}usage(e){return this.#d=e,this}example(e){return this.#c.push(e),this}aliases(...e){return this.#u=e,this}version(e){return this.#f=e,this}flag(e){return this.#h.push(e),this}persistentFlag(e){return this.#g.push({...e,persistent:!0}),this}args(e,n){return e==="exact"&&typeof n=="number"?this.#r={validation:e,count:n}:e==="min"&&typeof n=="number"?this.#r={validation:e,min:n}:e==="max"&&typeof n=="number"?this.#r={validation:e,max:n}:e==="range"&&Array.isArray(n)?this.#r={validation:e,min:n[0],max:n[1]}:this.#r={validation:e},this}command(e){return e.#t=this,this.#i.push(e),this}commands(...e){for(let n of e)this.command(n);return this}run(e){return this.#p=e,this}lazyCommand(e,n){return this.#s.set(e,n),this}group(e,n){return this.#o.set(e,n),this}modules(e){return this.#n=e,this}fallback(e){return this.#m=e,this}static#b=[{name:"help",short:"h",type:"boolean",description:"Show help for this command"}];#l(){let e=[],n=this.#t;for(;n!==void 0;)e.push(...n.#g),n=n.#t;return[...t.#b,...e,...this.#g,...this.#h]}#$(){return this.#t===void 0?this:this.#t.#$()}#C(){return this.#t===void 0?[this.#e]:[...this.#t.#C(),this.#e]}#x(e){return this.#i.find(n=>n.#e===e||n.#u.includes(e))}#_(e){let{validation:n,count:r,min:s,max:i}=this.#r,o=e.length;switch(n){case"no-args":if(o>0)return"This command takes no arguments";break;case"exact":if(o!==r)return`Expected exactly ${r} argument(s), got ${o}`;break;case"min":if(o<(s??0))return`Expected at least ${s} argument(s), got ${o}`;break;case"max":if(o>(i??1/0))return`Expected at most ${i} argument(s), got ${o}`;break;case"range":if(o<(s??0)||o>(i??1/0))return`Expected ${s}-${i} arguments, got ${o}`;break}}async parse(e){let n=e??x.process.args;return await this.#y(n,[])}async#y(e,n){let r=this.#l(),s=h(r),i=this.#i.length>0||this.#s.size>0||this.#o.size>0||this.#n!==void 0,o=u(e,{...s,stopEarly:i}),a=$(o,r),d=o._;if(this.#f!==void 0&&a.version===!0)return console.log(`${this.#e} ${this.#f}`),p(void 0);if(a.help===!0)return console.log(this.help()),p(void 0);let c=d[0];if(c!==void 0&&i){let F=this.#x(c);if(F!==void 0)return await F.#y(d.slice(1),[...n,this.#e]);if(this.#s.has(c)){let l=await this.#s.get(c).load();return l instanceof t?(l.#t=this,await l.parse(d.slice(1))):"parse"in l&&typeof l.parse=="function"?await l.parse(d.slice(1)):(console.log(l.help()),p(void 0))}if(this.#n!==void 0){let g=this.#n.aliases?.[c]??c,l=this.#n.modules[g];if(l!==void 0)return await(await l.load()).main(d.slice(1))}for(let[g,l]of this.#o)if(c===g){let m=d[1];if(m===void 0||m==="--help"||m==="-h")return this.#F(g,l),p(void 0);let G=l.aliases?.[m]??m,b=l.modules[G];return b===void 0?(console.error(`Unknown module: ${g} ${m}
|
|
88
|
+
`),this.#F(g,l),f({exitCode:1})):await(await b.load()).main(d.slice(2))}if(this.#m!==void 0)return await this.#m(c,d.slice(1))}if(this.#p===void 0)return console.log(this.help()),p(void 0);let C=_(a,r);if(C.length>0)return f({message:C.join(`
|
|
89
|
+
`),exitCode:1});let y=this.#_(d);if(y!==void 0)return f({message:y,exitCode:1});let L=[...n,this.#e],z={args:d,flags:a,root:this.#$(),commandPath:L};return await this.#p(z)}#F(e,n){console.log(`${this.#e} ${e} - ${n.description}
|
|
90
|
+
`),console.log(`Usage: ${this.#e} ${e} <module> [options]
|
|
91
|
+
`);let r=new Map;for(let[s,i]of Object.entries(n.modules)){let o=i.category??"Modules",a=r.get(o)??[];a.push([s,i]),r.set(o,a)}for(let[s,i]of r){console.log(`${s}:`);for(let[o,a]of i)console.log(` ${o.padEnd(24)} ${a.description}`);console.log()}if(n.aliases!==void 0&&Object.keys(n.aliases).length>0){console.log("Aliases:");for(let[s,i]of Object.entries(n.aliases))console.log(` ${s.padEnd(24)} \u2192 ${i}`)}}help(){let e=[...this.#i.map(r=>({name:r.#e,description:r.#a,usage:r.#d,examples:r.#c,flags:r.#l(),children:[]})),...[...this.#s.entries()].map(([r,s])=>({name:r,description:s.description,flags:[],children:[]})),...this.#n!==void 0?Object.entries(this.#n.modules).map(([r,s])=>({name:r,description:s.description,flags:s.flags??[],children:[]})):[],...[...this.#o.entries()].map(([r,s])=>({name:r,description:s.description,flags:[],children:[]}))],n={name:this.#e,description:this.#a,usage:this.#d,examples:this.#c,flags:this.#l(),children:e};return k(n,this.#C())}#O(){let e=r=>r.map(s=>({name:s.name,short:s.short,description:s.description,takesValue:s.type!=="boolean"})),n=r=>{let s=r.#i.map(n);for(let[i,o]of r.#s)s.push({name:i,description:o.description,children:[],flags:[]});if(r.#n!==void 0)for(let[i,o]of Object.entries(r.#n.modules))s.push({name:i,description:o.description,children:[],flags:o.flags!==void 0?e(o.flags):[]});for(let[i,o]of r.#o){let a=Object.entries(o.modules).map(([d,c])=>({name:d,description:c.description,children:[],flags:c.flags!==void 0?e(c.flags):[]}));s.push({name:i,description:o.description,children:a,flags:[]})}return{name:r.#e,description:r.#a,children:s,flags:e(r.#l())}};return n(this)}completions(e){let n=this.#O();return E(e,this.#e,n)}};export{re as a,N as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as v,b as N,c as H,l as D,m as h}from"./chunk-GLSCZGXA.js";import{a as x,b as p,c as u,e as A,f as P}from"./chunk-ZE5T64HQ.js";function L(e){e instanceof URL&&(e=v(e)),p(e);let r=-1,t=0,i=-1,n=!0,o=0;for(let s=e.length-1;s>=0;--s){let f=e.charCodeAt(s);if(u(f)){if(!n){t=s+1;break}continue}i===-1&&(n=!1,i=s+1),f===46?r===-1?r=s:o!==1&&(o=1):r!==-1&&(o=-1)}return r===-1||i===-1||o===0||o===1&&r===i-1&&r===t+1?"":e.slice(r,i)}function T(e){e instanceof URL&&(e=H(e)),p(e);let r=0,t=-1,i=0,n=-1,o=!0,s=0;e.length>=2&&e.charCodeAt(1)===58&&P(e.charCodeAt(0))&&(r=i=2);for(let f=e.length-1;f>=r;--f){let c=e.charCodeAt(f);if(A(c)){if(!o){i=f+1;break}continue}n===-1&&(o=!1,n=f+1),c===46?t===-1?t=f:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||n===-1||s===0||s===1&&t===n-1&&t===i+1?"":e.slice(t,n)}function j(e){return x?T(e):L(e)}function w(e,r){let t=r.dir||r.root,i=r.base||(r.name??"")+(r.ext??"");return t?i===e?t:t===r.root?t+i:t+e+i:i}function R(e){if(e===null||typeof e!="object")throw new TypeError(`The "pathObject" argument must be of type Object, received type "${typeof e}"`)}function W(e){return R(e),w("/",e)}function E(e){return R(e),w("\\",e)}function le(e){return x?E(e):W(e)}function O(e){p(e);let r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;let t=u(e.charCodeAt(0)),i;t?(r.root="/",i=1):i=0;let n=-1,o=0,s=-1,f=!0,c=e.length-1,d=0;for(;c>=i;--c){let l=e.charCodeAt(c);if(u(l)){if(!f){o=c+1;break}continue}s===-1&&(f=!1,s=c+1),l===46?n===-1?n=c:d!==1&&(d=1):n!==-1&&(d=-1)}return n===-1||s===-1||d===0||d===1&&n===s-1&&n===o+1?(s!==-1&&(o===0&&t?r.base=r.name=e.slice(1,s):r.base=r.name=e.slice(o,s)),r.base=r.base||"/"):(o===0&&t?(r.name=e.slice(1,n),r.base=e.slice(1,s)):(r.name=e.slice(o,n),r.base=e.slice(o,s)),r.ext=e.slice(n,s)),o>0?r.dir=N(e.slice(0,o-1),u):t&&(r.dir="/"),r}function y(e){p(e);let r={root:"",dir:"",base:"",ext:"",name:""},t=e.length;if(t===0)return r;let i=0,n=e.charCodeAt(0);if(t>1){if(A(n)){if(i=1,A(e.charCodeAt(1))){let a=2,m=a;for(;a<t&&!A(e.charCodeAt(a));++a);if(a<t&&a!==m){for(m=a;a<t&&A(e.charCodeAt(a));++a);if(a<t&&a!==m){for(m=a;a<t&&!A(e.charCodeAt(a));++a);a===t?i=a:a!==m&&(i=a+1)}}}}else if(P(n)&&e.charCodeAt(1)===58)if(i=2,t>2){if(A(e.charCodeAt(2))){if(t===3)return r.root=r.dir=e,r.base="\\",r;i=3}}else return r.root=r.dir=e,r}else if(A(n))return r.root=r.dir=e,r.base="\\",r;i>0&&(r.root=e.slice(0,i));let o=-1,s=i,f=-1,c=!0,d=e.length-1,l=0;for(;d>=i;--d){if(n=e.charCodeAt(d),A(n)){if(!c){s=d+1;break}continue}f===-1&&(c=!1,f=d+1),n===46?o===-1?o=d:l!==1&&(l=1):o!==-1&&(l=-1)}return o===-1||f===-1||l===0||l===1&&o===f-1&&o===s+1?f!==-1&&(r.base=r.name=e.slice(s,f)):(r.name=e.slice(s,o),r.base=e.slice(s,f),r.ext=e.slice(o,f)),r.base=r.base||"\\",s>0&&s!==i?r.dir=e.slice(0,s-1):r.dir=r.root,r}function we(e){return x?y(e):O(e)}function k(e,r){if(p(e),p(r),e===r)return""}function U(e,r){if(k(e,r),e=D(e),r=D(r),e===r)return"";let t=1,i=e.length;for(;t<i&&u(e.charCodeAt(t));++t);let n=i-t,o=1,s=r.length;for(;o<s&&u(r.charCodeAt(o));++o);let f=s-o,c=n<f?n:f,d=-1,l=0;for(;l<=c;++l){if(l===c){if(f>c){if(u(r.charCodeAt(o+l)))return r.slice(o+l+1);if(l===0)return r.slice(o+l)}else n>c&&(u(e.charCodeAt(t+l))?d=l:l===0&&(d=0));break}let m=e.charCodeAt(t+l),g=r.charCodeAt(o+l);if(m!==g)break;u(m)&&(d=l)}let a="";for(l=t+d+1;l<=i;++l)(l===i||u(e.charCodeAt(l)))&&(a.length===0?a+="..":a+="/..");return a.length>0?a+r.slice(o+d):(o+=d,u(r.charCodeAt(o))&&++o,r.slice(o))}function z(e,r){k(e,r);let t=h(e),i=h(r);if(t===i||(e=t.toLowerCase(),r=i.toLowerCase(),e===r))return"";let n=0,o=e.length;for(;n<o&&e.charCodeAt(n)===92;++n);for(;o-1>n&&e.charCodeAt(o-1)===92;--o);let s=o-n,f=0,c=r.length;for(;f<c&&r.charCodeAt(f)===92;++f);for(;c-1>f&&r.charCodeAt(c-1)===92;--c);let d=c-f,l=s<d?s:d,a=-1,m=0;for(;m<=l;++m){if(m===l){if(d>l){if(r.charCodeAt(f+m)===92)return i.slice(f+m+1);if(m===2)return i.slice(f+m)}s>l&&(e.charCodeAt(n+m)===92?a=m:m===2&&(a=3));break}let _=e.charCodeAt(n+m),G=r.charCodeAt(f+m);if(_!==G)break;_===92&&(a=m)}if(m!==l&&a===-1)return i;let g="";for(a===-1&&(a=0),m=n+a+1;m<=o;++m)(m===o||e.charCodeAt(m)===92)&&(g.length===0?g+="..":g+="\\..");return g.length>0?g+i.slice(f+a,c):(f+=a,i.charCodeAt(f)===92&&++f,i.slice(f,c))}function ze(e,r){return x?z(e,r):U(e,r)}export{j as a,le as b,we as c,ze as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as i}from"./chunk-DOV5776P.js";var t=async a=>{try{return await i`which ${a}`.noThrow().code()===0}catch{return!1}},r=async()=>{try{return(await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok}catch{return!1}},e=a=>typeof globalThis.Deno<"u"?Deno.env.get(a)!==void 0:!1,c=async()=>{let[a,o,n,l]=await Promise.all([t("claude"),r(),t("opencode"),t("kiro")]);return[{name:"claude-code",alias:"cc",type:"CLI",available:a,detail:a?"claude binary found":"claude not on PATH"},{name:"ollama",alias:"ol",type:"HTTP",available:o,detail:o?"localhost:11434 reachable":"localhost:11434 not reachable"},{name:"opencode",alias:"oc",type:"CLI",available:n,detail:n?"opencode binary found":"opencode not on PATH"},{name:"kiro",alias:"kr",type:"CLI",available:l,detail:l?"kiro binary found":"kiro not on PATH"},{name:"anthropic",alias:"ant",type:"API",available:e("ANTHROPIC_API_KEY"),detail:e("ANTHROPIC_API_KEY")?"ANTHROPIC_API_KEY set":"ANTHROPIC_API_KEY not set"},{name:"openai",alias:"oai",type:"API",available:e("OPENAI_API_KEY"),detail:e("OPENAI_API_KEY")?"OPENAI_API_KEY set":"OPENAI_API_KEY not set"},{name:"gemini",alias:"gem",type:"API",available:e("GEMINI_API_KEY")||e("GOOGLE_API_KEY"),detail:e("GEMINI_API_KEY")||e("GOOGLE_API_KEY")?"API key set":"GEMINI_API_KEY not set"},{name:"vertexai",alias:"vtx",type:"API",available:e("GOOGLE_CLOUD_PROJECT"),detail:e("GOOGLE_CLOUD_PROJECT")?"GOOGLE_CLOUD_PROJECT set":"GOOGLE_CLOUD_PROJECT not set"}]};export{c as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as t}from"./chunk-VFMYWG2I.js";var n=t({name:"validate-line-endings",description:"Normalize line endings to LF",canFix:!0,stacks:[],defaults:{},checkFile(i,e){return e===void 0?[]:e.includes("\r")?[{path:i.path,message:"file contains CRLF or CR line endings"}]:[]},fixFile(i,e){let r=e.replace(/\r\n/g,`
|
|
2
|
+
`).replace(/\r/g,`
|
|
3
|
+
`);if(r!==e)return{path:i.path,oldContent:e,newContent:r}}}),s=n.run,d=n.validator,p=n.main;export{n as a,s as b,d as c,p as d};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var c="<!-- noskills:start -->",i="<!-- noskills:end -->",y=n=>{let e=[c,"## noskills orchestrator","","This project uses noskills. Do not read skill files, concern files,","or rule files directly.","","At every step, run:",""," npx eser noskills next","","Follow the output. To submit a result or answer:","",' npx eser noskills next --answer="your response here"',"","Do not make architectural decisions independently.","noskills will tell you what to do next."];if(n.length>0){e.push("","### Active Rules","");for(let s of n)e.push(`- ${s}`)}return e.push(i),e.join(`
|
|
2
|
+
`)},a=async(n,e)=>{let s=`${n}/CLAUDE.md`,t=y(e),o;try{o=await Deno.readTextFile(s);let r=o.indexOf(c),l=o.indexOf(i);r!==-1&&l!==-1?o=o.slice(0,r)+t+o.slice(l+i.length):o=o.trimEnd()+`
|
|
3
|
+
|
|
4
|
+
`+t+`
|
|
5
|
+
`}catch{o=t+`
|
|
6
|
+
`}await Deno.writeTextFile(s,o)};var u=async(n,e)=>{let s=["# Generated by noskills \u2014 do not edit manually","","## Orchestration","","This project uses noskills for AI orchestration.","Run `npx eser noskills next` at every step.",'Follow the JSON output. Submit results with `npx eser noskills next --answer="..."`',""];if(e.length>0){s.push("## Rules","");for(let t of e)s.push(`- ${t}`);s.push("")}await Deno.writeTextFile(`${n}/.cursorrules`,s.join(`
|
|
7
|
+
`))};var d=async(n,e)=>{let s=["# Generated by noskills \u2014 do not edit manually","","## Orchestration","","This project uses noskills for AI orchestration.","Run `npx eser noskills next` at every step.",""];if(e.length>0){s.push("## Rules","");for(let t of e)s.push(`- ${t}`);s.push("")}await Deno.mkdir(`${n}/.kiro/steering`,{recursive:!0}),await Deno.writeTextFile(`${n}/.kiro/steering/conventions.md`,s.join(`
|
|
8
|
+
`))};var p=async(n,e)=>{let s=["# Generated by noskills \u2014 do not edit manually","","## Orchestration","","This project uses noskills for AI orchestration.","Run `npx eser noskills next` at every step.",""];if(e.length>0){s.push("## Rules","");for(let t of e)s.push(`- ${t}`);s.push("")}await Deno.mkdir(`${n}/.github`,{recursive:!0}),await Deno.writeTextFile(`${n}/.github/copilot-instructions.md`,s.join(`
|
|
9
|
+
`))};var h=async(n,e)=>{let s=["# Generated by noskills \u2014 do not edit manually","","## Orchestration","","This project uses noskills for AI orchestration.","Run `npx eser noskills next` at every step.",""];if(e.length>0){s.push("## Rules","");for(let t of e)s.push(`- ${t}`);s.push("")}await Deno.writeTextFile(`${n}/.windsurfrules`,s.join(`
|
|
10
|
+
`))};var w=async n=>{let e=`${n}/.nos/rules`,s=[];try{for await(let t of Deno.readDir(e))if(t.isFile&&(t.name.endsWith(".md")||t.name.endsWith(".txt"))){let o=await Deno.readTextFile(`${e}/${t.name}`);s.push(o.trim())}}catch{}return s},T={"claude-code":a,cursor:u,kiro:d,copilot:p,windsurf:h},D=async(n,e)=>{let s=await w(n),t=[];for(let o of e){let r=T[o];r!==void 0&&(await r(n,s),t.push(o))}return t};export{w as a,D as b};
|