@stacksjs/stx 0.2.128 → 0.2.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -810,7 +810,7 @@ ${H}
810
810
  `),X)J=J.replace(/\n/g,`<br />
811
811
  `);for(let z=0;z<Q.length;z++)J=J.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function l1($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
812
812
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
813
- `}),$}import Jz from"process";function F1($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(Jz.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}function Qz($="STX_PUBLIC_"){let Z={};for(let[Y,X]of Object.entries(Jz.env))if(Y.startsWith($)&&X!==void 0)Z[Y]=X;return Z}var u4=()=>{};import Z7 from"path";function MJ($){Kz=$?.trim()||null}function H$(){return process.env[Gz]?.trim()||Kz||k6}function l0($=process.cwd(),...Z){let Y=H$();return Z7.isAbsolute(Y)?Z7.join(Y,...Z):Z7.join($,Y,...Z)}function O$($){if(!$||Z7.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==k6&&!Z.startsWith(`${k6}/`))return $;let Y=Z.slice(k6.length+1);return Y?Z7.join(H$(),Y):H$()}var k6=".stx",Gz="STX_DIR",Kz=null;var J4=()=>{};var Y7={};$0(Y7,{queueClientBundleBuild:()=>_z,hasUserImports:()=>cR,bundleClientScript:()=>iR});import c0 from"path";import A1 from"fs";function cR($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(!Wz.some((G)=>G.test(J)))return console.log("[stx:bundler] detected user import:",J),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let J=Y[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!Wz.some((G)=>G.test(J)))return console.log("[stx:bundler] detected side-effect import:",J),!0}return!1}function pR($,Z,Y,X){let J=(Q,G)=>{let K=Q===Y?Z:c0.dirname(Q),W=c0.resolve(K,G),U=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,c0.join(W,"index.ts"),c0.join(W,"index.tsx"),c0.join(W,"index.js"),c0.join(W,"index.mjs")];for(let z of U)try{if(A1.existsSync(z)&&A1.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(A1.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=J(G.importer,G.path);return X.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=c0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,c0.join(K,"index.ts"),c0.join(K,"index.tsx"),c0.join(K,"index.js"),c0.join(K,"index.mjs")];for(let U of W)if(A1.existsSync(U)&&A1.statSync(U,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",U),X.add(U),{path:U};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=c0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";return X.add(G.path),{contents:A1.readFileSync(G.path,"utf8"),loader:W}})}}}function _z($){let Z=globalThis,X=(Z[Uz]??Promise.resolve()).then($,$);return Z[Uz]=X.then(()=>{return},()=>{return}),X}async function iR($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||l0(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${lR}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=c0.join(Q,`${K}.js`),U=c0.join(Q,`${K}.deps.json`),z=Bun.file(W);if(await z.exists()){let q=Bun.file(U),j=!0;if(await q.exists())try{let H=JSON.parse(await q.text());if(H.metadataVersion!==zz||!Array.isArray(H.files))j=!1;for(let O of Array.isArray(H.files)?H.files:[])try{if(A1.statSync(O.path).mtimeMs!==O.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let _=TJ.get(K);if(_)return await _;let B=_z(()=>nR($,Z,{projectRoot:X,minify:J,cacheDir:Q,hash:K,cachePath:W,depsPath:U}));TJ.set(K,B);try{return await B}finally{TJ.delete(K)}}async function nR($,Z,Y){let{projectRoot:X,minify:J,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,U=l0(X,"bundle-tmp"),z=c0.join(U,`${G}.ts`),_=c0.join(U,"out",G);A1.mkdirSync(U,{recursive:!0}),A1.mkdirSync(_,{recursive:!0});let B=c0.dirname(Z),q=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=j.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((F)=>{let A=F.split(":")[0].trim();if(A)q.push(A)});else if(O[3])q.push(O[3])}while((O=H.exec($))!==null){if(O[1])continue;q.push(O[2])}let V=q.length>0?`
813
+ `}),$}import Jz from"process";function F1($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(Jz.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}function Qz($="STX_PUBLIC_"){let Z={};for(let[Y,X]of Object.entries(Jz.env))if(Y.startsWith($)&&X!==void 0)Z[Y]=X;return Z}var u4=()=>{};import Z7 from"path";function MJ($){Kz=$?.trim()||null}function H$(){return process.env[Gz]?.trim()||Kz||k6}function l0($=process.cwd(),...Z){let Y=H$();return Z7.isAbsolute(Y)?Z7.join(Y,...Z):Z7.join($,Y,...Z)}function O$($){if(!$||Z7.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==k6&&!Z.startsWith(`${k6}/`))return $;let Y=Z.slice(k6.length+1);return Y?Z7.join(H$(),Y):H$()}var k6=".stx",Gz="STX_DIR",Kz=null;var J4=()=>{};var Y7={};$0(Y7,{queueClientBundleBuild:()=>_z,hasUserImports:()=>cR,bundleClientScript:()=>iR});import c0 from"path";import A1 from"fs";function cR($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(!Wz.some((G)=>G.test(J)))return console.log("[stx:bundler] detected user import:",J),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let J=Y[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!Wz.some((G)=>G.test(J)))return console.log("[stx:bundler] detected side-effect import:",J),!0}return!1}function pR($,Z,Y,X){let J=(Q,G)=>{let K=Q===Y?Z:c0.dirname(Q),W=c0.resolve(K,G),U=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,c0.join(W,"index.ts"),c0.join(W,"index.tsx"),c0.join(W,"index.js"),c0.join(W,"index.mjs")];for(let z of U)try{if(A1.existsSync(z)&&A1.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(A1.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=J(G.importer,G.path);return X.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=c0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,c0.join(K,"index.ts"),c0.join(K,"index.tsx"),c0.join(K,"index.js"),c0.join(K,"index.mjs")];for(let U of W)if(A1.existsSync(U)&&A1.statSync(U,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",U),X.add(U),{path:U};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=c0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:A1.readFileSync(G.path,"utf8"),loader:W}})}}}function _z($){let Z=globalThis,X=(Z[Uz]??Promise.resolve()).then($,$);return Z[Uz]=X.then(()=>{return},()=>{return}),X}async function iR($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||l0(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${lR}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=c0.join(Q,`${K}.js`),U=c0.join(Q,`${K}.deps.json`),z=Bun.file(W);if(await z.exists()){let q=Bun.file(U),j=!0;if(await q.exists())try{let H=JSON.parse(await q.text());if(H.metadataVersion!==zz||!Array.isArray(H.files))j=!1;for(let O of Array.isArray(H.files)?H.files:[])try{if(A1.statSync(O.path).mtimeMs!==O.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let _=TJ.get(K);if(_)return await _;let B=_z(()=>nR($,Z,{projectRoot:X,minify:J,cacheDir:Q,hash:K,cachePath:W,depsPath:U}));TJ.set(K,B);try{return await B}finally{TJ.delete(K)}}async function nR($,Z,Y){let{projectRoot:X,minify:J,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,U=l0(X,"bundle-tmp"),z=c0.join(U,`${G}.ts`),_=c0.join(U,"out",G);A1.mkdirSync(U,{recursive:!0}),A1.mkdirSync(_,{recursive:!0});let B=c0.dirname(Z),q=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=j.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((F)=>{let A=F.split(":")[0].trim();if(A)q.push(A)});else if(O[3])q.push(O[3])}while((O=H.exec($))!==null){if(O[1])continue;q.push(O[2])}let V=q.length>0?`
814
814
  export { ${q.join(", ")} }`:"";await Bun.write(z,$+V),console.log("[stx:bundler] bundling:",G,"from:",c0.basename(Z));let L=new Set;try{let F=await Bun.build({entrypoints:[z],outdir:_,target:"browser",format:"esm",minify:J,plugins:[pR(X,B,z,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...F1()},root:X});if(!F.success){let k=F.logs.filter((x)=>x.level==="error").map((x)=>x.message).join(", ");return console.warn("[stx:bundler] build failed:",k),$}let A="";for(let k of F.outputs){A=await k.text();break}let w=[];for(let k of A.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let x of k[1].split(",")){let y=x.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y){w.push([y[2],y[1]]);continue}let b=x.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))w.push([b,b])}let N=A.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];A=A.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let R=`__stxBundle_${G}`,E=w.map(([k,x])=>`${JSON.stringify(k)}: ${x}`).join(", "),M=w.map(([k])=>`var ${k} = undefined;`).join(`
815
815
  `),I=w.map(([k])=>`${k} = ${R}[${JSON.stringify(k)}];`).join(`
816
816
  `);if(A=`${N.join(`
@@ -22446,7 +22446,7 @@ else {
22446
22446
  `)}function KR($,Z){let Y=" ".repeat(Z),X=[];for(let[K,W]of Object.entries($.props))if(W.type==="literal"){let U=typeof W.value==="string"?`"${W.value}"`:String(W.value);X.push(`${K}: ${U}`)}let J=X.length>0?`{ ${X.join(", ")} }`:"{}",Q=$.children.map((K)=>K.type==="text"?`"${K.props.text?.type==="literal"?K.props.text.value:""}"`:KR(K,Z+1)),G=Q.length>0?`,
22447
22447
  ${Y} [${Q.join(`,
22448
22448
  ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${J}${G})`}function ah($,Z,Y){if(Z.target==="universal"){let X=[];X.push("// Universal entry point"),X.push("");for(let[J,Q]of Y)X.push(`// --- ${J.toUpperCase()} ---`),X.push(`#if ${J.toUpperCase()}`),X.push(Q),X.push("#endif"),X.push("");return X.join(`
22449
- `)}return Y.get(Z.target)||fU($,Z)}function sh($,Z,Y){let X=[];function J(Q){X.push({name:Q.zigType,hash:UR(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)J(G)}return J(Z),{version:"1.0.0",components:X,entry:$.id,assets:[],styles:$.styles}}function oh($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function WR(){return`id_${++th}`}function UR($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}function eh($){return $.charAt(0).toUpperCase()+$.slice(1)}function $d($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function Zd($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function gU($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=gU(Y);return Z}function hU($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=hU(Y);return Z}function zR($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(Z)=>{console.log(`[craft-compiler] File changed: ${Z}`)}}}var dU,th=0,Yd,Xd;var BR=D(()=>{dU=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);Yd={compileToNative:YR,createHotReloadServer:zR,NATIVE_COMPONENTS:dU},Xd=Yd});import{spawn as HR}from"child_process";import f0 from"fs";import Jd from"os";import Y0 from"path";import v from"process";import{CLI as Qd}from"@stacksjs/clapp";var D6="0.2.128";j$();jU();AK();kK();r4();EK();OK();JU();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",V0=new Qd("stx");function qR($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function jR($){try{if(!f0.existsSync($)){let Y=Y0.dirname($),X=Y0.basename($);if(f0.existsSync(Y)){let Q=f0.readdirSync(Y).filter((K)=>K.toLowerCase().includes(X.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Y}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Y} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${$}`,suggestion:G}}return{isValid:!1,error:`File does not exist: ${$}`,suggestion:"Check the file path and try again"}}if(f0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function uU($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var e5=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),Gd=($)=>$.endsWith(".stx")||$.endsWith(".md");function t5($,Z=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);v.exit(Z)}function Kd($){if(!$)return;let Z;try{Z=JSON.parse($)}catch(Y){console.error(`\u274C --info-plist is not valid JSON: ${Y.message}`),v.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),v.exit(1);for(let[Y,X]of Object.entries(Z))if(typeof X!=="string"&&typeof X!=="number"&&typeof X!=="boolean")console.error(`\u274C --info-plist value for "${Y}" must be a string, number or boolean`),v.exit(1);return Z}async function Wd($,Z){try{let Y=["test"],X=[];if($&&$.length>0)for(let W of $)if(e5(W))try{let U=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(U.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(X.push(...U),Z.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else X.push(W);if(X.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Y.push(...X),Z.filter)Y.push("--pattern",Z.filter);if(Z.timeout)Y.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=Y0.join(Jd.tmpdir(),`stx-test-report-${Date.now()}.xml`);Y.push("--reporter",Z.reporter),Y.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)Y.push("--coverage");if(Z.watch)Y.push("--watch");Y.push("--preload",Y0.join(__dirname,"../../../test-utils/happy-dom.ts"));let J={...v.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},Q="bun";if(Z.verbose)console.log(`Running: ${Q} ${Y.join(" ")}`);let G=performance.now(),K=HR(Q,Y,{stdio:"inherit",shell:!1,env:J});return new Promise((W)=>{K.on("close",(U)=>{let _=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),v.on("SIGINT",()=>{console.log(`
22449
+ `)}return Y.get(Z.target)||fU($,Z)}function sh($,Z,Y){let X=[];function J(Q){X.push({name:Q.zigType,hash:UR(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)J(G)}return J(Z),{version:"1.0.0",components:X,entry:$.id,assets:[],styles:$.styles}}function oh($,Z){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function WR(){return`id_${++th}`}function UR($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$.charCodeAt(Y);Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(36)}function eh($){return $.charAt(0).toUpperCase()+$.slice(1)}function $d($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function Zd($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,X;while((X=Y.exec($))!==null)Z.push(X[1]);return Z}function gU($){let Z=$.type==="component"?1:0;if($.children)for(let Y of $.children)Z+=gU(Y);return Z}function hU($){let Z=$.zigType.startsWith("craft.")?1:0;for(let Y of $.children)Z+=hU(Y);return Z}function zR($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(Z)=>{console.log(`[craft-compiler] File changed: ${Z}`)}}}var dU,th=0,Yd,Xd;var BR=D(()=>{dU=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);Yd={compileToNative:YR,createHotReloadServer:zR,NATIVE_COMPONENTS:dU},Xd=Yd});import{spawn as HR}from"child_process";import f0 from"fs";import Jd from"os";import Y0 from"path";import v from"process";import{CLI as Qd}from"@stacksjs/clapp";var D6="0.2.129";j$();jU();AK();kK();r4();EK();OK();JU();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",V0=new Qd("stx");function qR($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function jR($){try{if(!f0.existsSync($)){let Y=Y0.dirname($),X=Y0.basename($);if(f0.existsSync(Y)){let Q=f0.readdirSync(Y).filter((K)=>K.toLowerCase().includes(X.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Y}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Y} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${$}`,suggestion:G}}return{isValid:!1,error:`File does not exist: ${$}`,suggestion:"Check the file path and try again"}}if(f0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function uU($){let Z=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var e5=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),Gd=($)=>$.endsWith(".stx")||$.endsWith(".md");function t5($,Z=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);v.exit(Z)}function Kd($){if(!$)return;let Z;try{Z=JSON.parse($)}catch(Y){console.error(`\u274C --info-plist is not valid JSON: ${Y.message}`),v.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),v.exit(1);for(let[Y,X]of Object.entries(Z))if(typeof X!=="string"&&typeof X!=="number"&&typeof X!=="boolean")console.error(`\u274C --info-plist value for "${Y}" must be a string, number or boolean`),v.exit(1);return Z}async function Wd($,Z){try{let Y=["test"],X=[];if($&&$.length>0)for(let W of $)if(e5(W))try{let U=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(U.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(X.push(...U),Z.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else X.push(W);if(X.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Y.push(...X),Z.filter)Y.push("--pattern",Z.filter);if(Z.timeout)Y.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=Y0.join(Jd.tmpdir(),`stx-test-report-${Date.now()}.xml`);Y.push("--reporter",Z.reporter),Y.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)Y.push("--coverage");if(Z.watch)Y.push("--watch");Y.push("--preload",Y0.join(__dirname,"../../../test-utils/happy-dom.ts"));let J={...v.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},Q="bun";if(Z.verbose)console.log(`Running: ${Q} ${Y.join(" ")}`);let G=performance.now(),K=HR(Q,Y,{stdio:"inherit",shell:!1,env:J});return new Promise((W)=>{K.on("close",(U)=>{let _=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),v.on("SIGINT",()=>{console.log(`
22450
22450
  Test run interrupted`),K.kill("SIGINT"),v.exit(1)})})}catch(Y){return console.error("Error running tests:",Y instanceof Error?Y.message:String(Y)),!1}}var Ud=v.argv.length>=3&&(Gd(v.argv[2])&&f0.existsSync(v.argv[2])||e5(v.argv[2]));if(Ud){let $=v.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let Y=3;Y<v.argv.length;Y++){let X=v.argv[Y];if(X==="--port"&&Y+1<v.argv.length){let J=qR(v.argv[++Y]);if(!J.isValid)t5(J);Z.port=Number.parseInt(v.argv[Y],10)}else if(X==="--no-watch")Z.watch=!1;else if(X==="--highlight-theme"&&Y+1<v.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=v.argv[++Y]}else if(X==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(X==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(X==="--no-cache")Z.cache=!1;else if(X==="--native")Z.native=!0}if(e5($))try{let Y=await Array.fromAsync(new Bun.Glob($).scan({onlyFiles:!0,absolute:!0})),X=$.endsWith(".stx")?Y.filter((K)=>K.endsWith(".stx")):$.endsWith(".md")?Y.filter((K)=>K.endsWith(".md")):Y.filter((K)=>K.endsWith(".stx")||K.endsWith(".md")),J=$.split("*")[0].replace(/\/$/,"")||".",Q=Y0.resolve(J);try{let K=new Bun.Glob("**/*.stx"),U=(await Array.fromAsync(K.scan({cwd:Q,onlyFiles:!0,absolute:!0}))).filter((z)=>/\[.+\]/.test(Y0.basename(z)));for(let z of U)if(!X.includes(z))X.push(z)}catch{}if(X.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${$}`),v.exit(1);if(!await N3(X,Z))v.exit(1)}catch(Y){console.error("Failed to process files:",Y),v.exit(1)}else w3($,Z).catch((Y)=>{console.error("Failed to start dev server:",Y),v.exit(1)})}else{let $=function(X,J){let Q=[];for(let G=0;G<=J.length;G++)Q[G]=[G];for(let G=0;G<=X.length;G++)Q[0][G]=G;for(let G=1;G<=J.length;G++)for(let K=1;K<=X.length;K++)if(J.charAt(G-1)===X.charAt(K-1))Q[G][K]=Q[G-1][K-1];else Q[G][K]=Math.min(Q[G-1][K-1]+1,Q[G][K-1]+1,Q[G-1][K]+1);return Q[J.length][X.length]};V0.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(X)=>{try{if(await FK(X))console.log("Documentation generated successfully."),v.exit(0);else console.error("Documentation generation failed."),v.exit(1)}catch(J){console.error("Error generating documentation:",J),v.exit(1)}}),V0.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(X,J)=>{try{let{fetchCollections:Q,generatePackage:G}=await import("@stacksjs/iconify-generator");if(X==="list"){console.log(`
22451
22451
  \uD83D\uDCDA Fetching available icon collections...
22452
22452
  `);let K=await Q(),W=Object.entries(K).sort((U,z)=>z[1].total-U[1].total);console.log(`Available collections:
@@ -100,7 +100,8 @@ function createBundlePlugin(projectRoot, templateDir, tmpEntry, inputFiles) {
100
100
  });
101
101
  build.onLoad({ filter: /\.(?:[cm]?[jt]sx?|json)$/ }, (args) => {
102
102
  const extension = path.extname(args.path).toLowerCase(), loader = extension === ".json" ? "json" : extension === ".tsx" ? "tsx" : extension === ".jsx" ? "jsx" : extension === ".ts" || extension === ".mts" || extension === ".cts" ? "ts" : "js";
103
- inputFiles.add(args.path);
103
+ if (args.path !== tmpEntry)
104
+ inputFiles.add(args.path);
104
105
  return {
105
106
  contents: fs.readFileSync(args.path, "utf8"),
106
107
  loader
package/dist/craft.js CHANGED
@@ -639,7 +639,7 @@ ${H}
639
639
  `),X)Q=Q.replace(/\n/g,`<br />
640
640
  `);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function s0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
641
641
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
642
- `}),$}import gG from"process";function m0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(gG.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var P1=()=>{};import g5 from"path";function p9($){c9=$?.trim()||null}function h5(){return process.env[hG]?.trim()||c9||Z5}function u5($=process.cwd(),...Z){let Y=h5();return g5.isAbsolute(Y)?g5.join(Y,...Z):g5.join($,Y,...Z)}function d5($){if(!$||g5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==Z5&&!Z.startsWith(`${Z5}/`))return $;let Y=Z.slice(Z5.length+1);return Y?g5.join(h5(),Y):h5()}var Z5=".stx",hG="STX_DIR",c9=null;var T$=()=>{};var m5={};e(m5,{queueClientBundleBuild:()=>o9,hasUserImports:()=>dG,bundleClientScript:()=>lG});import H0 from"path";import S0 from"fs";function dG($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!i9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!i9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function mG($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:H0.dirname(J),q=H0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,H0.join(q,"index.ts"),H0.join(q,"index.tsx"),H0.join(q,"index.js"),H0.join(q,"index.mjs")];for(let U of W)try{if(S0.existsSync(U)&&S0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(S0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=H0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,H0.join(K,"index.ts"),H0.join(K,"index.tsx"),H0.join(K,"index.js"),H0.join(K,"index.mjs")];for(let W of q)if(S0.existsSync(W)&&S0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=H0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";return X.add(G.path),{contents:S0.readFileSync(G.path,"utf8"),loader:q}})}}}function o9($){let Z=globalThis,X=(Z[n9]??Promise.resolve()).then($,$);return Z[n9]=X.then(()=>{return},()=>{return}),X}async function lG($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||u5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${uG}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=H0.join(J,`${K}.js`),W=H0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let B=Bun.file(W),j=!0;if(await B.exists())try{let H=JSON.parse(await B.text());if(H.metadataVersion!==s9||!Array.isArray(H.files))j=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(S0.statSync(L.path).mtimeMs!==L.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=V7.get(K);if(z)return await z;let _=o9(()=>cG($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));V7.set(K,_);try{return await _}finally{V7.delete(K)}}async function cG($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=u5(X,"bundle-tmp"),U=H0.join(W,`${G}.ts`),z=H0.join(W,"out",G);S0.mkdirSync(W,{recursive:!0}),S0.mkdirSync(z,{recursive:!0});let _=H0.dirname(Z),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=j.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)B.push(w)});else if(L[3])B.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;B.push(L[2])}let F=B.length>0?`
642
+ `}),$}import gG from"process";function m0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(gG.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var P1=()=>{};import g5 from"path";function p9($){c9=$?.trim()||null}function h5(){return process.env[hG]?.trim()||c9||Z5}function u5($=process.cwd(),...Z){let Y=h5();return g5.isAbsolute(Y)?g5.join(Y,...Z):g5.join($,Y,...Z)}function d5($){if(!$||g5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==Z5&&!Z.startsWith(`${Z5}/`))return $;let Y=Z.slice(Z5.length+1);return Y?g5.join(h5(),Y):h5()}var Z5=".stx",hG="STX_DIR",c9=null;var T$=()=>{};var m5={};e(m5,{queueClientBundleBuild:()=>o9,hasUserImports:()=>dG,bundleClientScript:()=>lG});import H0 from"path";import S0 from"fs";function dG($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!i9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!i9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function mG($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:H0.dirname(J),q=H0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,H0.join(q,"index.ts"),H0.join(q,"index.tsx"),H0.join(q,"index.js"),H0.join(q,"index.mjs")];for(let U of W)try{if(S0.existsSync(U)&&S0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(S0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=H0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,H0.join(K,"index.ts"),H0.join(K,"index.tsx"),H0.join(K,"index.js"),H0.join(K,"index.mjs")];for(let W of q)if(S0.existsSync(W)&&S0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=H0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:S0.readFileSync(G.path,"utf8"),loader:q}})}}}function o9($){let Z=globalThis,X=(Z[n9]??Promise.resolve()).then($,$);return Z[n9]=X.then(()=>{return},()=>{return}),X}async function lG($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||u5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${uG}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=H0.join(J,`${K}.js`),W=H0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let B=Bun.file(W),j=!0;if(await B.exists())try{let H=JSON.parse(await B.text());if(H.metadataVersion!==s9||!Array.isArray(H.files))j=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(S0.statSync(L.path).mtimeMs!==L.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=V7.get(K);if(z)return await z;let _=o9(()=>cG($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));V7.set(K,_);try{return await _}finally{V7.delete(K)}}async function cG($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=u5(X,"bundle-tmp"),U=H0.join(W,`${G}.ts`),z=H0.join(W,"out",G);S0.mkdirSync(W,{recursive:!0}),S0.mkdirSync(z,{recursive:!0});let _=H0.dirname(Z),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=j.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)B.push(w)});else if(L[3])B.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;B.push(L[2])}let F=B.length>0?`
643
643
  export { ${B.join(", ")} }`:"";await Bun.write(U,$+F),console.log("[stx:bundler] bundling:",G,"from:",H0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:Q,plugins:[mG(X,_,U,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...m0()},root:X});if(!V.success){let E=V.logs.filter((P)=>P.level==="error").map((P)=>P.message).join(", ");return console.warn("[stx:bundler] build failed:",E),$}let w="";for(let E of V.outputs){w=await E.text();break}let A=[];for(let E of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of E[1].split(",")){let S=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let R=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let M=`__stxBundle_${G}`,N=A.map(([E,P])=>`${JSON.stringify(E)}: ${P}`).join(", "),T=A.map(([E])=>`var ${E} = undefined;`).join(`
644
644
  `),I=A.map(([E])=>`${E} = ${M}[${JSON.stringify(E)}];`).join(`
645
645
  `);if(w=`${R.join(`
package/dist/pwa.js CHANGED
@@ -1830,7 +1830,7 @@ ${H}
1830
1830
  `),X)Q=Q.replace(/\n/g,`<br />
1831
1831
  `);for(let z=0;z<J.length;z++)Q=Q.replace(`\x00CODEBLOCK${z}\x00`,J[z]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function c0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1832
1832
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1833
- `}),$}import oQ from"process";function d0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(oQ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var M1=()=>{};var b5={};r(b5,{queueClientBundleBuild:()=>x9,hasUserImports:()=>rQ,bundleClientScript:()=>tQ});import j0 from"path";import b0 from"fs";function rQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!P9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!P9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function aQ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let z of W)try{if(b0.existsSync(z)&&b0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(b0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(b0.existsSync(W)&&b0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=j0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";return X.add(G.path),{contents:b0.readFileSync(G.path,"utf8"),loader:q}})}}}function x9($){let Z=globalThis,X=(Z[C9]??Promise.resolve()).then($,$);return Z[C9]=X.then(()=>{return},()=>{return}),X}async function tQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||D5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${sQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let _=Bun.file(W),j=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==v9||!Array.isArray(H.files))j=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(b0.statSync(L.path).mtimeMs!==L.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=O7.get(K);if(U)return await U;let B=x9(()=>eQ($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));O7.set(K,B);try{return await B}finally{O7.delete(K)}}async function eQ($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=D5(X,"bundle-tmp"),z=j0.join(W,`${G}.ts`),U=j0.join(W,"out",G);b0.mkdirSync(W,{recursive:!0}),b0.mkdirSync(U,{recursive:!0});let B=j0.dirname(Z),_=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=j.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let R=V.split(":")[0].trim();if(R)_.push(R)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let F=_.length>0?`
1833
+ `}),$}import oQ from"process";function d0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(oQ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var M1=()=>{};var b5={};r(b5,{queueClientBundleBuild:()=>x9,hasUserImports:()=>rQ,bundleClientScript:()=>tQ});import j0 from"path";import b0 from"fs";function rQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!P9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!P9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function aQ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let z of W)try{if(b0.existsSync(z)&&b0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(b0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(b0.existsSync(W)&&b0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=j0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:b0.readFileSync(G.path,"utf8"),loader:q}})}}}function x9($){let Z=globalThis,X=(Z[C9]??Promise.resolve()).then($,$);return Z[C9]=X.then(()=>{return},()=>{return}),X}async function tQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||D5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${sQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let _=Bun.file(W),j=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==v9||!Array.isArray(H.files))j=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(b0.statSync(L.path).mtimeMs!==L.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=O7.get(K);if(U)return await U;let B=x9(()=>eQ($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));O7.set(K,B);try{return await B}finally{O7.delete(K)}}async function eQ($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=D5(X,"bundle-tmp"),z=j0.join(W,`${G}.ts`),U=j0.join(W,"out",G);b0.mkdirSync(W,{recursive:!0}),b0.mkdirSync(U,{recursive:!0});let B=j0.dirname(Z),_=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=j.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let R=V.split(":")[0].trim();if(R)_.push(R)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let F=_.length>0?`
1834
1834
  export { ${_.join(", ")} }`:"";await Bun.write(z,$+F),console.log("[stx:bundler] bundling:",G,"from:",j0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:Q,plugins:[aQ(X,B,z,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...d0()},root:X});if(!V.success){let D=V.logs.filter((P)=>P.level==="error").map((P)=>P.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let R="";for(let D of V.outputs){R=await D.text();break}let w=[];for(let D of R.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of D[1].split(",")){let S=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){w.push([S[2],S[1]]);continue}let b=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))w.push([b,b])}let A=R.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];R=R.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${G}`,T=w.map(([D,P])=>`${JSON.stringify(D)}: ${P}`).join(", "),M=w.map(([D])=>`var ${D} = undefined;`).join(`
1835
1835
  `),I=w.map(([D])=>`${D} = ${N}[${JSON.stringify(D)}];`).join(`
1836
1836
  `);if(R=`${A.join(`
package/dist/ssg.js CHANGED
@@ -639,7 +639,7 @@ ${H}
639
639
  `),J)X=X.replace(/\n/g,`<br />
640
640
  `);for(let W=0;W<Q.length;W++)X=X.replace(`\x00CODEBLOCK${W}\x00`,Q[W]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function o0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
641
641
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
642
- `}),$}import qQ from"process";function p0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(qQ.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var b1=()=>{};var b5={};e(b5,{queueClientBundleBuild:()=>U9,hasUserImports:()=>UQ,bundleClientScript:()=>BQ});import F0 from"path";import C0 from"fs";function UQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!z9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!z9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected side-effect import:",X),!0}return!1}function jQ($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:F0.dirname(Q),z=F0.resolve(K,G),q=[z,`${z}.ts`,`${z}.tsx`,`${z}.js`,`${z}.mjs`,`${z}.jsx`,F0.join(z,"index.ts"),F0.join(z,"index.tsx"),F0.join(z,"index.js"),F0.join(z,"index.mjs")];for(let W of q)try{if(C0.existsSync(W)&&C0.statSync(W,{throwIfNoEntry:!1})?.isFile())return W}catch{}return z};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(C0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return J.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=F0.resolve($,G.path.slice(2)),z=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let q of z)if(C0.existsSync(q)&&C0.statSync(q,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",q),J.add(q),{path:q};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=F0.extname(G.path).toLowerCase(),z=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";return J.add(G.path),{contents:C0.readFileSync(G.path,"utf8"),loader:z}})}}}function U9($){let Z=globalThis,J=(Z[q9]??Promise.resolve()).then($,$);return Z[q9]=J.then(()=>{return},()=>{return}),J}async function BQ($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||B1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${WQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),z=F0.join(Q,`${K}.js`),q=F0.join(Q,`${K}.deps.json`),W=Bun.file(z);if(await W.exists()){let B=Bun.file(q),_=!0;if(await B.exists())try{let H=JSON.parse(await B.text());if(H.metadataVersion!==W9||!Array.isArray(H.files))_=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(C0.statSync(L.path).mtimeMs!==L.mtimeMs){_=!1;break}}catch{_=!1;break}}catch{_=!1}if(_)return console.log("[stx:bundler] cache hit:",K),await W.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=Q7.get(K);if(U)return await U;let j=U9(()=>_Q($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:z,depsPath:q}));Q7.set(K,j);try{return await j}finally{Q7.delete(K)}}async function _Q($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:z}=Y,q=B1(J,"bundle-tmp"),W=F0.join(q,`${G}.ts`),U=F0.join(q,"out",G);C0.mkdirSync(q,{recursive:!0}),C0.mkdirSync(U,{recursive:!0});let j=F0.dirname(Z),B=[],_=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=_.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((F)=>{let w=F.split(":")[0].trim();if(w)B.push(w)});else if(L[3])B.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;B.push(L[2])}let V=B.length>0?`
642
+ `}),$}import qQ from"process";function p0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(qQ.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var b1=()=>{};var b5={};e(b5,{queueClientBundleBuild:()=>U9,hasUserImports:()=>UQ,bundleClientScript:()=>BQ});import F0 from"path";import C0 from"fs";function UQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!z9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!z9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected side-effect import:",X),!0}return!1}function jQ($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:F0.dirname(Q),z=F0.resolve(K,G),q=[z,`${z}.ts`,`${z}.tsx`,`${z}.js`,`${z}.mjs`,`${z}.jsx`,F0.join(z,"index.ts"),F0.join(z,"index.tsx"),F0.join(z,"index.js"),F0.join(z,"index.mjs")];for(let W of q)try{if(C0.existsSync(W)&&C0.statSync(W,{throwIfNoEntry:!1})?.isFile())return W}catch{}return z};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(C0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return J.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=F0.resolve($,G.path.slice(2)),z=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let q of z)if(C0.existsSync(q)&&C0.statSync(q,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",q),J.add(q),{path:q};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=F0.extname(G.path).toLowerCase(),z=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)J.add(G.path);return{contents:C0.readFileSync(G.path,"utf8"),loader:z}})}}}function U9($){let Z=globalThis,J=(Z[q9]??Promise.resolve()).then($,$);return Z[q9]=J.then(()=>{return},()=>{return}),J}async function BQ($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||B1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${WQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),z=F0.join(Q,`${K}.js`),q=F0.join(Q,`${K}.deps.json`),W=Bun.file(z);if(await W.exists()){let B=Bun.file(q),_=!0;if(await B.exists())try{let H=JSON.parse(await B.text());if(H.metadataVersion!==W9||!Array.isArray(H.files))_=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(C0.statSync(L.path).mtimeMs!==L.mtimeMs){_=!1;break}}catch{_=!1;break}}catch{_=!1}if(_)return console.log("[stx:bundler] cache hit:",K),await W.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=Q7.get(K);if(U)return await U;let j=U9(()=>_Q($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:z,depsPath:q}));Q7.set(K,j);try{return await j}finally{Q7.delete(K)}}async function _Q($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:z}=Y,q=B1(J,"bundle-tmp"),W=F0.join(q,`${G}.ts`),U=F0.join(q,"out",G);C0.mkdirSync(q,{recursive:!0}),C0.mkdirSync(U,{recursive:!0});let j=F0.dirname(Z),B=[],_=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=_.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((F)=>{let w=F.split(":")[0].trim();if(w)B.push(w)});else if(L[3])B.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;B.push(L[2])}let V=B.length>0?`
643
643
  export { ${B.join(", ")} }`:"";await Bun.write(W,$+V),console.log("[stx:bundler] bundling:",G,"from:",F0.basename(Z));let O=new Set;try{let F=await Bun.build({entrypoints:[W],outdir:U,target:"browser",format:"esm",minify:X,plugins:[jQ(J,j,W,O)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...p0()},root:J});if(!F.success){let D=F.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of F.outputs){w=await D.text();break}let A=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let k=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(k))A.push([k,k])}let R=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${G}`,M=A.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),T=A.map(([D])=>`var ${D} = undefined;`).join(`
644
644
  `),I=A.map(([D])=>`${D} = ${N}[${JSON.stringify(D)}];`).join(`
645
645
  `);if(w=`${R.join(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.128",
4
+ "version": "0.2.129",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -117,12 +117,12 @@
117
117
  "dependencies": {
118
118
  "@cwcss/crosswind": "^0.2.12",
119
119
  "@stacksjs/clapp": "^0.2.0",
120
- "@stacksjs/desktop": "0.2.128",
121
- "@stacksjs/sanitizer": "0.2.128",
120
+ "@stacksjs/desktop": "0.2.129",
121
+ "@stacksjs/sanitizer": "0.2.129",
122
122
  "@stacksjs/ts-i18n": "^0.1.11",
123
- "bun-plugin-stx": "0.2.128",
123
+ "bun-plugin-stx": "0.2.129",
124
124
  "bunfig": "^0.15.15",
125
- "stx-router": "0.2.128",
125
+ "stx-router": "0.2.129",
126
126
  "ts-broadcasting": "^0.0.9",
127
127
  "ts-images": "^0.1.9",
128
128
  "ts-syntax-highlighter": "^0.2.1"