@stacksjs/stx 0.2.706 → 0.2.708
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-shell.d.ts +2 -1
- package/dist/app-shell.js +5 -2
- package/dist/{chunk-e3yhx053.js → chunk-029qng4p.js} +5 -5
- package/dist/chunk-03p4w958.js +2 -0
- package/dist/chunk-0dve54ne.js +3 -0
- package/dist/chunk-0jtrdgyv.js +422 -0
- package/dist/{chunk-m4j9gedb.js → chunk-0myrwz84.js} +48 -8
- package/dist/chunk-12vjp2gr.js +2 -0
- package/dist/chunk-18fr730w.js +2 -0
- package/dist/chunk-19knw8c6.js +2 -0
- package/dist/{chunk-5bgkb4vm.js → chunk-1kwsnqr1.js} +3 -3
- package/dist/{chunk-n2ema4wf.js → chunk-1xjv71dw.js} +2 -2
- package/dist/chunk-27catnpa.js +2 -0
- package/dist/chunk-29sapda2.js +2 -0
- package/dist/{chunk-d597d0dp.js → chunk-2aarvd3a.js} +6 -6
- package/dist/chunk-2k6d8s6h.js +2 -0
- package/dist/chunk-2qf6kd9r.js +2 -0
- package/dist/chunk-2snfd93r.js +2 -0
- package/dist/chunk-2srb5f7t.js +2 -0
- package/dist/{chunk-y91rz3rq.js → chunk-3457kk19.js} +7 -7
- package/dist/chunk-3907sad1.js +2 -0
- package/dist/chunk-3nsdb1fg.js +2 -0
- package/dist/chunk-3qnke2jb.js +2 -0
- package/dist/chunk-3sg2ardr.js +2 -0
- package/dist/chunk-3t3p2c1t.js +65 -0
- package/dist/chunk-3vsnnr1b.js +2 -0
- package/dist/{chunk-3850m7ab.js → chunk-3wkgd883.js} +1 -1
- package/dist/{chunk-epnpst9q.js → chunk-3xmt01wr.js} +11 -11
- package/dist/{chunk-t27fecet.js → chunk-42w6snem.js} +4 -4
- package/dist/chunk-48936paw.js +2 -0
- package/dist/chunk-4c1fbthr.js +2 -0
- package/dist/{chunk-zggdhtmn.js → chunk-4ckxs446.js} +3 -3
- package/dist/chunk-4cs5t287.js +2 -0
- package/dist/chunk-4fxg20je.js +2 -0
- package/dist/chunk-58v34kba.js +2 -0
- package/dist/chunk-5n4qg8za.js +3 -0
- package/dist/{chunk-j9h41w8b.js → chunk-609pekf5.js} +2 -2
- package/dist/chunk-65fcex5r.js +42 -0
- package/dist/{chunk-1kr1mpft.js → chunk-67abad76.js} +1 -1
- package/dist/{chunk-7smgebdq.js → chunk-6cz1sbb1.js} +3 -3
- package/dist/{chunk-4sesw88b.js → chunk-6n11z33h.js} +5 -5
- package/dist/chunk-6ndeycxk.js +2 -0
- package/dist/{chunk-tp4eqfxq.js → chunk-6ts3sthp.js} +2 -2
- package/dist/chunk-75n3vbtk.js +2 -0
- package/dist/{chunk-8w4y3dx3.js → chunk-768evhvm.js} +2 -2
- package/dist/chunk-7dc3n69c.js +3 -0
- package/dist/{chunk-66cfnzem.js → chunk-7kaadsd1.js} +5 -5
- package/dist/{chunk-ccqe741j.js → chunk-83p5k4eb.js} +2 -2
- package/dist/chunk-86775qk0.js +2 -0
- package/dist/chunk-8c4zbq1k.js +2 -0
- package/dist/chunk-8s4rxgs8.js +2 -0
- package/dist/chunk-8t9em8md.js +2 -0
- package/dist/{chunk-vfjenjez.js → chunk-8v2vbc4y.js} +1 -1
- package/dist/chunk-8z469777.js +2 -0
- package/dist/{chunk-9p452mq6.js → chunk-90kfvtf6.js} +114 -114
- package/dist/{chunk-rcdjse0z.js → chunk-93y8zwcz.js} +5 -5
- package/dist/chunk-9736003n.js +2 -0
- package/dist/chunk-97r557ws.js +2 -0
- package/dist/chunk-9adx6f4k.js +3 -0
- package/dist/{chunk-5w1erc2m.js → chunk-9dg5ja4w.js} +1 -1
- package/dist/chunk-9nvywf05.js +3 -0
- package/dist/chunk-9wgvn5rn.js +24 -0
- package/dist/chunk-9whmbfwx.js +2 -0
- package/dist/{chunk-2e2qnce5.js → chunk-9xb33nz0.js} +2 -2
- package/dist/chunk-a32xsr61.js +11 -0
- package/dist/{chunk-3hxd5td3.js → chunk-am4wadh7.js} +2 -2
- package/dist/{chunk-wqe98032.js → chunk-an387127.js} +2 -2
- package/dist/{chunk-bsr9wnq4.js → chunk-ap30qs8p.js} +2 -2
- package/dist/chunk-avr65xra.js +2 -0
- package/dist/chunk-axwwhdtt.js +2 -0
- package/dist/chunk-b6318vv3.js +2 -0
- package/dist/{chunk-7kn0d1f1.js → chunk-b7j48bq9.js} +2 -2
- package/dist/chunk-bcr8sq50.js +2 -0
- package/dist/chunk-bhpsr1mt.js +20 -0
- package/dist/{chunk-3ja845kw.js → chunk-c2b5p621.js} +171 -171
- package/dist/{chunk-11mjqfde.js → chunk-c71f6mfr.js} +45 -45
- package/dist/chunk-ccty08sm.js +32 -0
- package/dist/chunk-cjx11tgd.js +2 -0
- package/dist/{chunk-njhd845r.js → chunk-ckrmrdjp.js} +5 -5
- package/dist/chunk-cqnpjdc9.js +2 -0
- package/dist/{chunk-k296qq0p.js → chunk-cwhzk2n3.js} +2 -2
- package/dist/{chunk-nv886zy6.js → chunk-d2xnkt8m.js} +10 -10
- package/dist/chunk-dedmk383.js +2 -0
- package/dist/chunk-dhdt7e54.js +2 -0
- package/dist/chunk-dxqvv686.js +3 -0
- package/dist/chunk-e5vsw0fw.js +4 -0
- package/dist/{chunk-qef5mz20.js → chunk-e8brwwp1.js} +105 -105
- package/dist/{chunk-b3sw5ykg.js → chunk-edka95zp.js} +3 -3
- package/dist/{chunk-y7xsjr28.js → chunk-erqsgfdj.js} +1 -1
- package/dist/chunk-eywx2f4h.js +2 -0
- package/dist/chunk-f6ybdjt0.js +14 -0
- package/dist/{chunk-0qtygx7m.js → chunk-f9b7847f.js} +4 -4
- package/dist/{chunk-44c1mbye.js → chunk-fcbd7kwj.js} +3 -3
- package/dist/chunk-fj3pct59.js +2 -0
- package/dist/chunk-fvk1xr5a.js +2 -0
- package/dist/{chunk-b2j7s1a2.js → chunk-g1tq4xdb.js} +2 -2
- package/dist/chunk-g6wd49b5.js +2 -0
- package/dist/chunk-gk0nq2ky.js +2 -0
- package/dist/{chunk-z9csfarm.js → chunk-gvs17jd0.js} +11 -11
- package/dist/chunk-h6pmg82p.js +4 -0
- package/dist/chunk-h8kbcz9t.js +2 -0
- package/dist/chunk-h9n71rdn.js +2 -0
- package/dist/{chunk-eb3xg8an.js → chunk-hb77kw66.js} +1 -1
- package/dist/{chunk-a8erwxng.js → chunk-hmkg3xy0.js} +3 -3
- package/dist/{chunk-yn9kvsk1.js → chunk-j2mpqa4p.js} +2 -2
- package/dist/chunk-j7gg6xrc.js +2 -0
- package/dist/{chunk-gp9k0t3g.js → chunk-jb5sftzz.js} +2 -2
- package/dist/{chunk-t8d33x9w.js → chunk-khrckvwn.js} +4 -4
- package/dist/{chunk-4x2gnvz1.js → chunk-kxf8z7vp.js} +2 -2
- package/dist/{chunk-ygtfjnqj.js → chunk-kxwfrdt3.js} +2 -2
- package/dist/{chunk-ah5ch04j.js → chunk-mr3r8crk.js} +2 -2
- package/dist/chunk-mzwa2478.js +2 -0
- package/dist/chunk-n6carvxa.js +2 -0
- package/dist/chunk-ncs2j5kc.js +3 -0
- package/dist/{chunk-b1a79hgk.js → chunk-nde9yj3n.js} +2 -2
- package/dist/{chunk-2gzrx4ma.js → chunk-p3dkhz9v.js} +56 -56
- package/dist/{chunk-3ys3sa08.js → chunk-qa9t9k6z.js} +1 -1
- package/dist/{chunk-p4czdmrr.js → chunk-qcw1neka.js} +2 -2
- package/dist/chunk-r5k21k3x.js +54 -0
- package/dist/chunk-r6bc2q44.js +2 -0
- package/dist/{chunk-sxf17xfc.js → chunk-rb2a1qxb.js} +6 -6
- package/dist/chunk-rdj74dqc.js +2 -0
- package/dist/chunk-rswg7xsg.js +18 -0
- package/dist/chunk-rtbkjq0y.js +2 -0
- package/dist/chunk-rwjgpmrw.js +2 -0
- package/dist/chunk-s1vj8gtz.js +21 -0
- package/dist/{chunk-416jy1m5.js → chunk-s9b6abkb.js} +2 -2
- package/dist/{chunk-2p34qf9c.js → chunk-stvw8y3c.js} +2 -2
- package/dist/chunk-sy1btryy.js +2 -0
- package/dist/chunk-sz0e6tpq.js +20 -0
- package/dist/{chunk-9ra3ne11.js → chunk-t63f15yh.js} +3 -3
- package/dist/{chunk-2v7t87n8.js → chunk-t6ayy0t5.js} +2 -2
- package/dist/chunk-t7mbaf69.js +2 -0
- package/dist/{chunk-x7rtrdqq.js → chunk-tvcr9sct.js} +3 -3
- package/dist/chunk-v5s6r2b3.js +130 -0
- package/dist/chunk-vqratjvb.js +33 -0
- package/dist/chunk-vstvadc2.js +12 -0
- package/dist/chunk-w2h6nn70.js +2 -0
- package/dist/chunk-w8yv9hnf.js +2 -0
- package/dist/{chunk-ktkmv1j8.js → chunk-wbfg7p3k.js} +4 -4
- package/dist/chunk-weaxr0qe.js +2 -0
- package/dist/{chunk-3392k9vm.js → chunk-wp6q0geg.js} +2 -2
- package/dist/{chunk-2nqt1m3m.js → chunk-wt18wv6x.js} +2 -2
- package/dist/{chunk-jkywbfb0.js → chunk-x2gxx8eg.js} +2 -2
- package/dist/chunk-xw8wwcr8.js +25 -0
- package/dist/{chunk-xc03cdet.js → chunk-xyyt8v1r.js} +28 -28
- package/dist/chunk-ykmcnk3x.js +2 -0
- package/dist/chunk-yw66yks2.js +43 -0
- package/dist/chunk-z05dbey1.js +2 -0
- package/dist/chunk-zaj3gzet.js +2 -0
- package/dist/{chunk-w7e28p74.js → chunk-zav8yrtp.js} +9 -9
- package/dist/{chunk-ywzh979k.js → chunk-zecgd1wz.js} +4 -4
- package/dist/{chunk-c3hr5mm2.js → chunk-zjaw79zp.js} +2 -2
- package/dist/chunk-zjcmybab.js +3 -0
- package/dist/{chunk-fgr56q3w.js → chunk-zjw6j2x0.js} +4 -4
- package/dist/{chunk-k7pmzreg.js → chunk-zn3c0ew5.js} +3 -3
- package/dist/chunk-ztckg7a3.js +2 -0
- package/dist/cli.js +46 -46
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/serve-app.js +1 -1
- package/dist/expressions.js +6 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/island-chunking.js +5 -1
- package/dist/native/accessibility.d.ts +2 -2
- package/dist/native/accessibility.js +5 -3
- package/dist/native/compiler/html-to-ir.js +1 -1
- package/dist/native/runtime/native-host.js +5 -5
- package/dist/page-head.d.ts +2 -0
- package/dist/page-head.js +35 -0
- package/dist/production-builder.js +1 -1
- package/dist/production-server.js +2 -2
- package/dist/pwa.js +3 -3
- package/dist/site-builder/i18n.js +1 -1
- package/dist/ssg.js +36 -36
- package/dist/template-compiler.js +2 -1
- package/dist/utils.js +41 -0
- package/package.json +5 -5
- package/dist/chunk-09801kkv.js +0 -2
- package/dist/chunk-0s55c880.js +0 -2
- package/dist/chunk-0ys97vq8.js +0 -2
- package/dist/chunk-13jg9qpq.js +0 -2
- package/dist/chunk-1e79xcc8.js +0 -2
- package/dist/chunk-1yt4ynxh.js +0 -2
- package/dist/chunk-2whqx2c0.js +0 -2
- package/dist/chunk-2xtzzx00.js +0 -2
- package/dist/chunk-4t9cggwf.js +0 -2
- package/dist/chunk-5g7m27e1.js +0 -21
- package/dist/chunk-5h1ahj7m.js +0 -2
- package/dist/chunk-5zqxzyxk.js +0 -2
- package/dist/chunk-68wezwr7.js +0 -2
- package/dist/chunk-7gw96jpj.js +0 -2
- package/dist/chunk-7w2mrg3s.js +0 -2
- package/dist/chunk-8hhyp9p6.js +0 -2
- package/dist/chunk-926fs6g7.js +0 -2
- package/dist/chunk-93ft5jea.js +0 -3
- package/dist/chunk-94gp1g2f.js +0 -2
- package/dist/chunk-983zpa57.js +0 -3
- package/dist/chunk-98yf0aq9.js +0 -4
- package/dist/chunk-9wq145yr.js +0 -2
- package/dist/chunk-a4r93m1q.js +0 -2
- package/dist/chunk-aea12k73.js +0 -2
- package/dist/chunk-b378jpbp.js +0 -2
- package/dist/chunk-b7e07ybq.js +0 -3
- package/dist/chunk-bfhks7zf.js +0 -43
- package/dist/chunk-bhnq6xr5.js +0 -2
- package/dist/chunk-bksjh409.js +0 -2
- package/dist/chunk-c4sskkv6.js +0 -421
- package/dist/chunk-ca0vn95n.js +0 -18
- package/dist/chunk-cbdyns7r.js +0 -3
- package/dist/chunk-cknbhyw6.js +0 -2
- package/dist/chunk-csx3zne1.js +0 -3
- package/dist/chunk-d7vmzkjy.js +0 -2
- package/dist/chunk-djwat8vn.js +0 -2
- package/dist/chunk-dm7am3p3.js +0 -2
- package/dist/chunk-dpjs0ajs.js +0 -2
- package/dist/chunk-e41h5yrz.js +0 -11
- package/dist/chunk-f498cdg5.js +0 -2
- package/dist/chunk-fazw6sxz.js +0 -2
- package/dist/chunk-ffddd2t8.js +0 -14
- package/dist/chunk-fk71r3h6.js +0 -2
- package/dist/chunk-g1bed7se.js +0 -2
- package/dist/chunk-gbgbhpms.js +0 -2
- package/dist/chunk-gxtmq5r2.js +0 -130
- package/dist/chunk-h1fpjmr8.js +0 -2
- package/dist/chunk-ha4vb9a6.js +0 -2
- package/dist/chunk-hadbgke6.js +0 -2
- package/dist/chunk-hkmewh5h.js +0 -12
- package/dist/chunk-hmnj2hrh.js +0 -20
- package/dist/chunk-htyee0b7.js +0 -3
- package/dist/chunk-hz5vabap.js +0 -25
- package/dist/chunk-j10dhha2.js +0 -2
- package/dist/chunk-kjc1f6af.js +0 -2
- package/dist/chunk-m28d7w2s.js +0 -54
- package/dist/chunk-mv4wfsc5.js +0 -2
- package/dist/chunk-mwwd425n.js +0 -33
- package/dist/chunk-nbzy9m6a.js +0 -2
- package/dist/chunk-nmcgyxcg.js +0 -2
- package/dist/chunk-p4e7x4f6.js +0 -2
- package/dist/chunk-p6sdrq1y.js +0 -2
- package/dist/chunk-p78v88ng.js +0 -65
- package/dist/chunk-pbtr7w5e.js +0 -2
- package/dist/chunk-q13cp39b.js +0 -42
- package/dist/chunk-qfk2gh5y.js +0 -20
- package/dist/chunk-qqj8n8s9.js +0 -4
- package/dist/chunk-qtr1660m.js +0 -2
- package/dist/chunk-r0nm6sz0.js +0 -2
- package/dist/chunk-rb8g9nnc.js +0 -2
- package/dist/chunk-rhm7wg6p.js +0 -2
- package/dist/chunk-tjf1eajh.js +0 -2
- package/dist/chunk-ttn2hvze.js +0 -24
- package/dist/chunk-w42v5j1j.js +0 -2
- package/dist/chunk-w9kak6aj.js +0 -2
- package/dist/chunk-wr6z8z70.js +0 -2
- package/dist/chunk-xy3p6d2m.js +0 -2
- package/dist/chunk-yfppczrm.js +0 -2
- package/dist/chunk-yhf7pj12.js +0 -2
- package/dist/chunk-ympp4tja.js +0 -2
- package/dist/chunk-yyx89zxs.js +0 -2
- package/dist/chunk-z00ysspf.js +0 -31
- package/dist/chunk-z0x54ynx.js +0 -3
- package/dist/chunk-za6teyn1.js +0 -2
- package/dist/chunk-zgyw04pj.js +0 -2
- package/dist/chunk-zmnqha0x.js +0 -2
- package/dist/chunk-zw924mfr.js +0 -2
package/dist/craft.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ao,pa,fa}from"./chunk-tvcr9sct.js";import"./chunk-p3dkhz9v.js";import"./chunk-xyyt8v1r.js";import"./chunk-wt18wv6x.js";import"./chunk-zn3c0ew5.js";import"./chunk-0jtrdgyv.js";import"./chunk-wp6q0geg.js";import"./chunk-qcw1neka.js";import"./chunk-stvw8y3c.js";import"./chunk-0myrwz84.js";import"./chunk-90kfvtf6.js";import"./chunk-3t3p2c1t.js";import"./chunk-zjw6j2x0.js";import"./chunk-zjcmybab.js";import"./chunk-3xmt01wr.js";import"./chunk-e8brwwp1.js";import"./chunk-65fcex5r.js";import"./chunk-r5k21k3x.js";import"./chunk-s1vj8gtz.js";import"./chunk-xw8wwcr8.js";import"./chunk-ap30qs8p.js";import"./chunk-t63f15yh.js";import{Fm,sa,zm,Hm,oa,io,ia,Vm,aa,Um,Wm,ca,la,ua,da}from"./chunk-c71f6mfr.js";import"./chunk-rswg7xsg.js";import"./chunk-9nvywf05.js";import"./chunk-7dc3n69c.js";import"./chunk-f6ybdjt0.js";import"./chunk-8v2vbc4y.js";import"./chunk-hmkg3xy0.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{Fm as CRAFT_BRIDGE_SCRIPT,io as CRAFT_COMPONENTS,Vm as CRAFT_COMPONENT_RUNTIME,ia as CRAFT_COMPONENT_STYLES,ao as NATIVE_COMPONENTS,ca as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,pa as compileToNative,fa as createHotReloadServer,la as findCraftBinary,sa as generateCraftBridgeScript,V as generateCraftOptimizations,da as getAvailableFormats,ua as getAvailableTargets,Wm as getCraftComponents,G as getSSRCacheStats,oa as injectCraftBridge,zm as isCraftEnvironment,Y as prerenderForCraft,aa as processCraftComponents,Hm as processCraftDirective,Um as registerCraftComponent,Q as renderSSR};
|
|
@@ -488,7 +488,7 @@ export async function serveApp(appDir = ".", options = {}) {
|
|
|
488
488
|
content = injectRouteParams(content, routeMatch.params);
|
|
489
489
|
content = await injectCss(content, absoluteAppDir);
|
|
490
490
|
const routerContainer = projectConfig?.router?.container || "main";
|
|
491
|
-
content = extractContainerContent(content, routerContainer);
|
|
491
|
+
content = extractContainerContent(content, routerContainer, !0);
|
|
492
492
|
return new Response(content, {
|
|
493
493
|
status: responseStatus,
|
|
494
494
|
headers: {
|
package/dist/expressions.js
CHANGED
|
@@ -559,6 +559,8 @@ export function processExpressions(template, context, filePath) {
|
|
|
559
559
|
...componentClientSignalNames(clientScriptBodies(scriptBlocks))
|
|
560
560
|
]), preservedClientExpressions = new Set(Array.isArray(context?.__stx_preserved_client_expressions) ? context.__stx_preserved_client_expressions : []);
|
|
561
561
|
output = replaceInterpolations(output, (match, expr, offset) => {
|
|
562
|
+
if (readsAnyName(expr, clientSignalNames))
|
|
563
|
+
return match;
|
|
562
564
|
try {
|
|
563
565
|
const value = evaluateExpression(expr, context, !1, (r) => warnRejectedExpression(r, match, filePath, template));
|
|
564
566
|
return value !== void 0 && value !== null ? String(value) : "";
|
|
@@ -568,6 +570,8 @@ export function processExpressions(template, context, filePath) {
|
|
|
568
570
|
}
|
|
569
571
|
}, 3);
|
|
570
572
|
output = output.replace(/\{!!([\s\S]*?)!!\}/g, (match, expr, offset) => {
|
|
573
|
+
if (readsAnyName(expr, clientSignalNames))
|
|
574
|
+
return match;
|
|
571
575
|
try {
|
|
572
576
|
const value = evaluateExpression(expr, context, !1, (r) => warnRejectedExpression(r, match, filePath, template));
|
|
573
577
|
if (value === void 0 && context.__stx_buildMode === "compile")
|
|
@@ -596,10 +600,10 @@ export function processExpressions(template, context, filePath) {
|
|
|
596
600
|
return match;
|
|
597
601
|
if (preservedClientExpressions.has(trimmedExpr))
|
|
598
602
|
return match;
|
|
599
|
-
const jsBuiltins = ["parseInt", "parseFloat", "String", "Number", "Boolean", "Array", "Object", "JSON", "Math", "Date", "encodeURIComponent", "decodeURIComponent", "encodeURI", "decodeURI", "true", "false", "null", "undefined"], identifierPattern = /^([a-zA-Z_$][a-zA-Z0-9_$]*)/, firstVarName = trimmedExpr.match(identifierPattern)?.[1], firstVarInContext = firstVarName && ((firstVarName in context) || jsBuiltins.includes(firstVarName)),
|
|
603
|
+
const jsBuiltins = ["parseInt", "parseFloat", "String", "Number", "Boolean", "Array", "Object", "JSON", "Math", "Date", "encodeURIComponent", "decodeURIComponent", "encodeURI", "decodeURI", "true", "false", "null", "undefined"], identifierPattern = /^([a-zA-Z_$][a-zA-Z0-9_$]*)/, firstVarName = trimmedExpr.match(identifierPattern)?.[1], firstVarInContext = firstVarName && ((firstVarName in context) || jsBuiltins.includes(firstVarName)), directFunctionCall = /^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/, directFuncMatch = trimmedExpr.match(directFunctionCall), isLikelySignal = directFuncMatch && !jsBuiltins.includes(directFuncMatch[1]) && !(directFuncMatch[1] in context);
|
|
600
604
|
if (/^__[A-Z_]+__$/.test(trimmedExpr))
|
|
601
605
|
return "";
|
|
602
|
-
if (
|
|
606
|
+
if (readsAnyName(trimmedExpr, clientSignalNames))
|
|
603
607
|
return match;
|
|
604
608
|
if (context.__stx_native_screen === !0 && callsContextFunction(trimmedExpr, context))
|
|
605
609
|
return match;
|
package/dist/index.d.ts
CHANGED
|
@@ -229,6 +229,7 @@ export * from './script-classifier';
|
|
|
229
229
|
export * from './seo';
|
|
230
230
|
export * from './serve';
|
|
231
231
|
export * from './spa-nav';
|
|
232
|
+
export * from './page-head';
|
|
232
233
|
// Where stx keeps its generated state (`.stx/` by default, configurable)
|
|
233
234
|
export * from './state-dir';
|
|
234
235
|
export * from './style-scoping';
|
package/dist/index.js
CHANGED
|
@@ -126,6 +126,7 @@ export * from "./script-classifier.js";
|
|
|
126
126
|
export * from "./seo.js";
|
|
127
127
|
export * from "./serve.js";
|
|
128
128
|
export * from "./spa-nav.js";
|
|
129
|
+
export * from "./page-head.js";
|
|
129
130
|
export * from "./state-dir.js";
|
|
130
131
|
export * from "./style-scoping.js";
|
|
131
132
|
export * from "./template-compiler.js";
|
package/dist/island-chunking.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { scanAtElementPosition } from "./html-masking.js";
|
|
2
3
|
function minifyChunk(code) {
|
|
3
4
|
try {
|
|
4
5
|
return new Bun.Transpiler({ loader: "js", minifyWhitespace: !0 }).transformSync(code).replace(/\}(var |let |const |function )/g, "};$1").trim();
|
|
@@ -42,7 +43,10 @@ export function injectIslandChunkPrefetch(html) {
|
|
|
42
43
|
while ((t = tagRe.exec(html)) !== null)
|
|
43
44
|
if (PREFETCH_TRIGGERS.has(triggerBySid.get(t[1]) || ""))
|
|
44
45
|
urls.add(t[2]);
|
|
45
|
-
const headEnd = html
|
|
46
|
+
const closeHead = /<\/head\s*>/iy, headEnd = scanAtElementPosition(html, (source, index) => {
|
|
47
|
+
closeHead.lastIndex = index;
|
|
48
|
+
return closeHead.exec(source) ? closeHead.lastIndex : -1;
|
|
49
|
+
})[0]?.start ?? -1;
|
|
46
50
|
if (urls.size === 0 || headEnd === -1)
|
|
47
51
|
return html;
|
|
48
52
|
const links = Array.from(urls).filter((url) => !html.includes(`rel="prefetch" href="${url}"`)).map((url) => `<link rel="prefetch" href="${url}" as="script">`).join("");
|
|
@@ -21,9 +21,9 @@ export declare function applyStaticAccessibility(props: Record<string, unknown>)
|
|
|
21
21
|
* disappear later, and explicit native props must still take precedence.
|
|
22
22
|
* Reuse the compiler's role/state vocabulary rather than a second mapping.
|
|
23
23
|
*/
|
|
24
|
-
export declare function projectAccessibility(props: Record<string, unknown
|
|
24
|
+
export declare function projectAccessibility(props: Record<string, unknown>, type?: string): Record<string, unknown>;
|
|
25
25
|
/** Patch derived fields including removals; native prop patches merge by key. */
|
|
26
|
-
export declare function accessibilityChanges(props: Record<string, unknown>, before: Record<string, unknown>, changedField: string): Record<string, unknown>;
|
|
26
|
+
export declare function accessibilityChanges(props: Record<string, unknown>, before: Record<string, unknown>, changedField: string, type?: string): Record<string, unknown>;
|
|
27
27
|
/** Recover authored native fields from compiler IR before reactive updates. */
|
|
28
28
|
export declare function authoredAccessibilityProps(props: Record<string, unknown>, source?: Record<string, unknown>): Record<string, unknown>;
|
|
29
29
|
/** Fields derived from web semantics at the native transport boundary. */
|
|
@@ -88,13 +88,15 @@ export function applyStaticAccessibility(props) {
|
|
|
88
88
|
props.accessibilityState = { ...state, ...authoredState };
|
|
89
89
|
}
|
|
90
90
|
export const ACCESSIBILITY_FIELDS = ["accessibilityLabel", "accessibilityRole", "accessibilityState", "accessibilityValue"];
|
|
91
|
-
export function projectAccessibility(props) {
|
|
91
|
+
export function projectAccessibility(props, type) {
|
|
92
92
|
const projected = { ...props };
|
|
93
93
|
applyStaticAccessibility(projected);
|
|
94
|
+
if (type === "Image" && projected.accessibilityLabel === void 0 && props.alt != null && props.alt !== "")
|
|
95
|
+
projected.accessibilityLabel = String(props.alt);
|
|
94
96
|
return Object.fromEntries(ACCESSIBILITY_FIELDS.filter((name) => (name in projected)).map((name) => [name, projected[name]]));
|
|
95
97
|
}
|
|
96
|
-
export function accessibilityChanges(props, before, changedField) {
|
|
97
|
-
const projected = projectAccessibility(props);
|
|
98
|
+
export function accessibilityChanges(props, before, changedField, type) {
|
|
99
|
+
const projected = projectAccessibility(props, type);
|
|
98
100
|
return Object.fromEntries(ACCESSIBILITY_FIELDS.filter((name) => name === changedField || JSON.stringify(before[name]) !== JSON.stringify(projected[name])).map((name) => [name, projected[name] ?? null]));
|
|
99
101
|
}
|
|
100
102
|
export function authoredAccessibilityProps(props, source) {
|
|
@@ -489,7 +489,7 @@ export async function translateHtmlToIR(html, options = {}) {
|
|
|
489
489
|
root._stylesheetRules = stylesheetRules;
|
|
490
490
|
const project = (node) => {
|
|
491
491
|
bindMustaches(node);
|
|
492
|
-
const projected = projectAccessibility(node.props);
|
|
492
|
+
const projected = projectAccessibility(node.props, node.type);
|
|
493
493
|
if (Object.keys(projected).length) {
|
|
494
494
|
node._accessibilitySource = Object.fromEntries(ACCESSIBILITY_FIELDS.filter((name) => (name in node.props)).map((name) => [name, node.props[name]]));
|
|
495
495
|
Object.assign(node.props, projected);
|
|
@@ -232,7 +232,7 @@ export function createNativeHost(options) {
|
|
|
232
232
|
return null;
|
|
233
233
|
}
|
|
234
234
|
function hostProps(record) {
|
|
235
|
-
return { ...record.props, ...projectAccessibility(record.props), ...projectTextEntry(record.type, record.props) };
|
|
235
|
+
return { ...record.props, ...projectAccessibility(record.props, record.type), ...projectTextEntry(record.type, record.props) };
|
|
236
236
|
}
|
|
237
237
|
function ariaState(value) {
|
|
238
238
|
return value === !0 || value === "true";
|
|
@@ -769,7 +769,7 @@ export function createNativeHost(options) {
|
|
|
769
769
|
applyClasses(node.__stxId, record);
|
|
770
770
|
return;
|
|
771
771
|
}
|
|
772
|
-
const record = recordOf(node), prop = nativePropName(name, record.type), accessibilityBefore = prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") ? projectAccessibility(record.props) : void 0, textEntryBefore = TEXT_ENTRY_SOURCES.has(prop) ? projectTextEntry(record.type, record.props) : void 0, wasDisabled = disabled(record);
|
|
772
|
+
const record = recordOf(node), prop = nativePropName(name, record.type), accessibilityBefore = record.type === "Image" && prop === "alt" || prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") ? projectAccessibility(record.props, record.type) : void 0, textEntryBefore = TEXT_ENTRY_SOURCES.has(prop) ? projectTextEntry(record.type, record.props) : void 0, wasDisabled = disabled(record);
|
|
773
773
|
record.props[prop] = value;
|
|
774
774
|
if (TEXT_ENTRY_SOURCES.has(prop) || prop === "multiline")
|
|
775
775
|
syncImplicitSubmit(node);
|
|
@@ -790,7 +790,7 @@ export function createNativeHost(options) {
|
|
|
790
790
|
markCurrentLink(node);
|
|
791
791
|
const patch = { [prop]: value };
|
|
792
792
|
if (accessibilityBefore)
|
|
793
|
-
Object.assign(patch, accessibilityChanges(record.props, accessibilityBefore, prop));
|
|
793
|
+
Object.assign(patch, accessibilityChanges(record.props, accessibilityBefore, prop, record.type));
|
|
794
794
|
if (textEntryBefore) {
|
|
795
795
|
Object.assign(patch, textEntryChanges(record.type, record.props, textEntryBefore));
|
|
796
796
|
const projected = projectTextEntry(record.type, record.props);
|
|
@@ -823,11 +823,11 @@ export function createNativeHost(options) {
|
|
|
823
823
|
this.setAttribute(node, name, "");
|
|
824
824
|
return;
|
|
825
825
|
}
|
|
826
|
-
const record = recordOf(node), prop = nativePropName(name, record.type), accessibilityBefore = prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") ? projectAccessibility(record.props) : void 0, textEntryBefore = TEXT_ENTRY_SOURCES.has(prop) ? projectTextEntry(record.type, record.props) : void 0;
|
|
826
|
+
const record = recordOf(node), prop = nativePropName(name, record.type), accessibilityBefore = record.type === "Image" && prop === "alt" || prop === "role" || prop.startsWith("aria-") || prop.startsWith("accessibility") ? projectAccessibility(record.props, record.type) : void 0, textEntryBefore = TEXT_ENTRY_SOURCES.has(prop) ? projectTextEntry(record.type, record.props) : void 0;
|
|
827
827
|
delete record.props[prop];
|
|
828
828
|
const patch = { [prop]: null };
|
|
829
829
|
if (accessibilityBefore)
|
|
830
|
-
Object.assign(patch, accessibilityChanges(record.props, accessibilityBefore, prop));
|
|
830
|
+
Object.assign(patch, accessibilityChanges(record.props, accessibilityBefore, prop, record.type));
|
|
831
831
|
if (textEntryBefore)
|
|
832
832
|
Object.assign(patch, textEntryChanges(record.type, record.props, textEntryBefore));
|
|
833
833
|
if (affectsGeometry(record.type, prop))
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { escapeAttr } from "./builtins/escape.js";
|
|
2
|
+
import { scanAtElementPosition } from "./html-masking.js";
|
|
3
|
+
import { decodeTitleEntities } from "./spa-nav.js";
|
|
4
|
+
function quoteValue(value) {
|
|
5
|
+
return value.replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
6
|
+
}
|
|
7
|
+
export function pageHeadFragment(html) {
|
|
8
|
+
const head = /<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(html)?.[1] ?? "", tag = /<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy, tags = scanAtElementPosition(head, (source, index) => {
|
|
9
|
+
tag.lastIndex = index;
|
|
10
|
+
return tag.exec(source) ? tag.lastIndex : -1;
|
|
11
|
+
}), metadata = [];
|
|
12
|
+
for (const { token } of tags) {
|
|
13
|
+
if (/^<title\b/i.test(token)) {
|
|
14
|
+
metadata.push(`<title>${quoteValue(token.replace(/^<title\b[^>]*>|<\/title\s*>$/gi, ""))}</title>`);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const attrs = Object.create(null), attributes = token.replace(/^<\w+\b|>$/g, "");
|
|
18
|
+
for (const match of attributes.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)) {
|
|
19
|
+
const name = match[1].toLowerCase();
|
|
20
|
+
if (!(name in attrs))
|
|
21
|
+
attrs[name] = match[2] ?? match[3] ?? match[4] ?? "";
|
|
22
|
+
}
|
|
23
|
+
if (/^<meta\b/i.test(token)) {
|
|
24
|
+
const kind = attrs.property ? "property" : "name", name = decodeTitleEntities(attrs[kind] ?? "").toLowerCase();
|
|
25
|
+
if (name === "description" || /^(?:og|twitter):[\w:]+$/.test(name))
|
|
26
|
+
metadata.push(`<meta ${kind}="${escapeAttr(name)}" content="${quoteValue(attrs.content ?? "")}">`);
|
|
27
|
+
} else {
|
|
28
|
+
const rel = decodeTitleEntities(attrs.rel ?? "").toLowerCase();
|
|
29
|
+
if (rel === "canonical" || rel === "alternate" && attrs.hreflang)
|
|
30
|
+
metadata.push(`<link rel="${rel}" href="${quoteValue(attrs.href ?? "")}"${rel === "alternate" ? ` hreflang="${quoteValue(attrs.hreflang)}"` : ""}>`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return `<template data-stx-page-head="1">${metadata.join("")}</template>
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
@@ -128,7 +128,7 @@ export async function buildForProduction(options = {}) {
|
|
|
128
128
|
compiled.serverScriptContent = [];
|
|
129
129
|
compiled.placeholders = {};
|
|
130
130
|
}
|
|
131
|
-
compiled.fragment = extractContainerContent(compiled.html, routerContainer);
|
|
131
|
+
compiled.fragment = extractContainerContent(compiled.html, routerContainer, !0);
|
|
132
132
|
const safeRouteName = route.pattern === "/" ? "index" : route.pattern.slice(1).replace(/\//g, "-").replace(/[[\]]/g, "_"), compiledPath = path.join("server", "pages", `${safeRouteName}.compiled.json`), fragmentPath = path.join("server", "fragments", `${safeRouteName}.html`);
|
|
133
133
|
await Bun.write(path.join(outputDir, compiledPath), JSON.stringify(compiled, null, 2));
|
|
134
134
|
await Bun.write(path.join(outputDir, fragmentPath), compiled.fragment);
|
|
@@ -211,7 +211,7 @@ export async function startProductionServer(options = {}) {
|
|
|
211
211
|
headers.set("X-STX-Layout", layout.layout);
|
|
212
212
|
headers.set("X-STX-Layout-Group", layout.group);
|
|
213
213
|
}
|
|
214
|
-
return streamToResponse(renderStreamingPage(isSpaNav && !isMutating ? extractContainerContent(html, manifest.routerContainer || "main") : html, boundaries, { timeoutMs: 30000 }), {
|
|
214
|
+
return streamToResponse(renderStreamingPage(isSpaNav && !isMutating ? extractContainerContent(html, manifest.routerContainer || "main", !0) : html, boundaries, { timeoutMs: 30000 }), {
|
|
215
215
|
status: status ?? compiled.status ?? 200,
|
|
216
216
|
headers
|
|
217
217
|
});
|
|
@@ -232,7 +232,7 @@ export async function startProductionServer(options = {}) {
|
|
|
232
232
|
headers.set("X-STX-Runtime", pageShipsSignalsRuntime(html) ? "true" : "false");
|
|
233
233
|
headers.set("X-STX-Layout", layout.layout);
|
|
234
234
|
headers.set("X-STX-Layout-Group", layout.group);
|
|
235
|
-
return new Response(extractContainerContent(html, manifest.routerContainer || "main"), { status: status ?? compiled.status ?? 200, headers });
|
|
235
|
+
return new Response(extractContainerContent(html, manifest.routerContainer || "main", !0), { status: status ?? compiled.status ?? 200, headers });
|
|
236
236
|
}
|
|
237
237
|
return new Response(html, { status: status ?? compiled.status ?? 200, headers });
|
|
238
238
|
} catch (error) {
|
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{Hs,Ft,sl,og}from"./chunk-zecgd1wz.js";import{zs,yi,ng,rg,sg}from"./chunk-3457kk19.js";import{tl,nl,rl,eg,tg}from"./chunk-83p5k4eb.js";import{Ve,_n,bi}from"./chunk-fcbd7kwj.js";import{ig,ag,cg,lg,Vs,Lh}from"./chunk-zjaw79zp.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-3qnke2jb.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=
|
|
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=Ve(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Hs(n,t);if(a){let s=Ft(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 yi(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,nl as auditBuildOutput,tl as auditConfig,re as buildPwaAssets,rl as calculateAuditResult,tg as formatAuditResult,bi as formatSize,j as generateManifest,_ as generateManifestJson,rg as generateManifestLink,F as generateOfflinePage,Ve as generatePrecacheManifest,_n as generatePrecacheManifestJs,M as generatePwaIcons,zs as generatePwaTags,Hs as generateServiceWorker,og as generateServiceWorkerAuto,ng as generateSwRegistrationScript,sg as generateThemeColorMeta,N as getExpectedIconPaths,Ft as getServiceWorkerFileName,yi as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,sl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,Vs as pwaDirectives,ig as pwaInstallDirective,cg as pwaOfflineDirective,lg as pwaPushDirective,ag as pwaUpdateDirective,Lh as registerPwaDirectives,eg as runPwaAudit,D as validateManifest};
|
|
@@ -92,7 +92,7 @@ export function translate(i18n, locale, key) {
|
|
|
92
92
|
export function applyTranslations(html, i18n, locale) {
|
|
93
93
|
return html.replace(/\{t(!?):([a-zA-Z][\w.-]*)\}/g, (_match, raw, key) => {
|
|
94
94
|
const value = translate(i18n, locale, key);
|
|
95
|
-
return raw === "!" ? value : escapeHtml(value);
|
|
95
|
+
return raw === "!" ? value : escapeHtml(value).replace(/"/g, """).replace(/'/g, "'");
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
export function localizePath(path, locale, defaultLocale) {
|