@stacksjs/stx 0.2.360 → 0.2.362
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/{chunk-6pdfvpa6.js → chunk-fyf0bz14.js} +1 -1
- package/dist/{chunk-vyhrzsnf.js → chunk-jk8exx37.js} +4 -4
- package/dist/{chunk-bxkr3ts9.js → chunk-kbfbfjpz.js} +1 -1
- package/dist/{chunk-3xspzgrq.js → chunk-p4eqd3fp.js} +1 -1
- package/dist/{chunk-z2rvc8d5.js → chunk-p75e8vf3.js} +47 -47
- package/dist/{chunk-d5gzma79.js → chunk-q065t1x7.js} +1 -1
- package/dist/{chunk-a68y9s2j.js → chunk-sr09yndb.js} +1 -1
- package/dist/{chunk-za8wxkx6.js → chunk-tz7kembg.js} +1 -1
- package/dist/{chunk-1hvxs7rh.js → chunk-zbk9frkq.js} +1 -1
- package/dist/{chunk-8akj7f4h.js → chunk-zjm3pz95.js} +1 -1
- package/dist/cli.js +3 -3
- package/package.json +5 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ze as a}from"./chunk-
|
|
2
|
+
import{Ze as a}from"./chunk-zbk9frkq.js";import"./chunk-sr09yndb.js";import"./chunk-0knxnyq6.js";import"./chunk-7rj4h2t2.js";import"./chunk-2119txb8.js";import"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import"./chunk-dj24n5n7.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-1tz8fb87.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import"./chunk-m8kem5ca.js";export{a as startProductionServer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$m as l,Cm as P,Co as i,Ep as h,Io as T,Km as k,_m as c,sm as R,tm as O}from"./chunk-2119txb8.js";import{Ps as S,Rs as y}from"./chunk-dj24n5n7.js";import{Lu as m}from"./chunk-met6wtbk.js";import{Ew as YJ,Hw as ZJ,Iw as $J}from"./chunk-e03m4har.js";import{Pw as XJ,Sw as q}from"./chunk-m8kem5ca.js";var r=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function s(J,Y,Q){let X={fullTag:Q,content:Y,attrs:J};if(/\bserver\b/.test(J))return{...X,type:"server"};if(/\bdata-stx-scoped\b/.test(J))return{...X,type:"client"};if(r.test(Y))return{...X,type:"signals"};if(/\bclient\b/.test(J)||/\btype\s*=\s*["']module["']/.test(J)||/\bsrc\s*=/.test(J))return{...X,type:"client"};return{...X,type:"server"}}var o=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function C(J){let Y=[],Q=[],X=[],$=0;while($<J.length){let Z=J.indexOf("<",$);if(Z===-1)break;let U=y(J,Z);if(U>Z){$=U;continue}let W=S(J,Z);if(W>Z){let j=J.slice(Z,W),F=o.exec(j);if(F){let K=s(F[1],F[2],j);switch(K.type){case"signals":Y.push(K);break;case"client":Q.push(K);break;case"server":X.push(K);break}}$=W;continue}$=Z+(J.startsWith("<!--",Z)?4:1)}return{signals:Y,client:Q,server:X}}var a=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function t(J){let Y=[],Q=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Q.exec(J))!==null)Y.push({start:X.index,end:X.index+X[0].length});return Y}function v(J,Y){return Y.some((Q)=>J>=Q.start&&J<Q.end)}function e(J){let Y=(J||"").trim();if(!Y)return null;if(/[\s>+~,:]/.test(Y))return null;let Q={},X=Y,$=X.match(/^[a-z][\w-]*/i);if($)Q.tag=$[0].toLowerCase(),X=X.slice($[0].length);while(X.length>0){let Z=X.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(Z){if(Q.attr=Z[1],Z[3]!==void 0&&Z[3]!=="")Q.attrValue=Z[3];X=X.slice(Z[0].length);continue}let U=X.match(/^#([\w-]+)/);if(U){Q.id=U[1],X=X.slice(U[0].length);continue}let W=X.match(/^\.([\w-]+)/);if(W){Q.className=W[1],X=X.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function JJ(J,Y){if(Y.attr){if(!(Y.attrValue===void 0?new RegExp(`\\b${Y.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${Y.attr}\\s*=\\s*(["'])\\s*${Y.attrValue}\\s*\\1`,"i")).test(J))return!1}if(Y.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${Y.id}\\s*\\1`,"i").test(J))return!1}if(Y.className){let Q=J.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(Y.className))return!1}return!0}function x(J,Y="main"){let Q=e(Y);if(!Q)return null;let X=/<([a-z][\w-]*)\b([^>]*)>/gi,$=t(J),Z;while((Z=X.exec(J))!==null){if(v(Z.index,$))continue;let U=Z[1].toLowerCase(),W=Z[2]||"";if(W.trimEnd().endsWith("/")||a.has(U))continue;if(Q.tag&&Q.tag!==U)continue;if(!JJ(W,Q))continue;let j=Z[0],F=Z.index+j.length,K=new RegExp(`<(/?)${U}\\b([^>]*)>`,"gi");K.lastIndex=F;let G=1,B;while((B=K.exec(J))!==null){if(v(B.index,$))continue;let w=B[1]==="/";if(!w&&(B[2]||"").trimEnd().endsWith("/"))continue;if(G+=w?-1:1,G===0)return{openTag:j,openIndex:Z.index,start:F,end:B.index,tagName:U}}return null}return null}var NJ="X-STX-Router",_J="private, no-store";function AJ(J){return J.replace(/&#(\d+);/g,(Y,Q)=>f(Number(Q),Y)).replace(/&#x([0-9a-f]+);/gi,(Y,Q)=>f(Number.parseInt(Q,16),Y)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function f(J,Y){if(!Number.isInteger(J)||J<0||J>1114111)return Y;try{return String.fromCodePoint(J)}catch{return Y}}function g(J){return J.headers.get("X-STX-Router")==="true"}function QJ(J,Y){if(!J)return Y;return J.split(",").some((X)=>X.trim().toLowerCase()===Y.toLowerCase())?J:`${J}, ${Y}`}function IJ(J){return{Vary:QJ(J,"X-STX-Router")}}import E from"path";YJ();var UJ="stx-page-head:",WJ=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,D={dev:null,prod:null};function jJ(){let J=m()?"dev":"prod",Y=D[J];if(Y!==null)return Y;try{let Q=($J(),XJ(ZJ)),X=J==="dev"&&typeof Q.getRouterScriptDev==="function"?Q.getRouterScriptDev:Q.getRouterScript;D[J]=`<script>${X()}</script>`}catch{D[J]=""}return D[J]}async function RJ(J,Y){if(Y===!1)return null;if(Y&&typeof Y==="string"){let X=E.resolve(J,Y);if(await Bun.file(X).exists())return X;return null}let Q=E.join(J,"app.stx");if(await Bun.file(Q).exists())return Q;return null}async function PJ(J,Y){try{let Q=await Bun.file(J).text(),X=Q,$=Q.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)X=$[1].trim();let Z=C(Q),U=[...Z.client.map((V)=>V.fullTag),...Z.signals.map((V)=>V.fullTag)],W=[],j=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,F;while((F=j.exec(Q))!==null)W.push(F[0]);let K=X;for(let V of Z.server)K=K.replace(V.fullTag,"");for(let V of Z.client)K=K.replace(V.fullTag,"");K=K.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let G="<!--__STX_PAGE_SLOT__-->";if(K=K.replace(/<slot\s*\/>/gi,G).replace(/<slot\s*>\s*<\/slot>/gi,G),!K.includes(G))return console.warn(`[stx] Shell ${J} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:B,extractVariables:w,defaultConfig:N,loadStxConfig:A}=await import("./chunk-
|
|
2
|
+
import{$m as l,Cm as P,Co as i,Ep as h,Io as T,Km as k,_m as c,sm as R,tm as O}from"./chunk-2119txb8.js";import{Ps as S,Rs as y}from"./chunk-dj24n5n7.js";import{Lu as m}from"./chunk-met6wtbk.js";import{Ew as YJ,Hw as ZJ,Iw as $J}from"./chunk-e03m4har.js";import{Pw as XJ,Sw as q}from"./chunk-m8kem5ca.js";var r=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function s(J,Y,Q){let X={fullTag:Q,content:Y,attrs:J};if(/\bserver\b/.test(J))return{...X,type:"server"};if(/\bdata-stx-scoped\b/.test(J))return{...X,type:"client"};if(r.test(Y))return{...X,type:"signals"};if(/\bclient\b/.test(J)||/\btype\s*=\s*["']module["']/.test(J)||/\bsrc\s*=/.test(J))return{...X,type:"client"};return{...X,type:"server"}}var o=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function C(J){let Y=[],Q=[],X=[],$=0;while($<J.length){let Z=J.indexOf("<",$);if(Z===-1)break;let U=y(J,Z);if(U>Z){$=U;continue}let W=S(J,Z);if(W>Z){let j=J.slice(Z,W),F=o.exec(j);if(F){let K=s(F[1],F[2],j);switch(K.type){case"signals":Y.push(K);break;case"client":Q.push(K);break;case"server":X.push(K);break}}$=W;continue}$=Z+(J.startsWith("<!--",Z)?4:1)}return{signals:Y,client:Q,server:X}}var a=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function t(J){let Y=[],Q=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Q.exec(J))!==null)Y.push({start:X.index,end:X.index+X[0].length});return Y}function v(J,Y){return Y.some((Q)=>J>=Q.start&&J<Q.end)}function e(J){let Y=(J||"").trim();if(!Y)return null;if(/[\s>+~,:]/.test(Y))return null;let Q={},X=Y,$=X.match(/^[a-z][\w-]*/i);if($)Q.tag=$[0].toLowerCase(),X=X.slice($[0].length);while(X.length>0){let Z=X.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(Z){if(Q.attr=Z[1],Z[3]!==void 0&&Z[3]!=="")Q.attrValue=Z[3];X=X.slice(Z[0].length);continue}let U=X.match(/^#([\w-]+)/);if(U){Q.id=U[1],X=X.slice(U[0].length);continue}let W=X.match(/^\.([\w-]+)/);if(W){Q.className=W[1],X=X.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function JJ(J,Y){if(Y.attr){if(!(Y.attrValue===void 0?new RegExp(`\\b${Y.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${Y.attr}\\s*=\\s*(["'])\\s*${Y.attrValue}\\s*\\1`,"i")).test(J))return!1}if(Y.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${Y.id}\\s*\\1`,"i").test(J))return!1}if(Y.className){let Q=J.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(Y.className))return!1}return!0}function x(J,Y="main"){let Q=e(Y);if(!Q)return null;let X=/<([a-z][\w-]*)\b([^>]*)>/gi,$=t(J),Z;while((Z=X.exec(J))!==null){if(v(Z.index,$))continue;let U=Z[1].toLowerCase(),W=Z[2]||"";if(W.trimEnd().endsWith("/")||a.has(U))continue;if(Q.tag&&Q.tag!==U)continue;if(!JJ(W,Q))continue;let j=Z[0],F=Z.index+j.length,K=new RegExp(`<(/?)${U}\\b([^>]*)>`,"gi");K.lastIndex=F;let G=1,B;while((B=K.exec(J))!==null){if(v(B.index,$))continue;let w=B[1]==="/";if(!w&&(B[2]||"").trimEnd().endsWith("/"))continue;if(G+=w?-1:1,G===0)return{openTag:j,openIndex:Z.index,start:F,end:B.index,tagName:U}}return null}return null}var NJ="X-STX-Router",_J="private, no-store";function AJ(J){return J.replace(/&#(\d+);/g,(Y,Q)=>f(Number(Q),Y)).replace(/&#x([0-9a-f]+);/gi,(Y,Q)=>f(Number.parseInt(Q,16),Y)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function f(J,Y){if(!Number.isInteger(J)||J<0||J>1114111)return Y;try{return String.fromCodePoint(J)}catch{return Y}}function g(J){return J.headers.get("X-STX-Router")==="true"}function QJ(J,Y){if(!J)return Y;return J.split(",").some((X)=>X.trim().toLowerCase()===Y.toLowerCase())?J:`${J}, ${Y}`}function IJ(J){return{Vary:QJ(J,"X-STX-Router")}}import E from"path";YJ();var UJ="stx-page-head:",WJ=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,D={dev:null,prod:null};function jJ(){let J=m()?"dev":"prod",Y=D[J];if(Y!==null)return Y;try{let Q=($J(),XJ(ZJ)),X=J==="dev"&&typeof Q.getRouterScriptDev==="function"?Q.getRouterScriptDev:Q.getRouterScript;D[J]=`<script>${X()}</script>`}catch{D[J]=""}return D[J]}async function RJ(J,Y){if(Y===!1)return null;if(Y&&typeof Y==="string"){let X=E.resolve(J,Y);if(await Bun.file(X).exists())return X;return null}let Q=E.join(J,"app.stx");if(await Bun.file(Q).exists())return Q;return null}async function PJ(J,Y){try{let Q=await Bun.file(J).text(),X=Q,$=Q.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)X=$[1].trim();let Z=C(Q),U=[...Z.client.map((V)=>V.fullTag),...Z.signals.map((V)=>V.fullTag)],W=[],j=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,F;while((F=j.exec(Q))!==null)W.push(F[0]);let K=X;for(let V of Z.server)K=K.replace(V.fullTag,"");for(let V of Z.client)K=K.replace(V.fullTag,"");K=K.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let G="<!--__STX_PAGE_SLOT__-->";if(K=K.replace(/<slot\s*\/>/gi,G).replace(/<slot\s*>\s*<\/slot>/gi,G),!K.includes(G))return console.warn(`[stx] Shell ${J} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:B,extractVariables:w,defaultConfig:N,loadStxConfig:A}=await import("./chunk-fyf0bz14.js"),I=await A(),z={__filename:J,__dirname:E.dirname(J)};for(let V of U){let L=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(L&&!V.includes("client")&&!V.includes('type="module"'))await w(L[1],z,J)}let _=await B(K,z,J,{...N,...I,...Y},new Set),H=_.indexOf(G);if(H===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:_.substring(0,H),afterSlot:_.substring(H+G.length),filePath:J,shellScripts:U,shellStyles:W}}catch(Q){return console.error(`[stx] Error processing shell ${J}:`,Q),null}}function kJ(J,Y,Q){let X,$="",Z=Y.match(WJ);if(Z){Y=Y.replace(Z[0],"");try{let K=Buffer.from(Z[1],"base64").toString("utf8"),G=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(G)X=G[1].trim();$=K.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let U=Q||X||"stx App",W=jJ(),j="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Xf as a}from"./chunk-
|
|
2
|
+
import{Xf as a}from"./chunk-p4eqd3fp.js";import"./chunk-sr09yndb.js";import"./chunk-0knxnyq6.js";import"./chunk-pwctc0m1.js";import"./chunk-0t1yyn1d.js";import"./chunk-frp9fc7j.js";import"./chunk-7rj4h2t2.js";import"./chunk-2119txb8.js";import"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import"./chunk-dj24n5n7.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-1tz8fb87.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import"./chunk-m8kem5ca.js";export{a as buildForProduction};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{bg as ZJ,dg as g,fg as A,lg as n,og as GJ,rg as WJ,tg as YJ,vg as jJ}from"./chunk-
|
|
2
|
+
import{bg as ZJ,dg as g,fg as A,lg as n,og as GJ,rg as WJ,tg as YJ,vg as jJ}from"./chunk-sr09yndb.js";import{yg as $J}from"./chunk-0knxnyq6.js";import{rl as XJ}from"./chunk-7rj4h2t2.js";import{lo as h}from"./chunk-2119txb8.js";import{Hs as e}from"./chunk-dj24n5n7.js";import{It as QJ,Mt as i,Ot as p}from"./chunk-xk402w4a.js";import{Dw as l,Iw as VJ,aw as KJ}from"./chunk-e03m4har.js";import{Sw as DJ}from"./chunk-m8kem5ca.js";import JJ from"fs";import k from"path";var{serve:wJ}=globalThis.Bun;VJ();import y from"zlib";import{promisify as a}from"util";var IJ=a(y.brotliCompress),OJ=a(y.gzip),UJ=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],BJ=["text/event-stream","multipart/x-mixed-replace"],_J=1024;function zJ(K){if(!K)return!1;let J=K.toLowerCase();if(BJ.some((G)=>J.startsWith(G)))return!1;return UJ.some((G)=>J.startsWith(G))}function FJ(K){let J=new Map;for(let G of K.split(",")){let[Z,...W]=G.trim().split(";"),O=Z.trim().toLowerCase();if(!O)continue;let U=1;for(let B of W){let w=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(B);if(!w)continue;let F=Number.parseFloat(w[1]);if(Number.isFinite(F))U=F}J.set(O,U)}return J}function LJ(K){if(!K)return null;let J=FJ(K),G=J.get("*"),Z=(W)=>J.get(W)??G??0;if(Z("br")>0)return"br";if(Z("gzip")>0)return"gzip";return null}async function t(K,J,G={}){if(J.headers.get("content-encoding"))return J;if(J.status===204||J.status===304||!J.body)return J;if(!zJ(J.headers.get("content-type")))return J;let Z=LJ(K.headers.get("accept-encoding"));if(!Z)return J;let W;try{W=new Uint8Array(await J.arrayBuffer())}catch{return J}let O=()=>new Response(W,{status:J.status,statusText:J.statusText,headers:s(J.headers)});if(W.length<(G.threshold??_J))return O();try{let U=Z==="br"?await IJ(W,{params:{[y.constants.BROTLI_PARAM_QUALITY]:G.quality??5,[y.constants.BROTLI_PARAM_SIZE_HINT]:W.length}}):await OJ(W);if(U.length>=W.length)return O();let B=s(J.headers);return B.set("Content-Encoding",Z),B.set("Content-Length",String(U.length)),new Response(U,{status:J.status,statusText:J.statusText,headers:B})}catch{return O()}}function s(K){let J=new Headers(K),G=J.get("Vary");if(!G)return J.set("Vary","Accept-Encoding"),J;if(!G.split(",").some((W)=>W.trim().toLowerCase()==="accept-encoding"))J.set("Vary",`${G}, Accept-Encoding`);return J}class d{now;entries=new e(1000,{maxBytes:33554432,sizeOf:(K)=>K.body.byteLength+JSON.stringify(K.headers).length*2});pending=new Map;generation=0;constructor(K=Date.now){this.now=K}invalidate(K){this.generation++,this.pending.clear();for(let J of Array.from(this.entries.keys()))if(K===void 0||this.entries.get(J)?.path===K)this.entries.delete(J)}async respond(K,J,G){let Z,W=async()=>{let X=Z??await G();return X.headers.set("Cache-Control","private, no-store"),X.headers.set("Vary",A(X.headers.get("Vary")).Vary),X};if(!J||K.method!=="GET"||K.headers.has("Cookie")||K.headers.has("Authorization")||K.headers.has("Range"))return W();let O=new URL(K.url),U=`${O.origin}${O.pathname}${O.search}|${g(K)?"fragment":"document"}`,B=this.entries.get(U),w=(X)=>{let T=new Headers(X.headers);return T.set("Cache-Control","private, no-store"),T.set("Age",String(Math.max(0,Math.floor((this.now()-X.created)/1000)))),new Response(X.body.slice(0),{headers:T})},F=B?(this.now()-B.created)/1000:1/0;if(B&&F<J.maxAge)return w(B);let S=this.generation,q=async()=>{let X=await G();Z=X;let T=(X.headers.get("Vary")??"").toLowerCase().split(",").map((L)=>L.trim()).filter(Boolean);if(X.status!==200||X.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(X.headers.get("Cache-Control")??"")||T.some((L)=>L!=="x-stx-router"&&L!=="accept-encoding"))return null;let M=await X.clone().arrayBuffer();if(M.byteLength>1048576)return null;X.headers.set("Vary",A(X.headers.get("Vary")).Vary);let Q={body:M,headers:Array.from(X.headers.entries()),created:this.now(),path:O.pathname};if(this.generation===S)this.entries.set(U,Q);return Q},H=this.pending.get(U);if(!H){if(this.pending.size>=1000)return W();H=q().finally(()=>{if(this.pending.get(U)===H)this.pending.delete(U)}),this.pending.set(U,H)}if(B&&F<J.maxAge+(J.swr??0))return H.catch(()=>{}),w(B);let x=await H;return x?w(x):W()}}var HJ={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function uJ(K={}){let J=k.resolve(K.outputDir||".output"),G=K.port??3000,Z=GJ(J);if(!Z)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${Z.routes.length} routes...`);let W=$J(Z.routeRules),O=new d,U=XJ(J,Z.apiRoutes??[]),B=Bun.file(k.join(J,"server/runtime-config.json")),w=K.runtimeConfig??(await B.exists()?await B.json():void 0),F=w?i(w):void 0,S=new Map,q=new Map,H=new Map,x=new Map;for(let Q of Z.routes)try{let L=k.join(J,Q.compiledPath),Y=JSON.parse(await Bun.file(L).text());if(F)Y.html=p(Y.html,F);S.set(Q.pattern,Y),H.set(Q.pattern,l(Y.html)),x.set(Q.pattern,h(Y.html));let C=k.join(J,Q.fragmentPath);if(await Bun.file(C).exists()){let P=await Bun.file(C).text();q.set(Q.pattern,F?p(P,F):P)}}catch(L){console.warn(`[stx] Failed to load route ${Q.pattern}:`,L)}let X=new Map,T=[];for(let Q of Z.routes)if(Q.hasParams){let{regex:L,params:Y}=KJ(Q.pattern);T.push({regex:L,route:Q,paramNames:Y})}else X.set(Q.pattern,Q);let M=wJ({port:G,async fetch(Q){return t(Q,await QJ(F??i(),async()=>{let Y=new URL(Q.url).pathname;if(K.onRequest){let j=await K.onRequest(Q);if(j)return j}if(K.apiRouter){let j=await K.apiRouter.handleRequest(Q);if(j.status!==404)return j}if(K.apiRoutes?.[Y])return K.apiRoutes[Y](Q);let C=await U(Q);if(C)return C;if((Q.method==="GET"||Q.method==="HEAD")&&Y!=="/"){let j=k.resolve(J,"public"),_;try{_=decodeURIComponent(Y)}catch{_=Y}if(!_.includes("\x00")){let I=k.resolve(j,`.${_}`);if(I===j||I.startsWith(`${j}${k.sep}`))try{if(JJ.existsSync(I)&&JJ.statSync(I).isFile()){let z=k.extname(I).toLowerCase(),E=HJ[z]||"application/octet-stream",v=Y.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(Y);return new Response(Bun.file(I),{headers:{"Content-Type":E,"Cache-Control":v?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=g(Q),D=null,o={};if(D=X.get(Y)||null,!D)for(let{regex:j,route:_,paramNames:I}of T){let $=Y.match(j);if($){D=_,I.forEach((z,E)=>{o[z]=$[E+1]});break}}if(!D){let j=X.get("/404")||null;if(j){let _=S.get(j.pattern);if(_)return new Response(_.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}let R=W(Y),r=Object.keys(R).length>0;return O.respond(Q,R.cache,async()=>{let j=S.get(D.pattern);if(P&&Q.method==="GET"&&j&&!j.hasServerScripts&&Object.keys(j.placeholders).length===0){let $=q.get(D.pattern);if($){let z=H.get(D.pattern);return new Response($,{status:j.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...x.has(D.pattern)?{"X-STX-Runtime":x.get(D.pattern)?"true":"false"}:{},...z?{"X-STX-Layout":z.layout,"X-STX-Layout-Group":z.group}:{},...A(),...R.cache?{}:{"Cache-Control":ZJ}}})}}let _=WJ(Q.method),I=S.get(D.pattern);if(!I){let $=X.get("/500")||null;if($){let z=S.get($.pattern);if(z)return new Response(z.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(D.prerendered&&_)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!_&&!I.hasServerScripts&&Object.keys(I.placeholders).length===0)return new Response(I.html,{status:I.status??200,headers:{"Content-Type":"text/html",...A(),"Cache-Control":"public, max-age=60"}});try{let{html:$,boundaries:z,redirect:E,cookies:v,status:m,headers:c}=await jJ(I,{params:o,request:Q,method:Q.method,__stx_strict_hydration:r,__stx_runtime_config:F});if(E)return YJ(E,v,c);if(z&&z.length>0){let{renderStreamingPage:N,streamToResponse:u}=await import("./chunk-xn226qe0.js"),b=new Headers({...A(),...c,"Cache-Control":"private, no-store"});for(let f of v??[])b.append("Set-Cookie",f);if(P&&!_){let f=l($);b.set("X-STX-Fragment","true"),b.set("X-STX-Runtime",h($)?"true":"false"),b.set("X-STX-Layout",f.layout),b.set("X-STX-Layout-Group",f.group)}return u(N(P&&!_?n($,Z.routerContainer||"main"):$,z,{timeoutMs:30000}),{status:m??I.status??200,headers:b})}let V=new Headers({"Content-Type":"text/html",...A(),...R.cache?{}:{"Cache-Control":"private, no-store"}});for(let N of v??[])V.append("Set-Cookie",N);for(let[N,u]of Object.entries(c??{}))V.set(N,u);if(V.set("Vary",A(V.get("Vary")).Vary),P&&!_){let N=l($);return V.set("X-STX-Fragment","true"),V.set("X-STX-Runtime",h($)?"true":"false"),V.set("X-STX-Layout",N.layout),V.set("X-STX-Layout-Group",N.group),new Response(n($,Z.routerContainer||"main"),{status:m??I.status??200,headers:V})}return new Response($,{status:m??I.status??200,headers:V})}catch($){if(console.error(`[stx] Hydration error for ${Y}:`,$),r)return new Response("Internal Server Error",{status:500});return new Response(I.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${M.port}`),console.log(`[stx] Serving ${Z.routes.length} routes (${S.size} pre-loaded)`),{port:M.port,stop:()=>{O.invalidate(),M.stop()},invalidate:(Q)=>O.invalidate(Q)}}
|
|
3
3
|
export{zJ as We,LJ as Xe,t as Ye,uJ as Ze};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xg as I}from"./chunk-0knxnyq6.js";import{xr as H}from"./chunk-2119txb8.js";import{Sw as G}from"./chunk-m8kem5ca.js";import L from"path";async function Q(k={}){let J=performance.now(),A=k.root||process.cwd(),j=await H(A),B=k.ssr?.routeRules??j.routeRules??{};if(I(B),!j.ssr&&Object.keys(B).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!j.ssr&&(k.ssr?.serverApi??j.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let q=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${q.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let D,E;if(q==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");D=await z({pagesDir:L.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,router:j.router,...k.ssg})}else{let{buildForProduction:z}=await import("./chunk-
|
|
2
|
+
import{xg as I}from"./chunk-0knxnyq6.js";import{xr as H}from"./chunk-2119txb8.js";import{Sw as G}from"./chunk-m8kem5ca.js";import L from"path";async function Q(k={}){let J=performance.now(),A=k.root||process.cwd(),j=await H(A),B=k.ssr?.routeRules??j.routeRules??{};if(I(B),!j.ssr&&Object.keys(B).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!j.ssr&&(k.ssr?.serverApi??j.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let q=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${q.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let D,E;if(q==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");D=await z({pagesDir:L.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,router:j.router,...k.ssg})}else{let{buildForProduction:z}=await import("./chunk-tz7kembg.js");E=await z({root:A,outputDir:".output",debug:k.debug,...k.ssr})}let K=Math.round(performance.now()-J);return{mode:q,ssg:D,ssr:E,duration:K}}
|
|
3
3
|
export{Q as Ve};
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{Ha as a,He as F,Je as v,Ke as P,Va as r,de as s,ee as t,nb as n,o as m,oa as l,ob as p,qb as i,wb as e}from"./chunk-
|
|
3
|
+
import{Ha as a,He as F,Je as v,Ke as P,Va as r,de as s,ee as t,nb as n,o as m,oa as l,ob as p,qb as i,wb as e}from"./chunk-jk8exx37.js";import"./chunk-b381xgvw.js";import"./chunk-7hb89n3z.js";import"./chunk-7kfv1q2r.js";import"./chunk-zjm3pz95.js";import"./chunk-zbk9frkq.js";import"./chunk-n0d7nwhd.js";import"./chunk-84577w4y.js";import"./chunk-5j3v0p6s.js";import"./chunk-198fr2d4.js";import"./chunk-p4eqd3fp.js";import"./chunk-sr09yndb.js";import"./chunk-0knxnyq6.js";import"./chunk-634gaa9d.js";import"./chunk-r6xmsxaz.js";import"./chunk-karkhcja.js";import"./chunk-ypgyhr2p.js";import"./chunk-bcpjhcpn.js";import"./chunk-y4zddt5r.js";import"./chunk-g7bpkpd4.js";import"./chunk-k33778kc.js";import"./chunk-yg0qm73a.js";import"./chunk-g1vxsvqv.js";import"./chunk-0ppgyq8q.js";import"./chunk-fqq5k9ve.js";import"./chunk-ya5m5vbn.js";import"./chunk-y4nzmkea.js";import"./chunk-7kw3grq5.js";import"./chunk-c79nfdyj.js";import"./chunk-ej8mv2k6.js";import"./chunk-bab01mkf.js";import"./chunk-ra1s4s6b.js";import"./chunk-benx1c4p.js";import"./chunk-pwctc0m1.js";import"./chunk-0t1yyn1d.js";import"./chunk-k91ej0ts.js";import"./chunk-rargfb5s.js";import"./chunk-necx4e30.js";import"./chunk-frp9fc7j.js";import{bl as u,cl as c}from"./chunk-qg0w5tjb.js";import"./chunk-7rj4h2t2.js";import"./chunk-qjvny3wf.js";import"./chunk-2119txb8.js";import{fs as f}from"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import{Js as A}from"./chunk-dj24n5n7.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-1tz8fb87.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import{Sw as B}from"./chunk-m8kem5ca.js";import{spawn as o}from"child_process";import L from"fs";import zb from"os";import $ from"path";import w from"process";import{CLI as wb}from"@stacksjs/clapp";var N="0.2.362";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",E=new wb("stx");function h(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;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 d(J){try{if(!L.existsSync(J)){let K=$.dirname(J),x=$.basename(J);if(L.existsSync(K)){let z=L.readdirSync(K).filter((j)=>j.toLowerCase().includes(x.toLowerCase().substring(0,3))||j.endsWith(".stx")||j.endsWith(".md")),k=z.length>0?`File not found. Similar files in ${K}: ${z.slice(0,3).join(", ")}`:`File not found. Directory ${K} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${J}`,suggestion:k}}return{isValid:!1,error:`File does not exist: ${J}`,suggestion:"Check the file path and try again"}}if(L.statSync(J).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${J}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${J}`,suggestion:"Check file permissions and path"}}}function y(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;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 V=(J)=>J.includes("*")||J.includes("?")||J.includes("{")||J.includes("["),jb=(J)=>J.endsWith(".stx")||J.endsWith(".md");function S(J,Z=1){if(console.error(`\u274C ${J.error}`),J.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${J.suggestion}`);w.exit(Z)}function kb(J){if(!J)return;let Z;try{Z=JSON.parse(J)}catch(K){console.error(`\u274C --info-plist is not valid JSON: ${K.message}`),w.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"}'`),w.exit(1);for(let[K,x]of Object.entries(Z))if(typeof x!=="string"&&typeof x!=="number"&&typeof x!=="boolean")console.error(`\u274C --info-plist value for "${K}" must be a string, number or boolean`),w.exit(1);return Z}async function Hb(J,Z){try{let K=["test"],x=[];if(J&&J.length>0)for(let W of J)if(V(W))try{let H=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(H.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(x.push(...H),Z.verbose)console.log(`Found ${H.length} file(s) matching pattern: ${W}`)}catch(H){return console.error(`Error expanding glob pattern ${W}:`,H),!1}else x.push(W);if(x.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(K.push(...x),Z.filter)K.push("--pattern",Z.filter);if(Z.timeout)K.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=$.join(zb.tmpdir(),`stx-test-report-${Date.now()}.xml`);K.push("--reporter",Z.reporter),K.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)K.push("--coverage");if(Z.watch)K.push("--watch");K.push("--preload",$.join(__dirname,"../../../test-utils/happy-dom.ts"));let b={...w.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},z="bun";if(Z.verbose)console.log(`Running: ${z} ${K.join(" ")}`);let k=performance.now(),j=o(z,K,{stdio:"inherit",shell:!1,env:b});return new Promise((W)=>{j.on("close",(H)=>{let Y=((performance.now()-k)/1000).toFixed(2);if(H===0)W(!0);else W(!1)}),w.on("SIGINT",()=>{console.log(`
|
|
4
4
|
Test run interrupted`),j.kill("SIGINT"),w.exit(1)})})}catch(K){return console.error("Error running tests:",K instanceof Error?K.message:String(K)),!1}}var Qb=w.argv.length>=3&&(jb(w.argv[2])&&L.existsSync(w.argv[2])||V(w.argv[2]));if(Qb){let J=w.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let K=3;K<w.argv.length;K++){let x=w.argv[K];if(x==="--port"&&K+1<w.argv.length){let b=h(w.argv[++K]);if(!b.isValid)S(b);Z.port=Number.parseInt(w.argv[K],10)}else if(x==="--no-watch")Z.watch=!1;else if(x==="--highlight-theme"&&K+1<w.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=w.argv[++K]}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(V(J))try{let K=await Array.fromAsync(new Bun.Glob(J).scan({onlyFiles:!0,absolute:!0})),x=J.endsWith(".stx")?K.filter((j)=>j.endsWith(".stx")):J.endsWith(".md")?K.filter((j)=>j.endsWith(".md")):K.filter((j)=>j.endsWith(".stx")||j.endsWith(".md")),b=J.split("*")[0].replace(/\/$/,"")||".",z=$.resolve(b);try{let j=new Bun.Glob("**/*.stx"),H=(await Array.fromAsync(j.scan({cwd:z,onlyFiles:!0,absolute:!0}))).filter((U)=>/\[.+\]/.test($.basename(U)));for(let U of H)if(!x.includes(U))x.push(U)}catch{}if(x.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${J}`),w.exit(1);if(!await v(x,Z))w.exit(1)}catch(K){console.error("Failed to process files:",K),w.exit(1)}else F(J,Z).catch((K)=>{console.error("Failed to start dev server:",K),w.exit(1)})}else{let J=function(x,b){let z=[];for(let k=0;k<=b.length;k++)z[k]=[k];for(let k=0;k<=x.length;k++)z[0][k]=k;for(let k=1;k<=b.length;k++)for(let j=1;j<=x.length;j++)if(b.charAt(k-1)===x.charAt(j-1))z[k][j]=z[k-1][j-1];else z[k][j]=Math.min(z[k-1][j-1]+1,z[k][j-1]+1,z[k-1][j]+1);return z[b.length][x.length]};E.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 r(x))console.log("Documentation generated successfully."),w.exit(0);else console.error("Documentation generation failed."),w.exit(1)}catch(b){console.error("Error generating documentation:",b),w.exit(1)}}),E.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,b)=>{try{let{fetchCollections:z,generatePackage:k}=await import("./chunk-p41s1y4v.js");if(x==="list"){console.log(`
|
|
5
5
|
\uD83D\uDCDA Fetching available icon collections...
|
|
6
6
|
`);let j=await z(),W=Object.entries(j).sort((H,U)=>U[1].total-H[1].total);console.log(`Available collections:
|
|
@@ -69,7 +69,7 @@ Total: ${H} issues in ${W} files`),b.output){let U=`
|
|
|
69
69
|
File not found: ${x}`),w.exit(1);if(!x.endsWith(".stx"))console.error(`
|
|
70
70
|
File must have .stx extension: ${x}`),w.exit(1)}let k=$.resolve(b.pages),j=$.resolve(b.out);if(!x&&!L.existsSync(k))console.error(`
|
|
71
71
|
Pages directory not found: ${k}`),console.log(`
|
|
72
|
-
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),w.exit(1);let{buildApp:W}=await import("./chunk-
|
|
72
|
+
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),w.exit(1);let{buildApp:W}=await import("./chunk-kbfbfjpz.js");c();let H=await W({root:x?$.dirname(x):void 0,debug:b.verbose,ssg:{pagesDir:b.pages,outputDir:b.out,domain:b.domain,baseUrl:b.base,sitemap:b.sitemap,rss:b.rss,minify:b.minify,cache:b.cache!==!1,cleanOutput:b.clean,concurrency:Number.parseInt(b.concurrency,10)||10,publicDir:b.public,trailingSlash:b.trailingSlash,generate404:!0,hooks:b.verbose?{onPageStart:(Y)=>console.log(` Generating: ${Y}`),onPageEnd:(Y,Q)=>console.log(` Generated: ${Y} (${Q.length} bytes)`),onError:(Y,Q)=>console.error(` Error in ${Q}: ${Y.message}`)}:void 0},ssr:{outputDir:b.out==="dist"?".output":b.out,debug:b.verbose}}),U=((performance.now()-z)/1000).toFixed(2);if(H.mode==="ssr"&&H.ssr)console.log(`
|
|
73
73
|
Build complete! (SSR)
|
|
74
74
|
`),console.log(` Pages compiled: ${H.ssr.pageCount}`),console.log(` Output: ${H.ssr.outputDir}`),console.log(` Duration: ${U}s
|
|
75
75
|
`);else if(H.ssg){if(console.log(`
|
|
@@ -84,7 +84,7 @@ Total: ${H} issues in ${W} files`),b.output){let U=`
|
|
|
84
84
|
Build completed with ${H.ssg.failedCount} error(s). Fix the issues above and try again.
|
|
85
85
|
`),w.exit(1);console.log(" To preview locally:"),console.log(` cd ${b.out||"dist"} && npx serve
|
|
86
86
|
`)}}catch(z){console.error(`
|
|
87
|
-
Build failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(x)=>{try{let b=$.resolve(x.output);if(!L.existsSync($.join(b,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),w.exit(1);let{startProductionServer:z}=await import("./chunk-
|
|
87
|
+
Build failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(x)=>{try{let b=$.resolve(x.output);if(!L.existsSync($.join(b,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),w.exit(1);let{startProductionServer:z}=await import("./chunk-q065t1x7.js");await z({outputDir:b,port:Number.parseInt(x.port,10)||3000})}catch(b){console.error(`
|
|
88
88
|
Failed to start production server:`,b instanceof Error?b.message:String(b)),w.exit(1)}}),E.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(x,b)=>{try{let{deploy:z,initNetlify:k,DeployError:j}=await import("./chunk-89xwdc1d.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${N}\x1B[0m`),b.init){console.log(`
|
|
89
89
|
\uD83D\uDCDD Initializing Netlify configuration...
|
|
90
90
|
`);let H=await k({directory:x||w.cwd(),siteId:b.siteId});if(console.log(`\u2713 Created ${H.configPath}`),H.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.362",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -118,12 +118,12 @@
|
|
|
118
118
|
"dependencies": {
|
|
119
119
|
"@stacksjs/ts-css": "^0.3.2",
|
|
120
120
|
"@stacksjs/clapp": "^0.2.16",
|
|
121
|
-
"@stacksjs/desktop": "0.2.
|
|
122
|
-
"@stacksjs/sanitizer": "0.2.
|
|
121
|
+
"@stacksjs/desktop": "0.2.362",
|
|
122
|
+
"@stacksjs/sanitizer": "0.2.362",
|
|
123
123
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
124
|
-
"bun-plugin-stx": "0.2.
|
|
124
|
+
"bun-plugin-stx": "0.2.362",
|
|
125
125
|
"bunfig": "^0.15.19",
|
|
126
|
-
"stx-router": "0.2.
|
|
126
|
+
"stx-router": "0.2.362",
|
|
127
127
|
"ts-broadcasting": "^0.0.10",
|
|
128
128
|
"ts-images": "^0.2.22",
|
|
129
129
|
"ts-syntax-highlighter": "^0.2.1"
|