@stacksjs/stx 0.2.679 → 0.2.682
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-01ks1244.js +2 -0
- package/dist/{chunk-qr7a378v.js → chunk-03xn8244.js} +3 -3
- package/dist/{chunk-ccmc5rqj.js → chunk-0527ytat.js} +2 -2
- package/dist/chunk-0gmwqhs0.js +2 -0
- package/dist/chunk-18jfkg1q.js +2 -0
- package/dist/chunk-1gw26g89.js +31 -0
- package/dist/chunk-1t6dg4s8.js +2 -0
- package/dist/{chunk-n8wvqnfc.js → chunk-1y50gat7.js} +2 -2
- package/dist/chunk-23efje42.js +2 -0
- package/dist/chunk-247fg189.js +2 -0
- package/dist/{chunk-xnx06qqt.js → chunk-2a1eeywj.js} +2 -2
- package/dist/{chunk-hh58k0nh.js → chunk-2ajbhefk.js} +2 -2
- package/dist/{chunk-p9az13b2.js → chunk-2ar5g9pa.js} +2 -2
- package/dist/{chunk-7j7h1eg3.js → chunk-2hh6g3y1.js} +1 -1
- package/dist/chunk-2zepd4ps.js +2 -0
- package/dist/chunk-34ps2w1z.js +2 -0
- package/dist/chunk-3tkag58v.js +2 -0
- package/dist/{chunk-ga5kjf9b.js → chunk-3zbege39.js} +6 -6
- package/dist/{chunk-2933mvwr.js → chunk-42qtadka.js} +10 -10
- package/dist/chunk-47fwr1z7.js +2 -0
- package/dist/{chunk-fzc98qgn.js → chunk-49c5v5fh.js} +6 -6
- package/dist/chunk-4g9wrxkm.js +2 -0
- package/dist/chunk-4m5g3f2b.js +2 -0
- package/dist/{chunk-tx4wfk5v.js → chunk-4z4sqc8q.js} +5 -5
- package/dist/{chunk-6ycyaf5g.js → chunk-58dv14c3.js} +2 -2
- package/dist/{chunk-87em5xdg.js → chunk-5nfb4gxk.js} +82 -82
- package/dist/chunk-5nrqc6v4.js +20 -0
- package/dist/chunk-5rdfcpfe.js +2 -0
- package/dist/{chunk-xyk2zxkk.js → chunk-65jb75vz.js} +2 -2
- package/dist/{chunk-5z8mq37c.js → chunk-6e60jp4a.js} +4 -4
- package/dist/chunk-7jxj6cv1.js +2 -0
- package/dist/{chunk-dnjbzwwn.js → chunk-7yree929.js} +1 -1
- package/dist/chunk-8bwa63m3.js +2 -0
- package/dist/chunk-8d0rqqyx.js +2 -0
- package/dist/chunk-8j0zcyd7.js +2 -0
- package/dist/chunk-8jxqg7kb.js +2 -0
- package/dist/chunk-8nk56cs2.js +2 -0
- package/dist/chunk-8y7tpjfs.js +2 -0
- package/dist/{chunk-q3gactm1.js → chunk-912r15hr.js} +4 -4
- package/dist/chunk-96hkch4q.js +2 -0
- package/dist/{chunk-4fhbh04h.js → chunk-974prn41.js} +4 -4
- package/dist/{chunk-078qg8r5.js → chunk-9bgb9n12.js} +2 -2
- package/dist/chunk-9qx6ansy.js +2 -0
- package/dist/{chunk-tst8p27s.js → chunk-9tg4995v.js} +3 -3
- package/dist/{chunk-sr3hmrah.js → chunk-9wa3t87n.js} +1 -1
- package/dist/{chunk-k06n5bjp.js → chunk-ae12wgc5.js} +3 -3
- package/dist/chunk-b375wt1n.js +2 -0
- package/dist/chunk-b5vqp3b2.js +2 -0
- package/dist/{chunk-vg1pg6yt.js → chunk-b7z6rqfg.js} +1 -1
- package/dist/{chunk-wt7rp7wc.js → chunk-bmqker64.js} +6 -6
- package/dist/{chunk-53e9ta3g.js → chunk-bmv6spcd.js} +4 -4
- package/dist/chunk-bpf3xxng.js +3 -0
- package/dist/{chunk-chy90834.js → chunk-brcj3953.js} +5 -5
- package/dist/chunk-brftzqzj.js +3 -0
- package/dist/chunk-bv43s0gx.js +2 -0
- package/dist/chunk-c9jnkbdb.js +2 -0
- package/dist/{chunk-x7wr720m.js → chunk-d1ssvg9k.js} +5 -5
- package/dist/{chunk-5z0q3qv3.js → chunk-d7js6v1m.js} +5 -5
- package/dist/{chunk-vd5w1jaz.js → chunk-drabexxq.js} +3 -3
- package/dist/{chunk-k72jqz6a.js → chunk-e26pxzjj.js} +2 -2
- package/dist/{chunk-2pvcp0y6.js → chunk-e97xj3rf.js} +6 -6
- package/dist/chunk-ev1tnd36.js +2 -0
- package/dist/{chunk-j388n7v2.js → chunk-f1hxrs7b.js} +17 -17
- package/dist/{chunk-wr1gm35v.js → chunk-f4z9w4kc.js} +1 -1
- package/dist/chunk-f80aqbwm.js +2 -0
- package/dist/chunk-fbbp8j97.js +2 -0
- package/dist/{chunk-26ps9djm.js → chunk-fqts9wvd.js} +5 -5
- package/dist/chunk-fy1waxy0.js +2 -0
- package/dist/chunk-g2v6c7kf.js +2 -0
- package/dist/chunk-g5ep75vp.js +2 -0
- package/dist/{chunk-wejabf6y.js → chunk-g83qeh2x.js} +5 -5
- package/dist/chunk-g9a56wwk.js +2 -0
- package/dist/chunk-gkmh0xys.js +2 -0
- package/dist/{chunk-78yjmbbs.js → chunk-gtktv6nn.js} +2 -2
- package/dist/{chunk-f26n6y9p.js → chunk-gymmbbzc.js} +4 -4
- package/dist/{chunk-48ma0qcr.js → chunk-h3bdqqzy.js} +2 -2
- package/dist/chunk-h5r4c9v5.js +2 -0
- package/dist/{chunk-3xyv2fec.js → chunk-hg7ys8rn.js} +3 -3
- package/dist/{chunk-kxj8e1gd.js → chunk-hm69jxmh.js} +6 -6
- package/dist/{chunk-y4ncmvf2.js → chunk-hwaqwrc2.js} +3 -3
- package/dist/chunk-jecmxby7.js +2 -0
- package/dist/{chunk-a2zb5fgg.js → chunk-jkywbfb0.js} +2 -2
- package/dist/{chunk-haz2ezyk.js → chunk-k3e0hcv7.js} +2 -2
- package/dist/{chunk-drmgwjnb.js → chunk-ka3xmbrd.js} +76 -76
- package/dist/chunk-kerxevf9.js +2 -0
- package/dist/chunk-km37yrk4.js +43 -0
- package/dist/chunk-mdmwgthz.js +2 -0
- package/dist/chunk-myc60z74.js +2 -0
- package/dist/chunk-mzkyw4yx.js +2 -0
- package/dist/{chunk-nb3kkvet.js → chunk-n8jq9yjy.js} +11 -11
- package/dist/{chunk-y34tyrpb.js → chunk-nbjyed3q.js} +7 -7
- package/dist/{chunk-d40zjm6k.js → chunk-np3zdjhr.js} +6 -6
- package/dist/{chunk-wav0xbnb.js → chunk-pfn70zdr.js} +2 -2
- package/dist/{chunk-tbb4en1q.js → chunk-pmma4f1x.js} +4 -4
- package/dist/chunk-pqg3ghvh.js +2 -0
- package/dist/chunk-pvn0fc7j.js +2 -0
- package/dist/{chunk-q4rejyd2.js → chunk-pzxy40a2.js} +2 -2
- package/dist/chunk-q7mpearc.js +2 -0
- package/dist/{chunk-7z7zp8xq.js → chunk-qb806pks.js} +5 -5
- package/dist/{chunk-wscnjtss.js → chunk-qh7fvr2z.js} +2 -2
- package/dist/chunk-r8hszntk.js +2 -0
- package/dist/{chunk-wc5tt6da.js → chunk-remsyfdx.js} +2 -2
- package/dist/chunk-rk8kmshp.js +2 -0
- package/dist/chunk-rs67af2x.js +1592 -0
- package/dist/{chunk-97h9ga3b.js → chunk-rspe6qa5.js} +3 -3
- package/dist/{chunk-78x52gz3.js → chunk-ry501z40.js} +5 -5
- package/dist/chunk-s0wa7zjr.js +2 -0
- package/dist/{chunk-qvefcnyb.js → chunk-se4n8tth.js} +2 -2
- package/dist/chunk-sncp7jhv.js +2 -0
- package/dist/{chunk-jv021x8e.js → chunk-sq4w1e1g.js} +2 -2
- package/dist/chunk-sqvdrk81.js +2 -0
- package/dist/{chunk-9wdd7eq6.js → chunk-t6m5d64b.js} +2 -2
- package/dist/chunk-tdwqwxhf.js +25 -0
- package/dist/{chunk-dera8fmc.js → chunk-tenbwcts.js} +2 -2
- package/dist/chunk-th45zgbz.js +54 -0
- package/dist/{chunk-cxgremn0.js → chunk-tpdvgb3d.js} +1 -1
- package/dist/chunk-tq2m6m3j.js +2 -0
- package/dist/{chunk-aw3jfdca.js → chunk-veh25cv5.js} +1 -1
- package/dist/chunk-vqv5w6gs.js +2 -0
- package/dist/chunk-vt5e25xg.js +2 -0
- package/dist/{chunk-028e9fty.js → chunk-vxnf3xab.js} +2 -2
- package/dist/{chunk-mabja59q.js → chunk-vxrhvrr9.js} +2 -2
- package/dist/{chunk-tmqrbs98.js → chunk-w1wzydvp.js} +8 -5
- package/dist/{chunk-qwdcts9w.js → chunk-w28wc7mv.js} +13 -13
- package/dist/{chunk-yxw8gbnh.js → chunk-wfg5379k.js} +4 -4
- package/dist/chunk-wvz7rp5p.js +2 -0
- package/dist/{chunk-k4x8v39k.js → chunk-xfdfk4g4.js} +2 -2
- package/dist/chunk-xjx1xbey.js +2 -0
- package/dist/{chunk-mn47s2ef.js → chunk-xr9a0hcr.js} +5 -5
- package/dist/{chunk-1b9thkg5.js → chunk-xvnrm5c3.js} +2 -2
- package/dist/{chunk-mf19qxgv.js → chunk-xvs84gas.js} +2 -2
- package/dist/{chunk-8aq07a1j.js → chunk-y55pcfaj.js} +3 -3
- package/dist/{chunk-2hmyj5wh.js → chunk-yhfm939b.js} +2 -2
- package/dist/chunk-ykjzhfyf.js +2 -0
- package/dist/chunk-ypwetty7.js +21 -0
- package/dist/chunk-z4khbpx0.js +2 -0
- package/dist/{chunk-9rs12v0r.js → chunk-z5av310q.js} +9 -9
- package/dist/chunk-zr16mga0.js +2 -0
- package/dist/{chunk-dxh45gve.js → chunk-zt5hp5w5.js} +1 -1
- package/dist/chunk-zwawqx5q.js +2 -0
- package/dist/cli.js +20 -20
- package/dist/client/signals-manifest-hydration-runtime.js +4 -1
- package/dist/component-client-factories.js +14 -3
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/serve-app.js +10 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +6 -6
- package/dist/utils.js +13 -1
- package/package.json +5 -5
- package/dist/chunk-0fjwqs9h.js +0 -2
- package/dist/chunk-0gk78x3r.js +0 -2
- package/dist/chunk-0v35wpm7.js +0 -2
- package/dist/chunk-1dkcakve.js +0 -25
- package/dist/chunk-1gg5vxe8.js +0 -2
- package/dist/chunk-1j0sarne.js +0 -21
- package/dist/chunk-248a88mc.js +0 -2
- package/dist/chunk-2nqtmp8c.js +0 -2
- package/dist/chunk-2yzwrvq1.js +0 -2
- package/dist/chunk-3bfegbpw.js +0 -2
- package/dist/chunk-3wsm9g9c.js +0 -2
- package/dist/chunk-3xx9d934.js +0 -2
- package/dist/chunk-52x079ax.js +0 -2
- package/dist/chunk-54zkkxmb.js +0 -2
- package/dist/chunk-5fmxn52y.js +0 -2
- package/dist/chunk-61ww9d2z.js +0 -2
- package/dist/chunk-75zc8w68.js +0 -2
- package/dist/chunk-7b3phzx4.js +0 -2
- package/dist/chunk-8p92r2sc.js +0 -2
- package/dist/chunk-8xr8y9sq.js +0 -2
- package/dist/chunk-909ymsjz.js +0 -2
- package/dist/chunk-ac75vk0w.js +0 -2
- package/dist/chunk-arh1qgmp.js +0 -2
- package/dist/chunk-b0th3d8q.js +0 -888
- package/dist/chunk-bh19ezq0.js +0 -43
- package/dist/chunk-bm42rsaa.js +0 -2
- package/dist/chunk-cfm6a679.js +0 -2
- package/dist/chunk-cwmazy7y.js +0 -2
- package/dist/chunk-e492je6q.js +0 -2
- package/dist/chunk-ft1ht0b3.js +0 -2
- package/dist/chunk-ft3f9nj0.js +0 -2
- package/dist/chunk-ggwvnpwj.js +0 -2
- package/dist/chunk-gx6wxmbv.js +0 -2
- package/dist/chunk-hamk3dky.js +0 -2
- package/dist/chunk-hqj28381.js +0 -3
- package/dist/chunk-k093pr2w.js +0 -2
- package/dist/chunk-kcp392wy.js +0 -2
- package/dist/chunk-kejrhccx.js +0 -2
- package/dist/chunk-kmj127rm.js +0 -2
- package/dist/chunk-kqbpkg8n.js +0 -2
- package/dist/chunk-m0f3strn.js +0 -2
- package/dist/chunk-mjsebtg6.js +0 -2
- package/dist/chunk-n8f0zw1y.js +0 -31
- package/dist/chunk-nadgej53.js +0 -2
- package/dist/chunk-nh3kd03f.js +0 -2
- package/dist/chunk-nw2zh40z.js +0 -2
- package/dist/chunk-p01b07se.js +0 -54
- package/dist/chunk-p99an8rj.js +0 -2
- package/dist/chunk-pgvwysxq.js +0 -2
- package/dist/chunk-pz3mg7hr.js +0 -2
- package/dist/chunk-qyf3jcy1.js +0 -2
- package/dist/chunk-rc79yyqx.js +0 -2
- package/dist/chunk-s8qe247r.js +0 -2
- package/dist/chunk-sswy3tfc.js +0 -2
- package/dist/chunk-swxznm5v.js +0 -2
- package/dist/chunk-t3gmm1ja.js +0 -2
- package/dist/chunk-tsrf4zzy.js +0 -2
- package/dist/chunk-tz09earb.js +0 -2
- package/dist/chunk-vct8a1qf.js +0 -20
- package/dist/chunk-x4q4bx3q.js +0 -3
- package/dist/chunk-xna6b7km.js +0 -2
- package/dist/chunk-xw4rm5zj.js +0 -2
- package/dist/chunk-yar7fwrb.js +0 -2
- package/dist/chunk-yt33wzqk.js +0 -2
- package/dist/chunk-zcbp27x1.js +0 -2
- package/dist/chunk-zq7xbc1k.js +0 -2
package/dist/craft-entry.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Xs,Ji,Yi}from"./chunk-y55pcfaj.js";import"./chunk-w28wc7mv.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-5nfb4gxk.js";import"./chunk-t6m5d64b.js";import"./chunk-remsyfdx.js";import"./chunk-tenbwcts.js";import"./chunk-gymmbbzc.js";import"./chunk-42qtadka.js";import"./chunk-nbjyed3q.js";import"./chunk-912r15hr.js";import"./chunk-yhfm939b.js";import"./chunk-bmqker64.js";import"./chunk-rs67af2x.js";import"./chunk-brcj3953.js";import"./chunk-th45zgbz.js";import"./chunk-ypwetty7.js";import"./chunk-tdwqwxhf.js";import"./chunk-9bgb9n12.js";import"./chunk-03xn8244.js";import{ep,Hi,tp,np,Vi,Ks,Ui,rp,Wi,sp,op,qi,Gi,Ki,Xi}from"./chunk-f1hxrs7b.js";import"./chunk-wfg5379k.js";import"./chunk-2a1eeywj.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-hg7ys8rn.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
6
6
|
`),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
|
|
7
7
|
<script data-craft-hydration>
|
|
8
8
|
window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
|
|
9
|
-
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{
|
|
9
|
+
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{ep as CRAFT_BRIDGE_SCRIPT,Ks as CRAFT_COMPONENTS,rp as CRAFT_COMPONENT_RUNTIME,Ui as CRAFT_COMPONENT_STYLES,Xs as NATIVE_COMPONENTS,qi as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Ji as compileToNative,Yi as createHotReloadServer,Gi as findCraftBinary,Hi as generateCraftBridgeScript,V as generateCraftOptimizations,Xi as getAvailableFormats,Ki as getAvailableTargets,op as getCraftComponents,G as getSSRCacheStats,Vi as injectCraftBridge,tp as isCraftEnvironment,Y as prerenderForCraft,Wi as processCraftComponents,np as processCraftDirective,sp as registerCraftComponent,Q as renderSSR};
|
package/dist/craft.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Xs,Ji,Yi}from"./chunk-y55pcfaj.js";import"./chunk-w28wc7mv.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import"./chunk-5nfb4gxk.js";import"./chunk-t6m5d64b.js";import"./chunk-remsyfdx.js";import"./chunk-tenbwcts.js";import"./chunk-gymmbbzc.js";import"./chunk-42qtadka.js";import"./chunk-nbjyed3q.js";import"./chunk-912r15hr.js";import"./chunk-yhfm939b.js";import"./chunk-bmqker64.js";import"./chunk-rs67af2x.js";import"./chunk-brcj3953.js";import"./chunk-th45zgbz.js";import"./chunk-ypwetty7.js";import"./chunk-tdwqwxhf.js";import"./chunk-9bgb9n12.js";import"./chunk-03xn8244.js";import{ep,Hi,tp,np,Vi,Ks,Ui,rp,Wi,sp,op,qi,Gi,Ki,Xi}from"./chunk-f1hxrs7b.js";import"./chunk-wfg5379k.js";import"./chunk-2a1eeywj.js";import"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-hg7ys8rn.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
6
6
|
`),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
|
|
7
7
|
<script data-craft-hydration>
|
|
8
8
|
window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
|
|
9
|
-
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{
|
|
9
|
+
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{ep as CRAFT_BRIDGE_SCRIPT,Ks as CRAFT_COMPONENTS,rp as CRAFT_COMPONENT_RUNTIME,Ui as CRAFT_COMPONENT_STYLES,Xs as NATIVE_COMPONENTS,qi as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Ji as compileToNative,Yi as createHotReloadServer,Gi as findCraftBinary,Hi as generateCraftBridgeScript,V as generateCraftOptimizations,Xi as getAvailableFormats,Ki as getAvailableTargets,op as getCraftComponents,G as getSSRCacheStats,Vi as injectCraftBridge,tp as isCraftEnvironment,Y as prerenderForCraft,Wi as processCraftComponents,np as processCraftDirective,sp as registerCraftComponent,Q as renderSSR};
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { partialsCache } from "../includes.js";
|
|
14
14
|
import { pageShipsSignalsRuntime } from "../runtime-injection.js";
|
|
15
15
|
import { BUILD_ID_HEADER, getBuildId } from "../build-id.js";
|
|
16
|
+
import { generateOfflineWorker, OFFLINE_WORKER_PATH } from "../offline/app-service-worker.js";
|
|
16
17
|
import { decodeTitleEntities, FRAGMENT_CACHE_CONTROL, spaNavVaryHeaders } from "../spa-nav.js";
|
|
17
18
|
import { stateDir } from "../state-dir.js";
|
|
18
19
|
import { plugin as stxPlugin } from "../plugin.js";
|
|
@@ -367,7 +368,15 @@ export async function serveApp(appDir = ".", options = {}) {
|
|
|
367
368
|
const server = serve({
|
|
368
369
|
port: actualPort,
|
|
369
370
|
async fetch(request) {
|
|
370
|
-
const url = new URL(request.url),
|
|
371
|
+
const url = new URL(request.url), offline = options.stxOptions?.offline ?? projectConfig.offline;
|
|
372
|
+
if (url.pathname === OFFLINE_WORKER_PATH && offline?.enabled) {
|
|
373
|
+
if (!["GET", "HEAD"].includes(request.method))
|
|
374
|
+
return new Response("Method Not Allowed", { status: 405, headers: { Allow: "GET, HEAD" } });
|
|
375
|
+
return new Response(request.method === "HEAD" ? null : generateOfflineWorker(offline, getBuildId()), {
|
|
376
|
+
headers: { "Content-Type": "application/javascript; charset=utf-8", "Cache-Control": "no-store", "Service-Worker-Allowed": "/" }
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
const publicDirName = projectConfig?.publicDir || "public", publicPath = path.join(absoluteAppDir, publicDirName, url.pathname), distPath = path.join(absoluteAppDir, url.pathname), outputPath = path.join(outputDir, url.pathname);
|
|
371
380
|
if ([publicPath, distPath, outputPath].some((file) => isServerApiSource(file, absoluteAppDir, serverApi)))
|
|
372
381
|
return new Response("Not Found", { status: 404 });
|
|
373
382
|
const [publicStat, distStat, outputStat] = await Promise.all([
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-
|
|
2
|
+
import{As,Bt,kc,vu}from"./chunk-6e60jp4a.js";import{Rs,ei,hu,yu,bu}from"./chunk-49c5v5fh.js";import{wc,xc,Sc,gu,mu}from"./chunk-sq4w1e1g.js";import{He,Sn,ti}from"./chunk-e26pxzjj.js";import{wu,xu,Su,ku,Ps,Yp}from"./chunk-vxrhvrr9.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
3
|
+
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-jecmxby7.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
|
|
|
233
233
|
}, 5000);
|
|
234
234
|
</script>
|
|
235
235
|
</body>
|
|
236
|
-
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=He(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=
|
|
236
|
+
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=He(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=As(n,t);if(a){let s=Bt(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return ei(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,xc as auditBuildOutput,wc as auditConfig,re as buildPwaAssets,Sc as calculateAuditResult,mu as formatAuditResult,ti as formatSize,j as generateManifest,_ as generateManifestJson,yu as generateManifestLink,F as generateOfflinePage,He as generatePrecacheManifest,Sn as generatePrecacheManifestJs,M as generatePwaIcons,Rs as generatePwaTags,As as generateServiceWorker,vu as generateServiceWorkerAuto,hu as generateSwRegistrationScript,bu as generateThemeColorMeta,N as getExpectedIconPaths,Bt as getServiceWorkerFileName,ei as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,kc as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,Ps as pwaDirectives,wu as pwaInstallDirective,Su as pwaOfflineDirective,ku as pwaPushDirective,xu as pwaUpdateDirective,Yp as registerPwaDirectives,gu as runPwaAudit,D as validateManifest};
|
package/dist/ssg.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-374nhgyf.js";import{y,
|
|
3
|
-
`)}function
|
|
2
|
+
import"./chunk-374nhgyf.js";import{y,sc}from"./chunk-w28wc7mv.js";import"./chunk-gtktv6nn.js";import"./chunk-6beg47t4.js";import{Et}from"./chunk-5nfb4gxk.js";import"./chunk-t6m5d64b.js";import"./chunk-remsyfdx.js";import"./chunk-tenbwcts.js";import{wt,xt,St,kt,_t,Ct}from"./chunk-gymmbbzc.js";import{i}from"./chunk-42qtadka.js";import{ts}from"./chunk-nbjyed3q.js";import"./chunk-912r15hr.js";import"./chunk-qb806pks.js";import{Ee,Xt,Jt}from"./chunk-5nrqc6v4.js";import"./chunk-yhfm939b.js";import{h}from"./chunk-bmqker64.js";import{gt,o}from"./chunk-rs67af2x.js";import"./chunk-brcj3953.js";import"./chunk-th45zgbz.js";import"./chunk-ypwetty7.js";import"./chunk-tdwqwxhf.js";import"./chunk-9bgb9n12.js";import{ea,ta,na}from"./chunk-rspe6qa5.js";import{Gt,Fn,zn}from"./chunk-bpf3xxng.js";import{Kt}from"./chunk-h3bdqqzy.js";import"./chunk-2a1eeywj.js";import{q,ye}from"./chunk-e97xj3rf.js";import"./chunk-zt5hp5w5.js";import"./chunk-hg7ys8rn.js";import{c}from"./chunk-xvs84gas.js";import{r,fe}from"./chunk-9tg4995v.js";import k from"fs";import p from"path";import{createHash as Pt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(t){return Bun.hash(t).toString(16)}function at(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let a=new Map,s=t.replace(Dt,(e,u,f,x)=>{let m=x.trim();if(!m)return e;if(/\bdata-stx-src=/.test(f))return e;if(n.minify)m=$t(m);let b=Rt(m);if(!a.has(b))a.set(b,m);let v=n.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(m).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${b}.js"${v}${f}></script>`}),l=Array.from(a,([e,u])=>({hash:e,code:u}));return{html:s,chunks:l}}var It=new Set(["visible","idle"]);function ot(t){if(!t.includes("data-stx-src="))return t;let n=new Map,a=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,s;while((s=a.exec(t))!==null)n.set(s[1],s[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(n.get(u[1])||""))l.add(u[2]);let f=t.lastIndexOf("</head>");if(l.size===0||f===-1)return t;let x=Array.from(l).filter((m)=>!t.includes(`rel="prefetch" href="${m}"`)).map((m)=>`<link rel="prefetch" href="${m}" as="script">`).join("");if(!x)return t;return t.slice(0,f)+x+t.slice(f)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function K(t){let n=t.trim();if(!n)return null;let a=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(a).origin+new URL(a).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let n of Bt){let a=t[n];if(!a)continue;let s=K(a);if(s)return{url:s,source:"env",via:n}}return null}function ct(t){if(!t||typeof t!=="object")return null;let n=t,a=n.site?.url??n.url??n.app?.url;return typeof a==="string"?K(a):null}async function Ft(t){let{existsSync:n}=await import("fs"),a=await import("path");for(let s of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=a.resolve(t,s);if(!n(l))continue;try{let e=await import(l),u=ct(e.default??e);if(u)return u}catch{}}return null}async function lt(t={}){let n=t.cwd??process.cwd(),a=t.env??process.env;if(t.explicit){let u=K(t.explicit);if(u)return{url:u,source:"option"}}let s=ct(t.stxConfig);if(s)return{url:s,source:"stx.config",via:"site.url"};let l=await Ft(n);if(l)return{url:l,source:"site.config",via:"url"};let e=jt(a);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ut(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
|
|
3
|
+
`)}function W(t){return async()=>({paths:await t(),fallback:!1})}var Tt;function Ot(t){let n=r(t),{depths:a}=fe(n),s=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=s.exec(n))!==null){if(a[l.index]!==0)continue;let u=y(n,"(",")",s.lastIndex-1),f=n.indexOf("{",u+1),x=y(n,"{","}",f);if(u<0||f<0||x<0)break;return t.slice(l.index,x+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(n))!==null){if(a[l.index]!==0)continue;let u=sc(n,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function dt(t){let n="read";try{let a=await Bun.file(t).text();n="parse";let s=Kt(a),l=[...s.server,...s.client,...s.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>a.indexOf(e.fullTag)-a.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Tt??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let f=Ot(u);if(/\bdefineStaticPaths\b/.test(r(f))&&Et(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let x=Function("defineStaticPaths",`return (${f})`)(W);if(typeof x!=="function")throw TypeError("getStaticPaths must be a function");let m=await x();n="result";let b=Array.isArray(m)?{paths:m}:m;if(!b||typeof b!=="object"||!("paths"in b)||!Array.isArray(b.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let v of b.paths)if(!v||typeof v!=="object"||!v.params||typeof v.params!=="object"||Array.isArray(v.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:b}}return{kind:"absent"}}catch(a){return{kind:"error",phase:n,error:a instanceof Error?a:Error(String(a))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=p.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[a,s]of Object.entries(n))this.cache.set(a,s)}catch{}this.loaded=!0}async save(){await k.promises.mkdir(this.cacheDir,{recursive:!0});let t=p.join(this.cacheDir,"build-cache.json"),n={};for(let[a,s]of this.cache)n[a]=s;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let a=k.statSync(t),s=`${this.salt}|${t}:${a.mtimeMs}`;for(let e of n)if(k.existsSync(e)){let u=k.statSync(e);s+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<s.length;e++){let u=s.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,n){let a=this.cache.get(t);if(!a)return null;let s=this.getHash(n,a.dependencies??[]);if(a.hash!==s)return this.cache.delete(t),null;return a.html}set(t,n,a,s){let l=this.getHash(n,a);this.cache.set(t,{hash:l,html:s,generatedAt:Date.now(),dependencies:a})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return p.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let a=this.getFilePath(t);await k.promises.mkdir(p.dirname(a),{recursive:!0}),await Bun.write(a,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await k.promises.unlink(n)}async invalidatePattern(t){let n=p.join(this.cacheDir,"isr");if(!k.existsSync(n))return;let a=await k.promises.readdir(n);for(let s of a){let l=s.replace(/_/g,"/").replace(".json","");if(t.test(l))await k.promises.unlink(p.join(n,s))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function At(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let a=await dt(t.filePath);if(a.kind==="error")throw Error(`getStaticPaths ${a.phase} failed for ${t.pattern} (${t.filePath}): ${a.error.message}`,{cause:a.error});if(a.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let s=a.value;if(s.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let l of s.paths){let e=t.pattern;for(let[u,f]of Object.entries(l.params))e=e.replace(`:${u}`,f).replace(`:${u}*`,f);n.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return n}async function Lt(t){let n=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let a of n)if(await Bun.file(a).exists())try{let s=await import(a);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:l,...e}=s;return e}}catch(s){console.error(`Error loading data file ${a}:`,s)}return null}async function Ut(t,n,a){let s=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!s)return null;let l=s[1];if(!l.includes("getStaticProps"))return null;try{let e=l.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
|
|
4
4
|
return (async function getStaticProps() {
|
|
5
5
|
${e[1]}
|
|
6
6
|
})()
|
|
@@ -37,7 +37,7 @@ ${t.map((s)=>{let l=new URL(s.loc,n).href,e=` <url>
|
|
|
37
37
|
${a.join(`
|
|
38
38
|
`)}
|
|
39
39
|
</channel>
|
|
40
|
-
</rss>`}async function Vt(t={}){let n=Date.now();Jt();let a=await i(process.cwd()),s=a.build||{},l=await lt({explicit:t.domain||s.domain,stxConfig:a});if(l.source==="fallback"&&(t.sitemap??s.sitemap??!0))console.warn(ut());let e={router:t.router??a?.router??{},pagesDir:t.pagesDir||s.pagesDir||"pages",outputDir:t.outputDir||s.outputDir||"dist",baseUrl:t.baseUrl||s.baseUrl||"/",domain:l.url,revalidate:t.revalidate??s.revalidate??!1,sitemap:t.sitemap??s.sitemap??!0,sitemapExclude:t.sitemapExclude||s.sitemapExclude||[],robots:t.robots??s.robots??!0,rss:t.rss??s.rss??!1,concurrency:t.concurrency||s.concurrency||10,cache:t.cache??s.cache??!0,cacheDir:t.cacheDir||s.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??s.minify??!0,generate404:t.generate404??s.generate404??!0,publicDir:t.publicDir||s.publicDir||"public",trailingSlash:t.trailingSlash??s.trailingSlash??!1,cleanOutput:t.cleanOutput??s.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||a?.partialsDir||"",componentsDir:t.componentsDir||a?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},f=new Set,x=0,m={},b={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&k.existsSync(e.outputDir))await k.promises.rm(e.outputDir,{recursive:!0});await k.promises.mkdir(e.outputDir,{recursive:!0});let R=e.cacheSalt;if(!R){let{resolveUserCssConfig:d,fingerprintConfig:w}=await import("./chunk-
|
|
40
|
+
</rss>`}async function Vt(t={}){let n=Date.now();Jt();let a=await i(process.cwd()),s=a.build||{},l=await lt({explicit:t.domain||s.domain,stxConfig:a});if(l.source==="fallback"&&(t.sitemap??s.sitemap??!0))console.warn(ut());let e={router:t.router??a?.router??{},pagesDir:t.pagesDir||s.pagesDir||"pages",outputDir:t.outputDir||s.outputDir||"dist",baseUrl:t.baseUrl||s.baseUrl||"/",domain:l.url,revalidate:t.revalidate??s.revalidate??!1,sitemap:t.sitemap??s.sitemap??!0,sitemapExclude:t.sitemapExclude||s.sitemapExclude||[],robots:t.robots??s.robots??!0,rss:t.rss??s.rss??!1,concurrency:t.concurrency||s.concurrency||10,cache:t.cache??s.cache??!0,cacheDir:t.cacheDir||s.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??s.minify??!0,generate404:t.generate404??s.generate404??!0,publicDir:t.publicDir||s.publicDir||"public",trailingSlash:t.trailingSlash??s.trailingSlash??!1,cleanOutput:t.cleanOutput??s.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||a?.partialsDir||"",componentsDir:t.componentsDir||a?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},f=new Set,x=0,m={},b={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&k.existsSync(e.outputDir))await k.promises.rm(e.outputDir,{recursive:!0});await k.promises.mkdir(e.outputDir,{recursive:!0});let R=e.cacheSalt;if(!R){let{resolveUserCssConfig:d,fingerprintConfig:w}=await import("./chunk-r8hszntk.js");try{R=w(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-g2v6c7kf.js"),D=await S(e.publicDir,e.outputDir);if(D.count>0)console.log(`Optimized ${D.count} image(s) for responsive delivery`),R=[R,D.fingerprint].filter(Boolean).join(":");let F=new pt(e.cacheDir,R);if(e.cache)await F.load();try{let{generateCss:d}=await import("./chunk-r8hszntk.js");await d('<div class="bg-black"></div>')}catch{}wt();let mt=a?.routeMiddleware?.dir||"middleware";await St(process.cwd(),mt);let J=xt();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let yt=a?.routeMiddleware?.global||[];na(a?.layoutsDir,c(process.cwd()));let Y=q(".",{pagesDir:e.pagesDir,pagesDirs:a?._layerPageDirs});console.log(`Found ${Y.length} routes`);let U=[];for(let d of Y)try{let w=await At(d);for(let P of w)U.push({route:d,url:P.url,params:P.params,props:P.props,revalidate:P.revalidate??e.revalidate})}catch(w){let P=w instanceof Error?w:Error(String(w));u.failedCount++,u.errors.push({route:d.pattern,error:P}),await e.hooks.onError?.(P,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,P)}u.totalPages=U.length+u.failedCount,console.log(`Generating ${U.length} pages...`);let M=[],Z=[];for(let d=0;d<U.length;d+=e.concurrency)Z.push(U.slice(d,d+e.concurrency));for(let d of Z)await Promise.all(d.map(async(w)=>{let{route:P,url:g,params:_,props:bt,revalidate:et}=w;try{await e.hooks.onPageStart?.(g);let T=await Bun.file(P.filePath).text(),O=Qt(T),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],rt=[...yt,...vt];if(rt.length>0){let I=kt(g,_,O||{}),A=_t(I,null,void 0,{isServer:!0}),B=await Ct(rt,A);if(B.redirect){let E=typeof B.redirect==="string"?B.redirect:B.redirect.path||B.redirect,N=te(String(E),g),L=ee(g,e);await k.promises.mkdir(p.dirname(L),{recursive:!0}),await Bun.write(L,N),u.successCount++,u.pages.push({route:g,outputPath:L,size:Buffer.byteLength(N),cached:!1}),M.push({loc:g,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${g} \u2192 redirect to ${E}`);return}if(B.abort){let E=typeof B.abort==="string"?B.abort:B.abort?.error?.message||"aborted";console.warn(` \u21B3 ${g} \u2014 middleware aborted: ${E}`);return}}let nt=T.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(nt)try{if(!await Function("route",`
|
|
41
41
|
const validate = ${nt[1]};
|
|
42
42
|
return validate(route);
|
|
43
43
|
`)({params:_})){console.warn(`Validation failed for ${g}, skipping...`);return}}catch{}let C=null,it=!1;if(e.cache){if(C=F.get(g,P.filePath),C)it=!0,u.cachedCount++}if(!C){let I=await ft(P,_,bt,e,a);if(C=I.html,e.failOnIncludeError&&I.includeFailures.length>0)throw Error(`${I.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
|
@@ -69,7 +69,7 @@ ${d}`)}if(e.cache)await F.save();if(e.generate404){let d=p.join(e.pagesDir,"404.
|
|
|
69
69
|
<a href="/">Go home</a>
|
|
70
70
|
</div>
|
|
71
71
|
</body>
|
|
72
|
-
</html>`)}for(let d of[500]){let w=p.join(e.pagesDir,`${d}.stx`);if(await Bun.file(w).exists()){let P=new Set,g={...a,debug:!1,cache:!1},_=await o(await Bun.file(w).text(),{},w,g,P);await Bun.write(p.join(e.outputDir,`${d}.html`),_)}}let V=p.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,w={...a,debug:!1,cache:!1},P=await o(await Bun.file(V).text(),{},V,w,d);await Bun.write(p.join(e.outputDir,"error.html"),P)}if(e.sitemap&&M.length>0){let d=Wt(M,e.domain),w=p.join(e.outputDir,"sitemap.xml");await Bun.write(w,d),u.sitemapPath=w,console.log(`Generated sitemap.xml with ${M.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},w=[...e.sitemapExclude.filter((g)=>typeof g==="string"),...d.disallow||[]],P=
|
|
72
|
+
</html>`)}for(let d of[500]){let w=p.join(e.pagesDir,`${d}.stx`);if(await Bun.file(w).exists()){let P=new Set,g={...a,debug:!1,cache:!1},_=await o(await Bun.file(w).text(),{},w,g,P);await Bun.write(p.join(e.outputDir,`${d}.html`),_)}}let V=p.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,w={...a,debug:!1,cache:!1},P=await o(await Bun.file(V).text(),{},V,w,d);await Bun.write(p.join(e.outputDir,"error.html"),P)}if(e.sitemap&&M.length>0){let d=Wt(M,e.domain),w=p.join(e.outputDir,"sitemap.xml");await Bun.write(w,d),u.sitemapPath=w,console.log(`Generated sitemap.xml with ${M.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},w=[...e.sitemapExclude.filter((g)=>typeof g==="string"),...d.disallow||[]],P=ts({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...w.length>0?{disallow:w}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(p.join(e.outputDir,"robots.txt"),P),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},w=[];if(d.getItems)w=await d.getItems();let P=qt(d,w),g=p.join(e.outputDir,"rss.xml");await Bun.write(g,P),u.rssPath=g,console.log(`Generated rss.xml with ${w.length} items`)}let z=ea(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let H=ta(e.outputDir);if(H.assets>0)console.log(`Externalized ${H.assets} repeated asset(s) from ${H.pages} page(s) (${(H.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&k.existsSync(e.publicDir))await X(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let tt=zn();if(tt)await X(tt,p.join(e.outputDir,Fn)),console.log(`Copied assets from ${Gt}`)}catch(R){throw await e.hooks.onError?.(R),R}if(u.buildTime=Date.now()-n,f.size>0){u.islandChunks={count:f.size,totalBytes:x};let R={generatedChunks:f.size,totalBytes:x,chunks:m,pages:b};await Bun.write(p.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(R,null,2))}await e.hooks.onBuildEnd?.(u);let v=u.islandChunks?`
|
|
73
73
|
Island chunks: ${u.islandChunks.count} (${(u.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
74
74
|
Build complete!
|
|
75
75
|
Total: ${u.totalPages} pages
|
|
@@ -77,7 +77,7 @@ Build complete!
|
|
|
77
77
|
Cached: ${u.cachedCount}
|
|
78
78
|
Failed: ${u.failedCount}
|
|
79
79
|
Time: ${u.buildTime}ms${v}
|
|
80
|
-
`),u}async function X(t,n){await k.promises.mkdir(n,{recursive:!0});let a=await k.promises.readdir(t,{withFileTypes:!0});for(let s of a){let l=p.join(t,s.name),e=p.join(n,s.name);if(s.isDirectory())await k.promises.mkdir(e,{recursive:!0}),await X(l,e);else await k.promises.copyFile(l,e)}}function Yt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),a=new ht(n),s=t.revalidate||3600;return{async get(l){let e=await a.get(l);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(l).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${s}, stale-while-revalidate=${s*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=
|
|
80
|
+
`),u}async function X(t,n){await k.promises.mkdir(n,{recursive:!0});let a=await k.promises.readdir(t,{withFileTypes:!0});for(let s of a){let l=p.join(t,s.name),e=p.join(n,s.name);if(s.isDirectory())await k.promises.mkdir(e,{recursive:!0}),await X(l,e);else await k.promises.copyFile(l,e)}}function Yt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),a=new ht(n),s=t.revalidate||3600;return{async get(l){let e=await a.get(l);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(l).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${s}, stale-while-revalidate=${s*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=q(".",{pagesDir:t.pagesDir||"pages"}).find((v)=>l.match(v.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let f=l.match(u.regex),x={};if(f)u.params.forEach((v,R)=>{x[v]=f[R+1]});let m=await i(),{html:b}=await ft(u,x,{},t,m);await a.set(l,{html:b,generatedAt:Date.now(),revalidateAfter:Date.now()+s*1000,etag:zt(b)}),console.log(`Revalidated: ${l}`)},async invalidate(l){if(typeof l==="string")await a.invalidate(l);else await a.invalidatePattern(l)}}}function Zt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),a=n.match(/^---\n([\s\S]*?)\n---/),s={},l=n;if(a){let m=a[1];l=n.slice(a[0].length).trim();for(let b of m.split(`
|
|
81
81
|
`)){let v=b.indexOf(":");if(v>0){let R=b.slice(0,v).trim(),S=b.slice(v+1).trim();if(S==="true")S=!0;else if(S==="false")S=!1;else if(/^\d+$/.test(S))S=parseInt(S,10);else if(/^\d+\.\d+$/.test(S))S=parseFloat(S);else if(S.startsWith("[")&&S.endsWith("]"))S=S.slice(1,-1).split(",").map((D)=>D.trim().replace(/^['"]|['"]$/g,""));s[R]=S}}}let e=l.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),u=[],f=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,x;while((x=f.exec(e))!==null){let m=parseInt(x[1],10),b=x[2],v=b.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:v,text:b,level:m})}return{content:e,data:s,toc:u}}}}function Qt(t){return gt(t)}function te(t,n){return`<!DOCTYPE html>
|
|
82
82
|
<html>
|
|
83
83
|
<head>
|
|
@@ -90,4 +90,4 @@ Build complete!
|
|
|
90
90
|
<p>Redirecting to <a href="${t}">${t}</a>...</p>
|
|
91
91
|
<script>window.location.replace('${t}')</script>
|
|
92
92
|
</body>
|
|
93
|
-
</html>`}function ee(t,n){if(t==="/"||t==="")return p.join(n.outputDir,"index.html");let a=t.replace(/^\/|\/$/g,"");if(n.trailingSlash)return p.join(n.outputDir,a,"index.html");return p.join(n.outputDir,`${a}.html`)}var je={generateStaticSite:Vt,createISRHandler:Yt,defineStaticPaths:
|
|
93
|
+
</html>`}function ee(t,n){if(t==="/"||t==="")return p.join(n.outputDir,"index.html");let a=t.replace(/^\/|\/$/g,"");if(n.trailingSlash)return p.join(n.outputDir,a,"index.html");return p.join(n.outputDir,`${a}.html`)}var je={generateStaticSite:Vt,createISRHandler:Yt,defineStaticPaths:W,createMarkdownLoader:Zt};export{Yt as createISRHandler,Zt as createMarkdownLoader,Mt as declaresPageAction,je as default,W as defineStaticPaths,Vt as generateStaticSite,Ht as isExcludedFromSitemap};
|
package/dist/utils.js
CHANGED
|
@@ -27,6 +27,12 @@ import { CLIENT_LOOP_NAMES_KEY, inheritedClientLoopNames } from "./loop-binding.
|
|
|
27
27
|
import { isFallthroughAttribute } from "./builtins/attrs.js";
|
|
28
28
|
import { StxValidationError } from "./errors/types.js";
|
|
29
29
|
import { validateClientScript } from "./script-validation.js";
|
|
30
|
+
function renderExternalComponentScript(script, context, filePath) {
|
|
31
|
+
const opening = /^<script\b([^>]*)>/i.exec(script);
|
|
32
|
+
if (!opening || !/(?:^|\s)src\s*=/i.test(opening[1] ?? ""))
|
|
33
|
+
return null;
|
|
34
|
+
return processExpressions(opening[0], context, filePath) + script.slice(opening[0].length);
|
|
35
|
+
}
|
|
30
36
|
export {
|
|
31
37
|
extractDirectiveNames,
|
|
32
38
|
getPositionInfo,
|
|
@@ -989,7 +995,10 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
|
|
|
989
995
|
const scriptMatch = script.match(/<script([^>]*)>([\s\S]*)<\/script>/i);
|
|
990
996
|
if (!scriptMatch)
|
|
991
997
|
return script;
|
|
992
|
-
const [, attrs, rawContent] = scriptMatch,
|
|
998
|
+
const [, attrs, rawContent] = scriptMatch, external = renderExternalComponentScript(script, componentContext, componentFilePath);
|
|
999
|
+
if (external !== null)
|
|
1000
|
+
return external;
|
|
1001
|
+
const island = await buildComponentIsland(rawContent, componentFilePath, options.buildMode === "compile"), bridge = generateServerDataBridge(island.clientCode, extractBridgeData(componentContext)), { vendorStyleTags } = island, factoryBody = bridge ? `function(__scopeId) {
|
|
993
1002
|
${bridge}
|
|
994
1003
|
return (${island.factoryBody})(__scopeId);
|
|
995
1004
|
}` : island.factoryBody, factoryId = hydrateTrigger ? null : registerComponentClientFactory(parentContext, factoryBody), wrappedContent = factoryId ? `window.__stxComponentFactories[${JSON.stringify(factoryId)}](${JSON.stringify(scopeId)});` : `(${factoryBody})(${JSON.stringify(scopeId)});`;
|
|
@@ -1009,6 +1018,9 @@ return (${island.factoryBody})(__scopeId);
|
|
|
1009
1018
|
` + preservedStyle;
|
|
1010
1019
|
if (clientScripts.length > 0) {
|
|
1011
1020
|
const eventBindings = componentContext.__stx_event_bindings || [], serverData = extractBridgeData(componentContext), transformedScripts = await Promise.all(clientScripts.map(async (fullScript) => {
|
|
1021
|
+
const external = renderExternalComponentScript(fullScript, componentContext, componentFilePath);
|
|
1022
|
+
if (external !== null)
|
|
1023
|
+
return external;
|
|
1012
1024
|
const contentMatch = fullScript.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);
|
|
1013
1025
|
if (!contentMatch)
|
|
1014
1026
|
return fullScript;
|
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.682",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -128,12 +128,12 @@
|
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@stacksjs/ts-css": "^0.3.11",
|
|
130
130
|
"@stacksjs/clapp": "^0.2.16",
|
|
131
|
-
"@stacksjs/desktop": "0.2.
|
|
132
|
-
"@stacksjs/sanitizer": "0.2.
|
|
131
|
+
"@stacksjs/desktop": "0.2.682",
|
|
132
|
+
"@stacksjs/sanitizer": "0.2.682",
|
|
133
133
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
134
|
-
"bun-plugin-stx": "0.2.
|
|
134
|
+
"bun-plugin-stx": "0.2.682",
|
|
135
135
|
"bunfig": "^0.15.21",
|
|
136
|
-
"stx-router": "0.2.
|
|
136
|
+
"stx-router": "0.2.682",
|
|
137
137
|
"ts-broadcasting": "^0.0.11",
|
|
138
138
|
"ts-images": "^0.2.22",
|
|
139
139
|
"ts-syntax-highlighter": "^0.2.1"
|
package/dist/chunk-0fjwqs9h.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Yu}from"./chunk-k4x8v39k.js";import"./chunk-2933mvwr.js";import"./chunk-3xyv2fec.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import"./chunk-87em5xdg.js";import"./chunk-wc5tt6da.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Yu as buildApp};
|
package/dist/chunk-0gk78x3r.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ms,xi,$r,Ls,js,_n,Ut,Si,Rr,Ar,Bs,Fs,Iu,Ou,lt}from"./chunk-mn47s2ef.js";export{lt as DeployError,xi as calculateSha1,$r as collectDeployFiles,Ar as createDefaultNetlifyConfig,Ls as createFileManifest,Ms as createNetlifyClient,Iu as deploy,Rr as detectProjectConfig,js as filterRequiredFiles,_n as formatSize,Si as generateNetlifyToml,Ut as getTotalSize,Fs as hasNetlifyConfig,Ou as initNetlify,Bs as writeNetlifyConfig};
|
package/dist/chunk-0v35wpm7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{be,vs,iu,Op,au,Np,Ot,d,H,J,mn,we,cu,Fo,lu,Dp,k,uu,Mp,_,Lp}from"./chunk-87em5xdg.js";import"./chunk-wc5tt6da.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{uu as applyFilters,Np as clearCustomFilters,cu as clientLoopScopes,vs as defaultFilters,mn as escapeAttributeValue,d as escapeHtml,H as escapeHtmlValue,J as escapeInterpolatedHtmlValue,_ as evaluateExpression,be as findMustacheEnd,au as getAllFilters,lu as interpolateScriptAttributes,Fo as interpolateScriptExpressions,Dp as interpolateScriptsInTemplate,k as processExpressions,iu as registerFilter,Op as registerFilters,Ot as replaceInterpolations,Mp as resetRejectedExpressionWarnings,Lp as unescapeHtml,we as usesSignalsInScript};
|
package/dist/chunk-1dkcakve.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Vo,Ss,l,p,E,tt,u,ks,t,a,y}from"./chunk-qwdcts9w.js";import{be,$t,G,z,Ot,J,k}from"./chunk-87em5xdg.js";import{Xn}from"./chunk-1j0sarne.js";import{ne}from"./chunk-xnx06qqt.js";import{Kr}from"./chunk-dxh45gve.js";var de=1000,pe=!1;function he(n,r){let c=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=c.exec(n))!==null){let g=i.index+i[0].length,x=i.index+i[0].indexOf("("),b=y(n,"(",")",x);if(b===-1)continue;let d=n.slice(g,b).trim();if(!d)continue;if(!Object.keys(r).some((f)=>new RegExp(`(?:^|[^\\w$.])${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(d)))continue;let m;try{let f=E(d,r);if(!f||typeof f!=="object")continue;m=JSON.stringify(f)}catch{continue}e+=n.slice(o,g)+m,o=b,c.lastIndex=b}return o===0?n:e+n.slice(o)}function me(n,r){let c=/@component\s*\(/g,e=n,o,i=[];while((o=c.exec(e))!==null){let g=o.index,x=g+o[0].length-1,b=1,d=x+1;while(d<e.length&&b>0){if(e[d]==="(")b++;else if(e[d]===")"){if(b--,b===0)break}d++}if(b!==0)continue;let s=e.substring(x+1,d),m=d+1,f=s.match(/^\s*['"]([^'"]+)['"]/);if(!f)continue;let _=f[1],h=s.slice(f[0].length),w=h.match(/^\s*,\s*/);if(!w)continue;let I=h.slice(w[0].length).trim();if(!I)continue;try{let F=E(I,r),j=JSON.stringify(F),S=`@component('${_}', ${j})`;i.push({start:g,end:m,replacement:S})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:x,end:b,replacement:d}=i[g];e=e.substring(0,x)+d+e.substring(b)}return e}function oe(n,r,c){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,x=g+i[0].length-1,b=1,d=x+1,s=null,m=!1;while(d<e.length&&b>0){let h=e[d];if(m){m=!1,d++;continue}if(h==="\\"&&s){m=!0,d++;continue}if(s){if(h===s)s=null;d++;continue}if(h==='"'||h==="'"||h==="`"){s=h,d++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}d++}if(b!==0)break;let f=e.substring(x+1,d),_=c(f);e=e.substring(0,g)+_+e.substring(d+1)}return e}function xe(n,r){let c=n;return c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(z(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),x=Object.values(r);Vo(i);let b=!1,s=u(i,g,()=>{b=!0})(...x);if(b)return e;let m=JSON.stringify(s);if(m===void 0){if(!tt(i).some((h)=>!(h in r)))return"";return e}let f=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${f}"`}catch(g){return e}}),c}var ee="<!--__STX_BREAK__-->",te="<!--__STX_CONTINUE__-->";function le(n,r){let c=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=c.exec(n);i;i=c.exec(n)){if(!i[1]){let d=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",c.lastIndex):be(n,i.index,d);if(s<0)break;c.lastIndex=s+(i[0]==="{!!"?3:d);continue}let g=c.lastIndex,x=!0,b=/^\s*\(/.exec(n.slice(g));if(b){let d=g+b[0].length-1,s=y(n,"(",")",d);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(d+1,s).trim()})`;x=p(m)?Boolean(u(m,Object.keys(r))(...Object.values(r))):Boolean(l(m,r))}catch{x=!1}}if(e+=n.slice(o,i.index),x)return e+(i[1]==="break"?ee:te);o=g,c.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),c="",e=0;return Ot(n,(o,i,g)=>(c+=ie(r(n.slice(e,g))),c+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),c+ie(r(n.slice(e)))}function ue(n,r,c,e){return J(n,r,c==null?"":String(c),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(c)=>{let e=c.trim();if(!ks(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(c)=>{let e=c.trim();if(!ks(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function ye(n){let r=/@forelse\s*\(/g,c,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let x=[],b=0;for(let s of e)b+=s.delta,x.push({pos:s.pos,depth:b});function d(s){let m=0,f=x.length-1,_=0;while(m<=f){let h=m+f>>1;if(x[h].pos<=s)_=x[h].depth,m=h+1;else f=h-1}return _}while((c=r.exec(n))!==null){if(d(c.index)>0)continue;let s=c.index,m=c.index+c[0].length-1,f=1,_=m+1,h=-1;while(_<n.length&&f>0){if(n[_]==="(")f++;else if(n[_]===")"){if(f--,f===0){h=_;break}}_++}if(h===-1)continue;let w=n.substring(m+1,h),I=$t(w);if(!I)continue;let{arrayExpr:F,itemVar:j}=I,S=h+1,R=1,W=S,D=/@forelse\s*\(/g,P=/@endforelse/g,L=-1;while(R>0&&W<n.length){D.lastIndex=W,P.lastIndex=W;let C=D.exec(n),A=P.exec(n);if(!A)break;if(C&&C.index<A.index)R++,W=C.index+C[0].length;else{if(R--,R===0){L=A.index;break}W=A.index+11}}if(L===-1)continue;let O=n.substring(S,L),K=L+11,T=-1,U=0,V=0;while(V<O.length){let C=O.indexOf("@",V);if(C===-1)break;let A=O.substring(C);if(/^@forelse\s*\(/.test(A))U++,V=C+1;else if(A.startsWith("@endforelse"))U--,V=C+11;else if(U===0&&A.startsWith("@empty")){if(O.length<=C+6||!/[a-z]/i.test(O[C+6])){T=C;break}V=C+1}else V=C+1}if(T===-1)continue;return{start:s,end:K,arrayExpr:F,itemVar:j,foreachContent:O.substring(0,T),emptyContent:O.substring(T+6)}}return null}function ce(n,r){let c=n;while(!0){let e=ye(c);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:x,foreachContent:b,emptyContent:d}=e;try{let s;if(p(g))s=u(g,Object.keys(r))(...Object.values(r));else s=l(g,r);let m;if(!Array.isArray(s)||s.length===0)m=d;else m=`@foreach (${g} as ${x})${b}@endforeach`;c=c.substring(0,o)+m+c.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),f=a("Forelse",`Error in @forelse(${g} as ${x}): ${m}`,t.EVALUATION_ERROR);c=c.substring(0,o)+f+c.substring(i)}}return c}var fe="<!--stx:foreach-not-iterable:",Ee=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function _e(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function $e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Lr(n){if(!n.includes(fe))return n;return n.replace(Ee,(r,c,e)=>($e(decodeURIComponent(c),decodeURIComponent(e)),""))}function Gn(n,r,c,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of Xn(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function x(s){let m=/@foreach\s*\(/g,f;while((f=m.exec(s))!==null){let _=f.index,h=f.index+f[0].length-1,w=1,I=h+1,F=-1;while(I<s.length&&w>0){if(s[I]==="(")w++;else if(s[I]===")"){if(w--,w===0){F=I;break}}I++}if(F===-1)continue;let j=s.substring(h+1,F),S=$t(j);if(!S)continue;let R=_,{arrayExpr:W,itemVar:D}=S,P=F+1,L=1,O=P,K=/@foreach\s*\(/g,T=/@endforeach/g;while(L>0&&O<s.length){K.lastIndex=O,T.lastIndex=O;let U=K.exec(s),V=T.exec(s);if(!V)break;if(U&&U.index<V.index)L++,O=U.index+U[0].length;else{if(L--,L===0){let C=s.substring(P,V.index),A=V.index+11;return{start:R,end:A,arrayExpr:W,itemVar:D,content:C}}O=V.index+11}}}return null}function b(s,m){let f=s;while(!0){let _=x(f);if(!_)break;let{start:h,end:w,arrayExpr:I,itemVar:F,content:j}=_;try{let S=I.trim(),R;if(p(S))R=u(S,Object.keys(m))(...Object.values(m));else R=l(S,m);let W=!1;if(!Array.isArray(R))if(R instanceof Map)R=Array.from(R),W=!0;else if(R instanceof Set)R=Array.from(R);else if(typeof R==="string")R=Array.from(R);else if(R&&typeof R==="object"&&!(R instanceof Date)&&!(R instanceof RegExp))R=Object.entries(R),W=!0;else{let A=_e(S,c)+a("Foreach",`Error in @foreach: ${S} is not iterable`,t.TYPE_ERROR);f=f.substring(0,h)+A+f.substring(w);continue}let D=e?.loops?.useAltLoopVariable??pe,P=F.trim(),L=null,O,K=!1;if(P.includes("=>")){let A=P.split("=>").map((M)=>M.trim());if(A.length===2&&A[0]&&A[1])L=A[0],O=A[1];else O=P}else if(!P.startsWith("[")&&!P.startsWith("{")&&P.includes(",")){let A=P.split(",").map((M)=>M.trim());if(A.length===2&&A[0]&&A[1])O=A[0],L=A[1],K=!0;else O=P}else O=P;let T="",U=new Set(G(`${I} as ${F}`)),V=R,C=m[Ss]??new WeakMap;for(let A=0;A<V.length;A++){let M=V[A],re={index:A,iteration:A+1,first:A===0,last:A===V.length-1,count:V.length},N={...m,loop:re,$loop:re,[Ss]:C};if(Array.isArray(m.__stx_client_signal_names))N.__stx_client_signal_names=m.__stx_client_signal_names.filter((X)=>!U.has(X));if(O.startsWith("[")&&O.endsWith("]")){let X=O.slice(1,-1).split(",").map((B)=>B.trim());if(Array.isArray(M))X.forEach((B,Z)=>{if(B)N[B]=M[Z]});else N[O]=M}else if(O.startsWith("{")&&O.endsWith("}")){let X=O.slice(1,-1).split(",").map((B)=>B.trim()).filter(Boolean);if(M!==null&&typeof M==="object")X.forEach((B)=>{let Z=B.indexOf(":"),Q=(Z===-1?B:B.slice(0,Z)).trim(),se=Z===-1?Q:B.slice(Z+1).trim();if(Q&&se)N[se]=M[Q]});else N[O]=M}else N[O]=M;if(L)if(!K&&W&&Array.isArray(M)&&M.length===2)N[L]=M[0],N[O]=M[1];else N[L]=A;let v=ce(j,N);v=Gn(v,N,c,e,!0),v=ne(v,N,c),v=le(v,N);let H=v.indexOf(ee),Y=v.indexOf(te),q=H<0?Y:Y<0?H:Math.min(H,Y);if(q>=0)v=v.slice(0,q);if(v=k(v,N,c),v=xe(v,N),v=me(v,N),v=he(v,N),T+=v,q>=0&&q===H)break}f=f.substring(0,h)+T+f.substring(w)}catch(S){let R=a("Foreach",`Error in @foreach(${I.trim()} as ${F.trim()}): ${S instanceof Error?S.message:String(S)}`,t.EVALUATION_ERROR);f=f.substring(0,h)+R+f.substring(w)}}return f}i=b(i,r),i=Ae(i,r,c,e);let d=e?.loops?.maxWhileIterations??de;return i=Oe(i,r,d),o?i:Lr(i)}function _l(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return ks(n)}function Ae(n,r,c,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let x=g.index,b=x+g[0].length-1,d=y(o,"(",")",b);if(d===-1)break;let s=_l(o.slice(b+1,d)),m=d+1,f=Kr(o.slice(x),"for","endfor");if(f.length===0)break;let _=f[0].content,h=x+f[0].end;if(!ge(s)){let w=a("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,x)+w+o.substring(h),i=!0;continue}try{let w=Re(s),I=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(w.length>0&&I){let D=we({forExpr:s,content:_,iterVarNames:w,context:r,filePath:c,options:e});o=o.substring(0,x)+D+o.substring(h),i=!0;continue}let F=Object.keys(r),j=Object.values(r),S=ae(_),W=Function(...F,"__stxRenderLoopValue",`
|
|
3
|
-
let result = '';
|
|
4
|
-
for (${s}) {
|
|
5
|
-
result += \`${S}\`;
|
|
6
|
-
}
|
|
7
|
-
return result;
|
|
8
|
-
`)(...j,(D,P,L)=>ue(_,D,P,L));o=o.substring(0,x)+W+o.substring(h),i=!0}catch(w){let I=a("For",`Error in @for(${s}): ${w instanceof Error?w.message:String(w)}`,t.EVALUATION_ERROR);o=o.substring(0,x)+I+o.substring(h),i=!0}}return o}function Re(n){let r=n.trim(),c=r.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(c){let i=c[1];return i.slice(1,-1).split(",").map((x)=>{let b=x.trim();if(!b)return"";let d=b.indexOf(":");if(d>=0&&i.startsWith("{")){let f=b.slice(d+1).trim(),_=f.indexOf("=");return(_>=0?f.slice(0,_):f).trim()}let s=b.indexOf("="),m=(s>=0?b.slice(0,s):b).trim();return/^[A-Za-z_$][\w$]*$/.test(m)?m:""}).filter(Boolean)}let e=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(e)return[e[1]];let o=r.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(o)return[o[1]];return[]}function we(n){let{forExpr:r,content:c,iterVarNames:e,context:o,filePath:i,options:g}=n,x=Object.keys(o),b=Object.values(o),d=i??"inline.stx",s="";return Function(...x,"__renderIteration",`
|
|
9
|
-
for (${r}) {
|
|
10
|
-
if (!__renderIteration([${e.join(", ")}])) break;
|
|
11
|
-
}
|
|
12
|
-
`)(...b,(f)=>{let _={...o};e.forEach((j,S)=>{_[j]=f[S]});let h=Gn(c,_,d,g,!0);h=ne(h,_,d),h=le(h,_);let w=h.indexOf(ee),I=h.indexOf(te),F=w<0?I:I<0?w:Math.min(w,I);if(F>=0)h=h.slice(0,F);return s+=k(h,_,d),F<0||F!==w}),s}function Oe(n,r,c){let e=n,o=!0;while(o){o=!1;let i=e.match(/@while\s*\(/);if(!i||i.index===void 0)break;let g=i.index,x=g+i[0].length-1,b=y(e,"(",")",x);if(b===-1)break;let d=e.slice(x+1,b),s=Kr(e.slice(g),"while","endwhile");if(s.length===0)break;let m=s[0].content,f=g+s[0].end;if(!ge(d)){let _=a("While",`Unsafe expression in @while: ${d}`,t.UNSAFE_EXPRESSION);e=e.substring(0,g)+_+e.substring(f),o=!0;continue}try{let _=Object.keys(r),h=Object.values(r),w=ae(m),F=Function(..._,"__stxRenderLoopValue",`
|
|
13
|
-
let result = '';
|
|
14
|
-
let maxIterations = ${c}; // Configurable safety limit
|
|
15
|
-
let counter = 0;
|
|
16
|
-
while (${d} && counter < maxIterations) {
|
|
17
|
-
counter++;
|
|
18
|
-
result += \`${w}\`;
|
|
19
|
-
}
|
|
20
|
-
if (counter > maxIterations) {
|
|
21
|
-
result += '<!-- [While Error [1104]]: Maximum iterations (${c}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
`)(...h,(j,S,R)=>ue(m,j,S,R));e=e.substring(0,g)+F+e.substring(f),o=!0}catch(_){let h=a("While",`Error in @while(${d}): ${_ instanceof Error?_.message:String(_)}`,t.EVALUATION_ERROR);e=e.substring(0,g)+h+e.substring(f),o=!0}}return e}
|
|
25
|
-
export{Lr,Gn,_l};
|
package/dist/chunk-1gg5vxe8.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Hd,Vd}from"./chunk-tbb4en1q.js";import"./chunk-vct8a1qf.js";import"./chunk-7z7zp8xq.js";import"./chunk-374nhgyf.js";import"./chunk-1j0sarne.js";import"./chunk-2pvcp0y6.js";import"./chunk-dxh45gve.js";import"./chunk-2933mvwr.js";import"./chunk-3xyv2fec.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import"./chunk-87em5xdg.js";import"./chunk-wc5tt6da.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Vd as clearStoreCache,Hd as getStoreScript};
|
package/dist/chunk-1j0sarne.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{st,dc}from"./chunk-78yjmbbs.js";import{T}from"./chunk-6beg47t4.js";import{L,is,s,an,F,se,Aa,It,fn,Me,Le}from"./chunk-87em5xdg.js";import{Yn}from"./chunk-2pvcp0y6.js";import{q}from"./chunk-a2zb5fgg.js";import{rn}from"./chunk-dxh45gve.js";var j=`(?:"[^"]*"|'[^']*'|[^>"'])*`,H=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Q=65536,J=4,O=new Map;function hp(){O.clear()}function K(e){let o=[];for(let n of se(e,F)){let t=n.token.match(/^<script\b([^>]*)>/i),r=n.token.match(/<\/script\s*>$/i);if(!t||!r)continue;let a=t[0].length,f=n.token.length-r[0].length;o.push(Object.freeze({fullMatch:n.token,attrs:t[1],body:n.token.slice(a,f),start:n.start,end:n.end}))}return o}function Tl(e,o={}){let n=e.length>=Q,t=n?O.get(e):void 0;if(t===void 0){if(t=K(e),n)Aa(O,J),O.set(e,t)}let r=o.skipAttrs;if(!r)return t.slice();let a=[];for(let f of t)if(r.lastIndex=0,!r.test(f.attrs))a.push(f);return a}function co(e){let o=e.trim(),n=o.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(n){let r=n[1].trim(),a=n[2].trim(),{itemVar:f,indexVar:c}=W(a);if(f)return{style:"as",iterable:r,itemVar:f,indexVar:c}}let t=o.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(t){let r=t[1].trim(),a=t[2].trim(),{itemVar:f,indexVar:c}=W(r);if(f)return{style:"in",iterable:a,itemVar:f,indexVar:c}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function W(e){let o=e.trim(),n=o.match(/^(\w+)\s*=>\s*(\w+)$/);if(n)return{itemVar:n[2],indexVar:n[1]};let t=o.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(t)return{itemVar:t[1],indexVar:t[2]||null};let r=o.match(/^(\w+)\s*,\s*(\w+)$/);if(r)return{itemVar:r[1],indexVar:r[2]};let a=o.match(/^(\w+)$/);if(a)return{itemVar:a[1],indexVar:null};return{itemVar:null,indexVar:null}}function Vr(e,o){return dc(e,o)}function Y(e){let o=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,n=0,t;while((t=o.exec(e))!==null){let r=t[1];if(r.startsWith("if"))n++;else if(r==="endif")n--;else if(n===0)return!0}return!1}function Xn(e){let o=new Set,n=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,r;while((r=n.exec(e))!==null){let a=r[1],f;while((f=t.exec(a))!==null)o.add(f[1])}return o}function ee(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let o=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${j})>`,"iy"),n=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,t=se(e,(a,f)=>{o.lastIndex=f;let c=o.exec(a);if(!c||c.index!==f||!n.test(c[2]))return-1;return o.lastIndex}),r=[];for(let a of t){o.lastIndex=0;let f=o.exec(a.token);if(!f)continue;let c=f[2].match(n),p=co(c?.[1]??c?.[2]??""),h=[p.itemVar,p.indexVar].filter(Boolean);if(h.length===0)continue;let i=f[1],g=/\/\s*>$/.test(a.token)||M.has(i.toLowerCase())?a.end:z(e,a.start,i,a.end);if(g!==-1)r.push({start:a.start,end:g,vars:new Set(h)})}return r}var B=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function te(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Z(e,o,n,t){if(!e)return!1;let r=te(e),a=!1,f=!1,c=!1,p=/([a-zA-Z_$][\w$]*)/g,h;while((h=p.exec(r))!==null){let l=h[1];if(r.slice(0,h.index).trimEnd().endsWith("."))continue;if(B.has(l))continue;if(o.has(l)||t?.has(l))a=!0;else if(n&&l in n)f=!0}let i=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,u;while((u=i.exec(r))!==null){let l=u[1];if(r.slice(0,u.index).trimEnd().endsWith("."))continue;if(B.has(l)||n&&l in n)continue;c=!0}return(a||c)&&!f}function N(e,o,n){let t=n===void 0?` ${o}`:` ${o}="${n.replace(/"/g,""")}"`,r=e.trim(),a=r.match(H);if(a&&ne(a[3],a[1])){let[,f,c,p]=a;return`<${f}${c}${t}>${p}</${f}>`}return`<template${t}>${r}</template>`}function ne(e,o){let n=new RegExp(`<(/)?${o}(?=[\\s/>])`,"gi"),t=0,r;while((r=n.exec(e))!==null)if(r[1]){if(t--,t<0)return!1}else t++;return!0}function lo(e,o){let n=Xn(e);function t(r){let a=r,f=ee(r),c=(u)=>{let g=new Set;for(let l of f)if(u>l.start&&u<l.end)for(let d of l.vars)g.add(d);return g},p=/@if\s*\(/g,h,i=[];while((h=p.exec(a))!==null){let u=h.index,g=u+h[0].length,l=1,d=g;while(d<a.length&&l>0){if(a[d]==="(")l++;else if(a[d]===")")l--;d++}if(l!==0)continue;let b=a.substring(g,d-1).trim(),S=d,w=1,E=S,m=/@(if\s*\(|endif)/g;m.lastIndex=S;let x;while((x=m.exec(a))!==null)if(x[1].startsWith("if"))w++;else if(x[1]==="endif"){if(w--,w===0){E=x.index+x[0].length;break}}if(w!==0)continue;let y=a.substring(S,E-6).trim(),R;if(Y(y)){let _=rn(a.substring(u,E));if(_.length===0)continue;let I=_[0].branches.filter((v)=>v.type!=="else"),k=c(u);if(!(I.length>0&&I.every((v)=>Z(v.condition,n,o,k))))continue;R=_[0].branches.map((v)=>{let V=t(v.content);if(v.type==="elseif")return N(V,"@else-if",v.condition??"");if(v.type==="else")return N(V,"@else");return N(V,"@if",v.condition??"")}).join(`
|
|
3
|
-
`)}else{if(!Z(b,n,o,c(u)))continue;R=N(t(y),"@if",b)}i.push({start:u,end:E,replacement:R}),p.lastIndex=E}for(let u=i.length-1;u>=0;u--){let{start:g,end:l,replacement:d}=i[u];a=a.substring(0,g)+d+a.substring(l)}return a}return t(e)}function re(e){let o=e.trim();if(o==="")return;if(o==="true")return!0;if(o==="false")return!1;if(o==="null")return!1;if(o==="undefined")return!1;if(o==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(o)){let r=Number(o);return r!==0&&!Number.isNaN(r)}let n=o.match(/^'((?:\\.|[^'\\])*)'$/);if(n)return n[1].length>0;let t=o.match(/^"((?:\\.|[^"\\])*)"$/);if(t)return t[1].length>0;return}var M=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),U=/<(script|style)\b/iy,ie=/<\/script/gi,oe=/<\/style/gi;function z(e,o,n,t){if(M.has(n.toLowerCase()))return t;let r=n.toLowerCase(),a=e.length,f=1,c=t;while(c<a){let p=e.indexOf("<",c);if(p===-1)return-1;if(c=p,e.startsWith("<!--",c)){let g=e.indexOf("-->",c+4);if(g===-1)return-1;c=g+3;continue}U.lastIndex=c;let h=U.exec(e);if(h){let g=e.indexOf(">",c);if(g===-1)return-1;if(e[g-1]==="/"){c=g+1;continue}let l=h[1].toLowerCase()==="script"?ie:oe;l.lastIndex=c;let d=l.exec(e);if(d===null)return-1;let b=e.indexOf(">",d.index);if(b===-1)return-1;c=b+1;continue}if(e[c+1]==="/"){let g=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(c,c+64));if(!g){c++;continue}if(g[1].toLowerCase()===r){if(f--,c+=g[0].length,f===0)return c;continue}c+=g[0].length;continue}let i=/^<([a-z][\w-]*)\b/i.exec(e.slice(c,c+64));if(!i){c++;continue}let u=e.indexOf(">",c);if(u===-1)return-1;if(i[1].toLowerCase()===r){let g=e.slice(c,u+1);if(!(/\/\s*>$/.test(g)||M.has(r)))f++}c=u+1}return-1}var ce=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ae(e,o){let n=o,t=e.length;for(;;){while(n<t&&e[n]!=="<")n++;if(n>=t)return!1;if(e.startsWith("<!--",n)){let f=e.indexOf("-->",n+4);if(f===-1)return!1;n=f+3;continue}break}if(e[n+1]==="/")return!1;let r=e.indexOf(">",n);if(r===-1)return!1;let a=e.slice(n,r+1);return ce.test(a)}function uo(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let o=[],n=/<([a-zA-Z][\w-]*)/y,t=/\s/,r=new Set([":if",":show","x-if","x-show","@if","@show"]);se(e,(i,u)=>{n.lastIndex=u;let g=n.exec(i);if(!g||/^(?:script|style)$/i.test(g[1]))return-1;let l=n.lastIndex,d;while(l<i.length){let b=l;while(l<i.length&&t.test(i[l]))l++;let S=l;if(i[S]==="/"){S++;while(S<i.length&&t.test(i[S]))S++}if(i[S]===">"){if(d)o.push({start:u,end:S+1,tag:g[1],...d});return-1}if(l===b)return-1;let w=l;while(l<i.length&&!t.test(i[l])&&i[l]!=="="&&i[l]!==">")l++;if(l===w)return-1;let E=i.slice(w,l);if(E.startsWith("@")&&E.includes("("))return-1;let m=l,x=l;while(x<i.length&&t.test(i[x]))x++;if(i[x]!=="="){l=m;continue}x++;while(x<i.length&&t.test(i[x]))x++;let y=i[x];if(y==='"'||y==="'"){let R=i.indexOf(y,x+1);if(R===-1)return-1;if(!d&&y==='"'&&r.has(E))d={attrName:E,attrStart:b,attrEnd:R+1,value:i.slice(x+1,R)};l=R+1}else{l=x;while(l<i.length&&!t.test(i[l])&&i[l]!==">")l++}}return-1});let a=[],f=-1;for(let i of o){let{start:u,end:g,tag:l,attrName:d,value:b}=i;if(u<f)continue;let S=re(b);if(S===void 0)continue;let m=/\/\s*>$/.test(e.slice(u,g))||M.has(l.toLowerCase())?g:z(e,u,l,g);if(m===-1)continue;if((d===":if"||d==="x-if"||d==="@if")&&ae(e,m))continue;if(S===!0){let y=e.slice(u,i.attrStart)+e.slice(i.attrEnd,g);a.push({start:u,end:g,replacement:y});continue}a.push({start:u,end:m,replacement:""}),f=m}if(a.length===0)return e;a.sort((i,u)=>i.start-u.start);let c=[],p=-1;for(let i of a){if(i.start<p)continue;c.push(i),p=i.end}let h=e;for(let i=c.length-1;i>=0;i--){let{start:u,end:g,replacement:l}=c[i];h=h.substring(0,u)+l+h.substring(g)}return h}var G=[":for","@for","x-for"];function Ur(e,o){if(!o||Object.keys(o).length===0)return e;if(!G.some((c)=>e.includes(`${c}=`)))return e;let n=Xn(e);if(Array.isArray(o.__stx_client_signal_names)){for(let c of o.__stx_client_signal_names)if(typeof c==="string")n.add(c)}let t=e,r=[],a=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,f;while((f=a.exec(t))!==null){let[c,p,h]=f,i=f.index,u=i+c.length,g=G.map((R)=>({attr:R,m:new RegExp(`\\s${R}="([^"]*)"`).exec(h)})).find((R)=>R.m!==null);if(!g||!g.m)continue;let l=co(g.m[1]);if(!l.iterable||!l.itemVar)continue;let d=l.iterable.trim().split(/[.[(]/)[0].trim();if(!d||n.has(d)||!(d in o))continue;let b=z(t,i,p,u);if(b===-1)continue;let S=h.replace(new RegExp(`\\s${g.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),w=t.slice(u,b-`</${p}>`.length),E={...o,[l.itemVar]:void 0};if(l.indexVar)E[l.indexVar]=void 0;let m=Ur(w,E),x=l.indexVar?`${l.iterable} as ${l.indexVar} => ${l.itemVar}`:`${l.iterable} as ${l.itemVar}`,y=p.toLowerCase()==="template"?m:`<${p}${S}>${m}</${p}>`;r.push({start:i,end:b,replacement:`@foreach(${x})${y}@endforeach`}),a.lastIndex=b}for(let c=r.length-1;c>=0;c--){let{start:p,end:h,replacement:i}=r[c];t=t.slice(0,p)+i+t.slice(h)}return t}function Wr(e,o){let n=e,t=/@(for|foreach)\s*\(/g,r,a=[],f=[];while((r=t.exec(n))!==null){let c=r[1],p=r.index,h=p+r[0].length,i=1,u=h;while(u<n.length&&i>0){if(n[u]==="(")i++;else if(n[u]===")")i--;u++}if(i!==0)continue;let g=n.substring(h,u-1).trim(),l=u,d=co(g),b=c==="for"?"@endfor":"@endforeach",S=1,w=l,E=c==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${c}\\s*\\(|end${c})`,"g");E.lastIndex=l;let m;while((m=E.exec(n))!==null)if(m[1].startsWith(c))S++;else if(S--,S===0){w=m.index+m[0].length;break}if(S!==0)continue;let x=()=>{let A=[d.itemVar,d.indexVar].filter(Boolean);if(A.length)f.push({start:p,end:w,vars:A})};if(d.iterable){let A=d.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A)){x();continue}let C=A.split(/[.[(]/)[0].trim(),v=o?C in o:!1,V=f.some((P)=>p>P.start&&p<P.end&&P.vars.includes(C));if(C&&(v||V)){x();continue}}if(d.style==="as")g=d.indexVar?`(${d.itemVar}, ${d.indexVar}) in ${d.iterable}`:`${d.itemVar} in ${d.iterable}`;let y=n.substring(l,w-b.length).trim(),R=o?{...o}:{};if(d.itemVar)delete R[d.itemVar];if(d.indexVar)delete R[d.indexVar];let _=Wr(y,R),I=_.match(H),k;if(I){let[,A,C,v]=I;k=`<${A}${C} @for="${g}">${v}</${A}>`}else k=`<template @for="${g}">${_}</template>`;a.push({start:p,end:w,replacement:k}),t.lastIndex=w}for(let c=a.length-1;c>=0;c--){let{start:p,end:h,replacement:i}=a[c];n=n.substring(0,p)+i+n.substring(h)}return n}function le(e){let o=new Set,n=[],t=0,r=0,a=e.length,f=(i)=>{let u=t+1;while(u<a){let g=e[u];if(g==="\\"){u+=2;continue}if(g===i)return u+1;u++}return a},c=()=>{let i=t+2;while(i<a&&e[i]!==`
|
|
4
|
-
`)i++;return i},p=()=>{let i=t+2;while(i<a-1){if(e[i]==="*"&&e[i+1]==="/")return i+2;i++}return a},h=(i)=>{let u=i,g=0;while(u<a){let l=e[u];if(l==="/"&&e[u+1]==="/"){let d=u+2;while(d<a&&e[d]!==`
|
|
5
|
-
`)d++;u=d;continue}if(l==="/"&&e[u+1]==="*"){let d=u+2;while(d<a-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;u=d+2;continue}if(l==='"'||l==="'"||l==="`"){let d=u+1;while(d<a){if(e[d]==="\\"){d+=2;continue}if(e[d]===l){d++;break}d++}u=d;continue}if(l==="("||l==="["||l==="{"){g++,u++;continue}if(l===")"||l==="]"||l==="}"){g--,u++;continue}if(l===";"&&g===0)return u+1;u++}return a};while(t<a){let i=e[t];if(i==="/"&&e[t+1]==="/"){let u=c();n.push(e.slice(t,u)),t=u;continue}if(i==="/"&&e[t+1]==="*"){let u=p();n.push(e.slice(t,u)),t=u;continue}if(i==='"'||i==="'"||i==="`"){let u=f(i);n.push(e.slice(t,u)),t=u;continue}if(i==="{"){r++,n.push(i),t++;continue}if(i==="}"){r--,n.push(i),t++;continue}if(r===0){let u=t>0?e[t-1]:"";if(u===""||/\s/.test(u)||u===";"||u==="}"||u==="{"){let l=e.slice(t).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(l){let d=l[2],b=h(t+l[0].length);if(o.has(d)){n.push(`/* stx: deduped const ${d} */`),t=b;continue}o.add(d),n.push(e.slice(t,b)),t=b;continue}}}n.push(i),t++}return n.join("")}var ue=new Set(["script","style","html","head","meta","link","title","!doctype"]);function D(e,o,n){for(let t of n){if(t.start>=o)return!1;if(t.end>e)return!0}return!1}function fe(e,o,n){let t=0;while(t<e.length){let r=e.indexOf(o,t);if(r===-1)return!1;if(!D(r,r+o.length,n))return!0;t=r+o.length}return!1}function de(e,o){if(fe(e,"<body",o)){let r=new RegExp(`<body(${j})>`,"g"),a;while((a=r.exec(e))!==null)if(!D(a.index,a.index+a[0].length,o))return a.index+a[0].length-1;return null}let n=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${j})>`,"gi"),t;while((t=n.exec(e))!==null){if(D(t.index,t.index+t[0].length,o))continue;if(ue.has(t[1].toLowerCase()))continue;return t.index+t[0].length-1}return null}function ge(e,o,n,t){let r=[],a=` data-stx="${t}"`,f=0,c=!1,p=(h)=>{if(n!==null&&!c&&n>=f&&n<=h)r.push(e.slice(f,n),a,e.slice(n,h)),c=!0;else r.push(e.slice(f,h))};for(let h of o){if(h.start<f)continue;p(h.start),f=h.end}return p(e.length),r.join("")}async function qr(e,o,n,t={}){let r=Tl(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),a=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:c,bundleClientScript:p}=await s("stx/client-script-bundler",()=>import("./chunk-t3gmm1ja.js"));for(let m of r){let x=m.body;if(Me(m.attrs))x=Le(x);if(t.forceClientSetup||a.test(x)){f.push({content:x,start:m.start,end:m.end});continue}if(!c(x))continue;try{let y=await p(It(x).code,o||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(a.test(y))f.push({content:x,start:m.start,end:m.end})}catch{}}if(f.length===0)return{output:e,setupCode:null};let h=`${o??""}\x00${f.map((m)=>m.content).join("\x00")}`,i=`__stx_setup_${Bun.hash(h).toString(36).slice(0,10)}`,u=[];for(let m=0;m<f.length;m++){let x=f[m].bundled??It(f[m].content).code;if(!f[m].bundled&&c(x))x=await p(x,o||"",{projectRoot:process.cwd()});x=ht(x);let y=T(x);u.push(`// \u2500\u2500 merged signal script #${m+1} \u2500\u2500
|
|
6
|
-
${y}`)}let g=u.join(`
|
|
7
|
-
|
|
8
|
-
`);g=le(g);let d=L(g).split(",").map((m)=>m.trim()).filter(Boolean),b=fn(g,n),S=`
|
|
9
|
-
<script data-stx-scoped>
|
|
10
|
-
function ${i}() {
|
|
11
|
-
${st("const",d)}
|
|
12
|
-
${an(`${b}${g}`)}
|
|
13
|
-
return ${is(g,d)};
|
|
14
|
-
}
|
|
15
|
-
window.__stx_latestSetup=${i};
|
|
16
|
-
if(window.stx)window.stx._latestSetup=${i};
|
|
17
|
-
</script>`,w=de(e,f);return{output:ge(e,f,w,i),setupCode:S}}async function po(e,o,n,t){if(!Vr(e,n))return e;let r=e;if(o.skipSignalsRuntime)return r;let{output:a,setupCode:f}=await qr(r,n,t);if(r=a,!f){let c=q(r);if(c&&!/data-stx/.test(c.attrs)&&!/data-stx-auto/.test(c.attrs)){let p=c.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");r=r.slice(0,c.index)+p+r.slice(c.index+c.tag.length)}}if(r=await Yn(r,o),f){let c=ca(r,/<\/head>/i),p=c===-1?ca(r,/<body[^>]*>/i):-1;if(c!==-1)r=`${r.slice(0,c)}${f}
|
|
18
|
-
${r.slice(c)}`;else if(p!==-1){let h=/<body[^>]*>/i.exec(r.slice(p))[0],i=p+h.length;r=`${r.slice(0,i)}
|
|
19
|
-
${f}${r.slice(i)}`}else r=`${r}
|
|
20
|
-
${f}`}return r}function ca(e,o){let n=/<(script|style)\b[\s\S]*?<\/\1>/gi,t=[],r;while((r=n.exec(e))!==null)t.push([r.index,r.index+r[0].length]);let a=new RegExp(o.source,o.flags.replace(/[gy]/g,"")),f=0;while(f<e.length){let c=a.exec(e.slice(f));if(!c)return-1;let p=f+c.index;if(!t.some(([i,u])=>p>=i&&p<u))return p;f=p+Math.max(c[0].length,1)}return-1}var X="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function $l(e){let o=[];for(let n of e.split(",")){let t=n.trim();if(!t||t.startsWith("type "))continue;let r=t.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(r&&r[1]!==r[2])o.push(`${r[2]} = ${r[1]}`)}if(o.length===0)return X;return`var ${o.join(", ")}; ${X}`}var pe=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function ht(e){return e.replace(pe,(o,n)=>$l(n))}
|
|
21
|
-
export{hp,Tl,co,Vr,Xn,lo,uo,Ur,Wr,qr,po,ca,$l,ht};
|
package/dist/chunk-248a88mc.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Y,Z,Q,Tn,ge,Ce,Ir,Vc,dt,Wt,$n,Rn,An,ee,Pn,In,Or}from"./chunk-x4q4bx3q.js";import"./chunk-qr7a378v.js";export{Z as DEFAULT_FORMATS,Q as DEFAULT_QUALITY,Y as DEFAULT_WIDTHS,Or as ImageProcessingError,In as formatSize,Wt as generateSizes,dt as generateSrcSet,$n as getFallbackVariant,Ir as getImageMetadata,ee as getMimeType,Pn as getTotalSize,Rn as groupVariantsByFormat,ge as isImageBackendAvailable,An as isImageFile,Tn as isSharpAvailable,Ce as processImage,Vc as resizeAndConvert};
|
package/dist/chunk-2nqtmp8c.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ri,si,oi,Tu,ii,ai,$u,ci,li,kc,Ru}from"./chunk-vd5w1jaz.js";export{ri as VideoProcessorCache,kc as analyzeVideo,Tu as clearVideoCache,li as generateDASHManifest,ci as generateHLSManifest,ii as generatePoster,$u as generateSpriteSheet,ai as generateThumbnails,si as getCachedVideoResult,Ru as processVideo,oi as setCachedVideoResult};
|
package/dist/chunk-2yzwrvq1.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ui,Wi,qi,Ki,sp}from"./chunk-j388n7v2.js";import"./chunk-yxw8gbnh.js";import"./chunk-qr7a378v.js";import"./chunk-b0th3d8q.js";import"./chunk-wt7rp7wc.js";import"./chunk-078qg8r5.js";import"./chunk-1dkcakve.js";import"./chunk-p01b07se.js";import"./chunk-chy90834.js";import"./chunk-xnx06qqt.js";import"./chunk-1j0sarne.js";import"./chunk-2pvcp0y6.js";import"./chunk-dxh45gve.js";import"./chunk-2hmyj5wh.js";import"./chunk-2933mvwr.js";import"./chunk-3xyv2fec.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import"./chunk-87em5xdg.js";import"./chunk-wc5tt6da.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Ui as buildNative,sp as default,Wi as findCraftBinary,Ki as getAvailableFormats,qi as getAvailableTargets};
|
package/dist/chunk-3bfegbpw.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Gc,Xc,Jc,Yc,Zc,Qc,el,tl,nl,rl,rd}from"./chunk-ga5kjf9b.js";export{Gc as createIslandRegistry,rd as default,rl as generateIslandManifest,Jc as generatePartialHydrationCSS,Qc as hydrateAll,Zc as hydrateByStrategy,Yc as hydrateIsland,el as isHydrated,tl as onHydrated,Xc as processPartialHydrationDirectives,nl as processStaticDirectives};
|
package/dist/chunk-3wsm9g9c.js
DELETED
package/dist/chunk-3xx9d934.js
DELETED
package/dist/chunk-52x079ax.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Un,o}from"./chunk-b0th3d8q.js";import"./chunk-wt7rp7wc.js";import"./chunk-078qg8r5.js";import"./chunk-1dkcakve.js";import"./chunk-p01b07se.js";import"./chunk-chy90834.js";import"./chunk-xnx06qqt.js";import"./chunk-1j0sarne.js";import{ye}from"./chunk-2pvcp0y6.js";import"./chunk-dxh45gve.js";import"./chunk-2hmyj5wh.js";import"./chunk-2933mvwr.js";import"./chunk-3xyv2fec.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import{Pe,hs,ys}from"./chunk-87em5xdg.js";import"./chunk-wc5tt6da.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Un as buildModulesTag,ye as injectRouterScript,o as processDirectives,hs as processJsonDirective,ys as processOnceDirective,Pe as validateClientScript};
|