@stacksjs/bun-router 0.0.27 → 0.1.1

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 (108) hide show
  1. package/dist/chunk-03m2j6h7.js +2 -0
  2. package/dist/chunk-08cw7ejr.js +3 -0
  3. package/dist/chunk-0e4g0fyv.js +62 -0
  4. package/dist/chunk-0mmn02yw.js +2 -0
  5. package/dist/chunk-126c9qm3.js +2 -0
  6. package/dist/chunk-12p13817.js +2 -0
  7. package/dist/chunk-14v65c37.js +4 -0
  8. package/dist/chunk-1b6a7t3v.js +231 -0
  9. package/dist/chunk-1wenkmk0.js +2 -0
  10. package/dist/chunk-2152npfd.js +2 -0
  11. package/dist/chunk-26w23krx.js +2 -0
  12. package/dist/chunk-2g8m379z.js +10 -0
  13. package/dist/chunk-2rr178et.js +1654 -0
  14. package/dist/chunk-2w8f3swz.js +29 -0
  15. package/dist/chunk-3y4gaz7v.js +82 -0
  16. package/dist/chunk-4r1x4afz.js +12 -0
  17. package/dist/chunk-4wyw66zk.js +2 -0
  18. package/dist/chunk-4z5sf8ag.js +2 -0
  19. package/dist/chunk-58tfvayh.js +4 -0
  20. package/dist/chunk-5be9x5cq.js +3 -0
  21. package/dist/chunk-5dp83qcx.js +397 -0
  22. package/dist/chunk-5f0d9j9a.js +2 -0
  23. package/dist/chunk-5z52b0fc.js +28 -0
  24. package/dist/chunk-5zrnk2kq.js +4 -0
  25. package/dist/chunk-6bbmkwng.js +3 -0
  26. package/dist/chunk-6dmqtdnq.js +2 -0
  27. package/dist/chunk-6e91956t.js +3 -0
  28. package/dist/chunk-6rv8w5jk.js +2 -0
  29. package/dist/chunk-6x1feysm.js +3 -0
  30. package/dist/chunk-7qnxdedn.js +321 -0
  31. package/dist/chunk-7y72hm1x.js +2 -0
  32. package/dist/chunk-8hbhfh6b.js +194 -0
  33. package/dist/chunk-8kfzygg5.js +3 -0
  34. package/dist/chunk-8wpj3fqe.js +351 -0
  35. package/dist/chunk-8wydx2we.js +2 -0
  36. package/dist/chunk-8zjnjvv7.js +2 -0
  37. package/dist/chunk-9805tt8n.js +341 -0
  38. package/dist/chunk-988h4bzr.js +2 -0
  39. package/dist/chunk-9b6a58ac.js +2 -0
  40. package/dist/chunk-a8fcaywb.js +2 -0
  41. package/dist/chunk-bfjwn7yg.js +2 -0
  42. package/dist/chunk-bp2522mm.js +2 -0
  43. package/dist/chunk-brpgjyqg.js +3 -0
  44. package/dist/chunk-bswe62q4.js +48 -0
  45. package/dist/chunk-c3v796c8.js +943 -0
  46. package/dist/chunk-ccqmwdry.js +2 -0
  47. package/dist/chunk-ck0crwnx.js +2 -0
  48. package/dist/chunk-cqgkxcb4.js +2 -0
  49. package/dist/chunk-dntnakjy.js +2 -0
  50. package/dist/chunk-dxg045wj.js +5 -0
  51. package/dist/chunk-e3qej0jr.js +4 -0
  52. package/dist/chunk-ettdpnrw.js +60 -0
  53. package/dist/chunk-ezqwq17j.js +185 -0
  54. package/dist/chunk-ezx3qsez.js +2 -0
  55. package/dist/chunk-f72nnjy4.js +15413 -0
  56. package/dist/chunk-fna5n0ey.js +246 -0
  57. package/dist/chunk-fqhckdt8.js +2 -0
  58. package/dist/chunk-fr6hbx25.js +2 -0
  59. package/dist/chunk-g9cwng6w.js +3 -0
  60. package/dist/chunk-gd3za5x0.js +2 -0
  61. package/dist/chunk-gf28608k.js +2 -0
  62. package/dist/chunk-h1dj6v8q.js +3 -0
  63. package/dist/chunk-hjxe7k2g.js +2 -0
  64. package/dist/chunk-hrkgznbn.js +2 -0
  65. package/dist/chunk-j6h5v0br.js +2 -0
  66. package/dist/chunk-kjtjbcq4.js +71 -0
  67. package/dist/chunk-mgb01qdv.js +14 -0
  68. package/dist/chunk-n24c9whp.js +2 -0
  69. package/dist/chunk-n2j24b0h.js +4540 -0
  70. package/dist/chunk-nf3kv7kv.js +3 -0
  71. package/dist/chunk-nhmtg01n.js +84 -0
  72. package/dist/chunk-p0qhpnqh.js +70 -0
  73. package/dist/chunk-p0w1x8y2.js +3 -0
  74. package/dist/chunk-p3dk1w2w.js +216 -0
  75. package/dist/chunk-q4e9pxs7.js +3 -0
  76. package/dist/chunk-q5dv1kyy.js +2 -0
  77. package/dist/chunk-qnqgf9tq.js +2 -0
  78. package/dist/chunk-qvwy1808.js +898 -0
  79. package/dist/chunk-r18f77vc.js +12 -0
  80. package/dist/chunk-r63za1mr.js +2 -0
  81. package/dist/chunk-rft8gw92.js +7851 -0
  82. package/dist/chunk-ryvmyskt.js +4211 -0
  83. package/dist/chunk-sa6mx308.js +2 -0
  84. package/dist/chunk-sw0chtw4.js +4 -0
  85. package/dist/chunk-va0pc7hx.js +2 -0
  86. package/dist/chunk-vcp8dnjq.js +412 -0
  87. package/dist/chunk-vg1erq1q.js +2 -0
  88. package/dist/chunk-vsh4390q.js +358 -0
  89. package/dist/chunk-w0jv49ch.js +11 -0
  90. package/dist/chunk-wm805tte.js +35 -0
  91. package/dist/chunk-xg9xscqz.js +1 -0
  92. package/dist/chunk-xj9h6mc9.js +2 -0
  93. package/dist/chunk-ytvzwrq3.js +51 -0
  94. package/dist/chunk-zde7ebc4.js +288 -0
  95. package/dist/chunk-zmqsv2xy.js +2 -0
  96. package/dist/cli.js +51 -3233
  97. package/dist/container/index.js +1 -321
  98. package/dist/index.d.ts +1 -0
  99. package/dist/index.js +80 -13987
  100. package/dist/typed/client.d.ts +89 -0
  101. package/dist/typed/contract.d.ts +34 -0
  102. package/dist/typed/endpoint.d.ts +90 -0
  103. package/dist/typed/index.d.ts +14 -0
  104. package/dist/typed/router.d.ts +141 -0
  105. package/package.json +1 -1
  106. package/dist/chunk-1ahs68ys.js +0 -18
  107. package/dist/chunk-cgptvjdf.js +0 -18131
  108. package/dist/chunk-g3ybefhg.js +0 -1923
@@ -0,0 +1,397 @@
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};
@@ -0,0 +1,2 @@
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};
@@ -0,0 +1,28 @@
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};
@@ -0,0 +1,4 @@
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};
@@ -0,0 +1,3 @@
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};
@@ -0,0 +1,2 @@
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};
@@ -0,0 +1,3 @@
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,"&amp;").replace(/"/g,"&quot;")}
3
+ export{v as ve};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{_ as r}from"./chunk-sw0chtw4.js";import"./chunk-xg9xscqz.js";import"./chunk-nf3kv7kv.js";export{r as PrometheusExporter};
@@ -0,0 +1,3 @@
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};