@stacksjs/bun-router 0.1.6 → 0.1.8
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-4wd1d6ay.js +416 -0
- package/dist/{chunk-nf3kv7kv.js → chunk-8rrs7556.js} +1 -1
- package/dist/{chunk-3y4gaz7v.js → chunk-m4aaj9ay.js} +1 -1
- package/dist/cli.js +30 -59
- package/dist/container/index.js +1 -1
- package/dist/index.js +12 -12
- package/dist/request/macros.d.ts +13 -0
- package/package.json +9 -1
- package/dist/chunk-03m2j6h7.js +0 -2
- package/dist/chunk-08cw7ejr.js +0 -3
- package/dist/chunk-0e4g0fyv.js +0 -62
- package/dist/chunk-0mmn02yw.js +0 -2
- package/dist/chunk-126c9qm3.js +0 -2
- package/dist/chunk-12p13817.js +0 -2
- package/dist/chunk-14v65c37.js +0 -4
- package/dist/chunk-1b6a7t3v.js +0 -231
- package/dist/chunk-1wenkmk0.js +0 -2
- package/dist/chunk-2152npfd.js +0 -2
- package/dist/chunk-26w23krx.js +0 -2
- package/dist/chunk-2g8m379z.js +0 -10
- package/dist/chunk-2rr178et.js +0 -1654
- package/dist/chunk-2w8f3swz.js +0 -29
- package/dist/chunk-4r1x4afz.js +0 -12
- package/dist/chunk-4wyw66zk.js +0 -2
- package/dist/chunk-4z5sf8ag.js +0 -2
- package/dist/chunk-58tfvayh.js +0 -4
- package/dist/chunk-5be9x5cq.js +0 -3
- package/dist/chunk-5dp83qcx.js +0 -397
- package/dist/chunk-5f0d9j9a.js +0 -2
- package/dist/chunk-5z52b0fc.js +0 -28
- package/dist/chunk-5zrnk2kq.js +0 -4
- package/dist/chunk-6bbmkwng.js +0 -3
- package/dist/chunk-6dmqtdnq.js +0 -2
- package/dist/chunk-6e91956t.js +0 -3
- package/dist/chunk-6rv8w5jk.js +0 -2
- package/dist/chunk-6x1feysm.js +0 -3
- package/dist/chunk-7qnxdedn.js +0 -321
- package/dist/chunk-7y72hm1x.js +0 -2
- package/dist/chunk-8hbhfh6b.js +0 -194
- package/dist/chunk-8kfzygg5.js +0 -3
- package/dist/chunk-8wpj3fqe.js +0 -351
- package/dist/chunk-8wydx2we.js +0 -2
- package/dist/chunk-8zjnjvv7.js +0 -2
- package/dist/chunk-9805tt8n.js +0 -341
- package/dist/chunk-988h4bzr.js +0 -2
- package/dist/chunk-9b6a58ac.js +0 -2
- package/dist/chunk-a8fcaywb.js +0 -2
- package/dist/chunk-bfjwn7yg.js +0 -2
- package/dist/chunk-bp2522mm.js +0 -2
- package/dist/chunk-brpgjyqg.js +0 -3
- package/dist/chunk-bswe62q4.js +0 -48
- package/dist/chunk-c3v796c8.js +0 -943
- package/dist/chunk-ccqmwdry.js +0 -2
- package/dist/chunk-ck0crwnx.js +0 -2
- package/dist/chunk-cqgkxcb4.js +0 -2
- package/dist/chunk-dntnakjy.js +0 -2
- package/dist/chunk-dxg045wj.js +0 -5
- package/dist/chunk-e3qej0jr.js +0 -4
- package/dist/chunk-ettdpnrw.js +0 -60
- package/dist/chunk-ezqwq17j.js +0 -185
- package/dist/chunk-ezx3qsez.js +0 -2
- package/dist/chunk-f72nnjy4.js +0 -15413
- package/dist/chunk-fna5n0ey.js +0 -246
- package/dist/chunk-fqhckdt8.js +0 -2
- package/dist/chunk-fr6hbx25.js +0 -2
- package/dist/chunk-g9cwng6w.js +0 -3
- package/dist/chunk-gd3za5x0.js +0 -2
- package/dist/chunk-gf28608k.js +0 -2
- package/dist/chunk-h1dj6v8q.js +0 -3
- package/dist/chunk-hjxe7k2g.js +0 -2
- package/dist/chunk-hrkgznbn.js +0 -2
- package/dist/chunk-j6h5v0br.js +0 -2
- package/dist/chunk-kjtjbcq4.js +0 -71
- package/dist/chunk-mgb01qdv.js +0 -14
- package/dist/chunk-n24c9whp.js +0 -2
- package/dist/chunk-n2j24b0h.js +0 -4540
- package/dist/chunk-nhmtg01n.js +0 -84
- package/dist/chunk-p0qhpnqh.js +0 -70
- package/dist/chunk-p0w1x8y2.js +0 -3
- package/dist/chunk-p3dk1w2w.js +0 -216
- package/dist/chunk-q4e9pxs7.js +0 -3
- package/dist/chunk-q5dv1kyy.js +0 -2
- package/dist/chunk-qnqgf9tq.js +0 -2
- package/dist/chunk-qvwy1808.js +0 -898
- package/dist/chunk-r18f77vc.js +0 -12
- package/dist/chunk-r63za1mr.js +0 -2
- package/dist/chunk-rft8gw92.js +0 -7851
- package/dist/chunk-ryvmyskt.js +0 -4211
- package/dist/chunk-sa6mx308.js +0 -2
- package/dist/chunk-sw0chtw4.js +0 -4
- package/dist/chunk-va0pc7hx.js +0 -2
- package/dist/chunk-vcp8dnjq.js +0 -412
- package/dist/chunk-vg1erq1q.js +0 -2
- package/dist/chunk-vsh4390q.js +0 -358
- package/dist/chunk-w0jv49ch.js +0 -11
- package/dist/chunk-wm805tte.js +0 -35
- package/dist/chunk-xg9xscqz.js +0 -1
- package/dist/chunk-xj9h6mc9.js +0 -2
- package/dist/chunk-ytvzwrq3.js +0 -51
- package/dist/chunk-zde7ebc4.js +0 -288
- package/dist/chunk-zmqsv2xy.js +0 -2
package/dist/chunk-2w8f3swz.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Fu as B,Ku as v,Lu as O,Mu as U,Nu as N}from"./chunk-6x1feysm.js";import{Zu as P}from"./chunk-nf3kv7kv.js";import{resolve as Z,basename as ce,extname as de,join as ue}from"path";import{mkdir as he}from"fs/promises";var ie={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class V{config;constructor(t={}){this.config={...ie,...t}}async get(t,e){return O(t,e,"video",this.config)}async set(t,e,a){return U(t,e,a,"video",this.config)}async clear(){return N("video",this.config)}updateConfig(t){this.config={...this.config,...t}}}var R=null;function D(t){if(!R)R=new V(t);else if(t)R.updateConfig(t);return R}async function M(t,e,a){let n=a?{directory:`${a.outputDir}/../.cache`}:{};return D(n).get(t,e)}async function A(t,e,a,n){let u=n?{directory:`${n.outputDir}/../.cache`}:{};return D(u).set(t,e,a)}async function re(){return D().clear()}import{resolve as I,basename as F,extname as W,join as H}from"path";import{mkdir as q}from"fs/promises";async function L(){try{return await import("ts-videos")}catch{return null}}async function z(t,e,a,n){let u=await L();if(!u)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let r=I(t);if(!await v(r))return null;await q(a,{recursive:!0});let i=await B(r),o=F(t,W(t)),s=e.format||"webp",h=e.timestamp||0,p=`${o}-poster-${i}.${s}`,l=H(a,p),m=await u.extractThumbnails(r,{timestamps:[h],width:e.width||1280,height:e.height,format:s,quality:e.quality||85,outputDir:a,outputPattern:p.replace(`.${s}`,"")});if(m&&m.length>0){let c=m[0];return{path:l,url:`${n}/${p}`,width:c.width||e.width||1280,height:c.height||720,timestamp:h,size:c.size||0}}return null}catch(r){return console.warn(`[stx-media] Failed to generate poster: ${r}`),null}}async function E(t,e,a,n){let u=await L();if(!u)return[];try{let r=I(t);if(!await v(r))return[];await q(a,{recursive:!0});let i=await B(r),o=F(t,W(t)),s=e.format||"webp",h=(await new u.Input(r).getInfo()).duration||60,p=e.count||10,l=e.interval||h/p,m=[];for(let d=0;d<p&&d*l<h;d++)m.push(d*l);let c=await u.extractThumbnails(r,{timestamps:m,width:e.width||320,format:s,quality:e.quality||80,outputDir:a,outputPattern:`${o}-thumb-${i}`});if(c&&c.length>0)return c.map((d,f)=>({path:d.path||H(a,`${o}-thumb-${i}-${f}.${s}`),url:`${n}/${o}-thumb-${i}-${f}.${s}`,width:d.width||e.width||320,height:d.height||180,timestamp:m[f],size:d.size||0}));return[]}catch(r){return console.warn(`[stx-media] Failed to generate thumbnails: ${r}`),[]}}async function ne(t,e,a,n){let u=await L();if(!u)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let r=I(t);if(!await v(r))return null;await q(a,{recursive:!0});let i=await B(r),o=F(t,W(t)),s=(await new u.Input(r).getInfo()).duration||60,h=e.columns||10,p=e.interval||5,l=e.thumbnailWidth||160,m=e.thumbnailHeight||90,c=e.format||"jpeg",d=Math.ceil(s/p),f=Math.ceil(d/h),y=`${o}-sprite-${i}.${c}`,w=H(a,y),x=[];for(let b=0;b<d;b++)x.push(b*p);let g=await u.extractThumbnails(r,{timestamps:x,width:l,height:m,format:c,quality:e.quality||70,outputDir:H(a,".temp")});if(!g||g.length===0)return null;try{let b=await import("./chunk-9b6a58ac.js"),S=h*l,pe=f*m,we=await b.createSprite({images:g.map((ae)=>ae.path),columns:h,padding:0,outputPath:w,format:c,quality:e.quality||70});return{url:`${n}/${y}`,path:w,columns:h,rows:f,thumbnailWidth:l,thumbnailHeight:m,interval:p,totalFrames:d}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(r){return console.warn(`[stx-media] Failed to generate sprite sheet: ${r}`),null}}import{resolve as X,basename as _,extname as G,join as C}from"path";import{mkdir as T,writeFile as J}from"fs/promises";async function K(){try{return await import("ts-videos")}catch{return null}}var Y=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function j(t,e,a,n,u){let r=await K();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let i=X(t);if(!await v(i))return null;let o=await B(i),s=_(t,G(t)),h=C(a,`${s}-${o}-hls`);await T(h,{recursive:!0});let p=e.length>0?e:Y,l=u?.segmentDuration||6,m=(await new r.Input(i).getInfo()).duration||0,c=[],d=0;for(let w of p){let x=C(h,w.label);await T(x,{recursive:!0});let g=`${w.label}.m3u8`,b=C(x,g);try{let S=await r.generateHLS(i,{outputDir:x,segmentDuration:l,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate,playlistName:w.label});if(S)c.push({quality:w,url:`${n}/${s}-${o}-hls/${w.label}/${g}`,path:b}),d+=S.segmentCount||Math.ceil(m/l)}catch(S){console.warn(`[stx-media] Failed to generate HLS for ${w.label}: ${S}`)}}if(c.length===0)return null;let f=C(h,"master.m3u8"),y=se(c,n,s,o);return await J(f,y),{manifestUrl:`${n}/${s}-${o}-hls/master.m3u8`,manifestPath:f,playlists:c,segmentCount:d,duration:m}}catch(i){return console.warn(`[stx-media] Failed to generate HLS manifest: ${i}`),null}}function se(t,e,a,n){let u=["#EXTM3U","#EXT-X-VERSION:3"];for(let r of t){let{quality:i}=r,o=i.bitrate+(i.audioBitrate||128000),s=`${i.width}x${i.height||Math.round(i.width*9/16)}`;u.push(`#EXT-X-STREAM-INF:BANDWIDTH=${o},RESOLUTION=${s},NAME="${i.label}"`,`${i.label}/${i.label}.m3u8`)}return u.join(`
|
|
3
|
-
`)}async function k(t,e,a,n,u){let r=await K();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=X(t);if(!await v(i))return null;let o=await B(i),s=_(t,G(t)),h=C(a,`${s}-${o}-dash`);await T(h,{recursive:!0});let p=e.length>0?e:Y,l=u?.segmentDuration||4,m=u?.minBufferTime||2,c=(await new r.Input(i).getInfo()).duration||0,d=[],f=[];for(let g of p){let b=C(h,g.label);await T(b,{recursive:!0});try{if(await r.generateDASH(i,{outputDir:b,segmentDuration:l,width:g.width,height:g.height,videoBitrate:g.bitrate,audioBitrate:g.audioBitrate})){if(d.push({bandwidth:g.bitrate,width:g.width,height:g.height||Math.round(g.width*9/16),url:`${n}/${s}-${o}-dash/${g.label}/video`}),g.audioBitrate)f.push({bandwidth:g.audioBitrate,url:`${n}/${s}-${o}-dash/${g.label}/audio`})}}catch(S){console.warn(`[stx-media] Failed to generate DASH for ${g.label}: ${S}`)}}if(d.length===0)return null;let y=C(h,"manifest.mpd"),w=oe(d,f,c,l,m);await J(y,w);let x=[{type:"video",representations:d}];if(f.length>0)x.push({type:"audio",representations:f});return{manifestUrl:`${n}/${s}-${o}-dash/manifest.mpd`,manifestPath:y,adaptationSets:x,duration:c}}catch(i){return console.warn(`[stx-media] Failed to generate DASH manifest: ${i}`),null}}function oe(t,e,a,n,u){let r=Q(a),i=Q(u),o=`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
|
-
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
5
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
6
|
-
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
7
|
-
type="static"
|
|
8
|
-
mediaPresentationDuration="${r}"
|
|
9
|
-
minBufferTime="${i}"
|
|
10
|
-
profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
|
|
11
|
-
<Period>
|
|
12
|
-
<AdaptationSet mimeType="video/mp4" codecs="avc1.64001f" segmentAlignment="true" startWithSAP="1">
|
|
13
|
-
`;for(let s=0;s<t.length;s++){let h=t[s];o+=` <Representation id="video${s}" bandwidth="${h.bandwidth}" width="${h.width}" height="${h.height}">
|
|
14
|
-
<BaseURL>${h.url}/</BaseURL>
|
|
15
|
-
<SegmentBase indexRange="0-999">
|
|
16
|
-
<Initialization range="0-999"/>
|
|
17
|
-
</SegmentBase>
|
|
18
|
-
</Representation>
|
|
19
|
-
`}if(o+=` </AdaptationSet>
|
|
20
|
-
`,e.length>0){o+=` <AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
|
|
21
|
-
`;for(let s=0;s<e.length;s++){let h=e[s];o+=` <Representation id="audio${s}" bandwidth="${h.bandwidth}">
|
|
22
|
-
<BaseURL>${h.url}/</BaseURL>
|
|
23
|
-
<SegmentBase indexRange="0-999">
|
|
24
|
-
<Initialization range="0-999"/>
|
|
25
|
-
</SegmentBase>
|
|
26
|
-
</Representation>
|
|
27
|
-
`}o+=` </AdaptationSet>
|
|
28
|
-
`}return o+=` </Period>
|
|
29
|
-
</MPD>`,o}function Q(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),n=Math.floor(t%60),u="PT";if(e>0)u+=`${e}H`;if(a>0)u+=`${a}M`;return u+=`${n}S`,u}async function ee(){try{return await import("ts-videos")}catch{return null}}function le(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function me(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function te(t){let e=await ee();if(!e)return null;try{let a=Z(t),n=await new e.Input(a).getInfo();return{duration:n.duration||0,width:n.width||0,height:n.height||0,frameRate:n.frameRate||0,bitrate:n.bitrate||0,codec:n.videoCodec||"",audioCodec:n.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function fe(t,e,a,n){let u=await ee();if(!u)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let r=await M(t,e,a);if(r)return r;try{let i=Z(t);if(!await v(i))return{src:t,processed:!1,errors:[`Source file not found: ${t}`]};let o=a.outputDir||"dist/videos",s=a.baseUrl||"/videos";await he(o,{recursive:!0});let h=await B(i),p=ce(t,de(t)),l={src:t,processed:!0,hash:h};n?.({percentage:5,stage:"analyzing"}),l.metadata=await te(i)||void 0;let m={};if(e.quality)m.bitrate=le(e.quality);if(e.platform)Object.assign(m,me(e.platform));if(e.transcode)Object.assign(m,e.transcode);if(Object.keys(m).length>0||e.process){n?.({percentage:10,stage:"transcoding"});let c=`${p}-${h}.mp4`,d=ue(o,c);try{let f=await ge(i,d,m,u,(y)=>n?.({percentage:10+y*0.5,stage:"transcoding"}));if(f)l.transcoded={path:d,url:`${s}/${c}`,duration:f.duration,size:f.size,video:{codec:m.codec||"h264",width:f.width,height:f.height,bitrate:f.bitrate,frameRate:f.frameRate},audio:f.audioCodec?{codec:m.audioCodec||"aac",bitrate:m.audioBitrate||128000,sampleRate:m.sampleRate||48000,channels:m.channels||2}:void 0}}catch(f){l.errors=l.errors||[],l.errors.push(`Transcoding failed: ${f}`)}}if(e.generatePoster){n?.({percentage:65,stage:"generating-poster"});let c=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},d=await z(i,c,o,s);if(d)l.poster=d}if(a.thumbnails?.enabled){n?.({percentage:70,stage:"generating-thumbnails"});let c=await E(i,a.thumbnails,o,s);if(c.length>0)l.thumbnails=c}if(e.streaming){n?.({percentage:80,stage:"generating-manifests"});let c=typeof e.streaming==="object"?e.streaming:a.streaming||{format:"hls"};if(c.format==="hls"||c.format===void 0){let d=await j(i,c.qualities||a.streaming?.defaultQualities||[],o,s);if(d)l.streaming={...l.streaming,hls:d}}if(c.format==="dash"){let d=await k(i,c.qualities||a.streaming?.defaultQualities||[],o,s);if(d)l.streaming={...l.streaming,dash:d}}}if(e.spriteSheet)n?.({percentage:90,stage:"generating-sprite-sheet"});return n?.({percentage:100,stage:"complete"}),await A(t,e,l,a),l}catch(i){return{src:t,processed:!1,errors:[`Processing failed: ${i}`]}}}async function ge(t,e,a,n,u){try{let r=await new n.Conversion(t,e,{videoCodec:a.codec,videoBitrate:a.bitrate,width:a.maxWidth,height:a.maxHeight,frameRate:a.frameRate,audioCodec:a.audioCodec,audioBitrate:a.audioBitrate,sampleRate:a.sampleRate,channels:a.channels}).run((i)=>{u?.(i.percentage/100)});return{duration:r.duration||0,size:r.size||0,width:r.width||a.maxWidth||0,height:r.height||a.maxHeight||0,bitrate:r.bitrate||a.bitrate||0,frameRate:r.frameRate||a.frameRate||30,audioCodec:r.audioCodec}}catch(r){return console.error(`[stx-media] Transcoding failed: ${r}`),null}}export{V as uu,M as vu,A as wu,re as xu,z as yu,E as zu,ne as Au,j as Bu,k as Cu,te as Du,fe as Eu};
|
package/dist/chunk-4r1x4afz.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{If as T,Jf as I}from"./chunk-dxg045wj.js";import{gj as M}from"./chunk-ryvmyskt.js";import{Vm as R}from"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import{Mo as O}from"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";import o from"path";import p from"fs";var Z=5,U=1;function q(n=process.env){return n.STX_DEBUG==="true"||n.STX_DEBUG==="1"}function g(...n){if(q())console.log("[stx:bundler]",...n)}var N=[];function G(n,i,c){N.push({filePath:n||"<inline>",message:i,details:c})}function ie(){return N.slice()}function ce(){N.length=0}var A;function ae(n){A=n}function Q(){if(A)return A;try{let n=M.strict;return typeof n==="object"&&n!==null?n.bundlerFallback??"warn":"warn"}catch{return"warn"}}var C=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function le(n){let i=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,c;while((c=i.exec(n))!==null){let d=c[1];if(!C.some((s)=>s.test(d)))return g("detected user import:",d),!0}let f=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((c=f.exec(n))!==null){let d=c[1];if(/\.css(?:\?.*)?$/.test(d))continue;if(!C.some((s)=>s.test(d)))return g("detected side-effect import:",d),!0}return!1}function K(n,i,c,f){let d=(s,t)=>{let e=s===c?i:o.dirname(s),r=o.resolve(e,t),u=[r,`${r}.ts`,`${r}.tsx`,`${r}.js`,`${r}.mjs`,`${r}.jsx`,o.join(r,"index.ts"),o.join(r,"index.tsx"),o.join(r,"index.js"),o.join(r,"index.mjs")];for(let h of u)try{if(p.existsSync(h)&&p.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return r};return{name:"stx-client-bundle",setup(s){s.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(t)=>({path:t.path,external:!0})),s.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(t)=>({path:t.path,external:!0})),s.onResolve({filter:/^\//},(t)=>{if(p.existsSync(t.path))return{path:t.path};return{path:t.path,external:!0}}),s.onResolve({filter:/^\.\.?\//},(t)=>{let e=d(t.importer,t.path);return f.add(e),{path:e}}),s.onResolve({filter:/^[@~]\//},(t)=>{let e=o.resolve(n,t.path.slice(2)),r=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,o.join(e,"index.ts"),o.join(e,"index.tsx"),o.join(e,"index.js"),o.join(e,"index.mjs")];for(let u of r)if(p.existsSync(u)&&p.statSync(u,{throwIfNoEntry:!1})?.isFile())return g(`resolved ${t.path[0]}/ import:`,t.path,"\u2192",u),f.add(u),{path:u};return console.warn(`[stx:bundler] could not resolve ${t.path[0]}/ import:`,t.path),{path:e}}),s.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(t)=>{let e=o.extname(t.path).toLowerCase(),r=e===".json"?"json":e===".tsx"?"tsx":e===".jsx"?"jsx":e===".ts"||e===".mts"||e===".cts"?"ts":"js";if(t.path!==c)f.add(t.path);return{contents:p.readFileSync(t.path,"utf8"),loader:r}})}}}var _=new Map,L=Symbol.for("stx.client-bundle-build-queue");function W(n){let i=globalThis,c=(i[L]??Promise.resolve()).then(n,n);return i[L]=c.then(()=>{return},()=>{return}),c}async function ue(n,i,c={}){let f=c.projectRoot||process.cwd(),d=c.minify??!1,s=c.cacheDir||R(f,"bundle-cache"),t=new Bun.CryptoHasher("md5");t.update(`${Z}\x00${n}\x00${i}`);let e=t.digest("hex").slice(0,12),r=o.join(s,`${e}.js`),u=o.join(s,`${e}.deps.json`),h=Bun.file(r);if(await h.exists()){let x=Bun.file(u),b=!0;if(await x.exists())try{let B=JSON.parse(await x.text());if(B.metadataVersion!==U||!Array.isArray(B.files))b=!1;for(let m of Array.isArray(B.files)?B.files:[])try{if(p.statSync(m.path).mtimeMs!==m.mtimeMs){b=!1;break}}catch{b=!1;break}}catch{b=!1}if(b)return g("cache hit:",e),await h.text();g("cache invalidated by dep change:",e)}let v=_.get(e);if(v)return await v;let S=W(()=>Y(n,i,{projectRoot:f,minify:d,cacheDir:s,hash:e,cachePath:r,depsPath:u}));_.set(e,S);try{return await S}finally{_.delete(e)}}async function Y(n,i,c){let{projectRoot:f,minify:d,cacheDir:s,hash:t,cachePath:e,depsPath:r}=c,u=R(f,"bundle-tmp"),h=o.join(u,`${t}.ts`),v=o.join(u,"out",t);p.mkdirSync(u,{recursive:!0}),p.mkdirSync(v,{recursive:!0});let S=o.dirname(i),x=[],b=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,B=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,m;while((m=b.exec(n))!==null){if(m[1])continue;if(m[2])m[2].split(",").forEach((y)=>{let l=y.split(":")[0].trim();if(l)x.push(l)});else if(m[3])x.push(m[3])}while((m=B.exec(n))!==null){if(m[1])continue;x.push(m[2])}let V=x.length>0?`
|
|
3
|
-
export { ${x.join(", ")} }`:"";await Bun.write(h,n+V),g("bundling:",t,"from:",o.basename(i));let F=new Set;try{let y=await Bun.build({entrypoints:[h],outdir:v,target:"browser",format:"esm",minify:d,plugins:[K(f,S,h,F)],define:{"process.env.NODE_ENV":d?'"production"':'"development"',...O()},root:f});if(!y.success){let a=y.logs.filter((w)=>w.level==="error").map((w)=>w.message).join(", ");return console.warn("[stx:bundler] build failed:",a),n}let l="";for(let a of y.outputs){l=await a.text();break}let j=[];for(let a of l.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let w of a[1].split(",")){let E=w.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E){j.push([E[2],E[1]]);continue}let D=w.trim();if(/^[A-Za-z_$][\w$]*$/.test(D))j.push([D,D])}let J=l.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];l=l.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let k=`__stxBundle_${t}`,z=j.map(([a,w])=>`${JSON.stringify(a)}: ${w}`).join(", "),H=j.map(([a])=>`var ${a} = undefined;`).join(`
|
|
4
|
-
`),P=j.map(([a])=>`${a} = ${k}[${JSON.stringify(a)}];`).join(`
|
|
5
|
-
`);if(l=`${J.join(`
|
|
6
|
-
`)}
|
|
7
|
-
${H}
|
|
8
|
-
var ${k} = (function() {
|
|
9
|
-
${l}
|
|
10
|
-
return { ${z} };
|
|
11
|
-
})();
|
|
12
|
-
${P}`.trim(),g("bundled:",t,"output:",l.length,"bytes"),x.length>0&&j.length===0)return console.warn(`[stx:bundler] dropped every binding for ${o.basename(i)} (${t}); serving the unbundled source and not caching this result`),n;p.mkdirSync(s,{recursive:!0}),await Bun.write(e,l);let X=Array.from(F).map((a)=>{try{return{path:a,mtimeMs:p.statSync(a).mtimeMs}}catch{return null}}).filter((a)=>a!==null);return await Bun.write(r,JSON.stringify({metadataVersion:U,files:X})),l}catch(y){let l=T(y,i||void 0),j=I(y,i||void 0);if(console.warn(`[stx:bundler] error: ${j}`),G(i||"",j,l),Q()==="error")throw y;return n}finally{try{p.rmSync(h,{force:!0}),p.rmSync(v,{recursive:!0,force:!0})}catch{}}}export{ue as bundleClientScript,ce as clearBundleFailures,ie as getBundleFailures,le as hasUserImports,W as queueClientBundleBuild,G as recordBundleFailure,Q as resolveBundlerFallback,ae as setBundlerFallbackMode,q as shouldLogBundlerDiagnostics};
|
package/dist/chunk-4wyw66zk.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{pl as a,ql as b}from"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{b as processComponents,a as processESImports};
|
package/dist/chunk-4z5sf8ag.js
DELETED
package/dist/chunk-58tfvayh.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var p={},b=[],m={};function _(){return p}function w(){return m}function k(){p={},b.length=0,m={}}function h(t){p=c(p,t)}function c(t,e){return{title:e.title??t.title,titleTemplate:e.titleTemplate??t.titleTemplate,base:e.base??t.base,meta:[...t.meta||[],...e.meta||[]],link:[...t.link||[],...e.link||[]],script:[...t.script||[],...e.script||[]],style:[...t.style||[],...e.style||[]],htmlAttrs:{...t.htmlAttrs,...e.htmlAttrs},bodyAttrs:{...t.bodyAttrs,...e.bodyAttrs}}}function f(t){h(A(t))}function A(t){let e=[];if(t.description)e.push({name:"description",content:t.description});if(t.keywords){let a=Array.isArray(t.keywords)?t.keywords.join(", "):t.keywords;e.push({name:"keywords",content:a})}if(t.author)e.push({name:"author",content:t.author});if(t.robots)e.push({name:"robots",content:t.robots});let r=t.ogTitle??t.title,i=t.ogDescription??t.description;if(r)e.push({property:"og:title",content:r});if(i)e.push({property:"og:description",content:i});if(t.ogImage)e.push({property:"og:image",content:t.ogImage});if(t.ogUrl)e.push({property:"og:url",content:t.ogUrl});if(t.ogType)e.push({property:"og:type",content:t.ogType});if(t.ogSiteName)e.push({property:"og:site_name",content:t.ogSiteName});if(t.ogLocale)e.push({property:"og:locale",content:t.ogLocale});let n=t.twitterTitle??t.title,s=t.twitterDescription??t.description,l=t.twitterImage??t.ogImage;if(t.twitterCard)e.push({name:"twitter:card",content:t.twitterCard});if(n)e.push({name:"twitter:title",content:n});if(s)e.push({name:"twitter:description",content:s});if(l)e.push({name:"twitter:image",content:l});if(t.twitterSite)e.push({name:"twitter:site",content:t.twitterSite});if(t.twitterCreator)e.push({name:"twitter:creator",content:t.twitterCreator});if(t.articleAuthor)e.push({property:"article:author",content:t.articleAuthor});if(t.articlePublishedTime)e.push({property:"article:published_time",content:t.articlePublishedTime});if(t.articleModifiedTime)e.push({property:"article:modified_time",content:t.articleModifiedTime});if(t.articleSection)e.push({property:"article:section",content:t.articleSection});if(t.articleTags)for(let a of t.articleTags)e.push({property:"article:tag",content:a});let o=[];if(t.canonical)o.push({rel:"canonical",href:t.canonical});return{title:t.title,titleTemplate:t.titleTemplate,meta:e,link:o}}function x(t){if(m={...m,...t},t.title||t.description)f({title:t.title,description:t.description})}function j(t){let e=typeof t==="function"?t():t;h({title:e})}function S(t=p){let e=[];if(t.title){let r=t.title;if(t.titleTemplate)r=typeof t.titleTemplate==="function"?t.titleTemplate(r):t.titleTemplate.replace("%s",r);e.push(`<title>${u(r)}</title>`)}if(t.base){let r=Object.entries(t.base).map(([i,n])=>`${i}="${u(n)}"`).join(" ");e.push(`<base ${r}>`)}for(let r of t.meta||[]){let i=Object.entries(r).filter(([n,s])=>s!==void 0).map(([n,s])=>`${n==="httpEquiv"?"http-equiv":n}="${u(String(s))}"`).join(" ");e.push(`<meta ${i}>`)}for(let r of t.link||[]){let i=Object.entries(r).filter(([n,s])=>s!==void 0).map(([n,s])=>`${n}="${u(String(s))}"`).join(" ");e.push(`<link ${i}>`)}for(let r of t.script||[]){let{content:i,...n}=r,s=Object.entries(n).filter(([l,o])=>o!==void 0).map(([l,o])=>{if(typeof o==="boolean")return o?l:"";return`${l}="${u(String(o))}"`}).filter(Boolean).join(" ");if(i)e.push(`<script ${s}>${i}</script>`);else e.push(`<script ${s}></script>`)}for(let r of t.style||[]){let i=r.type?` type="${r.type}"`:"";e.push(`<style${i}>${r.content}</style>`)}return e.join(`
|
|
3
|
-
`)}function H(t=p){if(!t.htmlAttrs)return"";return Object.entries(t.htmlAttrs).map(([e,r])=>`${e}="${u(r)}"`).join(" ")}function C(t=p){if(!t.bodyAttrs)return"";return Object.entries(t.bodyAttrs).map(([e,r])=>`${e}="${u(r)}"`).join(" ")}function u(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function O(t=p){if(typeof document>"u")return;if(t.title){let e=t.title;if(t.titleTemplate)e=typeof t.titleTemplate==="function"?t.titleTemplate(e):t.titleTemplate.replace("%s",e);document.title=e}for(let e of t.meta||[]){let r=e.name?`meta[name="${e.name}"]`:e.property?`meta[property="${e.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),e.name)i.setAttribute("name",e.name);if(e.property)i.setAttribute("property",e.property);document.head.appendChild(i)}i.setAttribute("content",e.content)}}for(let e of t.link||[]){let r=`link[rel="${e.rel}"]${e.href?`[href="${e.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[n,s]of Object.entries(e))if(s!==void 0)i.setAttribute(n,String(s))}if(t.htmlAttrs)for(let[e,r]of Object.entries(t.htmlAttrs))if(e==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(e,r);if(t.bodyAttrs)for(let[e,r]of Object.entries(t.bodyAttrs))document.body.setAttribute(e,r)}function M(t){let e="";return{content:t.replace(/@head\s*([\s\S]*?)@endhead/g,(r,i)=>(e+=i.trim()+`
|
|
4
|
-
`,"")),headContent:e.trim()}}function D(t,e){return t.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,n,s)=>{let l=i?n:e[(s||"").trim()]??s,o=e.__stx_runtime_head??{};return e.__stx_runtime_head=c(o,{title:l}),""})}function v(t,e){return t.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(r,i,n,s,l,o)=>{let a=s?l:o,d=s?a:e[(a||"").trim()]??a,y=n.includes(":")?{property:n,content:d}:{name:n,content:d},T=e.__stx_runtime_head??{};return e.__stx_runtime_head=c(T,{meta:[y]}),""})}export{_ as En,w as Fn,k as Gn,h as Hn,c as In,f as Jn,A as Kn,x as Ln,j as Mn,S as Nn,H as On,C as Pn,O as Qn,M as Rn,D as Sn,v as Tn};
|
package/dist/chunk-5be9x5cq.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import r from"process";function c(i="STX_PUBLIC_"){let t={},n={};for(let[e,o]of Object.entries(r.env)){if(!e.startsWith(i)||o===void 0)continue;t[`import.meta.env.${e}`]=JSON.stringify(o),n[e]=o}return t["import.meta.env"]=JSON.stringify(n),t}function f(i="STX_PUBLIC_"){let t={};for(let[n,e]of Object.entries(r.env))if(n.startsWith(i)&&e!==void 0)t[n]=e;return t}
|
|
3
|
-
export{c as Mo,f as No};
|
package/dist/chunk-5dp83qcx.js
DELETED
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
function b(){return`<script data-stx-hydration-runtime>
|
|
3
|
-
(function() {
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
var stxIslands = window.__stxIslands = window.__stxIslands || {
|
|
7
|
-
_registry: {},
|
|
8
|
-
_hydrated: new Set(),
|
|
9
|
-
|
|
10
|
-
register: function(name, loader) {
|
|
11
|
-
this._registry[name] = loader;
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
hydrateIsland: function(el) {
|
|
15
|
-
var id = el.getAttribute('data-island');
|
|
16
|
-
if (!id || this._hydrated.has(id)) return Promise.resolve();
|
|
17
|
-
this._hydrated.add(id);
|
|
18
|
-
|
|
19
|
-
var componentName = el.getAttribute('data-component');
|
|
20
|
-
var propsScript = el.querySelector('script[data-island-props="' + id + '"]');
|
|
21
|
-
var props = {};
|
|
22
|
-
if (propsScript) {
|
|
23
|
-
try { props = JSON.parse(propsScript.textContent || '{}'); }
|
|
24
|
-
catch (e) {}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var loader = componentName ? this._registry[componentName] : null;
|
|
28
|
-
|
|
29
|
-
if (loader) {
|
|
30
|
-
return Promise.resolve(typeof loader === 'function' ? loader() : loader)
|
|
31
|
-
.then(function(mod) {
|
|
32
|
-
var comp = mod && mod.default ? mod.default : mod;
|
|
33
|
-
if (comp && comp.hydrate) {
|
|
34
|
-
return comp.hydrate(el, props);
|
|
35
|
-
}
|
|
36
|
-
else if (comp && comp.mount) {
|
|
37
|
-
return comp.mount(el, props);
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
.then(function() {
|
|
41
|
-
el.classList.add('hydrated');
|
|
42
|
-
el.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
43
|
-
})
|
|
44
|
-
.catch(function(err) {
|
|
45
|
-
console.error('[stx] Hydration failed for island:', id, err);
|
|
46
|
-
el.classList.add('hydrated');
|
|
47
|
-
el.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// No loader registered \u2014 just mark as hydrated (CSS-only island)
|
|
52
|
-
el.classList.add('hydrated');
|
|
53
|
-
el.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
54
|
-
return Promise.resolve();
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
_setupStrategy: function(el) {
|
|
58
|
-
var self = this;
|
|
59
|
-
var strategy = el.getAttribute('data-strategy') || 'load';
|
|
60
|
-
|
|
61
|
-
switch (strategy) {
|
|
62
|
-
case 'load':
|
|
63
|
-
self.hydrateIsland(el);
|
|
64
|
-
break;
|
|
65
|
-
|
|
66
|
-
case 'idle':
|
|
67
|
-
if ('requestIdleCallback' in window) {
|
|
68
|
-
requestIdleCallback(function() { self.hydrateIsland(el); }, { timeout: 2000 });
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
setTimeout(function() { self.hydrateIsland(el); }, 200);
|
|
72
|
-
}
|
|
73
|
-
break;
|
|
74
|
-
|
|
75
|
-
case 'visible':
|
|
76
|
-
if ('IntersectionObserver' in window) {
|
|
77
|
-
var rootMargin = el.getAttribute('data-root-margin') || '0px';
|
|
78
|
-
var threshold = parseFloat(el.getAttribute('data-threshold') || '0') || 0;
|
|
79
|
-
var obs = new IntersectionObserver(function(entries) {
|
|
80
|
-
entries.forEach(function(entry) {
|
|
81
|
-
if (entry.isIntersecting) {
|
|
82
|
-
obs.disconnect();
|
|
83
|
-
self.hydrateIsland(el);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}, { rootMargin: rootMargin, threshold: threshold });
|
|
87
|
-
obs.observe(el);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
self.hydrateIsland(el);
|
|
91
|
-
}
|
|
92
|
-
break;
|
|
93
|
-
|
|
94
|
-
case 'media':
|
|
95
|
-
var mediaQuery = el.getAttribute('data-media') || '(min-width: 768px)';
|
|
96
|
-
var mq = window.matchMedia(mediaQuery);
|
|
97
|
-
if (mq.matches) {
|
|
98
|
-
self.hydrateIsland(el);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
var handler = function(e) {
|
|
102
|
-
if (e.matches) {
|
|
103
|
-
mq.removeEventListener('change', handler);
|
|
104
|
-
self.hydrateIsland(el);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
mq.addEventListener('change', handler);
|
|
108
|
-
}
|
|
109
|
-
break;
|
|
110
|
-
|
|
111
|
-
case 'hover':
|
|
112
|
-
var events = ['mouseenter', 'focusin', 'touchstart'];
|
|
113
|
-
var hoverHandler = function() {
|
|
114
|
-
events.forEach(function(e) { el.removeEventListener(e, hoverHandler); });
|
|
115
|
-
self.hydrateIsland(el);
|
|
116
|
-
};
|
|
117
|
-
events.forEach(function(e) {
|
|
118
|
-
el.addEventListener(e, hoverHandler, { once: true, passive: true });
|
|
119
|
-
});
|
|
120
|
-
break;
|
|
121
|
-
|
|
122
|
-
case 'event':
|
|
123
|
-
var eventName = el.getAttribute('data-event') || 'stx:activate';
|
|
124
|
-
window.addEventListener(eventName, function evtHandler(e) {
|
|
125
|
-
if (!e.detail || e.detail.id === el.getAttribute('data-island') || e.detail.id === '*') {
|
|
126
|
-
window.removeEventListener(eventName, evtHandler);
|
|
127
|
-
self.hydrateIsland(el);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
break;
|
|
131
|
-
|
|
132
|
-
case 'only':
|
|
133
|
-
var tmpl = el.querySelector('template[data-client-content]');
|
|
134
|
-
if (tmpl) {
|
|
135
|
-
el.innerHTML = tmpl.innerHTML;
|
|
136
|
-
}
|
|
137
|
-
el.classList.add('hydrated');
|
|
138
|
-
break;
|
|
139
|
-
|
|
140
|
-
default:
|
|
141
|
-
self.hydrateIsland(el);
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
initIslands: function() {
|
|
146
|
-
var self = this;
|
|
147
|
-
var islands = document.querySelectorAll('.stx-island:not(.hydrated)');
|
|
148
|
-
islands.forEach(function(el) {
|
|
149
|
-
self._setupStrategy(el);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
// Auto-init on DOMContentLoaded
|
|
155
|
-
if (document.readyState === 'loading') {
|
|
156
|
-
document.addEventListener('DOMContentLoaded', function() { stxIslands.initIslands(); });
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
stxIslands.initIslands();
|
|
160
|
-
}
|
|
161
|
-
})();
|
|
162
|
-
</script>`}function D(t){if(t.size===0)return"";return`<script data-stx-island-manifest>
|
|
163
|
-
(function() {
|
|
164
|
-
if (!window.__stxIslands) return;
|
|
165
|
-
${Array.from(t.entries()).map(([e,n])=>` window.__stxIslands.register('${e}', function() { return import('${n}'); });`).join(`
|
|
166
|
-
`)}
|
|
167
|
-
})();
|
|
168
|
-
</script>`}function g(t){let e=t.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(e)return e[1];let n=t.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(t,e){let n={},a=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=a.exec(t))!==null){let d=i[1],o=i[2];if(o in e)n[d]=e[o];else n[d]=o}return n}function L(){let t=new Map;return{islands:t,register(e){t.set(e.id,e)},get(e){return t.get(e)},async hydrate(e){let n=t.get(e);if(!n||n.hydrated)return;if(n.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:e,component:n.component}}))},async hydrateAll(){let e=Array.from(t.values()).filter((n)=>!n.hydrated).map((n)=>this.hydrate(n.id));await Promise.all(e)}}}function I(t){return`
|
|
169
|
-
<script data-hydrate="${t}">
|
|
170
|
-
(function() {
|
|
171
|
-
const island = document.querySelector('[data-island="${t}"]');
|
|
172
|
-
if (!island) return;
|
|
173
|
-
|
|
174
|
-
// Immediately hydrate
|
|
175
|
-
island.classList.add('hydrated');
|
|
176
|
-
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
177
|
-
})();
|
|
178
|
-
</script>
|
|
179
|
-
`}function S(t,e){let n=e.timeout||2000,a=e.priority||"low";return`
|
|
180
|
-
<script data-hydrate="${t}">
|
|
181
|
-
(function() {
|
|
182
|
-
const island = document.querySelector('[data-island="${t}"]');
|
|
183
|
-
if (!island) return;
|
|
184
|
-
|
|
185
|
-
function hydrate() {
|
|
186
|
-
if (island.classList.contains('hydrated')) return;
|
|
187
|
-
island.classList.add('hydrated');
|
|
188
|
-
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if ('requestIdleCallback' in window) {
|
|
192
|
-
const idleOptions = { timeout: ${n} };
|
|
193
|
-
${a==="high"?"requestIdleCallback(hydrate, idleOptions);":`
|
|
194
|
-
// Low priority: wait for multiple idle periods
|
|
195
|
-
let idleCount = 0;
|
|
196
|
-
function waitForIdle() {
|
|
197
|
-
requestIdleCallback((deadline) => {
|
|
198
|
-
if (deadline.didTimeout || ++idleCount >= 2) {
|
|
199
|
-
hydrate();
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
waitForIdle();
|
|
203
|
-
}
|
|
204
|
-
}, idleOptions);
|
|
205
|
-
}
|
|
206
|
-
waitForIdle();
|
|
207
|
-
`}
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
// Fallback for browsers without requestIdleCallback
|
|
211
|
-
setTimeout(hydrate, ${n});
|
|
212
|
-
}
|
|
213
|
-
})();
|
|
214
|
-
</script>
|
|
215
|
-
`}function C(t,e){let n=e.rootMargin||"0px",a=e.threshold||0;return`
|
|
216
|
-
<script data-hydrate="${t}">
|
|
217
|
-
(function() {
|
|
218
|
-
const island = document.querySelector('[data-island="${t}"]');
|
|
219
|
-
if (!island) return;
|
|
220
|
-
|
|
221
|
-
function hydrate() {
|
|
222
|
-
if (island.classList.contains('hydrated')) return;
|
|
223
|
-
island.classList.add('hydrated');
|
|
224
|
-
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if ('IntersectionObserver' in window) {
|
|
228
|
-
const observer = new IntersectionObserver((entries) => {
|
|
229
|
-
entries.forEach((entry) => {
|
|
230
|
-
if (entry.isIntersecting) {
|
|
231
|
-
observer.disconnect();
|
|
232
|
-
hydrate();
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}, {
|
|
236
|
-
rootMargin: '${n}',
|
|
237
|
-
threshold: ${JSON.stringify(a)}
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
observer.observe(island);
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
// Fallback: hydrate on load
|
|
244
|
-
hydrate();
|
|
245
|
-
}
|
|
246
|
-
})();
|
|
247
|
-
</script>
|
|
248
|
-
`}function k(t,e){let n=e.media||"(min-width: 768px)";return`
|
|
249
|
-
<script data-hydrate="${t}">
|
|
250
|
-
(function() {
|
|
251
|
-
const island = document.querySelector('[data-island="${t}"]');
|
|
252
|
-
if (!island) return;
|
|
253
|
-
|
|
254
|
-
function hydrate() {
|
|
255
|
-
if (island.classList.contains('hydrated')) return;
|
|
256
|
-
island.classList.add('hydrated');
|
|
257
|
-
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const mediaQuery = window.matchMedia('${n}');
|
|
261
|
-
|
|
262
|
-
function handleMediaChange(e) {
|
|
263
|
-
if (e.matches) {
|
|
264
|
-
mediaQuery.removeEventListener('change', handleMediaChange);
|
|
265
|
-
hydrate();
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (mediaQuery.matches) {
|
|
270
|
-
hydrate();
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
mediaQuery.addEventListener('change', handleMediaChange);
|
|
274
|
-
}
|
|
275
|
-
})();
|
|
276
|
-
</script>
|
|
277
|
-
`}function M(t){return`
|
|
278
|
-
<script data-hydrate="${t}">
|
|
279
|
-
(function() {
|
|
280
|
-
const island = document.querySelector('[data-island="${t}"]');
|
|
281
|
-
if (!island) return;
|
|
282
|
-
|
|
283
|
-
function hydrate() {
|
|
284
|
-
if (island.classList.contains('hydrated')) return;
|
|
285
|
-
island.classList.add('hydrated');
|
|
286
|
-
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// Hydrate on first interaction
|
|
290
|
-
const events = ['mouseenter', 'focusin', 'touchstart'];
|
|
291
|
-
const handler = () => {
|
|
292
|
-
events.forEach(e => island.removeEventListener(e, handler));
|
|
293
|
-
hydrate();
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
|
|
297
|
-
})();
|
|
298
|
-
</script>
|
|
299
|
-
`}function q(t,e){let n=e.event||"stx:activate";return`
|
|
300
|
-
<script data-hydrate="${t}">
|
|
301
|
-
(function() {
|
|
302
|
-
const island = document.querySelector('[data-island="${t}"]');
|
|
303
|
-
if (!island) return;
|
|
304
|
-
|
|
305
|
-
function hydrate() {
|
|
306
|
-
if (island.classList.contains('hydrated')) return;
|
|
307
|
-
island.classList.add('hydrated');
|
|
308
|
-
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// Listen for custom event
|
|
312
|
-
window.addEventListener('${n}', function handler(e) {
|
|
313
|
-
if (!e.detail || e.detail.id === '${t}' || e.detail.id === '*') {
|
|
314
|
-
window.removeEventListener('${n}', handler);
|
|
315
|
-
hydrate();
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
})();
|
|
319
|
-
</script>
|
|
320
|
-
`}function H(t,e={},n){let a=t,i=!1,d=/@client:(load|idle|visible|media|only|hover|event)/i.test(t);if(a=u(a,"load",e),a=u(a,"idle",e),a=u(a,"visible",e),a=u(a,"media",e),a=_(a),a=u(a,"hover",e),a=u(a,"event",e),i=d&&a!==t,i)a+=`
|
|
321
|
-
`+b();return a}function u(t,e,n){let a=new RegExp(`@client:${e}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return t.replace(a,(i,d,o)=>{let r={strategy:e};if(d)try{let E=d.split(",").map((h)=>h.trim());for(let h of E){let[m,v]=h.split(":").map((y)=>y.trim());if(m&&v){let y=v.replace(/^['"]|['"]$/g,"");r[m]=y}}}catch{}let s=`island-${Math.random().toString(36).substring(2,9)}`,p=g(o.trim()),f=w(o.trim(),n),c=[];if(r.rootMargin)c.push(`data-root-margin="${r.rootMargin}"`);if(r.threshold!==void 0)c.push(`data-threshold="${r.threshold}"`);if(r.media)c.push(`data-media="${r.media}"`);if(r.event)c.push(`data-event="${r.event}"`);if(p)c.push(`data-component="${p}"`);let x=Object.keys(f).length>0?`
|
|
322
|
-
<script type="application/json" data-island-props="${s}">${JSON.stringify(f)}</script>`:"",l="";switch(e){case"load":l=I(s);break;case"idle":l=S(s,r);break;case"visible":l=C(s,r);break;case"media":l=k(s,r);break;case"hover":l=M(s);break;case"event":l=q(s,r);break}return`
|
|
323
|
-
<div data-island="${s}"
|
|
324
|
-
data-strategy="${e}"
|
|
325
|
-
${c.join(`
|
|
326
|
-
`)}
|
|
327
|
-
class="stx-island"
|
|
328
|
-
style="contents;">
|
|
329
|
-
${o.trim()}${x}
|
|
330
|
-
</div>
|
|
331
|
-
${l}
|
|
332
|
-
`})}function _(t){let e=/@client:only\s*([\s\S]*?)@endclient/gi;return t.replace(e,(n,a)=>{let i=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
|
|
333
|
-
<div data-island="${i}"
|
|
334
|
-
data-strategy="only"
|
|
335
|
-
class="stx-island stx-client-only">
|
|
336
|
-
<!-- Client-only content will be rendered here -->
|
|
337
|
-
<template data-client-content>${a.trim()}</template>
|
|
338
|
-
</div>
|
|
339
|
-
<script data-hydrate="${i}">
|
|
340
|
-
(function() {
|
|
341
|
-
const island = document.querySelector('[data-island="${i}"]');
|
|
342
|
-
if (!island) return;
|
|
343
|
-
|
|
344
|
-
const template = island.querySelector('template[data-client-content]');
|
|
345
|
-
if (template) {
|
|
346
|
-
island.innerHTML = template.innerHTML;
|
|
347
|
-
island.classList.add('hydrated');
|
|
348
|
-
}
|
|
349
|
-
})();
|
|
350
|
-
</script>
|
|
351
|
-
`})}function A(){return`
|
|
352
|
-
/* Island base styles */
|
|
353
|
-
.stx-island {
|
|
354
|
-
display: contents;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/* Pre-hydration state */
|
|
358
|
-
.stx-island:not(.hydrated) {
|
|
359
|
-
/* Optional: add loading indicator */
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/* Hydrated state */
|
|
363
|
-
.stx-island.hydrated {
|
|
364
|
-
/* Island is now interactive */
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/* Client-only placeholder */
|
|
368
|
-
.stx-client-only:not(.hydrated) {
|
|
369
|
-
min-height: 50px;
|
|
370
|
-
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
371
|
-
background-size: 200% 100%;
|
|
372
|
-
animation: island-shimmer 1.5s infinite;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
@keyframes island-shimmer {
|
|
376
|
-
0% { background-position: 200% 0; }
|
|
377
|
-
100% { background-position: -200% 0; }
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/* Hydration transition */
|
|
381
|
-
.stx-island {
|
|
382
|
-
transition: opacity 0.2s ease-out;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
.stx-island:not(.hydrated) {
|
|
386
|
-
opacity: 0.7;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.stx-island.hydrated {
|
|
390
|
-
opacity: 1;
|
|
391
|
-
}
|
|
392
|
-
`}function N(t){if(typeof window>"u")return;let e=document.querySelector(`[data-island="${t}"]`);if(!e||e.classList.contains("hydrated"))return;e.classList.add("hydrated"),e.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function O(t){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${t}"]:not(.hydrated)`).forEach((e)=>{e.classList.add("hydrated"),e.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function P(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function z(t){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${t}"]`)?.classList.contains("hydrated")??!1}function T(t){return new Promise((e)=>{if(typeof window>"u"){e();return}let n=document.querySelector(`[data-island="${t}"]`);if(!n){e();return}if(n.classList.contains("hydrated")){e();return}n.addEventListener("stx:hydrated",()=>e(),{once:!0})})}function j(t){return t.replace(/@static\s*([\s\S]*?)@endstatic/gi,(e,n)=>`<div class="stx-static">${n.trim()}</div>`)}function B(t){let e=t.map((n)=>({id:n.id,component:n.component,strategy:n.options.strategy,props:n.props}));return`
|
|
393
|
-
<script type="application/json" id="stx-island-manifest">
|
|
394
|
-
${JSON.stringify(e)}
|
|
395
|
-
</script>
|
|
396
|
-
`}var J={processPartialHydrationDirectives:H,processStaticDirectives:j,generatePartialHydrationCSS:A,generateIslandManifest:B,createIslandRegistry:L,hydrateIsland:N,hydrateByStrategy:O,hydrateAll:P,isHydrated:z,onHydrated:T};
|
|
397
|
-
export{b as _d,D as $d,g as ae,w as be,L as ce,H as de,A as ee,N as fe,O as ge,P as he,z as ie,T as je,j as ke,B as le,J as me};
|
package/dist/chunk-5f0d9j9a.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Kf as a,Lf as b,Mf as c,Nf as d,Of as e,Pf as f,Qf as g,Rf as h,Sf as i,Tf as j,Uf as k,Vf as l,Wf as m,Xf as n}from"./chunk-8hbhfh6b.js";import"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{c as SUSPENSE_RESOLVER_RUNTIME,b as buildSuspenseResolveScript,h as createStreamRenderer,f as extractStreamBoundaries,n as generateHydrationRuntime,j as islandDirective,l as processSectionDirectives,e as processStreamDirectives,k as registerStreamingDirectives,d as renderStreamingPage,a as streamTemplate,g as streamTemplateSimple,m as streamToResponse,i as streamingSuspenseDirective};
|
package/dist/chunk-5z52b0fc.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ff as S,Gf as B,Hf as f}from"./chunk-e3qej0jr.js";import{fj as x,og as g,pg as y}from"./chunk-ryvmyskt.js";import{Un as h}from"./chunk-brpgjyqg.js";import{Mo as v}from"./chunk-5be9x5cq.js";import _ from"path";var a=new Map,m=new Map,A=["composables","functions"];function D(r){let e=_.basename(r,".ts");return e==="index"||e==="types"||r.endsWith(".d.ts")}async function E(r){if(r)return _.resolve(r);let e=`<default>:${process.cwd()}`,n=m.get(e);if(n!==void 0)return n;let s=await I();if(s!==null)m.set(e,s);return s}async function I(){let r=await x(),e=r.root||process.cwd(),n=r.composablesDir;if(n)return _.resolve(e,n);for(let s of A){let i=_.resolve(e,s);try{let u=new Bun.Glob("**/*.ts");for await(let c of u.scan({cwd:i,absolute:!0}))if(!D(c))return i}catch{}}return null}async function J(r){let e=await E(r);if(!e)return null;let n=[];try{let t=new Bun.Glob("**/*.ts");for await(let o of t.scan({cwd:e,absolute:!0})){if(D(o))continue;n.push(o)}}catch{return f(a,e,"",""),null}let s=S(n),i=B(a,e,s);if(i!==void 0)return i||null;if(n.length===0)return f(a,e,s,""),null;n.sort();let u=new Bun.Transpiler({loader:"ts",target:"browser",define:v()}),c=[],d=new Set,p=new Set;for(let t of n)try{let o=await Bun.file(t).text(),k=_.basename(t,".ts");for(let l of o.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(l[1])p.add(l[1]);try{for(let l of u.scan(o).exports)if(l!=="default")d.add(l)}catch{}o=g(o),o=y(o),o=o.replace(/^export\s+(default\s+)?/gm,""),o=u.transformSync(o),c.push(`// Composable: ${k}
|
|
3
|
-
${o.trim()}`)}catch(o){console.warn(`[stx] Failed to load composable ${t}:`,o)}if(c.length===0||d.size===0)return f(a,e,s,""),null;let C=[...d].map((t)=>` try { __c[${JSON.stringify(t)}] = ${t}; } catch (e) {}`).join(`
|
|
4
|
-
`),N=JSON.stringify([...d]),w=c.join(`
|
|
5
|
-
|
|
6
|
-
`),b=`;(function(){
|
|
7
|
-
window.__composables = window.__composables || {};
|
|
8
|
-
var __c = window.__composables;
|
|
9
|
-
var __stx = window.stx || {};
|
|
10
|
-
${h.filter((t)=>!p.has(t)&&new RegExp(`\\b${t}\\b`).test(w)).map((t)=>`var ${t} = __stx[${JSON.stringify(t)}];`).join(`
|
|
11
|
-
`)}
|
|
12
|
-
${w}
|
|
13
|
-
${C}
|
|
14
|
-
var __names = ${N};
|
|
15
|
-
for (var __i = 0; __i < __names.length; __i++) {
|
|
16
|
-
var __n = __names[__i];
|
|
17
|
-
if (!(__n in __c)) continue;
|
|
18
|
-
var __takenByBuiltin = !!(window.stx && __n in window.stx);
|
|
19
|
-
if (__takenByBuiltin || __n in window) {
|
|
20
|
-
console.warn('[stx] composable "' + __n + '" is not available as a bare identifier: '
|
|
21
|
-
+ (__takenByBuiltin ? 'a built-in of that name already exists' : 'window already defines that property')
|
|
22
|
-
+ '. Rename it, or use: import { ' + __n + ' } from "@composables"');
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
window[__n] = __c[__n];
|
|
26
|
-
}
|
|
27
|
-
})();`;return f(a,e,s,b),b}function L(){a.clear(),m.clear()}
|
|
28
|
-
export{J as Df,L as Ef};
|
package/dist/chunk-5zrnk2kq.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),w=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function l(i){return i.replace(/[^\n]/g," ")}function h(i){let o=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,l).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,l).replace(/<!--[\s\S]*?-->/g,l).replace(/\{\{\{[\s\S]*?\}\}\}/g,l).replace(/\{\{[\s\S]*?\}\}/g,l).replace(/\{!![\s\S]*?!!\}/g,l),s=new Map,c=new Map,p=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,n;while((n=p.exec(o))!==null){let e=n[1]==="/",t=n[2],a=n[3]==="/";if(f.has(t.toLowerCase()))continue;if(a)continue;if(e)c.set(t,(c.get(t)??0)+1);else{let d=s.get(t);if(d)d.count++;else{let u=o.slice(0,n.index).split(`
|
|
3
|
-
`).length;s.set(t,{count:1,firstLine:u})}}}let r=[];for(let e of new Set([...s.keys(),...c.keys()])){if(w.has(e.toLowerCase()))continue;let t=s.get(e)?.count??0,a=c.get(e)??0;if(t!==a)r.push({tag:e,opened:t,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return r}var g=new Set;function b(i,o){let s;try{s=h(i)}catch{return}if(s.length===0)return;let c=`${o}:${i.length}`;if(g.has(c))return;g.add(c);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:n,opened:r,closed:e,firstOpenLine:t}of s)if(r>e){let a=t?` (first opened at line ${t})`:"";console.warn(`[stx] ${p}: <${n}> ${r} opened, ${e} closed \u2014 an unclosed <${n}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${n}> ${r} opened, ${e} closed \u2014 ${e-r} stray </${n}>.`)}
|
|
4
|
-
export{h as Oo,b as Po};
|
package/dist/chunk-6bbmkwng.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
function a(e){return e}class c{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,r){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let t of e.dependencies)if(!this.plugins.has(t))throw Error(`Plugin "${e.name}" depends on "${t}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(r);this.sortPlugins()}async unregister(e){let r=this.plugins.get(e);if(!r)return!1;for(let[t,s]of this.plugins)if(s.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${t}" depends on it`);if(r.onUnregister)await r.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let r of this.sortedPlugins)if(r.registerDirectives)e.push(...r.registerDirectives());return e}getAllFilters(){let e={};for(let r of this.sortedPlugins)if(r.registerFilters)Object.assign(e,r.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,r){return this.runDirectiveHooks("beforeDirective",e,r)}async runAfterDirective(e,r){return this.runDirectiveHooks("afterDirective",e,r)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let r of this.sortedPlugins)if(r.onError)try{let t=await r.onError(e);if(t){if(t.template!==void 0)e.template=t.template;if(t.context)e.context={...e.context,...t.context};if(t.metadata)e.metadata={...e.metadata,...t.metadata};if(t.skip)return e}}catch(t){console.error(`Error in plugin "${r.name}" onError hook:`,t)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,r)=>(e.priority??100)-(r.priority??100))}async runHooks(e,r){let t={...r};for(let s of this.sortedPlugins){let o=s[e];if(o)try{let n=await o(t);if(n){if(n.template!==void 0)t.template=n.template;if(n.context)t.context={...t.context,...n.context};if(n.metadata)t.metadata={...t.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${s.name}" ${e} hook:`,n)}}return t}async runDirectiveHooks(e,r,t){let s={...t};for(let o of this.sortedPlugins){let n=o[e];if(n)try{let i=await n(r,s);if(i){if(i.template!==void 0)s.template=i.template;if(i.context)s.context={...s.context,...i.context};if(i.metadata)s.metadata={...s.metadata,...i.metadata};if(i.skip)break}}catch(i){console.error(`Error in plugin "${o.name}" ${e} hook:`,i)}}return s}}var u=new c;function l(e,r,t={}){return{name:e,...t,registerDirectives:()=>r}}function g(e,r,t={}){return{name:e,...t,registerFilters:()=>r}}var f=a({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,r){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,r){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),d=a({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let r=e.metadata.startTime;if(r){let t=performance.now()-r;console.log(`[stx-timing] Processing took ${t.toFixed(2)}ms`)}}});function p(e){return a({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(r){return{context:{...r.context,...e}}}})}
|
|
3
|
-
export{a as Qu,c as Ru,u as Su,l as Tu,g as Uu,f as Vu,d as Wu,p as Xu};
|
package/dist/chunk-6dmqtdnq.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Df as a,Ef as b}from"./chunk-5z52b0fc.js";import"./chunk-e3qej0jr.js";import"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{b as clearComposableCache,a as getComposableScript};
|
package/dist/chunk-6e91956t.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import s from"path";var x=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function v(e,i){let a=i.formats??d;if(!i.publicDir)return e;let n=R(e),u=[],p=/<img\b[^>]*?>/gi,c=[],o;while((o=p.exec(e))!==null){let t=o[0],r=t.match(/\bsrc=["']([^"']+)["']/i);if(!r)continue;if(S(o.index,n))continue;c.push({idx:o.index,length:t.length,src:r[1],raw:t})}if(c.length===0)return e;let m=await Promise.all(c.map(async(t)=>{let r=await b(t.src,i.publicDir,a);return{match:t,sources:r}}));for(let{match:t,sources:r}of m){if(r.length===0)continue;let h=`<picture>${r.map((g)=>`<source type="${g.mime}" srcset="${W(g.url)}">`).join("")}${t.raw}</picture>`;u.push({start:t.idx,end:t.idx+t.length,replacement:h})}if(u.length===0)return e;let f="",l=0;for(let t of u)f+=e.slice(l,t.start),f+=t.replacement,l=t.end;return f+=e.slice(l),f}async function b(e,i,a){if(!w(e))return[];let n=s.extname(e).toLowerCase();if(!x.has(n))return[];if(!e.startsWith("/"))return[];let u=s.join(i,e.slice(1)),p=s.dirname(u),c=s.basename(u,n),o=s.resolve(p),m=s.resolve(i);if(!o.startsWith(m))return[];let f=s.posix.dirname(e),l=a.map(async(t)=>{let r=s.join(p,`${c}${t.ext}`);if(!await Bun.file(r).exists())return null;return{url:s.posix.join(f,`${c}${t.ext}`),mime:t.mime}});return(await Promise.all(l)).filter((t)=>t!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function R(e){let i=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,n;while((n=a.exec(e))!==null)i.push([n.index,n.index+n[0].length]);return i}function S(e,i){for(let[a,n]of i)if(e>=a&&e<n)return!0;return!1}function W(e){return e.replace(/&/g,"&").replace(/"/g,""")}
|
|
3
|
-
export{v as ve};
|
package/dist/chunk-6rv8w5jk.js
DELETED
package/dist/chunk-6x1feysm.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{createHash as y}from"crypto";import{readFile as k,stat as x}from"fs/promises";async function g(t){try{let e=await k(t);return y("sha256").update(e).digest("hex").slice(0,16)}catch{return""}}function N(t){return y("sha256").update(t).digest("hex").slice(0,16)}function p(t){return y("sha256").update(t).digest("hex").slice(0,16)}function d(t,e){let a=JSON.stringify(e,Object.keys(e).sort());return`${p(t)}-${p(a)}`}async function m(t){try{return(await x(t)).mtimeMs}catch{return 0}}async function C(t){try{return await x(t),!0}catch{return!1}}import{mkdir as v,readFile as D,writeFile as E,readdir as S,rm as w,stat as z}from"fs/promises";import{join as h,dirname as O}from"path";var f=new Map,u={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function P(t){try{await v(t,{recursive:!0})}catch{}}function F(t,e,a){return h(t,a,`${e}.json`)}async function A(t,e,a){if((Date.now()-t.createdAt)/86400000>a)return!1;if(await m(e)!==t.srcMtime)return!1;return!0}async function V(t,e,a,c=u){if(!c.enabled)return null;let r=d(t,e),i=f.get(r);if(i){if(await A(i,t,c.maxAge))return i.lastAccessedAt=Date.now(),i.data;f.delete(r)}let s=F(c.directory,r,a);if(await C(s))try{let n=await D(s,"utf-8"),o=JSON.parse(n);if(await A(o,t,c.maxAge))return o.lastAccessedAt=Date.now(),f.set(r,o),o.data}catch{}return null}async function q(t,e,a,c,r=u){if(!r.enabled)return;let i=d(t,e),s=await g(t),n=await m(t),o={key:i,src:t,srcHash:s,srcMtime:n,optionsHash:d("",e),data:a,createdAt:Date.now(),lastAccessedAt:Date.now()};f.set(i,o);let l=F(r.directory,i,c);try{await P(O(l)),await E(l,JSON.stringify(o,null,2))}catch(M){console.warn(`[stx-media] Failed to write cache: ${M}`)}}async function G(t,e=u){if(t==="all")f.clear();else f.clear();let a=t==="all"?["image","video"]:[t];for(let c of a){let r=h(e.directory,c);try{await w(r,{recursive:!0,force:!0})}catch{}}}async function I(t=u){let e={memoryEntries:f.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let a of["image","video"]){let c=h(t.directory,a);try{let r=await S(c);e.diskEntries[a]=r.length;for(let i of r){let s=h(c,i),n=await z(s);e.totalSizeMB+=n.size/1048576}}catch{}}return e}async function L(t=u){let e=0,a=t.maxAge*24*60*60*1000;for(let c of["image","video"]){let r=h(t.directory,c);try{let i=await S(r);for(let s of i){let n=h(r,s);try{let o=await D(n,"utf-8"),l=JSON.parse(o);if(Date.now()-l.createdAt>a)await w(n),f.delete(l.key),e++}catch{await w(n).catch(()=>{}),e++}}}catch{}}return e}
|
|
3
|
-
export{g as Fu,N as Gu,p as Hu,d as Iu,m as Ju,C as Ku,V as Lu,q as Mu,G as Nu,I as Ou,L as Pu};
|