@stacksjs/bun-router 0.0.26 → 0.1.0

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.
Files changed (103) hide show
  1. package/dist/chunk-0gjq8ttx.js +14 -0
  2. package/dist/chunk-0t5vz87j.js +35 -0
  3. package/dist/chunk-30rkn2ym.js +2 -0
  4. package/dist/chunk-38cmrard.js +2 -0
  5. package/dist/chunk-3qna6dwd.js +2 -0
  6. package/dist/chunk-4d5fmta0.js +2 -0
  7. package/dist/chunk-4x3b4b4q.js +2 -0
  8. package/dist/chunk-5be9x5cq.js +3 -0
  9. package/dist/chunk-5mxby3fd.js +1654 -0
  10. package/dist/chunk-5n0ckcmc.js +3 -0
  11. package/dist/chunk-5ncn73tp.js +3 -0
  12. package/dist/chunk-5s0pnsd6.js +12 -0
  13. package/dist/chunk-5s1pr62n.js +3 -0
  14. package/dist/chunk-67wgad4f.js +60 -0
  15. package/dist/chunk-6bbmkwng.js +3 -0
  16. package/dist/chunk-6s1kbajm.js +7851 -0
  17. package/dist/chunk-6sjvhy5f.js +3 -0
  18. package/dist/chunk-6xed4va1.js +2 -0
  19. package/dist/chunk-73k79n7q.js +15413 -0
  20. package/dist/chunk-748n6ydj.js +2 -0
  21. package/dist/chunk-7qnxdedn.js +321 -0
  22. package/dist/chunk-7rsf8tes.js +898 -0
  23. package/dist/chunk-8aspmtf1.js +2 -0
  24. package/dist/chunk-8wpj3fqe.js +351 -0
  25. package/dist/chunk-8yfdg595.js +2 -0
  26. package/dist/chunk-90eze7av.js +3 -0
  27. package/dist/chunk-9805tt8n.js +341 -0
  28. package/dist/chunk-9dvwyej7.js +2 -0
  29. package/dist/chunk-9ght4n4r.js +216 -0
  30. package/dist/chunk-a2w45krb.js +2 -0
  31. package/dist/chunk-a3wahyg7.js +3 -0
  32. package/dist/chunk-a547f2ab.js +48 -0
  33. package/dist/chunk-bqdycvtc.js +2 -0
  34. package/dist/chunk-brpgjyqg.js +3 -0
  35. package/dist/chunk-cd03rk3x.js +2 -0
  36. package/dist/chunk-csfrpsp7.js +185 -0
  37. package/dist/chunk-ct0m17q5.js +2 -0
  38. package/dist/chunk-dhbvvr5h.js +2 -0
  39. package/dist/chunk-dhptcsya.js +943 -0
  40. package/dist/chunk-dq93zag9.js +2 -0
  41. package/dist/chunk-dxg045wj.js +5 -0
  42. package/dist/chunk-e3qej0jr.js +4 -0
  43. package/dist/chunk-edrtesh7.js +2 -0
  44. package/dist/chunk-ejcws37w.js +2 -0
  45. package/dist/chunk-ex5fkjah.js +397 -0
  46. package/dist/chunk-ex890p45.js +51 -0
  47. package/dist/chunk-f69cpnhw.js +2 -0
  48. package/dist/chunk-fjf53b44.js +2 -0
  49. package/dist/chunk-fjzye4qj.js +2 -0
  50. package/dist/chunk-gfd23b6t.js +2 -0
  51. package/dist/chunk-habv0vef.js +12 -0
  52. package/dist/chunk-hmgedrmr.js +11 -0
  53. package/dist/chunk-hz6fc788.js +2 -0
  54. package/dist/chunk-jff6j9y3.js +10 -0
  55. package/dist/chunk-jmeb7n8k.js +70 -0
  56. package/dist/chunk-jrf5a2ap.js +2 -0
  57. package/dist/chunk-jy2jhcpy.js +246 -0
  58. package/dist/chunk-kc659vhx.js +4 -0
  59. package/dist/chunk-kjtjbcq4.js +71 -0
  60. package/dist/chunk-krkchy8v.js +4 -0
  61. package/dist/chunk-kxp888dn.js +4540 -0
  62. package/dist/chunk-m249t3je.js +3 -0
  63. package/dist/chunk-m9yabnjx.js +2 -0
  64. package/dist/chunk-mekrq9wd.js +2 -0
  65. package/dist/chunk-mmxv535f.js +82 -0
  66. package/dist/chunk-mypn7jss.js +2 -0
  67. package/dist/chunk-n18x1k3c.js +2 -0
  68. package/dist/chunk-nkddjzsa.js +2 -0
  69. package/dist/chunk-pjmhqmr9.js +2 -0
  70. package/dist/chunk-qyrnsaq1.js +2 -0
  71. package/dist/chunk-r19ff2qm.js +62 -0
  72. package/dist/chunk-r338fssq.js +2 -0
  73. package/dist/chunk-s36z58x2.js +29 -0
  74. package/dist/chunk-s3dn1kwx.js +231 -0
  75. package/dist/chunk-s79dd325.js +471 -0
  76. package/dist/chunk-sw0chtw4.js +4 -0
  77. package/dist/chunk-ta38j9em.js +2 -0
  78. package/dist/chunk-tpfgntwj.js +4211 -0
  79. package/dist/chunk-vr10sbbh.js +3 -0
  80. package/dist/chunk-vsh4390q.js +358 -0
  81. package/dist/chunk-vv3gb1m5.js +84 -0
  82. package/dist/chunk-vw8rwv6e.js +2 -0
  83. package/dist/chunk-w4r464v5.js +288 -0
  84. package/dist/chunk-wcrqs5z9.js +2 -0
  85. package/dist/chunk-x6d1rmwa.js +2 -0
  86. package/dist/chunk-x7ft15zz.js +2 -0
  87. package/dist/chunk-x8trwn7j.js +3 -0
  88. package/dist/chunk-xg9xscqz.js +1 -0
  89. package/dist/chunk-xhepdj1f.js +2 -0
  90. package/dist/chunk-xv2em0q4.js +4 -0
  91. package/dist/chunk-ypw6g0te.js +2 -0
  92. package/dist/chunk-z8szsm21.js +2 -0
  93. package/dist/chunk-zetqzgf3.js +194 -0
  94. package/dist/chunk-zfbh14qe.js +2 -0
  95. package/dist/chunk-zhx0hxdd.js +28 -0
  96. package/dist/cli.js +67 -3240
  97. package/dist/container/index.js +1 -321
  98. package/dist/index.js +80 -13987
  99. package/dist/types.d.ts +12 -2
  100. package/package.json +1 -1
  101. package/dist/chunk-1ahs68ys.js +0 -18
  102. package/dist/chunk-cgptvjdf.js +0 -18131
  103. package/dist/chunk-g3ybefhg.js +0 -1923
@@ -0,0 +1,288 @@
1
+ // @bun
2
+ import"./chunk-a3wahyg7.js";function r(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
3
+ (function() {
4
+ 'use strict';
5
+
6
+ class XElement {
7
+ constructor(el, data) {
8
+ this.el = el;
9
+ this.data = this.makeReactive(data);
10
+ this.watchers = new Map();
11
+ this.init();
12
+ }
13
+
14
+ makeReactive(obj) {
15
+ const self = this;
16
+ return new Proxy(obj, {
17
+ get(target, key) {
18
+ return target[key];
19
+ },
20
+ set(target, key, value) {
21
+ const oldValue = target[key];
22
+ target[key] = value;
23
+ if (oldValue !== value) {
24
+ self.update(key);
25
+ }
26
+ return true;
27
+ }
28
+ });
29
+ }
30
+
31
+ init() {
32
+ this.processElement(this.el);
33
+
34
+ // Process x-init (run expression after initialization)
35
+ const initExpr = this.el.getAttribute('x-init');
36
+ if (initExpr) {
37
+ setTimeout(() => this.execute(initExpr), 0);
38
+ }
39
+ }
40
+
41
+ processElement(el) {
42
+ // Process x-model (two-way binding)
43
+ const models = el.querySelectorAll('[x-model]');
44
+ models.forEach(input => {
45
+ const key = input.getAttribute('x-model');
46
+
47
+ // Set initial value
48
+ if (this.data[key] !== undefined) {
49
+ if (input.type === 'checkbox') {
50
+ input.checked = this.data[key];
51
+ }
52
+ else if (input.type === 'radio') {
53
+ input.checked = input.value === this.data[key];
54
+ }
55
+ else {
56
+ input.value = this.data[key];
57
+ }
58
+ }
59
+
60
+ // Listen for changes
61
+ const eventType = input.tagName === 'SELECT' || input.type === 'checkbox' || input.type === 'radio' ? 'change' : 'input';
62
+ input.addEventListener(eventType, () => {
63
+ if (input.type === 'checkbox') {
64
+ this.data[key] = input.checked;
65
+ }
66
+ else if (input.type === 'radio') {
67
+ if (input.checked) this.data[key] = input.value;
68
+ }
69
+ else if (input.type === 'number' || input.type === 'range') {
70
+ this.data[key] = parseFloat(input.value) || 0;
71
+ }
72
+ else {
73
+ this.data[key] = input.value;
74
+ }
75
+ });
76
+
77
+ // Watch for data changes
78
+ this.watch(key, (value) => {
79
+ if (input.type === 'checkbox') {
80
+ input.checked = value;
81
+ }
82
+ else if (input.type === 'radio') {
83
+ input.checked = input.value === value;
84
+ }
85
+ else if (input.value !== String(value)) {
86
+ input.value = value;
87
+ }
88
+ });
89
+ });
90
+
91
+ // Process x-text (reactive text)
92
+ const texts = el.querySelectorAll('[x-text]');
93
+ texts.forEach(elem => {
94
+ const expr = elem.getAttribute('x-text');
95
+ const update = () => {
96
+ elem.textContent = this.evaluate(expr);
97
+ };
98
+ update();
99
+ this.watchExpression(expr, update);
100
+ });
101
+
102
+ // Process x-html (reactive innerHTML)
103
+ const htmls = el.querySelectorAll('[x-html]');
104
+ htmls.forEach(elem => {
105
+ const expr = elem.getAttribute('x-html');
106
+ const update = () => {
107
+ elem.innerHTML = this.evaluate(expr);
108
+ };
109
+ update();
110
+ this.watchExpression(expr, update);
111
+ });
112
+
113
+ // Process x-show (toggle visibility)
114
+ const shows = el.querySelectorAll('[x-show]');
115
+ shows.forEach(elem => {
116
+ const expr = elem.getAttribute('x-show');
117
+ const update = () => {
118
+ elem.style.display = this.evaluate(expr) ? '' : 'none';
119
+ };
120
+ update();
121
+ this.watchExpression(expr, update);
122
+ });
123
+
124
+ // Process @event and :bind attributes
125
+ const allElements = el.querySelectorAll('*');
126
+ allElements.forEach(elem => {
127
+ Array.from(elem.attributes).forEach(attr => {
128
+ if (attr.name.startsWith('@')) {
129
+ // Event handling
130
+ const eventName = attr.name.slice(1);
131
+ const expr = attr.value;
132
+
133
+ // Handle modifiers
134
+ const parts = eventName.split('.');
135
+ const event = parts[0];
136
+ const modifiers = parts.slice(1);
137
+
138
+ // Determine target element for event listener
139
+ const useWindow = modifiers.includes('window');
140
+ const useOutside = modifiers.includes('outside');
141
+ const useOnce = modifiers.includes('once');
142
+ const target = useWindow ? window : elem;
143
+
144
+ // Check for debounce modifier (e.g., debounce.300)
145
+ let debounceMs = 0;
146
+ const debounceIdx = modifiers.indexOf('debounce');
147
+ if (debounceIdx !== -1 && modifiers[debounceIdx + 1]) {
148
+ debounceMs = parseInt(modifiers[debounceIdx + 1]) || 0;
149
+ }
150
+
151
+ let debounceTimer;
152
+ const handler = (e) => {
153
+ if (modifiers.includes('prevent')) e.preventDefault();
154
+ if (modifiers.includes('stop')) e.stopPropagation();
155
+ if (modifiers.includes('self') && e.target !== elem) return;
156
+
157
+ // For .outside modifier, only fire if click was outside the element
158
+ if (useOutside && elem.contains(e.target)) return;
159
+
160
+ // Key modifiers
161
+ if (event === 'keydown' || event === 'keyup' || event === 'keypress') {
162
+ const keyMap = { enter: 'Enter', escape: 'Escape', tab: 'Tab', space: ' ' };
163
+ for (const mod of modifiers) {
164
+ if (keyMap[mod] && e.key !== keyMap[mod]) return;
165
+ }
166
+ }
167
+
168
+ if (debounceMs > 0) {
169
+ clearTimeout(debounceTimer);
170
+ debounceTimer = setTimeout(() => this.execute(expr, { $event: e, $el: elem }), debounceMs);
171
+ }
172
+ else {
173
+ this.execute(expr, { $event: e, $el: elem });
174
+ }
175
+ };
176
+
177
+ target.addEventListener(event, handler, { once: useOnce });
178
+ }
179
+ else if (attr.name.startsWith(':')) {
180
+ // Attribute binding (:disabled, :class, :href, :src, etc.)
181
+ const bindAttr = attr.name.slice(1);
182
+ const expr = attr.value;
183
+
184
+ const update = () => {
185
+ const val = this.evaluate(expr);
186
+ if (bindAttr === 'class') {
187
+ // :class supports object syntax { className: bool }
188
+ if (val && typeof val === 'object') {
189
+ for (const [cls, active] of Object.entries(val)) {
190
+ elem.classList.toggle(cls, !!active);
191
+ }
192
+ }
193
+ else if (typeof val === 'string') {
194
+ elem.className = val;
195
+ }
196
+ }
197
+ else if (typeof val === 'boolean') {
198
+ // Boolean attributes (disabled, hidden, readonly, etc.)
199
+ if (val) {
200
+ elem.setAttribute(bindAttr, '');
201
+ }
202
+ else {
203
+ elem.removeAttribute(bindAttr);
204
+ }
205
+ }
206
+ else {
207
+ elem.setAttribute(bindAttr, val != null ? String(val) : '');
208
+ }
209
+ };
210
+ update();
211
+ this.watchExpression(expr, update);
212
+ }
213
+ });
214
+ });
215
+ }
216
+
217
+ watch(key, callback) {
218
+ if (!this.watchers.has(key)) {
219
+ this.watchers.set(key, []);
220
+ }
221
+ this.watchers.get(key).push(callback);
222
+ }
223
+
224
+ watchExpression(expr, callback) {
225
+ const vars = expr.match(/[a-zA-Z_$][a-zA-Z0-9_$]*/g) || [];
226
+ vars.forEach(v => {
227
+ if (v in this.data) {
228
+ this.watch(v, callback);
229
+ }
230
+ });
231
+ }
232
+
233
+ update(key) {
234
+ const callbacks = this.watchers.get(key) || [];
235
+ callbacks.forEach(cb => cb(this.data[key]));
236
+ }
237
+
238
+ evaluate(expr) {
239
+ try {
240
+ const fn = new Function(...Object.keys(this.data), 'return ' + expr);
241
+ return fn(...Object.values(this.data));
242
+ }
243
+ catch (e) {
244
+ console.warn('x-element: Error evaluating', expr, e);
245
+ return '';
246
+ }
247
+ }
248
+
249
+ execute(expr, extra = {}) {
250
+ try {
251
+ const allData = { ...this.data, ...extra };
252
+ const fn = new Function(...Object.keys(allData), expr);
253
+ fn.call(this.data, ...Object.values(allData));
254
+ }
255
+ catch (e) {
256
+ console.warn('x-element: Error executing', expr, e);
257
+ }
258
+ }
259
+ }
260
+
261
+ // Initialize all x-data elements
262
+ function init() {
263
+ document.querySelectorAll('[x-data]').forEach(el => {
264
+ const dataExpr = el.getAttribute('x-data');
265
+ try {
266
+ const data = new Function('return ' + dataExpr)();
267
+ new XElement(el, data);
268
+ }
269
+ catch (e) {
270
+ console.error('x-element: Error parsing x-data', e);
271
+ }
272
+ });
273
+ }
274
+
275
+ // Run on DOM ready
276
+ if (document.readyState === 'loading') {
277
+ document.addEventListener('DOMContentLoaded', init);
278
+ }
279
+ else {
280
+ init();
281
+ }
282
+
283
+ // Expose for manual initialization
284
+ window.XElement = XElement;
285
+ })();
286
+ </script>`}function l(t){return/\bx-data(?:\s|=)/.test(t)}function c(t){let a=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,n=t.match(a)||[],e=n.length>0?t.replace(a,""):t;if(!l(e))return e;let s=n[0]?.trim()||r(),i=e.lastIndexOf("</body>");if(i!==-1)return e.slice(0,i)+s+`
287
+ `+e.slice(i);return e+`
288
+ `+s}export{c as processXElementDirectives,l as hasXElementDirectives,r as generateXElementRuntime};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Af as k,qf as a,rf as b,sf as c,tf as d,uf as e,vf as f,wf as g,xf as h,yf as i,zf as j}from"./chunk-6sjvhy5f.js";import"./chunk-tpfgntwj.js";import"./chunk-jff6j9y3.js";import"./chunk-csfrpsp7.js";import"./chunk-0t5vz87j.js";import"./chunk-krkchy8v.js";import"./chunk-brpgjyqg.js";import"./chunk-5mxby3fd.js";import"./chunk-5be9x5cq.js";import"./chunk-jmeb7n8k.js";import"./chunk-kc659vhx.js";import"./chunk-a3wahyg7.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,k as hashFilePath,f as getCachedSignalsRuntime,g as getCachedRouterScript,h as clearDevCaches,i as checkCache,j as cacheTemplate,e as __setSignalsGeneratorsForTest};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pe as a,Qe as b,Re as c,Se as d,Te as e,Ue as f,Ve as g}from"./chunk-8wpj3fqe.js";import"./chunk-a3wahyg7.js";export{c as shouldCacheComponent,a as processKeepAliveDirectives,g as onDeactivated,f as onActivated,e as generateKeepAliveRuntime,d as generateKeepAliveCSS,b as createKeepAliveCache};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ae as b,Be as c,Ce as d,De as e,Ee as f,ze as a}from"./chunk-7qnxdedn.js";import"./chunk-a3wahyg7.js";export{c as processTransitionDirectives,f as processTransitionAttributes,b as performLeave,a as performEnter,e as generateTransitionRuntime,d as generateTransitionCSS};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{qs as k}from"./chunk-90eze7av.js";import{Zu as F}from"./chunk-a3wahyg7.js";import P from"fs";import d from"path";import C from"crypto";var v=new Set(["webp","avif","jpeg","png"]),R=new Set(["cover","contain","fill","inside","outside"]),A=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),S=4096,D=80,U="cover";async function N(e,t){let a=t.routePath??"/_stx/img",p=new URL(e.url);if(p.pathname!==a)return null;let s=L(p,t);if(!s.ok)return new Response(s.error,{status:s.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:i,srcUrl:g,width:l,height:n,format:r,quality:c,fit:h}=s,m;try{m=P.statSync(i)}catch{return new Response(`Source image not found: ${g}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await P.promises.mkdir(w,{recursive:!0});let b=`${i}:${m.mtimeMs}:${m.size}`,x=`${l}x${n}:${r}:${c}:${h}`,f=C.createHash("sha256").update(`${b}|${x}`).digest("hex").slice(0,16),o=d.join(w,`${f}.${r}`),u={"Content-Type":k(r),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:u});let $=Bun.file(o);if(await $.exists())return new Response($,{headers:u});try{let y=Buffer.from(await Bun.file(i).arrayBuffer()),{resizeAndConvert:I}=await M(),T=await I(y,{width:l,height:n,format:r,quality:c,fit:h});return await Bun.write(o,T),u["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(T),{headers:u})}catch(y){let I=y.message;return new Response(`Image processing failed: ${I}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function j(e){return async(t)=>{return await N(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}}function L(e,t){let a=e.searchParams.get("src");if(!a)return{ok:!1,error:"Missing required param: src",status:400};if(!a.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(a.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let p=d.extname(a).toLowerCase();if(!A.has(p))return{ok:!1,error:`Unsupported source extension: ${p}`,status:400};let s=d.resolve(t.publicDir),i=d.resolve(s,a.slice(1));if(!i.startsWith(`${s}${d.sep}`)&&i!==s)return{ok:!1,error:"src is outside publicDir",status:400};let g=t.maxWidth??S,l=t.maxHeight??S,n=e.searchParams.get("w"),r=e.searchParams.get("h"),c=n?Number.parseInt(n,10):0,h=r?Number.parseInt(r,10):0;if(n&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(r&&(!Number.isFinite(h)||h<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!n&&!r)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(c||g,g),w=Math.min(h||l,l),b=e.searchParams.get("f")||"webp";if(!v.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...v].join(", ")})`,status:400};let x=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let u=e.searchParams.get("fit")||t.defaultFit||U;if(!R.has(u))return{ok:!1,error:`Invalid fit (must be one of: ${[...R].join(", ")})`,status:400};return{ok:!0,srcFsPath:i,srcUrl:a,width:m,height:w,format:x,quality:o,fit:u}}async function M(){return await import("./chunk-4d5fmta0.js")}
3
+ export{N as m,j as n};
@@ -0,0 +1 @@
1
+ // @bun
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{m as a,n as b}from"./chunk-x8trwn7j.js";import"./chunk-90eze7av.js";import"./chunk-jy2jhcpy.js";import"./chunk-a3wahyg7.js";export{a as handleImageRequest,b as createImageHandler};
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{cf as g}from"./chunk-m249t3je.js";function m(e,t){let r={};for(let n of e)r[n]=g(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,u)=>{if(r[a])r[a].set(u);else r[a]=g(u);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>{return delete r[a],!0},ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function D(e,t){let r={};for(let n of t)r[n]=e[n];return r}function p(e,t){let r=Object.keys(e),n=m(r,(s)=>t?.[s]??e[s].getDefaultValue()),a=m(r,()=>[]),u=m(r,()=>!1),d=m(r,()=>!1),f=m(r,()=>!1),i=g(!1);async function o(s){f[s]=!0;let c=await e[s].validate(n[s],n);return a[s]=c,f[s]=!1,c.length===0}async function l(){i.set(!0);let s=await Promise.all(r.map(o));return i.set(!1),s.every(Boolean)}function b(){for(let s of r)n[s]=t?.[s]??e[s].getDefaultValue(),a[s]=[],u[s]=!1,d[s]=!1}function y(s){for(let c of r)if(c in s)n[c]=s[c],d[c]=!0}function R(s,c){n[s]=c,d[s]=!0}function w(s,c=!0){if(u[s]=c,c)o(s)}function v(s){return{value:n[s],errors:a[s],touched:u[s],dirty:d[s],valid:a[s].length===0,validating:f[s]}}function S(s){return async(c)=>{c?.preventDefault?.();for(let M of r)u[M]=!0;if(await l())await s(D(n,r))}}return{values:n,errors:a,touched:u,dirty:d,get isValid(){return r.every((s)=>a[s].length===0)},get isValidating(){return i()||r.some((s)=>f[s])},get isDirty(){return r.some((s)=>d[s])},validate:l,validateField:o,reset:b,setValues:y,setFieldValue:R,setFieldTouched:w,getFieldState:v,handleSubmit:S}}var x=p;class h{rules=[];defaultValue="";addRule(e){let t=new h;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let u=String(a).length;return u>=e&&u<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let u=Number(a);return u>=e&&u<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new h;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,u)=>{if(!e(a,u||{}))return!0;return n.validate(a,u)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new h;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var F=new h;function $(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,u,d)=>{try{let f=u.trim().split("."),i=t;for(let l of f)if(i&&typeof i==="object"&&l in i)i=i[l];else return"";let o=i;if(!o||!Array.isArray(o)||o.length===0)return"";return o.map((l)=>{return d.replace(/\{\{\s*message\s*\}\}/g,l)}).join(`
3
+ `)}catch{return""}})}function N(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,u,d)=>{try{let f=u.trim().split("."),i=t;for(let l of f)if(i&&typeof i==="object"&&l in i)i=i[l];else return"";let o=i;if(!o||!Array.isArray(o)||o.length===0)return"";return o.map((l)=>d.replace(/\{\{\s*message\s*\}\}/g,l)).join(`
4
+ `)}catch{return""}})}function V(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,u,d)=>{try{let f=u.trim().split("."),i=t;for(let l of f)if(i&&typeof i==="object"&&l in i)i=i[l];else return"";let o=i;if(!o||!Array.isArray(o)||o.length===0)return"";return d}catch{return""}})}function O(e,t,r){let n=e;return n=$(n,t,r),n=N(n,t,r),n=V(n,t,r),n}export{p as ne,x as oe,h as pe,F as qe,$ as re,N as se,V as te,O as ue};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{En as a,Fn as b,Gn as c,Hn as d,In as e,Jn as f,Kn as g,Ln as h,Mn as i,Nn as j,On as k,Pn as l,Qn as m,Rn as n,Sn as o,Tn as p}from"./chunk-krkchy8v.js";import"./chunk-a3wahyg7.js";export{i as useTitle,f as useSeoMeta,i as usePageTitle,d as useHead,g as seoMetaToHeadConfig,c as resetHead,k as renderHtmlAttrs,j as renderHead,l as renderBodyAttrs,o as processTitleDirective,p as processMetaDirective,n as processHeadDirective,e as mergeHeadConfigs,b as getPageMeta,a as getHead,h as definePageMeta,m as applyHead};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$o as n,Ap as O,Bp as P,Cp as Q,Dp as R,Ep as S,Fp as T,Oo as a,Po as b,Qo as c,Ro as d,So as e,To as f,Uo as g,Vo as h,Wo as i,Xo as j,Yo as k,Zo as l,_o as m,ap as o,bp as p,cp as q,dp as r,ep as s,fp as t,gp as u,hp as v,ip as w,jp as x,kp as y,lp as z,mp as A,np as B,op as C,pp as D,qp as E,rp as F,sp as G,tp as H,up as I,vp as J,wp as K,xp as L,yp as M,zp as N}from"./chunk-jmeb7n8k.js";import"./chunk-a3wahyg7.js";export{y as withErrorRecovery,N as tryLoadConfig,K as loadConfigWithResult,L as loadConfig,B as isRetryableError,A as isConfigNotFoundError,z as isBunfigError,l as hasLocalConfig,d as globalPerformanceMonitor,c as globalCache,j as getLocalConfigPaths,i as getLocalConfigDirectories,D as getEnvOrDefault,h as getConfigPaths,g as getConfigNamePatterns,R as generateConfigTypes,k as findLocalConfig,Q as defaultGeneratedDir,P as defaultConfigDir,G as deepMergeWithArrayStrategy,F as deepMerge,S as createLibraryConfig,M as config,T as bunfigPlugin,O as applyEnvVarsToConfig,t as TypeGenerationError,u as SchemaValidationError,w as PluginError,b as PerformanceMonitor,s as FileSystemError,x as ErrorFactory,r as EnvVarError,C as EnvProcessor,I as ConfigValidator,p as ConfigValidationError,n as ConfigNotFoundError,q as ConfigMergeError,J as ConfigLoader,o as ConfigLoadError,H as ConfigFileLoader,a as ConfigCache,e as CacheUtils,f as CONFIG_FILE_EXTENSIONS,m as BunfigError,v as BrowserConfigError,E as ArrayMergeStrategies};
@@ -0,0 +1,194 @@
1
+ // @bun
2
+ import{Fj as T,Om as M,dj as $,xm as x}from"./chunk-tpfgntwj.js";import{yn as E}from"./chunk-0t5vz87j.js";import C from"path";var R={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},_=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var I=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function z(e){let t=[],i=0,n;I.lastIndex=0;while((n=I.exec(e))!==null){if(n.index>i){let a=e.slice(i,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),i=n.index+n[0].length}if(i<e.length){let s=e.slice(i);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function V(e,t={},i={}){let n={...$,...i,streaming:{...R,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),y=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),l=y?y[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u={...t,__filename:e,__dirname:C.dirname(e)};if(l.trim())await E(l,u,e);let p=z(c),m=new Set;if(!p.some((f)=>f.type==="suspense")){let f=n.streaming?.strategy||"auto",g=new RegExp(_.source,"g");if(!(f!=="manual"&&g.test(c))){let o=await x(c,u,e,n,m);for(let d=0;d<o.length;d+=s)r.enqueue(o.slice(d,d+s)),await new Promise((h)=>setTimeout(h,0))}else{let o=[],d=new RegExp(_.source,"g"),h;while((h=d.exec(c))!==null)o.push({name:h[1],content:h[2],start:h.index,end:h.index+h[0].length});let w=0;for(let S of o){if(S.start>w){let v=c.slice(w,S.start);if(v.trim()){let k=await x(v,u,e,n,m);r.enqueue(k),await new Promise((O)=>setTimeout(O,0))}}let b=await x(S.content,u,e,n,m);r.enqueue(b),await new Promise((v)=>setTimeout(v,0)),w=S.end}if(w<c.length){let S=c.slice(w);if(S.trim()){let b=await x(S,u,e,n,m);r.enqueue(b)}}}}else{let f=new Map;for(let o of p)if(o.type==="shell"||o.type==="content"){let d=await x(o.content,u,e,n,m);r.enqueue(d)}else if(o.type==="suspense"&&o.name){let d=`stx-suspense-${o.name}`;r.enqueue(`<div id="${d}" data-suspense="${o.name}" style="display:contents;">
3
+ <template data-suspense-fallback>Loading...</template>
4
+ </div>`),f.set(o.name,x(o.content,u,e,n,m))}r.enqueue(`
5
+ <script>
6
+ (function() {
7
+ window.__stxSuspense = window.__stxSuspense || {
8
+ resolve: function(name, content) {
9
+ var el = document.querySelector('[data-suspense="' + name + '"]');
10
+ if (el) {
11
+ // Create a template to parse the HTML
12
+ var template = document.createElement('template');
13
+ template.innerHTML = content;
14
+ // Replace placeholder with actual content
15
+ el.replaceWith(template.content);
16
+ }
17
+ }
18
+ };
19
+ })();
20
+ </script>`);let g=Array.from(f.entries()).map(async([o,d])=>{r.enqueue(await q(o,d))});await Promise.all(g)}r.close()}catch(a){r.error(a)}}})}async function q(e,t){try{let i=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
21
+ <script>
22
+ window.__stxSuspense.resolve('${e}', \`${i}\`);
23
+ </script>`}catch(i){let n=i instanceof Error?i.message:String(i);return`
24
+ <script>
25
+ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${T(n)}</div>');
26
+ </script>`}}var H=`
27
+ <script>
28
+ (function(){
29
+ window.__stxSuspense = window.__stxSuspense || {
30
+ resolve: function(name, content){
31
+ var el = document.querySelector('[data-suspense="' + name + '"]');
32
+ if (!el) return;
33
+ var t = document.createElement('template');
34
+ t.innerHTML = content;
35
+ // Keep handles to the inserted nodes \u2014 the fragment is emptied on insert.
36
+ var nodes = Array.prototype.slice.call(t.content.childNodes);
37
+ el.replaceWith(t.content);
38
+ // Hydrate the streamed content so interactive islands/directives inside
39
+ // it come alive (no-op when the signals runtime isn't on the page).
40
+ if (window.stx && typeof window.stx.hydrate === 'function') {
41
+ nodes.forEach(function(n){ if (n.nodeType === 1) window.stx.hydrate(n); });
42
+ }
43
+ }
44
+ };
45
+ })();
46
+ </script>`;function A(e,t,i){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${i}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function W(e,t=[],i={}){let n=i.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(H),await Promise.all(t.map(async(r)=>{let a=A(r.render(),n,r.id);s.enqueue(await q(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var D=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function G(e,t){return e.replace(D,(i,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),y=a[0].trim(),l=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=y,`<div data-suspense="${r}">${l}</div>`})}function J(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let i=Object.entries(t).filter(([,n])=>typeof n==="function");return i.length>0?i.map(([n,s])=>({id:n,render:s})):void 0}async function K(e,t={},i={}){let n={...$,...i,streaming:{...R,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),y=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),l=y?y[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u={...t,__filename:e,__dirname:C.dirname(e)};if(l.trim())await E(l,u,e);let p=new Set,m=n.streaming?.strategy||"auto",f=new RegExp(_.source,"g");if(!(m!=="manual"&&f.test(c))){let g=await x(c,u,e,n,p);for(let o=0;o<g.length;o+=s)r.enqueue(g.slice(o,o+s))}else{let g=[],o=new RegExp(_.source,"g"),d;while((d=o.exec(c))!==null)g.push({name:d[1],content:d[2],start:d.index,end:d.index+d[0].length});let h=0;for(let w of g){if(w.start>h){let b=c.slice(h,w.start);if(b.trim()){let v=await x(b,u,e,n,p);r.enqueue(v)}}let S=await x(w.content,u,e,n,p);r.enqueue(S),h=w.end}if(h<c.length){let w=c.slice(h);if(w.trim()){let S=await x(w,u,e,n,p);r.enqueue(S)}}}r.close()}catch(a){r.error(a)}}})}async function Q(e,t={}){let i={...$,...t,streaming:{...R,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y=a,l={},c;_.lastIndex=0;while((c=_.exec(a))!==null){let p=c[1],m=c[2];l[p]=m}let u=a.replace(_,"");return{renderShell:async(p={})=>{let m={...p,__filename:e,__dirname:C.dirname(e)};return await E(r,m,e),x(u,m,e,i,new Set)},renderSection:async(p,m={})=>{try{if(!l[p])return`<div class="error-message">Section "${T(p)}" not found in template "${T(e)}"</div>`;let f={...m,__filename:e,__dirname:C.dirname(e)};await E(r,f,e);let g=new Set;return await x(l[p],f,e,i,g)}catch(f){let g=f instanceof Error?f.message:String(f);return M("Expression",g,e,l[p]||"",0,l[p]||"")}},getSections:()=>{return Object.keys(l)},getTemplate:()=>{return y}}}var N={name:"suspense",hasEndTag:!0,handler:(e,t,i,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},L={name:"island",hasEndTag:!0,handler:(e,t,i,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,y=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),l=y?y[1].trim():"",c=y?e.replace(y[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
47
+ ${c}
48
+ <script type="application/json" data-island-props="${a}">
49
+ ${l?`{${l}}`:"{}"}
50
+ </script>
51
+ </div>`}};function Y(e={}){let t=[];if(e.streaming?.enabled)t.push(N);if(e.hydration?.enabled)t.push(L);return t}async function Z(e,t,i,n={}){return e}function P(e,t={}){let i=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(i.encode(r))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function ee(e={mode:"full"}){let{mode:t,components:i={},dynamicImports:n=!0}=e,s=Object.entries(i).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
52
+ `);if(t==="loader")return`
53
+ (function() {
54
+ window.__stx = window.__stx || {};
55
+ window.__stx.islands = new Map();
56
+ window.__stx.registerComponent = function(name, component) {
57
+ window.__stx.islands.set(name, component);
58
+ };
59
+ })();`;return`
60
+ (function() {
61
+ 'use strict';
62
+
63
+ // Hydration runtime for stx islands
64
+ const stx = {
65
+ // Component registry
66
+ components: {
67
+ ${s}
68
+ },
69
+
70
+ // Loaded island instances
71
+ islands: new Map(),
72
+
73
+ // Register a component for hydration
74
+ registerComponent: function(name, loader) {
75
+ this.components[name] = loader;
76
+ },
77
+
78
+ // Get props for an island by ID
79
+ getIslandProps: function(id) {
80
+ const propsScript = document.querySelector('[data-island-props="' + id + '"]');
81
+ if (!propsScript) return {};
82
+ try {
83
+ return JSON.parse(propsScript.textContent || '{}');
84
+ }
85
+ catch (e) {
86
+ console.warn('[stx] Failed to parse island props:', id, e);
87
+ return {};
88
+ }
89
+ },
90
+
91
+ // Hydrate a single island
92
+ hydrateIsland: async function(element) {
93
+ const name = element.dataset.island;
94
+ const id = element.dataset.islandId;
95
+
96
+ if (!name || this.islands.has(id)) return;
97
+
98
+ const loader = this.components[name];
99
+ if (!loader) {
100
+ console.warn('[stx] Unknown island component:', name);
101
+ return;
102
+ }
103
+
104
+ try {
105
+ const component = typeof loader === 'function' ? await loader() : loader;
106
+ const props = this.getIslandProps(id);
107
+
108
+ // Mark as hydrating
109
+ element.dataset.hydrating = 'true';
110
+
111
+ // Call component's hydrate method if available
112
+ if (component.hydrate) {
113
+ await component.hydrate(element, props);
114
+ }
115
+ else if (component.default && component.default.hydrate) {
116
+ await component.default.hydrate(element, props);
117
+ }
118
+
119
+ // Mark as hydrated
120
+ delete element.dataset.hydrating;
121
+ element.dataset.hydrated = 'true';
122
+ this.islands.set(id, { element, component, props });
123
+
124
+ }
125
+ catch (error) {
126
+ console.error('[stx] Failed to hydrate island:', name, error);
127
+ element.dataset.hydrateError = 'true';
128
+ }
129
+ },
130
+
131
+ // Hydrate all islands based on priority
132
+ hydrate: function() {
133
+ const islands = document.querySelectorAll('[data-island]');
134
+
135
+ // Group by priority
136
+ const eager = [];
137
+ const lazy = [];
138
+ const idle = [];
139
+
140
+ islands.forEach(function(el) {
141
+ const priority = el.dataset.priority || 'lazy';
142
+ if (priority === 'eager') eager.push(el);
143
+ else if (priority === 'idle') idle.push(el);
144
+ else lazy.push(el);
145
+ });
146
+
147
+ // Hydrate eager immediately
148
+ eager.forEach(function(el) { stx.hydrateIsland(el); });
149
+
150
+ // Hydrate lazy on intersection
151
+ if (lazy.length > 0 && 'IntersectionObserver' in window) {
152
+ const observer = new IntersectionObserver(function(entries) {
153
+ entries.forEach(function(entry) {
154
+ if (entry.isIntersecting) {
155
+ observer.unobserve(entry.target);
156
+ stx.hydrateIsland(entry.target);
157
+ }
158
+ });
159
+ }, { rootMargin: '50px' });
160
+
161
+ lazy.forEach(function(el) { observer.observe(el); });
162
+ }
163
+ else {
164
+ // Fallback: hydrate all lazy immediately
165
+ lazy.forEach(function(el) { stx.hydrateIsland(el); });
166
+ }
167
+
168
+ // Hydrate idle during browser idle time
169
+ if (idle.length > 0 && 'requestIdleCallback' in window) {
170
+ requestIdleCallback(function() {
171
+ idle.forEach(function(el) { stx.hydrateIsland(el); });
172
+ });
173
+ }
174
+ else {
175
+ // Fallback: hydrate after a delay
176
+ setTimeout(function() {
177
+ idle.forEach(function(el) { stx.hydrateIsland(el); });
178
+ }, 200);
179
+ }
180
+ }
181
+ };
182
+
183
+ // Expose to window
184
+ window.__stx = stx;
185
+
186
+ // Auto-hydrate on DOMContentLoaded if not SSR
187
+ if (document.readyState === 'loading') {
188
+ document.addEventListener('DOMContentLoaded', function() { stx.hydrate(); });
189
+ }
190
+ else {
191
+ stx.hydrate();
192
+ }
193
+ })();`}
194
+ export{V as Kf,q as Lf,H as Mf,W as Nf,G as Of,J as Pf,K as Qf,Q as Rf,N as Sf,L as Tf,Y as Uf,Z as Vf,P as Wf,ee as Xf};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-r19ff2qm.js";import"./chunk-vr10sbbh.js";import"./chunk-sw0chtw4.js";import"./chunk-xg9xscqz.js";import"./chunk-a3wahyg7.js";export{j as toUsers,i as toUser,f as stopBroadcasting,e as startBroadcasting,g as loadChannels,d as getBroadcastServer,c as channel,k as broadcastPrivate,l as broadcastPresence,h as broadcast,a as BroadcastServer,b as Broadcast};
@@ -0,0 +1,28 @@
1
+ // @bun
2
+ import{Ff as S,Gf as $,Hf as f}from"./chunk-e3qej0jr.js";import{fj as x,og as g,pg as y}from"./chunk-tpfgntwj.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,k=["composables","functions"];function B(r){let e=_.basename(r,".ts");return e==="index"||e==="types"||r.endsWith(".d.ts")}async function A(r){if(r)return _.resolve(r);let e=`<default>:${process.cwd()}`,n=m.get(e);if(n!==void 0)return n;let s=await E();if(s!==null)m.set(e,s);return s}async function E(){let r=await x(),e=r.root||process.cwd(),n=r.composablesDir;if(n)return _.resolve(e,n);for(let s of k){let i=_.resolve(e,s);try{let u=new Bun.Glob("**/*.ts");for await(let c of u.scan({cwd:i,absolute:!0}))if(!B(c))return i}catch{}}return null}async function G(r){let e=await A(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(B(o))continue;n.push(o)}}catch{return f(a,e,"",""),null}let s=S(n),i=$(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(),N=_.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: ${N}
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 D=[...d].map((t)=>` try { __c[${JSON.stringify(t)}] = ${t}; } catch (e) {}`).join(`
4
+ `),C=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
+ ${D}
14
+ var __names = ${C};
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 J(){a.clear(),m.clear()}
28
+ export{G as Df,J as Ef};