@stacksjs/stx 0.2.266 → 0.2.267
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/app-shell.js +5 -24
- package/dist/{chunk-a78tzerx.js → chunk-13ftt3qc.js} +1 -1
- package/dist/{chunk-aagn8j9e.js → chunk-18nxwzv3.js} +107 -107
- package/dist/{chunk-pbsfbgx7.js → chunk-5d4csjhx.js} +1 -1
- package/dist/{chunk-mv0syvrg.js → chunk-6kcz7bg6.js} +1 -1
- package/dist/{chunk-6g4mnrr0.js → chunk-8vewrjzp.js} +2 -2
- package/dist/{chunk-p9ase2nx.js → chunk-b41qf397.js} +1 -1
- package/dist/{chunk-nswz1rkm.js → chunk-cksz4k5v.js} +2 -2
- package/dist/{chunk-0j9hrzjj.js → chunk-e6tvnnnz.js} +1 -1
- package/dist/{chunk-v9crchhq.js → chunk-e6vdk4v0.js} +1 -1
- package/dist/{chunk-5jcsg2mc.js → chunk-j135b7xt.js} +1 -1
- package/dist/{chunk-ym3r8ktq.js → chunk-jcped0kt.js} +1 -1
- package/dist/{chunk-nwq01xh0.js → chunk-jq4104he.js} +1 -1
- package/dist/{chunk-a95rrp0j.js → chunk-khfszwjy.js} +1 -1
- package/dist/{chunk-k4m48h62.js → chunk-m0aetx9j.js} +2 -2
- package/dist/{chunk-x2mke7a1.js → chunk-mzpb11dp.js} +1 -1
- package/dist/chunk-r8qvm7a3.js +30 -0
- package/dist/{chunk-f3k5xbhk.js → chunk-sz51py35.js} +1 -1
- package/dist/{chunk-z66a9nnd.js → chunk-v9xkrwxt.js} +1 -1
- package/dist/{chunk-gn48cpgb.js → chunk-vnrhn6b0.js} +1 -1
- package/dist/{chunk-n3jgypjf.js → chunk-wrg838f0.js} +1 -1
- package/dist/{chunk-tybdapd3.js → chunk-xv2mr8vq.js} +1 -1
- package/dist/{chunk-nfykda12.js → chunk-y9tv04zh.js} +2 -2
- package/dist/{chunk-6yphtg3q.js → chunk-z86pq9pd.js} +1 -1
- package/dist/{chunk-behbakfv.js → chunk-zr2rkgag.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/fragment-container.js +15 -1
- package/package.json +5 -5
- package/dist/chunk-a7x7dmtf.js +0 -30
package/dist/chunk-a7x7dmtf.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{lm as E,mm as M,yq as T}from"./chunk-mbvkvac6.js";import{Lu as d,Nu as c,Ou as i}from"./chunk-5wkwhjjn.js";import{Vu as m,Yu as p}from"./chunk-f8wjdg40.js";var y=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function f(z,Q,F){let J={fullTag:F,content:Q,attrs:z};if(/\bserver\b/.test(z))return{...J,type:"server"};if(/\bdata-stx-scoped\b/.test(z))return{...J,type:"client"};if(y.test(Q))return{...J,type:"signals"};if(/\bclient\b/.test(z)||/\btype\s*=\s*["']module["']/.test(z)||/\bsrc\s*=/.test(z))return{...J,type:"client"};return{...J,type:"server"}}var g=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function P(z){let Q=[],F=[],J=[],$=0;while($<z.length){let Y=z.indexOf("<",$);if(Y===-1)break;let K=M(z,Y);if(K>Y){$=K;continue}let Z=E(z,Y);if(Z>Y){let B=z.slice(Y,Z),U=g.exec(B);if(U){let X=f(U[1],U[2],B);switch(X.type){case"signals":Q.push(X);break;case"client":F.push(X);break;case"server":J.push(X);break}}$=Z;continue}$=Y+(z.startsWith("<!--",Y)?4:1)}return{signals:Q,client:F,server:J}}var s="X-STX-Router",a="private, no-store";function R(z){return z.headers.get("X-STX-Router")==="true"}function u(z,Q){if(!z)return Q;return z.split(",").some((J)=>J.trim().toLowerCase()===Q.toLowerCase())?z:`${z}, ${Q}`}function t(z){return{Vary:u(z,"X-STX-Router")}}import L from"path";d();var h="stx-page-head:",o=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,I=null;function r(){if(I!==null)return I;try{let{getRouterScript:z}=(i(),m(c));I=`<script>${z()}</script>`}catch{I=""}return I}async function Yz(z,Q){if(Q===!1)return null;if(Q&&typeof Q==="string"){let J=L.resolve(z,Q);if(await Bun.file(J).exists())return J;return null}let F=L.join(z,"app.stx");if(await Bun.file(F).exists())return F;return null}async function Zz(z,Q){try{let F=await Bun.file(z).text(),J=F,$=F.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)J=$[1].trim();let Y=P(F),K=[...Y.client.map((j)=>j.fullTag),...Y.signals.map((j)=>j.fullTag)],Z=[],B=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,U;while((U=B.exec(F))!==null)Z.push(U[0]);let X=J;for(let j of Y.server)X=X.replace(j.fullTag,"");for(let j of Y.client)X=X.replace(j.fullTag,"");X=X.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let W="<!--__STX_PAGE_SLOT__-->";if(X=X.replace(/<slot\s*\/>/gi,W).replace(/<slot\s*>\s*<\/slot>/gi,W),!X.includes(W))return console.warn(`[stx] Shell ${z} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:q,extractVariables:k,defaultConfig:v,loadStxConfig:H}=await import("./chunk-a78tzerx.js"),w=await H(),A={__filename:z,__dirname:L.dirname(z)};for(let j of K){let N=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(N&&!j.includes("client")&&!j.includes('type="module"'))await k(N[1],A,z)}let V=await q(X,A,z,{...v,...w,...Q},new Set),G=V.indexOf(W);if(G===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:V.substring(0,G),afterSlot:V.substring(G+W.length),filePath:z,shellScripts:K,shellStyles:Z}}catch(F){return console.error(`[stx] Error processing shell ${z}:`,F),null}}function $z(z,Q,F){let J,$="",Y=Q.match(o);if(Y){Q=Q.replace(Y[0],"");try{let X=Buffer.from(Y[1],"base64").toString("utf8"),W=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(W)J=W[1].trim();$=X.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let K=F||J||"stx App",Z=r(),B="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
3
|
-
<html lang="en">
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>${K}</title>
|
|
8
|
-
${$?` ${$}
|
|
9
|
-
`:""} ${z.shellStyles.join(`
|
|
10
|
-
`)}
|
|
11
|
-
</head>
|
|
12
|
-
<body>
|
|
13
|
-
${z.beforeSlot}
|
|
14
|
-
<div data-stx-content>${Q}</div>
|
|
15
|
-
${z.afterSlot}
|
|
16
|
-
${z.shellScripts.filter((X)=>!X.includes("server")).join(`
|
|
17
|
-
`)}
|
|
18
|
-
${B}
|
|
19
|
-
${Z}
|
|
20
|
-
</body>
|
|
21
|
-
</html>`}function x(z,Q={}){let F=z.trim();if(!T(F))return z;let J=[],$=F.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if($){let B=$[1],U=/<style\b[^>]*>[\s\S]*?<\/style>/gi,X;while((X=U.exec(B))!==null)J.push(X[0])}if(Q.preserveHead&&$){let B=[],U=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,X;while((X=U.exec($[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(X[0]))continue;B.push(X[0])}if(B.length>0)J.unshift(`<!--${h}${Buffer.from(B.join(`
|
|
22
|
-
`),"utf8").toString("base64")}-->`)}let Y=F.match(/<body\b[^>]*>/i),K=F.lastIndexOf("</body>");if(Y&&K!==-1){let B=Y.index+Y[0].length,U=F.slice(B,K).trim();if(J.length>0)return J.join(`
|
|
23
|
-
`)+`
|
|
24
|
-
`+U;return U}let Z=F;if(Z=Z.replace(/<!DOCTYPE\b[^>]*>/i,""),Z=Z.replace(/<html\b[^>]*>/i,""),Z=Z.replace(/<\/html\s*>/i,""),$)Z=Z.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,J.join(`
|
|
25
|
-
`));return Z=Z.replace(/<body\b[^>]*>/i,""),Z=Z.replace(/<\/body\s*>/i,""),Z.trim()}function jz(z){return R(z)}function Bz(z,Q="main"){let F=z.trim(),J=[],$=[],Y=F.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(Y){let G=Y[1],j=/<style\b[^>]*>[\s\S]*?<\/style>/gi,N;while((N=j.exec(G))!==null)J.push(N[0]);let _=/<script\b[^>]*data-stx-route-params[^>]*>[\s\S]*?<\/script>/gi;while((N=_.exec(G))!==null)$.push(N[0])}let K=Q.replace(/^[.#]/,"").toLowerCase(),Z=new RegExp(`<${K}\\b[^>]*>`,"i"),B=F.match(Z);if(!B||B.index===void 0)return x(z);let U=B.index+B[0].length,X=new RegExp(`<${K}\\b[^>]*>`,"gi"),W=new RegExp(`</${K}\\s*>`,"gi");X.lastIndex=U,W.lastIndex=U;let q=1,k=-1;while(q>0){let G=X.exec(F),j=W.exec(F);if(!j)break;if(G&&G.index<j.index)q++,W.lastIndex=G.index+G[0].length;else if(q--,k=j.index,q>0)X.lastIndex=j.index+j[0].length}if(k===-1)return x(z);let v=F.slice(U,k).trim(),H=[],w=F.match(/<body\b[^>]*>/i),A=F.lastIndexOf("</body>");if(w&&w.index!==void 0&&A!==-1){let j=[[w.index+w[0].length,B.index],[k+`</${K}>`.length,A]],N=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[_,O]of j){if(_>=O)continue;let S=F.slice(_,O),b;N.lastIndex=0;while((b=N.exec(S))!==null)H.push(b[0])}}let V=[];if(J.length>0)V.push(J.join(`
|
|
26
|
-
`));if($.length>0)V.push($.join(`
|
|
27
|
-
`));if(H.length>0)V.push(H.join(`
|
|
28
|
-
`));return V.push(v),V.join(`
|
|
29
|
-
`)}import D from"fs";import C from"path";function Nz(z,Q,F){return{version:1,buildTime:new Date().toISOString(),routes:z,assets:Q,outputDir:F}}function Vz(z,Q){let F=C.join(Q,"manifest.json");D.writeFileSync(F,JSON.stringify(z,null,2))}function qz(z){let Q=C.join(z,"manifest.json");if(!D.existsSync(Q))return null;try{let F=D.readFileSync(Q,"utf-8"),J=JSON.parse(F);if(J.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${J.version}`),null;return J}catch(F){return console.warn("[stx] Failed to load manifest:",F),null}}
|
|
30
|
-
export{f as xg,P as yg,s as zg,a as Ag,R as Bg,u as Cg,t as Dg,Yz as Eg,Zz as Fg,$z as Gg,x as Hg,jz as Ig,Bz as Jg,Nz as Kg,Vz as Lg,qz as Mg};
|