@stacksjs/stx 0.2.817 → 0.2.818
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-pyytr30r.js → chunk-035m9ada.js} +3 -3
- package/dist/chunk-03mtfndv.js +2 -0
- package/dist/chunk-18qxd18d.js +2 -0
- package/dist/{chunk-d47m4qat.js → chunk-1a8qtvs1.js} +2 -2
- package/dist/{chunk-s9xs2ff4.js → chunk-1ae3megp.js} +5 -5
- package/dist/chunk-1cd0w20k.js +2 -0
- package/dist/{chunk-549end3k.js → chunk-1hg0zb3p.js} +2 -2
- package/dist/{chunk-p8wq37hd.js → chunk-1rvgv1fr.js} +5 -5
- package/dist/{chunk-n761hp6d.js → chunk-1tzqqr0p.js} +2 -2
- package/dist/{chunk-rc424p1c.js → chunk-2bnbcr22.js} +24 -24
- package/dist/{chunk-b5ckg7zq.js → chunk-2jn0x4sh.js} +5 -5
- package/dist/chunk-2kt1gqtq.js +2 -0
- package/dist/chunk-2vaap97d.js +2 -0
- package/dist/chunk-33ewq978.js +2 -0
- package/dist/chunk-3m342maz.js +2 -0
- package/dist/chunk-46sej67y.js +2 -0
- package/dist/{chunk-5efv1fhk.js → chunk-4fbg7gq8.js} +2 -2
- package/dist/{chunk-cj1p3qdh.js → chunk-4h78zypb.js} +1 -1
- package/dist/chunk-5zf566bv.js +2 -0
- package/dist/chunk-67k5q95t.js +2 -0
- package/dist/chunk-6e76tz09.js +2 -0
- package/dist/{chunk-bphwhfbd.js → chunk-6n11z33h.js} +5 -5
- package/dist/{chunk-7rk7wfm6.js → chunk-72jt897s.js} +13 -13
- package/dist/chunk-72w08sh9.js +2 -0
- package/dist/{chunk-agxjwnz0.js → chunk-7ac98ja7.js} +8 -8
- package/dist/chunk-7q79h0j4.js +2 -0
- package/dist/chunk-88mhhbqj.js +2 -0
- package/dist/{chunk-a0r4dpzs.js → chunk-8dmey36n.js} +2 -2
- package/dist/chunk-8gcg9maj.js +1327 -0
- package/dist/{chunk-gtfs96f2.js → chunk-8hfgvs0x.js} +2 -2
- package/dist/{chunk-cm5cp3m0.js → chunk-8wdy7kdq.js} +4 -4
- package/dist/{chunk-kjjvs3sc.js → chunk-9487tyfa.js} +2 -2
- package/dist/chunk-9736003n.js +2 -0
- package/dist/chunk-99zwpazg.js +2 -0
- package/dist/chunk-9e5gamvs.js +2 -0
- package/dist/{chunk-17wb2x3z.js → chunk-9egd7tx3.js} +2 -2
- package/dist/{chunk-5hxvhmg3.js → chunk-9gj702tw.js} +4 -4
- package/dist/{chunk-2ws2qe1k.js → chunk-9gwhs0gk.js} +2 -2
- package/dist/{chunk-rxt4jj9b.js → chunk-9tzcvsv0.js} +6 -6
- package/dist/{chunk-133vw0ae.js → chunk-9xd85mvm.js} +4 -4
- package/dist/chunk-9y1dm510.js +2 -0
- package/dist/{chunk-yvqe0pzk.js → chunk-a1cy78h3.js} +2 -2
- package/dist/{chunk-sa0nkpx9.js → chunk-a67c2xrp.js} +2 -2
- package/dist/chunk-abzrvxct.js +2 -0
- package/dist/chunk-avbvedyx.js +2 -0
- package/dist/{chunk-3vpgr6nk.js → chunk-b9d70mgr.js} +3 -3
- package/dist/chunk-bbxzkcsk.js +2 -0
- package/dist/chunk-c179xpsq.js +2 -0
- package/dist/{chunk-n9av365c.js → chunk-casvvt3k.js} +1 -1
- package/dist/{chunk-p5ez40kf.js → chunk-cf196sv5.js} +2 -2
- package/dist/chunk-cvq4bz8y.js +2 -0
- package/dist/{chunk-1wdv3zj2.js → chunk-d4pmddb9.js} +1 -1
- package/dist/chunk-dh1f8ga0.js +2 -0
- package/dist/{chunk-1fc6rax4.js → chunk-dpn314z2.js} +2 -2
- package/dist/{chunk-6cw072n5.js → chunk-dq9djbgq.js} +4 -4
- package/dist/{chunk-tb4wmzzd.js → chunk-e3t2bqyf.js} +5 -5
- package/dist/{chunk-y3p6w1e0.js → chunk-e9w8qav3.js} +5 -5
- package/dist/{chunk-jg9f5nqf.js → chunk-em2yy1te.js} +6 -6
- package/dist/chunk-em7kntfc.js +2 -0
- package/dist/chunk-enm79dwe.js +2 -0
- package/dist/{chunk-m0x96g8e.js → chunk-f6nk205v.js} +1 -1
- package/dist/{chunk-f54t0qar.js → chunk-fmawgk87.js} +1 -1
- package/dist/chunk-fvs15n0s.js +2 -0
- package/dist/{chunk-gqjb1y7c.js → chunk-g7mjv276.js} +2 -2
- package/dist/{chunk-r6dtrd7y.js → chunk-gcje06er.js} +30 -30
- package/dist/{chunk-1bgv727x.js → chunk-gtd6qs1r.js} +2 -2
- package/dist/chunk-gvthmy3a.js +2 -0
- package/dist/chunk-h8kbcz9t.js +2 -0
- package/dist/chunk-h8x56dq5.js +2 -0
- package/dist/{chunk-hg67a15h.js → chunk-hntm02x0.js} +3 -3
- package/dist/chunk-hx575xy8.js +2 -0
- package/dist/{chunk-dy7yccxm.js → chunk-j24psz0z.js} +7 -7
- package/dist/chunk-j58z3y2g.js +2 -0
- package/dist/chunk-j5t40n2g.js +2 -0
- package/dist/{chunk-nmkkfpmh.js → chunk-j65nf7mt.js} +6 -6
- package/dist/{chunk-kvhsdyfg.js → chunk-j8r0am39.js} +1 -1
- package/dist/{chunk-jtx9x3as.js → chunk-k01aftw0.js} +6 -6
- package/dist/{chunk-0h99mrb0.js → chunk-k3t72x38.js} +2 -2
- package/dist/{chunk-0svj1nfa.js → chunk-k3zcadcc.js} +2 -2
- package/dist/chunk-kgwdxx75.js +2 -0
- package/dist/{chunk-r5nt1bcx.js → chunk-mbhvf0sv.js} +2 -2
- package/dist/{chunk-fn3q1gtr.js → chunk-mjg9cx5a.js} +3 -3
- package/dist/{chunk-ccxphr19.js → chunk-mm8ak4w2.js} +2 -2
- package/dist/{chunk-xrd1md4j.js → chunk-mr2ke5km.js} +6 -6
- package/dist/chunk-n1tbc7da.js +2 -0
- package/dist/{chunk-4ws3yz5q.js → chunk-n4s0se11.js} +8 -8
- package/dist/chunk-n7dm6prj.js +2 -0
- package/dist/chunk-nknpr8cy.js +2 -0
- package/dist/{chunk-jham85mf.js → chunk-nqdh7z2d.js} +1 -1
- package/dist/{chunk-vbrn4w81.js → chunk-p13wg97w.js} +3 -3
- package/dist/chunk-pe9npaby.js +2 -0
- package/dist/chunk-pyz2jqph.js +2 -0
- package/dist/chunk-q51w24br.js +2 -0
- package/dist/chunk-qek9bcjt.js +2 -0
- package/dist/chunk-qkxx34vt.js +2 -0
- package/dist/{chunk-0jcady6w.js → chunk-qr14xvwb.js} +1 -1
- package/dist/chunk-r2v042ym.js +2 -0
- package/dist/{chunk-df60fpgx.js → chunk-r8ydxe4z.js} +3 -3
- package/dist/chunk-rjzp7za8.js +2 -0
- package/dist/{chunk-yts2b9d8.js → chunk-s6mte5vy.js} +11 -6
- package/dist/chunk-s9b49v74.js +3 -0
- package/dist/{chunk-vkn133cs.js → chunk-s9b6abkb.js} +2 -2
- package/dist/chunk-sata7rh2.js +2 -0
- package/dist/{chunk-pdnyhs63.js → chunk-sf4rntqj.js} +1 -1
- package/dist/{chunk-8h3jv8dd.js → chunk-sh1hbhhb.js} +2 -2
- package/dist/{chunk-ntn6bnjv.js → chunk-skht06a2.js} +1 -1
- package/dist/{chunk-gc7pykfq.js → chunk-swbrvrgr.js} +2 -2
- package/dist/{chunk-s90m43sm.js → chunk-sxad7x2s.js} +4 -4
- package/dist/{chunk-w6n4y2xg.js → chunk-tj6zvs8f.js} +2 -2
- package/dist/chunk-tmcgpf68.js +2 -0
- package/dist/chunk-tsb5h4e2.js +2 -0
- package/dist/chunk-v8h2kns0.js +2 -0
- package/dist/{chunk-ncyjaxyz.js → chunk-vmxzktdr.js} +1 -1
- package/dist/chunk-vpazz8ca.js +2 -0
- package/dist/{chunk-5gxneecs.js → chunk-vtt2dec3.js} +3 -3
- package/dist/chunk-vyw40ym7.js +2 -0
- package/dist/chunk-whq40bdm.js +2 -0
- package/dist/chunk-x15hrtmt.js +2 -0
- package/dist/{chunk-fcvyk047.js → chunk-x34me5ar.js} +7 -7
- package/dist/{chunk-0ekdbagy.js → chunk-xc7nynb9.js} +2 -2
- package/dist/chunk-xha2gt0n.js +2 -0
- package/dist/{chunk-hhazm0cs.js → chunk-y3zjmv9e.js} +3 -3
- package/dist/chunk-ydt1pbhx.js +2 -0
- package/dist/chunk-ymypc1rp.js +709 -0
- package/dist/chunk-z8ywxqqg.js +2 -0
- package/dist/{chunk-crmxg1c0.js → chunk-zgq8bfaw.js} +4 -4
- package/dist/{chunk-e39nkbt4.js → chunk-zhvmcj78.js} +4 -4
- package/dist/{chunk-2p3eaj16.js → chunk-zme16hcr.js} +3 -3
- package/dist/{chunk-sphc7xzx.js → chunk-znx5m1jv.js} +1 -1
- package/dist/chunk-zwp7n01x.js +2 -0
- package/dist/cli.js +12 -12
- package/dist/client/signals-expression-runtime.js +6 -2
- package/dist/client/signals-public-api-runtime.js +1 -0
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/process.js +2 -2
- package/dist/pwa.js +3 -3
- package/dist/reactive.d.ts +12 -2
- package/dist/reactive.js +69 -32
- package/dist/ssg.js +10 -10
- package/dist/utils.js +6 -1
- package/package.json +5 -5
- package/dist/chunk-0yjm4j26.js +0 -2
- package/dist/chunk-1kz70290.js +0 -2
- package/dist/chunk-1rwfgmmk.js +0 -2
- package/dist/chunk-2k3qtmn8.js +0 -2
- package/dist/chunk-2vget8rh.js +0 -2
- package/dist/chunk-3e85etrf.js +0 -2
- package/dist/chunk-3eqs0rpv.js +0 -2
- package/dist/chunk-3ftaegqg.js +0 -2
- package/dist/chunk-3jd5ak8h.js +0 -2
- package/dist/chunk-4ypwqrj2.js +0 -2
- package/dist/chunk-5eqna31h.js +0 -2
- package/dist/chunk-6a97a9wk.js +0 -2
- package/dist/chunk-7agp0wj2.js +0 -2
- package/dist/chunk-7hch54b2.js +0 -2
- package/dist/chunk-7pb9fepg.js +0 -2
- package/dist/chunk-8g8h2xwz.js +0 -2
- package/dist/chunk-9mtw71xy.js +0 -2
- package/dist/chunk-9ttf7k5e.js +0 -2
- package/dist/chunk-9wmjmas8.js +0 -2
- package/dist/chunk-a350jjd3.js +0 -2
- package/dist/chunk-aqydav9y.js +0 -2
- package/dist/chunk-ar7w1kx0.js +0 -2
- package/dist/chunk-aya8nv31.js +0 -2
- package/dist/chunk-b9ntt41z.js +0 -2
- package/dist/chunk-bj6ax0he.js +0 -2
- package/dist/chunk-cxpnkgvw.js +0 -2
- package/dist/chunk-d3gncxq1.js +0 -2
- package/dist/chunk-da886asf.js +0 -2
- package/dist/chunk-dnemxdvy.js +0 -2
- package/dist/chunk-dnqt6y8v.js +0 -3
- package/dist/chunk-f0bwetnx.js +0 -421
- package/dist/chunk-gzhrtymg.js +0 -1592
- package/dist/chunk-h9yvb9qn.js +0 -2
- package/dist/chunk-hsmwzzy2.js +0 -2
- package/dist/chunk-jsvc264s.js +0 -2
- package/dist/chunk-k98nt4pk.js +0 -2
- package/dist/chunk-ka1hrt56.js +0 -2
- package/dist/chunk-m477m5dp.js +0 -2
- package/dist/chunk-mkr46mzz.js +0 -2
- package/dist/chunk-mmyrdbxx.js +0 -2
- package/dist/chunk-p4f1hrvn.js +0 -2
- package/dist/chunk-py244ymg.js +0 -2
- package/dist/chunk-rp6b7awz.js +0 -2
- package/dist/chunk-rqfg21xk.js +0 -2
- package/dist/chunk-rxc1076r.js +0 -2
- package/dist/chunk-rzwyaqgg.js +0 -2
- package/dist/chunk-s5pegavh.js +0 -2
- package/dist/chunk-sj4vw93g.js +0 -2
- package/dist/chunk-snfjvd94.js +0 -2
- package/dist/chunk-syvsj91a.js +0 -2
- package/dist/chunk-tzb0n60s.js +0 -2
- package/dist/chunk-w8xvkbt9.js +0 -2
- package/dist/chunk-x5rt4kpx.js +0 -2
- package/dist/chunk-xbknqp19.js +0 -2
- package/dist/chunk-xgqyzkt2.js +0 -2
- package/dist/chunk-yd0074ks.js +0 -2
- package/dist/chunk-yd1zsy7t.js +0 -2
- package/dist/chunk-yjezsy4p.js +0 -2
- package/dist/chunk-yjvwp1s6.js +0 -2
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{eo,Ht,
|
|
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{eo,Ht,Sl,Eg}from"./chunk-k3zcadcc.js";import{Qs,Pi,kg,_g,Cg}from"./chunk-zhvmcj78.js";import{wl,vl,xl,xg,Sg}from"./chunk-1a8qtvs1.js";import{Ue,Tn,Ii}from"./chunk-7xs45trj.js";import{Tg,$g,Rg,Ag,to,py}from"./chunk-g7mjv276.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-enm79dwe.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=Ue(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=eo(n,t);if(a){let s=Ht(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 Pi(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,
|
|
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=Ue(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=eo(n,t);if(a){let s=Ht(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 Pi(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,vl as auditBuildOutput,wl as auditConfig,re as buildPwaAssets,xl as calculateAuditResult,Sg as formatAuditResult,Ii as formatSize,j as generateManifest,_ as generateManifestJson,_g as generateManifestLink,F as generateOfflinePage,Ue as generatePrecacheManifest,Tn as generatePrecacheManifestJs,M as generatePwaIcons,Qs as generatePwaTags,eo as generateServiceWorker,Eg as generateServiceWorkerAuto,kg as generateSwRegistrationScript,Cg as generateThemeColorMeta,N as getExpectedIconPaths,Ht as getServiceWorkerFileName,Pi as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Sl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,to as pwaDirectives,Tg as pwaInstallDirective,Rg as pwaOfflineDirective,Ag as pwaPushDirective,$g as pwaUpdateDirective,py as registerPwaDirectives,xg as runPwaAudit,D as validateManifest};
|
package/dist/reactive.d.ts
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
* @param template - The HTML template string
|
|
7
7
|
* @param context - Template context
|
|
8
8
|
* @param filePath - Source file path for error messages
|
|
9
|
+
* @param deferInit - Wait for component helper registration before initialization
|
|
9
10
|
* @returns Processed template with reactive runtime script
|
|
10
11
|
*/
|
|
11
|
-
export declare function processReactiveDirectives(template: string, context: Record<string, unknown>, _filePath: string): string;
|
|
12
|
+
export declare function processReactiveDirectives(template: string, context: Record<string, unknown>, _filePath: string, deferInit?: boolean): string;
|
|
12
13
|
/**
|
|
13
14
|
* Check if a template contains reactive directives
|
|
14
15
|
*/
|
|
@@ -64,9 +65,18 @@ export declare function hasReactiveDirectives(template: string): boolean;
|
|
|
64
65
|
*
|
|
65
66
|
* ### x-init - Run code on mount
|
|
66
67
|
* ```html
|
|
67
|
-
* <div x-data="{ items: [] }" x-init="items =
|
|
68
|
+
* <div x-data="{ items: [] }" x-init="fetchItems().then(next => { items = next })">
|
|
68
69
|
* ```
|
|
69
70
|
*
|
|
71
|
+
* ### x-destroy - Dispose a scope's resources
|
|
72
|
+
* ```html
|
|
73
|
+
* <div x-data="{ handle: null }" x-init="handle = follow()" x-destroy="handle?.stop()">
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* Component initializers run after their own client helpers and props are ready.
|
|
77
|
+
* Bare assignments write through the scope's signals, including in callbacks.
|
|
78
|
+
* Standalone x-data initializes synchronously. Teardown belongs to the scope.
|
|
79
|
+
*
|
|
70
80
|
* @module reactive
|
|
71
81
|
*/
|
|
72
82
|
// =============================================================================
|
package/dist/reactive.js
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import { evaluateExpression } from "./expressions.js";
|
|
2
|
+
import { scanAtElementPosition } from "./html-masking.js";
|
|
2
3
|
let scopeCounter = 0, elementCounter = 0;
|
|
3
4
|
function escapeRegex(str) {
|
|
4
5
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5
6
|
}
|
|
6
7
|
function extractAttributeValue(attributesStr, attrName) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (singleMatch)
|
|
12
|
-
return singleMatch[1];
|
|
8
|
+
const attributes = /(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;
|
|
9
|
+
for (const match of attributesStr.matchAll(attributes))
|
|
10
|
+
if (match[1].toLowerCase() === attrName.toLowerCase())
|
|
11
|
+
return match[2] ?? match[3] ?? match[4] ?? null;
|
|
13
12
|
return null;
|
|
14
13
|
}
|
|
14
|
+
function reactiveOpeningTags(template) {
|
|
15
|
+
const tags = [], opening = /<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;
|
|
16
|
+
scanAtElementPosition(template, (html, index) => {
|
|
17
|
+
opening.lastIndex = index;
|
|
18
|
+
const match = opening.exec(html);
|
|
19
|
+
if (!match || !extractAttributeValue(match[2], "x-data"))
|
|
20
|
+
return -1;
|
|
21
|
+
tags.push({ fullMatch: match[0], tagName: match[1], attributes: match[2], startIndex: index, endIndex: opening.lastIndex });
|
|
22
|
+
return opening.lastIndex;
|
|
23
|
+
});
|
|
24
|
+
return tags;
|
|
25
|
+
}
|
|
15
26
|
function findReactiveScopes(template) {
|
|
16
|
-
const scopes = []
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const [fullMatch, tagName, attributesStr] = match, startIndex = match.index, stateExpr = extractAttributeValue(attributesStr, "x-data");
|
|
27
|
+
const scopes = [];
|
|
28
|
+
for (const { fullMatch, tagName, attributes: attributesStr, startIndex } of reactiveOpeningTags(template)) {
|
|
29
|
+
const stateExpr = extractAttributeValue(attributesStr, "x-data");
|
|
20
30
|
if (!stateExpr)
|
|
21
31
|
continue;
|
|
22
32
|
const scopeId = `__stx_scope_${scopeCounter++}`, initExpr = extractAttributeValue(attributesStr, "x-init"), closingTag = findClosingTag(template, tagName, startIndex + fullMatch.length), scopeContent = template.slice(startIndex, closingTag.endIndex), refs = findRefsInScope(scopeContent);
|
|
@@ -228,7 +238,7 @@ window.__stx_reactive = (function() {
|
|
|
228
238
|
|
|
229
239
|
// Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
|
|
230
240
|
// then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
|
|
231
|
-
function initScope(scopeEl, initialState, bindings, refs, initExpr) {
|
|
241
|
+
function initScope(scopeEl, initialState, bindings, refs, initExpr, deferInit) {
|
|
232
242
|
// Parse initial state (may contain methods including async init())
|
|
233
243
|
var state;
|
|
234
244
|
try {
|
|
@@ -298,6 +308,11 @@ window.__stx_reactive = (function() {
|
|
|
298
308
|
if (prop === '$refs') return $refs;
|
|
299
309
|
if (prop === '$el') return scopeEl;
|
|
300
310
|
if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
|
|
311
|
+
if (prop === Symbol.unscopables) return undefined;
|
|
312
|
+
if (!(prop in signalState)) {
|
|
313
|
+
var owner = stx._scopeForBinding(scopeEl, prop);
|
|
314
|
+
return owner ? owner[prop] : undefined;
|
|
315
|
+
}
|
|
301
316
|
var s = signalState[prop];
|
|
302
317
|
if (!s) return undefined;
|
|
303
318
|
if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
|
|
@@ -331,7 +346,7 @@ window.__stx_reactive = (function() {
|
|
|
331
346
|
return true;
|
|
332
347
|
},
|
|
333
348
|
has: function(target, prop) {
|
|
334
|
-
return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick';
|
|
349
|
+
return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick' || !!stx._scopeForBinding(scopeEl, prop);
|
|
335
350
|
},
|
|
336
351
|
ownKeys: function() {
|
|
337
352
|
return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
|
|
@@ -383,7 +398,8 @@ window.__stx_reactive = (function() {
|
|
|
383
398
|
|
|
384
399
|
// Register scope \u2014 merge with any existing vars from partial signal scripts
|
|
385
400
|
if (!stx._scopes) stx._scopes = {};
|
|
386
|
-
stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
|
|
401
|
+
var registered = stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
|
|
402
|
+
registered.__el = scopeEl;
|
|
387
403
|
|
|
388
404
|
// Store on element for findElementScope
|
|
389
405
|
scopeEl.__stx_scope = scopeVars;
|
|
@@ -396,10 +412,8 @@ window.__stx_reactive = (function() {
|
|
|
396
412
|
}
|
|
397
413
|
if (initExpr) {
|
|
398
414
|
try {
|
|
399
|
-
var
|
|
400
|
-
var
|
|
401
|
-
var fn = new Function(keys.join(','), initExpr);
|
|
402
|
-
var result = fn.apply(ctxProxy, vals);
|
|
415
|
+
var fn = new Function('with(this){' + initExpr + ';}');
|
|
416
|
+
var result = fn.call(ctxProxy);
|
|
403
417
|
if (result && typeof result.then === 'function') maybePromise = result;
|
|
404
418
|
} catch (e) {
|
|
405
419
|
console.warn('[stx-reactive] init expression error:', e);
|
|
@@ -414,8 +428,23 @@ window.__stx_reactive = (function() {
|
|
|
414
428
|
}
|
|
415
429
|
}
|
|
416
430
|
|
|
417
|
-
//
|
|
418
|
-
|
|
431
|
+
// A component's helper setup follows its markup. Its own mount queue
|
|
432
|
+
// starts the initializer after all component factories have registered.
|
|
433
|
+
// Standalone x-data retains synchronous initialization.
|
|
434
|
+
if (deferInit) {
|
|
435
|
+
registered.__mountCallbacks = registered.__mountCallbacks || [];
|
|
436
|
+
registered.__mountCallbacks.push(runInit);
|
|
437
|
+
} else {
|
|
438
|
+
runInit();
|
|
439
|
+
}
|
|
440
|
+
var destroyExpr = scopeEl.getAttribute('data-stx-xdestroy') || scopeEl.getAttribute('x-destroy');
|
|
441
|
+
if (destroyExpr) {
|
|
442
|
+
registered.__destroyCallbacks = registered.__destroyCallbacks || [];
|
|
443
|
+
var teardown = function() { scopeEl.__stx_execute(destroyExpr); };
|
|
444
|
+
registered.__destroyCallbacks.push(teardown);
|
|
445
|
+
registered.__destroyHooks = registered.__destroyHooks || [];
|
|
446
|
+
registered.__destroyHooks.push(teardown);
|
|
447
|
+
}
|
|
419
448
|
|
|
420
449
|
// Expose for debugging
|
|
421
450
|
scopeEl.__stx_state = ctxProxy;
|
|
@@ -499,7 +528,7 @@ function substituteExpressionsInExpr(expr, context) {
|
|
|
499
528
|
return JSON.stringify(value);
|
|
500
529
|
}
|
|
501
530
|
}
|
|
502
|
-
function generateScopeInitializers(scopes, context) {
|
|
531
|
+
function generateScopeInitializers(scopes, context, deferInit) {
|
|
503
532
|
if (scopes.length === 0)
|
|
504
533
|
return "";
|
|
505
534
|
const initializers = scopes.map((scope) => {
|
|
@@ -509,7 +538,7 @@ function generateScopeInitializers(scopes, context) {
|
|
|
509
538
|
var scopeEl = document.querySelector('${scope.selector}');
|
|
510
539
|
if (!scopeEl) return;
|
|
511
540
|
var refs = ${refsJson};
|
|
512
|
-
__stx_reactive.initScope(scopeEl, ${stateExprJson}, [], refs, ${initExprJson});
|
|
541
|
+
window.__stx_reactive.initScope(scopeEl, ${stateExprJson}, [], refs, ${initExprJson}${deferInit ? ", true" : ""});
|
|
513
542
|
})();`;
|
|
514
543
|
}).join(`
|
|
515
544
|
`);
|
|
@@ -574,14 +603,14 @@ function removeReactiveAttributes(template) {
|
|
|
574
603
|
output = output.replace(regex, "");
|
|
575
604
|
return output;
|
|
576
605
|
}
|
|
577
|
-
export function processReactiveDirectives(template, context, _filePath) {
|
|
606
|
+
export function processReactiveDirectives(template, context, _filePath, deferInit = !1) {
|
|
578
607
|
if (!hasReactiveDirectives(template))
|
|
579
608
|
return template;
|
|
580
609
|
const scopes = findReactiveScopes(template);
|
|
581
610
|
if (scopes.length === 0)
|
|
582
611
|
return template;
|
|
583
612
|
let output = finalizeTemplate(template, scopes);
|
|
584
|
-
const script = generateScopeInitializers(scopes, context), bodyCloseIdx = output.lastIndexOf("</body>");
|
|
613
|
+
const script = generateScopeInitializers(scopes, context, deferInit), bodyCloseIdx = output.lastIndexOf("</body>");
|
|
585
614
|
if (bodyCloseIdx !== -1)
|
|
586
615
|
output = output.slice(0, bodyCloseIdx) + script + `
|
|
587
616
|
` + output.slice(bodyCloseIdx);
|
|
@@ -616,22 +645,30 @@ function addAllReactiveIds(template) {
|
|
|
616
645
|
return output;
|
|
617
646
|
}
|
|
618
647
|
function finalizeTemplate(template, scopes) {
|
|
619
|
-
|
|
620
|
-
|
|
648
|
+
const parts = [];
|
|
649
|
+
let end = 0;
|
|
650
|
+
for (const [index, tag] of reactiveOpeningTags(template).entries()) {
|
|
651
|
+
const scope = scopes[index];
|
|
621
652
|
if (!scope)
|
|
622
|
-
|
|
623
|
-
|
|
653
|
+
break;
|
|
654
|
+
parts.push(template.slice(end, tag.startIndex));
|
|
655
|
+
const existing = extractAttributeValue(tag.attributes, "data-stx-scope");
|
|
624
656
|
if (existing) {
|
|
625
|
-
scope.id = existing
|
|
657
|
+
scope.id = existing;
|
|
626
658
|
scope.selector = `[data-stx-scope="${scope.id}"]`;
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
|
|
659
|
+
parts.push(tag.fullMatch);
|
|
660
|
+
} else
|
|
661
|
+
parts.push(`<${tag.tagName} data-stx-scope="${scope.id}"${tag.attributes}>`);
|
|
662
|
+
end = tag.endIndex;
|
|
663
|
+
}
|
|
664
|
+
parts.push(template.slice(end));
|
|
665
|
+
let output = parts.join("");
|
|
631
666
|
output = output.replace(/\s*x-data\s*=\s*"([^"]*)"/g, ' data-stx-xdata="$1"');
|
|
632
667
|
output = output.replace(/\s*x-data\s*=\s*'([^']*)'/g, " data-stx-xdata='$1'");
|
|
633
668
|
output = output.replace(/\s*x-init\s*=\s*"([^"]*)"/g, ' data-stx-xinit="$1"');
|
|
634
669
|
output = output.replace(/\s*x-init\s*=\s*'([^']*)'/g, " data-stx-xinit='$1'");
|
|
670
|
+
output = output.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g, ' data-stx-xdestroy="$1"');
|
|
671
|
+
output = output.replace(/\s*x-destroy\s*=\s*'([^']*)'/g, " data-stx-xdestroy='$1'");
|
|
635
672
|
return output;
|
|
636
673
|
}
|
|
637
674
|
export function hasReactiveDirectives(template) {
|
package/dist/ssg.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-7sh9fa3q.js";import{
|
|
3
|
-
`)}function q(t){return async()=>({paths:await t(),fallback:!1})}var Ot;function Lt(t){let n=r(t),{depths:s}=ge(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(n))!==null){if(s[l.index]!==0)continue;let u=
|
|
2
|
+
import"./chunk-7sh9fa3q.js";import{x,rl}from"./chunk-72jt897s.js";import"./chunk-1tzqqr0p.js";import"./chunk-r9e0r6jx.js";import{Rt,w}from"./chunk-ymypc1rp.js";import"./chunk-m7hfcxt3.js";import"./chunk-sf4rntqj.js";import"./chunk-9gwhs0gk.js";import{kt,_t,Ct,Et,Tt,$t}from"./chunk-gtd6qs1r.js";import{a}from"./chunk-j65nf7mt.js";import{Es}from"./chunk-em2yy1te.js";import"./chunk-t2sg2tp2.js";import"./chunk-p13wg97w.js";import{he,en,tn}from"./chunk-vtt2dec3.js";import"./chunk-swbrvrgr.js";import{y}from"./chunk-9tzcvsv0.js";import{yt,i}from"./chunk-8gcg9maj.js";import"./chunk-r8ydxe4z.js";import"./chunk-7ac98ja7.js";import{ps}from"./chunk-x34me5ar.js";import"./chunk-e9w8qav3.js";import"./chunk-c84pxd2k.js";import{Ya,Za,Qa}from"./chunk-hwcfgs3e.js";import{Zt,Yn,Zn}from"./chunk-ndjmt3vg.js";import{Qt}from"./chunk-qr14xvwb.js";import"./chunk-s9b49v74.js";import"./chunk-f6nk205v.js";import{X,we}from"./chunk-9xd85mvm.js";import"./chunk-fmawgk87.js";import"./chunk-casvvt3k.js";import{c}from"./chunk-0rjcbqk3.js";import{r,ge}from"./chunk-b9d70mgr.js";import D from"fs";import f from"path";import{createHash as vt}from"crypto";function Pt(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 It(t){return Bun.hash(t).toString(16)}function ot(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,o=t.replace(Dt,(e,u,g,v)=>{let S=v.trim();if(!S)return e;if(/\bdata-stx-src=/.test(g))return e;if(n.minify)S=Pt(S);let p=It(S);if(!s.has(p))s.set(p,S);let P=n.integrity?` data-stx-integrity="sha384-${vt("sha384").update(S).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),l=Array.from(s,([e,u])=>({hash:e,code:u}));return{html:o,chunks:l}}var Bt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(t))!==null)n.set(o[1],o[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(Bt.has(n.get(u[1])||""))l.add(u[2]);let g=/<\/head\s*>/iy,v=w(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(l.size===0||v===-1)return t;let S=Array.from(l).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!S)return t;return t.slice(0,v)+S+t.slice(v)}var jt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function K(t){let n=t.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Ft(t){for(let n of jt){let s=t[n];if(!s)continue;let o=K(s);if(o)return{url:o,source:"env",via:n}}return null}function lt(t){if(!t||typeof t!=="object")return null;let n=t,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?K(s):null}async function At(t){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=s.resolve(t,o);if(!n(l))continue;try{let e=await import(l),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let n=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let u=K(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let l=await At(n);if(l)return{url:l,source:"site.config",via:"url"};let e=Ft(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){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 q(t){return async()=>({paths:await t(),fallback:!1})}var Ot;function Lt(t){let n=r(t),{depths:s}=ge(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(n))!==null){if(s[l.index]!==0)continue;let u=x(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=x(n,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(l.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(n))!==null){if(s[l.index]!==0)continue;let u=rl(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 gt(t){let n="read";try{let s=await Bun.file(t).text();n="parse";let o=Qt(s),l=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>s.indexOf(e.fullTag)-s.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(r(g))&&Rt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(q);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let S=await v();n="result";let p=Array.isArray(S)?{paths:S}:S;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}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=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let s=D.statSync(t),o=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of n)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,n){let s=this.cache.get(t);if(!s)return null;let o=ft(n).some((u)=>D.existsSync(u)),l=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&ps(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||l)return this.cache.delete(t),null;let e=this.getHash(n,s.dependencies??[]);if(s.hash!==e)return this.cache.delete(t),null;return s.html}set(t,n,s,o){let l=this.getHash(n,s);this.cache.set(t,{hash:l,html:o,generatedAt:Date.now(),dependencies:s})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.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 s=this.getFilePath(t);await D.promises.mkdir(f.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await D.promises.unlink(n)}async invalidatePattern(t){let n=f.join(this.cacheDir,"isr");if(!D.existsSync(n))return;let s=await D.promises.readdir(n);for(let o of s){let l=o.replace(/_/g,"/").replace(".json","");if(t.test(l))await D.promises.unlink(f.join(n,o))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function Ut(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let s=await gt(t.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${t.pattern} (${t.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let l of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(l.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return n}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let n of ft(t))if(await Bun.file(n).exists())try{let s=await import(n);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:o,...l}=s;return l}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Gt(t,n,s){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let l=o[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
|
})()
|
|
7
|
-
`)(n)}catch(e){return console.error(`Error executing getStaticProps in ${s}:`,e),null}}function Nt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function mt(t,n,s={},o,l){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,n,t.filePath),v={...u||{},...g||{},...s,params:n,$route:{path:t.pattern,params:n}},
|
|
8
|
-
resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let b=await i(e,v,t.filePath,E,
|
|
7
|
+
`)(n)}catch(e){return console.error(`Error executing getStaticProps in ${s}:`,e),null}}function Nt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function mt(t,n,s={},o,l){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,n,t.filePath),v={...u||{},...g||{},...s,params:n,$route:{path:t.pattern,params:n}},S=new Set,p=[],P=[],E={...l,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{p.push(`${f.relative(process.cwd(),R.templatePath)}: ${R.message}
|
|
8
|
+
resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let b=await i(e,v,t.filePath,E,S);for(let R of[t.filePath,...S])for(let T of he(R))S.add(T);if(Object.keys(n).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(b.includes("</head>"))b=b.replace("</head>",`${R}
|
|
9
9
|
</head>`);else b=`${R}
|
|
10
|
-
${b}`}if(b=await we(b,{router:o.router}),b=await y(b),o.minify!==!1)return{html:Ht(b),dependencies:Array.from(
|
|
10
|
+
${b}`}if(b=await we(b,{router:o.router}),b=await y(b),o.minify!==!1)return{html:Ht(b),dependencies:Array.from(S),includeFailures:p,serverScriptFailures:P};return{html:b,dependencies:Array.from(S),includeFailures:p,serverScriptFailures:P}}function Ht(t){let n=[],s=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,l;while((l=o.exec(t))!==null){let u=t.slice(s,l.index);n.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=l[1],v=l[2],S=l[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),n.push(g+v+S),s=l.index+l[0].length}let e=t.slice(s);return n.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function zt(t){let n=0;for(let s=0;s<t.length;s++){let o=t.charCodeAt(s);n=(n<<5)-n+o,n=n&n}return`"${Math.abs(n).toString(36)}"`}function Wt(t,n,s,o){if(s?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return o.some((l)=>{if(l instanceof RegExp)return l.test(t);return l.endsWith("/")?t===l.slice(0,-1)||t.startsWith(l):t===l})}function qt(t,n){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
11
11
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
12
12
|
${t.map((o)=>{let l=new URL(o.loc,n).href,e=` <url>
|
|
13
13
|
<loc>${F(l)}</loc>`;if(o.lastmod)e+=`
|
|
@@ -37,7 +37,7 @@ ${t.map((o)=>{let l=new URL(o.loc,n).href,e=` <url>
|
|
|
37
37
|
${s.join(`
|
|
38
38
|
`)}
|
|
39
39
|
</channel>
|
|
40
|
-
</rss>`}async function Vt(t={}){let n=Date.now();tn();let s=await a(process.cwd()),o=s.build||{},l=await ut({explicit:t.domain||o.domain,stxConfig:s});if(l.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:l.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.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:[]},g=new Set,v=0,
|
|
40
|
+
</rss>`}async function Vt(t={}){let n=Date.now();tn();let s=await a(process.cwd()),o=s.build||{},l=await ut({explicit:t.domain||o.domain,stxConfig:s});if(l.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:l.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.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:[]},g=new Set,v=0,S={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-33ewq978.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:b}=await import("./chunk-gvthmy3a.js"),R=await b(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let T=new pt(e.cacheDir,E);if(e.cache)await T.load();try{let{generateCss:d}=await import("./chunk-33ewq978.js");await d('<div class="bg-black"></div>')}catch{}kt();let wt=s?.routeMiddleware?.dir||"middleware";await Ct(process.cwd(),wt);let J=_t();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let St=s?.routeMiddleware?.global||[];Qa(s?.layoutsDir,c(process.cwd()));let Z=X(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Ut(d);for(let k of m)M.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=M.length+u.failedCount,console.log(`Generating ${M.length} pages...`);let _=[],Q=[];for(let d=0;d<M.length;d+=e.concurrency)Q.push(M.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:h,params:G,props:xt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let A=await Bun.file(k.filePath).text(),O=Yt(A),bt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...St,...bt];if(nt.length>0){let B=Et(h,G,O||{}),L=Tt(B,null,void 0,{isServer:!0}),j=await $t(nt,L);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,H=te(String(C),h),U=ee(h,e);await D.promises.mkdir(f.dirname(U),{recursive:!0}),await Bun.write(U,H),u.successCount++,u.pages.push({route:h,outputPath:U,size:Buffer.byteLength(H),cached:!1}),_.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=A.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
|
|
41
41
|
const validate = ${it[1]};
|
|
42
42
|
return validate(route);
|
|
43
43
|
`)({params:G})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,G,xt,e,s);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
|
@@ -46,7 +46,7 @@ ${s.join(`
|
|
|
46
46
|
Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&B.serverScriptFailures.length>0)throw Error(`${B.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
|
|
47
47
|
${B.serverScriptFailures.join(`
|
|
48
48
|
`)}
|
|
49
|
-
Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)T.set(h,k.filePath,B.dependencies,I)}let N;if(e.trailingSlash)N=f.join(e.outputDir,h,"index.html");else N=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:L}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(L.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of L){let H=f.join(j,`${C.hash}.js`);if(!await Bun.file(H).exists())await Bun.write(H,C.code);if(!g.has(C.hash)){g.add(C.hash);let U=Buffer.byteLength(C.code,"utf8");v+=U,
|
|
49
|
+
Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)T.set(h,k.filePath,B.dependencies,I)}let N;if(e.trailingSlash)N=f.join(e.outputDir,h,"index.html");else N=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:L}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(L.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of L){let H=f.join(j,`${C.hash}.js`);if(!await Bun.file(H).exists())await Bun.write(H,C.code);if(!g.has(C.hash)){g.add(C.hash);let U=Buffer.byteLength(C.code,"utf8");v+=U,S[C.hash]={bytes:U,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=L.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(N),{recursive:!0}),await Bun.write(N,I),!Wt(h,I,O,e.sitemapExclude))_.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,outputPath:N,size:Buffer.byteLength(I,"utf8"),cached:st};if(rt!==!1)at.revalidateAt=Date.now()+rt*1000;u.pages.push(at),u.successCount++,await e.hooks.onPageEnd?.(h,I)}catch(A){u.failedCount++,u.errors.push({route:h,error:A}),await e.hooks.onError?.(A,h),console.error(`Error generating ${h}:`,A)}}));let tt=en();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
|
|
50
50
|
`);throw Error(`Client script bundling failed:
|
|
51
51
|
${d}`)}if(e.cache)await T.save();if(e.generate404){let d=f.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,k={...s,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,k,m);await Bun.write(f.join(e.outputDir,"404.html"),h)}else await Bun.write(f.join(e.outputDir,"404.html"),`<!DOCTYPE html>
|
|
52
52
|
<html lang="en">
|
|
@@ -69,7 +69,7 @@ ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=f.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 m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},G=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),G)}}let V=f.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,m={...s,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(V).text(),{},V,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&_.length>0){let d=qt(_,e.domain),m=f.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${_.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],k=Es({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(f.join(e.outputDir,"robots.txt"),k),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},m=[];if(d.getItems)m=await d.getItems();let k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let z=Ya(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 W=Za(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} repeated asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=Zn();if(et)await Y(et,f.join(e.outputDir,Yn)),console.log(`Copied assets from ${Zt}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:
|
|
72
|
+
</html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},G=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),G)}}let V=f.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,m={...s,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(V).text(),{},V,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&_.length>0){let d=qt(_,e.domain),m=f.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${_.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],k=Es({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(f.join(e.outputDir,"robots.txt"),k),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},m=[];if(d.getItems)m=await d.getItems();let k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let z=Ya(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 W=Za(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} repeated asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=Zn();if(et)await Y(et,f.join(e.outputDir,Yn)),console.log(`Copied assets from ${Zt}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:S,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=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,8 +77,8 @@ Build complete!
|
|
|
77
77
|
Cached: ${u.cachedCount}
|
|
78
78
|
Failed: ${u.failedCount}
|
|
79
79
|
Time: ${u.buildTime}ms${P}
|
|
80
|
-
`),u}async function Y(t,n){await D.promises.mkdir(n,{recursive:!0});let s=await D.promises.readdir(t,{withFileTypes:!0});for(let o of s){let l=f.join(t,o.name),e=f.join(n,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(l,e);else await D.promises.copyFile(l,e)}}function Kt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),s=new ht(n),o=t.revalidate||3600;return{async get(l){let e=await s.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=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=X(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>l.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let g=l.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let
|
|
81
|
-
`)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),b=p.slice(P+1).trim();if(b==="true")b=!0;else if(b==="false")b=!1;else if(/^\d+$/.test(b))b=parseInt(b,10);else if(/^\d+\.\d+$/.test(b))b=parseFloat(b);else if(b.startsWith("[")&&b.endsWith("]"))b=b.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=b}}}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=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let
|
|
80
|
+
`),u}async function Y(t,n){await D.promises.mkdir(n,{recursive:!0});let s=await D.promises.readdir(t,{withFileTypes:!0});for(let o of s){let l=f.join(t,o.name),e=f.join(n,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(l,e);else await D.promises.copyFile(l,e)}}function Kt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),s=new ht(n),o=t.revalidate||3600;return{async get(l){let e=await s.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=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=X(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>l.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let g=l.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let S=await a(),{html:p}=await mt(u,v,{},t,S);await s.set(l,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${l}`)},async invalidate(l){if(typeof l==="string")await s.invalidate(l);else await s.invalidatePattern(l)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},l=n;if(s){let S=s[1];l=n.slice(s[0].length).trim();for(let p of S.split(`
|
|
81
|
+
`)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),b=p.slice(P+1).trim();if(b==="true")b=!0;else if(b==="false")b=!1;else if(/^\d+$/.test(b))b=parseInt(b,10);else if(/^\d+\.\d+$/.test(b))b=parseFloat(b);else if(b.startsWith("[")&&b.endsWith("]"))b=b.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=b}}}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=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let S=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:S})}return{content:e,data:o,toc:u}}}}function Yt(t){return yt(t)}function te(t,n){return`<!DOCTYPE html>
|
|
82
82
|
<html>
|
|
83
83
|
<head>
|
|
84
84
|
<meta charset="utf-8">
|
package/dist/utils.js
CHANGED
|
@@ -22,6 +22,7 @@ import { processScopedStyles } from "./style-scoping.js";
|
|
|
22
22
|
import { findSfcTemplateBlock } from "./sfc-template.js";
|
|
23
23
|
import { importOnce } from "./lazy-module.js";
|
|
24
24
|
import { scanAtElementPosition, stashScriptElements } from "./html-masking.js";
|
|
25
|
+
import { hasReactiveDirectives } from "./reactive.js";
|
|
25
26
|
import { markProjectedRefs } from "./misc-directives.js";
|
|
26
27
|
import { collectBlockDeclarations } from "./stx-virtual-ts.js";
|
|
27
28
|
import { CLIENT_LOOP_NAMES_KEY, inheritedClientLoopNames } from "./loop-binding.js";
|
|
@@ -1058,7 +1059,7 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
|
|
|
1058
1059
|
}
|
|
1059
1060
|
if (slotContent && templateContent.includes("{{ text || slot }}"))
|
|
1060
1061
|
templateContent = templateContent.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g, () => slotContent);
|
|
1061
|
-
const { applySlots } = await importOnce("stx/slots", () => import("./slots.js")), { defaultSlot, namedSlots } = parsedSlotContent, callerEvents = parentContext.__stx_signals_gate === !0 && /\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(componentSlotContent), hasSignalScripts = options._nativeHostAttrs === !0 && clientScripts.length > 0 || callerEvents && clientScripts.length > 0 || clientScripts.some((s) => /\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(s)), projectRefs = (content) => hasSignalScripts ? markProjectedRefs(content, componentUid) : content, projectedSlots = new Map([...namedSlots].map(([name, slot]) => [name, {
|
|
1062
|
+
const { applySlots } = await importOnce("stx/slots", () => import("./slots.js")), { defaultSlot, namedSlots } = parsedSlotContent, callerEvents = parentContext.__stx_signals_gate === !0 && /\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(componentSlotContent), hasSignalScripts = clientScripts.length > 0 && hasReactiveDirectives(templateContent) || options._nativeHostAttrs === !0 && clientScripts.length > 0 || callerEvents && clientScripts.length > 0 || clientScripts.some((s) => /\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(s)), projectRefs = (content) => hasSignalScripts ? markProjectedRefs(content, componentUid) : content, projectedSlots = new Map([...namedSlots].map(([name, slot]) => [name, {
|
|
1062
1063
|
...slot,
|
|
1063
1064
|
content: projectRefs(slot.content)
|
|
1064
1065
|
}]));
|
|
@@ -1511,6 +1512,10 @@ async function buildComponentIsland(rawContent, componentFilePath, minify) {
|
|
|
1511
1512
|
catch { __componentProps = {}; }
|
|
1512
1513
|
}
|
|
1513
1514
|
window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
|
|
1515
|
+
const __scopeProps = window.__STX_CURRENT_PROPS__;
|
|
1516
|
+
Object.defineProperty(__scopeVars, '$props', { configurable: true, enumerable: true, get: function() {
|
|
1517
|
+
return (__componentElement && __componentElement.__stx_props) || __scopeProps;
|
|
1518
|
+
} });
|
|
1514
1519
|
|
|
1515
1520
|
// Scope-specific lifecycle callbacks. The queues drain as they run; the
|
|
1516
1521
|
// hook lists keep what setup registered, because a component behind an :if
|
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.818",
|
|
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.21",
|
|
130
130
|
"@stacksjs/clapp": "^0.2.16",
|
|
131
|
-
"@stacksjs/desktop": "0.2.
|
|
132
|
-
"@stacksjs/sanitizer": "0.2.
|
|
131
|
+
"@stacksjs/desktop": "0.2.818",
|
|
132
|
+
"@stacksjs/sanitizer": "0.2.818",
|
|
133
133
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
134
|
-
"bun-plugin-stx": "0.2.
|
|
134
|
+
"bun-plugin-stx": "0.2.818",
|
|
135
135
|
"bunfig": "^0.15.21",
|
|
136
|
-
"stx-router": "0.2.
|
|
136
|
+
"stx-router": "0.2.818",
|
|
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-0yjm4j26.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ht,Hn,uh}from"./chunk-yts2b9d8.js";import{le,Vn,dh,Un,vo,Gr,Jr,ph,fh,gh,Wn,qn,xo,Yr,mh}from"./chunk-17wb2x3z.js";import"./chunk-n761hp6d.js";export{vo as batch,uh as default,Vn as derived,Un as effect,ht as generateSignalsRuntime,Hn as generateSignalsRuntimeDev,qn as isDerived,Wn as isSignal,dh as memo,Jr as onDestroy,Gr as onMount,Yr as peek,gh as pendingLifecycleCounts,fh as runDestroyCallbacks,ph as runMountCallbacks,le as state,xo as untrack,mh as useOptimistic};
|
package/dist/chunk-1kz70290.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Df,Oh,Nh,Mh,Dh,Lf,jf,Lh,jh,Xo,Bh,lr,ur,ws}from"./chunk-gc7pykfq.js";import{nt}from"./chunk-5emrarpf.js";import"./chunk-f0bwetnx.js";import"./chunk-pdnyhs63.js";import"./chunk-m7hfcxt3.js";import"./chunk-7rk7wfm6.js";import"./chunk-r9e0r6jx.js";import"./chunk-n761hp6d.js";export{Dh as __setSignalsGeneratorsForTest,nt as cacheEngineFingerprint,ur as cacheTemplate,lr as checkCache,Bh as clearDevCaches,jf as getCachedRouterScript,Lf as getCachedSignalsRuntime,Lh as getServeClientAsset,Xo as getServeModuleBundle,ws as hashFilePath,Nh as invalidateFileCache,Mh as invalidateFileCacheByDir,Oh as readFileCached,jh as registerServeModuleBundle,Df as templateCache};
|
package/dist/chunk-1rwfgmmk.js
DELETED
package/dist/chunk-2k3qtmn8.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{oa,Yg,ia,Zg,Dl,Ll,Qg,em}from"./chunk-dy7yccxm.js";import"./chunk-2p3eaj16.js";import"./chunk-5gxneecs.js";import"./chunk-vbrn4w81.js";import"./chunk-7sh9fa3q.js";import"./chunk-fcvyk047.js";import"./chunk-133vw0ae.js";import"./chunk-f54t0qar.js";import"./chunk-nmkkfpmh.js";import"./chunk-n9av365c.js";import"./chunk-2ws2qe1k.js";import"./chunk-t2sg2tp2.js";import"./chunk-jg9f5nqf.js";import"./chunk-1bgv727x.js";import{Pt,Jf}from"./chunk-f0bwetnx.js";import"./chunk-pdnyhs63.js";import"./chunk-m7hfcxt3.js";import"./chunk-7rk7wfm6.js";import"./chunk-r9e0r6jx.js";import"./chunk-n761hp6d.js";export{oa as buildScriptVirtualFile,Yg as buildVirtualSource,Pt as extractScriptBlocks,Jf as extractTemplateExpressions,Dl as findRuntimeTypeDeclarations,Ll as findStxModuleDeclarations,em as formatTypecheckDiagnostics,Zg as sourcePathFor,Qg as typecheckStxFiles,ia as virtualPathFor};
|
package/dist/chunk-2vget8rh.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{xe,mi,hi,sg,Nt,qc,og,Kc,Kh,De,yn,Le}from"./chunk-f0bwetnx.js";import{el,r}from"./chunk-3vpgr6nk.js";import"./chunk-pdnyhs63.js";import"./chunk-m7hfcxt3.js";import"./chunk-7rk7wfm6.js";import"./chunk-r9e0r6jx.js";import"./chunk-n761hp6d.js";export{xe as BROWSER_CORE_IMPORTS,sg as STX_AUTO_IMPORTS,mi as extractAndStripCssImports,De as extractBridgeData,el as findInterpolationEnd,Kc as generateAutoImportDestructuring,Kh as generateBrowserAutoImportDestructuring,yn as generateServerDataBridge,Nt as injectBrowserCoreAutoImports,Le as processClientScript,og as referencesName,hi as renderVendorStyleTags,r as stripCommentsAndLiterals,qc as transformAutoImports};
|
package/dist/chunk-3e85etrf.js
DELETED
package/dist/chunk-3eqs0rpv.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Cl,El}from"./chunk-4ws3yz5q.js";import"./chunk-w6n4y2xg.js";import"./chunk-hhazm0cs.js";import"./chunk-gtfs96f2.js";import"./chunk-p5ez40kf.js";import"./chunk-pyytr30r.js";import"./chunk-6cw072n5.js";import"./chunk-dy7yccxm.js";import"./chunk-yvqe0pzk.js";import"./chunk-jtx9x3as.js";import"./chunk-a0r4dpzs.js";import"./chunk-r5nt1bcx.js";import"./chunk-ncyjaxyz.js";import"./chunk-kjjvs3sc.js";import"./chunk-5efv1fhk.js";import"./chunk-vkn133cs.js";import"./chunk-s90m43sm.js";import"./chunk-bphwhfbd.js";import"./chunk-s9xs2ff4.js";import"./chunk-xrd1md4j.js";import"./chunk-hg67a15h.js";import"./chunk-b5ckg7zq.js";import"./chunk-549end3k.js";import"./chunk-fn3q1gtr.js";import"./chunk-p8wq37hd.js";import"./chunk-tb4wmzzd.js";import"./chunk-crmxg1c0.js";import"./chunk-2p3eaj16.js";import"./chunk-yts2b9d8.js";import"./chunk-ccxphr19.js";import"./chunk-baj6w8ja.js";import"./chunk-hwcfgs3e.js";import{Qt}from"./chunk-0jcady6w.js";import"./chunk-5gxneecs.js";import"./chunk-vbrn4w81.js";import"./chunk-7sh9fa3q.js";import{Re,i}from"./chunk-gzhrtymg.js";import"./chunk-rxt4jj9b.js";import"./chunk-agxjwnz0.js";import"./chunk-c84pxd2k.js";import"./chunk-df60fpgx.js";import"./chunk-dnqt6y8v.js";import"./chunk-y3p6w1e0.js";import"./chunk-m0x96g8e.js";import"./chunk-fcvyk047.js";import{we}from"./chunk-133vw0ae.js";import"./chunk-f54t0qar.js";import{lr,ur}from"./chunk-gc7pykfq.js";import{xs,B,a}from"./chunk-nmkkfpmh.js";import"./chunk-n9av365c.js";import"./chunk-2ws2qe1k.js";import"./chunk-t2sg2tp2.js";import"./chunk-jg9f5nqf.js";import"./chunk-1bgv727x.js";import{m,Le}from"./chunk-f0bwetnx.js";import"./chunk-pdnyhs63.js";import"./chunk-m7hfcxt3.js";import"./chunk-7rk7wfm6.js";import"./chunk-r9e0r6jx.js";import"./chunk-n761hp6d.js";import"./chunk-kvhsdyfg.js";import"./chunk-8h3jv8dd.js";export{xs as buildWebComponents,ur as cacheTemplate,lr as checkCache,Qt as classifyAllScripts,Cl as createMiddleware,El as createRoute,B as defaultConfig,m as extractVariables,we as injectRouterScript,a as loadStxConfig,Le as processClientScript,i as processDirectives,Re as readMarkdownFile};
|
package/dist/chunk-3ftaegqg.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{on,Ao,Po,Io,_h,Oo}from"./chunk-vbrn4w81.js";import"./chunk-t2sg2tp2.js";import"./chunk-1bgv727x.js";import"./chunk-m7hfcxt3.js";export{Po as buildServerApi,_h as createServerApi,on as discoverServerApi,Ao as generateApiTypes,Oo as isServerApiSource,Io as productionApiDispatcher};
|
package/dist/chunk-3jd5ak8h.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Oi,Ni,Mi,Ag,Pg,Ig,Sl,Og,Ng}from"./chunk-kvhsdyfg.js";export{Oi as ImageProcessorCache,Sl as applyTransformations,Ag as clearImageCache,Og as generateResponsiveVariants,Ng as generateSrcset,Ni as getCachedImageResult,Ig as optimizeImage,Pg as processImage,Mi as setCachedImageResult};
|
package/dist/chunk-4ypwqrj2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$l,na,Rl,Al,ra,Pl,Il,Ol,Nl,sa,Ml,Jg}from"./chunk-6cw072n5.js";import{fa,Bl}from"./chunk-r5nt1bcx.js";import{Q,ee,te,Nn,me,Te,Kr,gt,Xt,Mn,Dn,Ln,ne,jn,Bn,Xr}from"./chunk-5efv1fhk.js";import{Ul}from"./chunk-vkn133cs.js";import"./chunk-baj6w8ja.js";export{ee as DEFAULT_FORMATS,te as DEFAULT_QUALITY,Q as DEFAULT_WIDTHS,Xr as ImageProcessingError,Al as clearImageCache,ra as createImageDirective,Bl as createImageHandler,Il as createImagePlugin,Jg as defaultImageConfig,Bn as formatSize,sa as generateImageManifest,Xt as generateSizes,gt as generateSrcSet,Mn as getFallbackVariant,Kr as getImageMetadata,ne as getMimeType,jn as getTotalSize,Dn as groupVariantsByFormat,fa as handleImageRequest,Pl as imageDirective,me as isImageBackendAvailable,Ln as isImageFile,Nn as isSharpAvailable,Nl as optimizeDirectory,Ol as optimizeImage,na as parseImageComponent,Te as processImage,Rl as processImageComponents,$l as renderImageComponent,Ul as rewriteImagesWithSiblings,Ml as writeImageManifest};
|
package/dist/chunk-5eqna31h.js
DELETED
package/dist/chunk-6a97a9wk.js
DELETED
package/dist/chunk-7agp0wj2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{nm,rm,sm,om,jl,im,am,cm,lm,um,dm,pm}from"./chunk-a0r4dpzs.js";export{dm as Broadcast,pm as BroadcastServer,jl as broadcast,lm as broadcastPresence,cm as broadcastPrivate,um as channel,nm as getBroadcastServer,om as loadChannels,rm as startBroadcasting,sm as stopBroadcasting,im as toUser,am as toUsers};
|
package/dist/chunk-7hch54b2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{m,gi,Uc,Wc,ig,ag,cg,lg,ug,Vs,dg,je,Y,Be,pg,Cr,fg,Xc,Gc,yi,Fe,s,bn,Jc,h,fe,Xh}from"./chunk-f0bwetnx.js";import"./chunk-pdnyhs63.js";import"./chunk-m7hfcxt3.js";import"./chunk-7rk7wfm6.js";import"./chunk-r9e0r6jx.js";import"./chunk-n761hp6d.js";export{Gc as SIGNAL_COMPOSABLE_CALL,fe as clearComponentCache,yi as componentClientSignalNames,gi as convertToCommonJS,h as createDetailedErrorMessage,ug as extractDirectiveNames,Uc as extractScriptFromTemplate,m as extractVariables,s as fileExists,Xh as getComponentCacheStats,ag as getPositionInfo,Y as getSharedTranspiler,Jc as getSourceLineInfo,lg as hasDirectives,Wc as hasVariables,fg as isHydrateTrigger,dg as isJavaScriptScript,Fe as renderComponentWithSlot,bn as resolveTemplatePath,pg as scopeOnRootElement,Vs as scopeSequenceKey,je as shouldTranspileTypeScript,Xc as slotContentHasExpressions,Be as transpileTypeScript,Cr as userComponentFileExists,cg as validateDirective,ig as validateTemplate};
|
package/dist/chunk-7pb9fepg.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{rh,bo,sh,oh,ih,ah}from"./chunk-crmxg1c0.js";import"./chunk-5gxneecs.js";import"./chunk-vbrn4w81.js";import"./chunk-7sh9fa3q.js";import"./chunk-fcvyk047.js";import"./chunk-133vw0ae.js";import"./chunk-f54t0qar.js";import"./chunk-nmkkfpmh.js";import"./chunk-n9av365c.js";import"./chunk-2ws2qe1k.js";import"./chunk-t2sg2tp2.js";import"./chunk-jg9f5nqf.js";import"./chunk-1bgv727x.js";import"./chunk-f0bwetnx.js";import"./chunk-pdnyhs63.js";import"./chunk-m7hfcxt3.js";import"./chunk-7rk7wfm6.js";import"./chunk-r9e0r6jx.js";import"./chunk-n761hp6d.js";export{ah as clearStoreCache,rh as getStoreScript,ih as getStoreScriptFor,oh as pageStoresAll,bo as storesRead,sh as storesReadInFiles};
|
package/dist/chunk-8g8h2xwz.js
DELETED
package/dist/chunk-9mtw71xy.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ni,ri,St,ue,pr,Ts,fr,$s,Rs,zf,Hf,Vf,gr,Uf,Wf,qf,Kf,kc,_c,Cc,si,Ec,Xf,kt,_t,Ct,Et,Tt,$t,tt,Gf}from"./chunk-1bgv727x.js";export{fr as Router,qf as abortNavigation,Ts as bracketPathToRegex,kt as clearMiddleware,_c as createClientCookieManager,Tt as createMiddlewareContext,Et as createRouteLocation,kc as createServerCookieManager,Cc as createStorageManager,Kf as defineMiddleware,Hf as defineRoute,Vf as defineRoutes,$s as findErrorPage,Rs as formatRoutes,ri as generateRouteManifest,ni as generateRouteTypes,Ec as getMiddleware,_t as getMiddlewareNames,tt as getRouterScript,Gf as getRouterScriptDev,Xf as hasMiddleware,St as isFileRequestPath,Ct as loadMiddlewareFromDirectory,pr as matchRoute,Wf as navigateTo,ue as patternToRegex,si as registerMiddleware,Uf as resetRoutes,gr as route,$t as runMiddleware,zf as setAppUrl};
|