@stacksjs/bun-router 0.1.7 → 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 +2 -2
- 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-vg1erq1q.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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-q4e9pxs7.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{e as __setSignalsGeneratorsForTest,j as cacheTemplate,i as checkCache,h as clearDevCaches,g as getCachedRouterScript,f as getCachedSignalsRuntime,k as hashFilePath,c as invalidateFileCache,d as invalidateFileCacheByDir,b as readFileCached,a as templateCache};
|
package/dist/chunk-vsh4390q.js
DELETED
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var f=0;function p(){return`async-${++f}-${Date.now().toString(36)}`}function w(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,a=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,i,d)=>{let l=p(),y=u(s);return m(l,y,i.trim(),d.trim())}),n=n.replace(a,(r,s,i)=>{let d=p(),l=u(s);return m(d,l,i.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let a=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(a){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:a,timeout:n,delay:r,suspensible:s,retries:i}=t;return`
|
|
3
|
-
<div class="stx-async-component" data-async-id="${e}" data-component="${a}" data-status="pending">
|
|
4
|
-
<div class="stx-async-loading" data-async-loading="${e}">
|
|
5
|
-
${c}
|
|
6
|
-
</div>
|
|
7
|
-
<div class="stx-async-content" data-async-content="${e}" style="display: none;">
|
|
8
|
-
</div>
|
|
9
|
-
<div class="stx-async-error" data-async-error="${e}" style="display: none;">
|
|
10
|
-
${o}
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
<script>
|
|
14
|
-
(function() {
|
|
15
|
-
const asyncId = '${e}';
|
|
16
|
-
const componentPath = '${a}';
|
|
17
|
-
const timeout = ${n};
|
|
18
|
-
const delay = ${r};
|
|
19
|
-
const suspensible = ${s};
|
|
20
|
-
const maxRetries = ${i};
|
|
21
|
-
|
|
22
|
-
const container = document.querySelector('[data-async-id="' + asyncId + '"]');
|
|
23
|
-
const loadingEl = document.querySelector('[data-async-loading="' + asyncId + '"]');
|
|
24
|
-
const contentEl = document.querySelector('[data-async-content="' + asyncId + '"]');
|
|
25
|
-
const errorEl = document.querySelector('[data-async-error="' + asyncId + '"]');
|
|
26
|
-
|
|
27
|
-
if (!container || !loadingEl || !contentEl || !errorEl) return;
|
|
28
|
-
|
|
29
|
-
let attempts = 0;
|
|
30
|
-
let delayTimer = null;
|
|
31
|
-
let timeoutTimer = null;
|
|
32
|
-
let resolved = false;
|
|
33
|
-
let aborted = false;
|
|
34
|
-
|
|
35
|
-
// AbortController + container detachment guards (stacksjs/stx#1720). Without
|
|
36
|
-
// these, an in-flight fetch from a previous page would write innerHTML on
|
|
37
|
-
// a detached container after the user SPA-navigated away, or \u2014 for
|
|
38
|
-
// components removed via :if/parent toggle \u2014 would log a "rejected" state
|
|
39
|
-
// on a node that no longer exists. The router dispatches stx:navigate
|
|
40
|
-
// when a navigation starts; we treat that as a teardown signal. The
|
|
41
|
-
// isConnected check covers non-router unmounts (:if false, parent remove).
|
|
42
|
-
const controller = new AbortController();
|
|
43
|
-
function teardown() {
|
|
44
|
-
if (aborted) return;
|
|
45
|
-
aborted = true;
|
|
46
|
-
controller.abort();
|
|
47
|
-
clearTimeout(delayTimer);
|
|
48
|
-
clearTimeout(timeoutTimer);
|
|
49
|
-
window.removeEventListener('stx:navigate', teardown);
|
|
50
|
-
}
|
|
51
|
-
window.addEventListener('stx:navigate', teardown);
|
|
52
|
-
|
|
53
|
-
// Update state
|
|
54
|
-
function setState(status) {
|
|
55
|
-
container.setAttribute('data-status', status);
|
|
56
|
-
loadingEl.style.display = status === 'loading' ? '' : 'none';
|
|
57
|
-
contentEl.style.display = status === 'resolved' ? '' : 'none';
|
|
58
|
-
errorEl.style.display = status === 'rejected' ? '' : 'none';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Show loading after delay
|
|
62
|
-
function showLoading() {
|
|
63
|
-
if (!resolved) {
|
|
64
|
-
setState('loading');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Load component
|
|
69
|
-
async function loadComponent() {
|
|
70
|
-
attempts++;
|
|
71
|
-
|
|
72
|
-
// Start delay timer for loading state
|
|
73
|
-
delayTimer = setTimeout(showLoading, delay);
|
|
74
|
-
|
|
75
|
-
// Start timeout timer
|
|
76
|
-
timeoutTimer = setTimeout(function() {
|
|
77
|
-
if (!resolved) {
|
|
78
|
-
handleError(new Error('Component load timeout after ' + timeout + 'ms'));
|
|
79
|
-
}
|
|
80
|
-
}, timeout);
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
// Notify Suspense boundary if suspensible
|
|
84
|
-
if (suspensible && window.STX && window.STX.suspense) {
|
|
85
|
-
window.STX.suspense.register(asyncId);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Fetch the component with the AbortController signal so a teardown
|
|
89
|
-
// (SPA navigation, component unmount) cancels the in-flight request.
|
|
90
|
-
const response = await fetch('/_stx/component/' + encodeURIComponent(componentPath), {
|
|
91
|
-
signal: controller.signal
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
if (!response.ok) {
|
|
95
|
-
throw new Error('Failed to load component: ' + response.statusText);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const html = await response.text();
|
|
99
|
-
|
|
100
|
-
// Clear timers
|
|
101
|
-
clearTimeout(delayTimer);
|
|
102
|
-
clearTimeout(timeoutTimer);
|
|
103
|
-
|
|
104
|
-
// Belt-and-suspenders: if the container was removed between the fetch
|
|
105
|
-
// starting and now (e.g. :if flipped to false, or a non-router parent
|
|
106
|
-
// mutation), bail before writing innerHTML on a detached node.
|
|
107
|
-
if (aborted || !container.isConnected) return;
|
|
108
|
-
|
|
109
|
-
resolved = true;
|
|
110
|
-
contentEl.innerHTML = html;
|
|
111
|
-
setState('resolved');
|
|
112
|
-
|
|
113
|
-
// Execute any scripts in the loaded component
|
|
114
|
-
contentEl.querySelectorAll('script').forEach(function(script) {
|
|
115
|
-
const newScript = document.createElement('script');
|
|
116
|
-
if (script.src) {
|
|
117
|
-
newScript.src = script.src;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
newScript.textContent = script.textContent;
|
|
121
|
-
}
|
|
122
|
-
script.parentNode.replaceChild(newScript, script);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
// Process signals/bindings on the loaded content ({{ }}, :attr, @event, etc.)
|
|
126
|
-
if (window.stx && window.stx._latestSetup) {
|
|
127
|
-
window.dispatchEvent(new Event('stx:load'));
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Notify Suspense boundary
|
|
131
|
-
if (suspensible && window.STX && window.STX.suspense) {
|
|
132
|
-
window.STX.suspense.resolve(asyncId);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Dispatch loaded event
|
|
136
|
-
container.dispatchEvent(new CustomEvent('stx:async:loaded', {
|
|
137
|
-
detail: { asyncId: asyncId, component: componentPath },
|
|
138
|
-
bubbles: true
|
|
139
|
-
}));
|
|
140
|
-
|
|
141
|
-
// Load succeeded \u2014 drop the navigate-teardown listener so it doesn't
|
|
142
|
-
// accumulate per async component across an app's lifetime.
|
|
143
|
-
window.removeEventListener('stx:navigate', teardown);
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
// AbortError fires when teardown() runs during an in-flight fetch.
|
|
147
|
-
// That's not a load failure \u2014 the component is being unmounted, so
|
|
148
|
-
// don't render the rejected state, don't retry, don't dispatch error.
|
|
149
|
-
if (aborted || (error && error.name === 'AbortError')) return;
|
|
150
|
-
handleError(error);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Handle errors
|
|
155
|
-
function handleError(error) {
|
|
156
|
-
clearTimeout(delayTimer);
|
|
157
|
-
clearTimeout(timeoutTimer);
|
|
158
|
-
|
|
159
|
-
// The container may have been removed (e.g., a non-router :if toggle)
|
|
160
|
-
// between the failure and now. No DOM left to write the error state to.
|
|
161
|
-
if (aborted || !container.isConnected) return;
|
|
162
|
-
|
|
163
|
-
if (attempts < maxRetries) {
|
|
164
|
-
// Retry
|
|
165
|
-
console.warn('[stx:async:' + asyncId + '] Retrying... (' + attempts + '/' + maxRetries + ')');
|
|
166
|
-
setTimeout(loadComponent, 1000 * attempts); // Exponential backoff
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
resolved = true;
|
|
171
|
-
setState('rejected');
|
|
172
|
-
|
|
173
|
-
// Update error content with error message
|
|
174
|
-
const errorMsgEl = errorEl.querySelector('[data-error-message]');
|
|
175
|
-
if (errorMsgEl) {
|
|
176
|
-
errorMsgEl.textContent = error.message;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Notify Suspense boundary
|
|
180
|
-
if (suspensible && window.STX && window.STX.suspense) {
|
|
181
|
-
window.STX.suspense.reject(asyncId, error);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// Dispatch error event
|
|
185
|
-
container.dispatchEvent(new CustomEvent('stx:async:error', {
|
|
186
|
-
detail: { asyncId: asyncId, component: componentPath, error: error },
|
|
187
|
-
bubbles: true
|
|
188
|
-
}));
|
|
189
|
-
|
|
190
|
-
console.error('[stx:async:' + asyncId + ']', error);
|
|
191
|
-
|
|
192
|
-
// Final error state \u2014 no more retries. Drop the navigate listener so it
|
|
193
|
-
// doesn't outlive the (failed) component.
|
|
194
|
-
window.removeEventListener('stx:navigate', teardown);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// Retry function
|
|
198
|
-
function retry() {
|
|
199
|
-
resolved = false;
|
|
200
|
-
attempts = 0;
|
|
201
|
-
setState('pending');
|
|
202
|
-
loadComponent();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Expose retry function
|
|
206
|
-
window['$stxAsyncRetry_' + asyncId.replace(/-/g, '_')] = retry;
|
|
207
|
-
|
|
208
|
-
// Make $retry available within the error content
|
|
209
|
-
errorEl.querySelectorAll('[onclick*="$retry"]').forEach(function(el) {
|
|
210
|
-
const onclick = el.getAttribute('onclick');
|
|
211
|
-
if (onclick) {
|
|
212
|
-
el.setAttribute('onclick', onclick.replace(/\\$retry\\(\\)/g, "window['$stxAsyncRetry_" + asyncId.replace(/-/g, '_') + "']()"));
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
// Expose API
|
|
217
|
-
window.STX = window.STX || {};
|
|
218
|
-
window.STX.asyncComponents = window.STX.asyncComponents || {};
|
|
219
|
-
window.STX.asyncComponents[asyncId] = {
|
|
220
|
-
getStatus: function() { return container.getAttribute('data-status'); },
|
|
221
|
-
retry: retry,
|
|
222
|
-
getAttempts: function() { return attempts; }
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
// Start loading
|
|
226
|
-
loadComponent();
|
|
227
|
-
})();
|
|
228
|
-
</script>
|
|
229
|
-
`}function g(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function h(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function b(){return`
|
|
230
|
-
/* STX Async Component Styles */
|
|
231
|
-
.stx-async-component {
|
|
232
|
-
position: relative;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.stx-async-loading {
|
|
236
|
-
display: flex;
|
|
237
|
-
align-items: center;
|
|
238
|
-
justify-content: center;
|
|
239
|
-
min-height: 100px;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.stx-async-error {
|
|
243
|
-
padding: 1rem;
|
|
244
|
-
border: 1px solid #ef4444;
|
|
245
|
-
border-radius: 0.5rem;
|
|
246
|
-
background-color: #fef2f2;
|
|
247
|
-
color: #991b1b;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
.stx-async-error button {
|
|
251
|
-
margin-top: 0.5rem;
|
|
252
|
-
padding: 0.5rem 1rem;
|
|
253
|
-
border: 1px solid #ef4444;
|
|
254
|
-
border-radius: 0.25rem;
|
|
255
|
-
background-color: #ef4444;
|
|
256
|
-
color: white;
|
|
257
|
-
cursor: pointer;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.stx-async-error button:hover {
|
|
261
|
-
background-color: #dc2626;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/* Loading spinner animation */
|
|
265
|
-
@keyframes stx-async-spin {
|
|
266
|
-
to { transform: rotate(360deg); }
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
.stx-async-spinner {
|
|
270
|
-
width: 24px;
|
|
271
|
-
height: 24px;
|
|
272
|
-
border: 2px solid #e5e7eb;
|
|
273
|
-
border-top-color: #3b82f6;
|
|
274
|
-
border-radius: 50%;
|
|
275
|
-
animation: stx-async-spin 0.8s linear infinite;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/* Skeleton loading */
|
|
279
|
-
.stx-async-skeleton {
|
|
280
|
-
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
281
|
-
background-size: 200% 100%;
|
|
282
|
-
animation: stx-async-shimmer 1.5s infinite;
|
|
283
|
-
border-radius: 0.25rem;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
@keyframes stx-async-shimmer {
|
|
287
|
-
0% { background-position: 200% 0; }
|
|
288
|
-
100% { background-position: -200% 0; }
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/* Dark mode */
|
|
292
|
-
@media (prefers-color-scheme: dark) {
|
|
293
|
-
.stx-async-error {
|
|
294
|
-
background-color: #450a0a;
|
|
295
|
-
color: #fecaca;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
.stx-async-skeleton {
|
|
299
|
-
background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
|
|
300
|
-
background-size: 200% 100%;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
`}function x(){return`
|
|
304
|
-
// STX Async Component Runtime
|
|
305
|
-
(function() {
|
|
306
|
-
if (typeof window === 'undefined') return;
|
|
307
|
-
|
|
308
|
-
window.STX = window.STX || {};
|
|
309
|
-
window.STX.asyncComponents = window.STX.asyncComponents || {};
|
|
310
|
-
|
|
311
|
-
// Load a component dynamically
|
|
312
|
-
window.STX.loadComponent = async function(componentPath, targetSelector, options) {
|
|
313
|
-
options = options || {};
|
|
314
|
-
const target = document.querySelector(targetSelector);
|
|
315
|
-
if (!target) {
|
|
316
|
-
throw new Error('Target element not found: ' + targetSelector);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
const loadingHtml = options.loading || '<div class="stx-async-spinner"></div>';
|
|
320
|
-
target.innerHTML = loadingHtml;
|
|
321
|
-
|
|
322
|
-
try {
|
|
323
|
-
const response = await fetch('/_stx/component/' + encodeURIComponent(componentPath));
|
|
324
|
-
if (!response.ok) {
|
|
325
|
-
throw new Error('Failed to load: ' + response.statusText);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const html = await response.text();
|
|
329
|
-
target.innerHTML = html;
|
|
330
|
-
|
|
331
|
-
// Execute scripts
|
|
332
|
-
target.querySelectorAll('script').forEach(function(script) {
|
|
333
|
-
const newScript = document.createElement('script');
|
|
334
|
-
if (script.src) {
|
|
335
|
-
newScript.src = script.src;
|
|
336
|
-
}
|
|
337
|
-
else {
|
|
338
|
-
newScript.textContent = script.textContent;
|
|
339
|
-
}
|
|
340
|
-
script.parentNode.replaceChild(newScript, script);
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
if (options.onLoad) options.onLoad();
|
|
344
|
-
return true;
|
|
345
|
-
}
|
|
346
|
-
catch (error) {
|
|
347
|
-
if (options.error) {
|
|
348
|
-
target.innerHTML = options.error;
|
|
349
|
-
}
|
|
350
|
-
if (options.onError) options.onError(error);
|
|
351
|
-
throw error;
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
console.log('[stx] Async component runtime initialized');
|
|
356
|
-
})();
|
|
357
|
-
`}
|
|
358
|
-
export{w as Ke,g as Le,h as Me,b as Ne,x as Oe};
|
package/dist/chunk-w0jv49ch.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ff as v,Gf as _,Hf as i}from"./chunk-e3qej0jr.js";import{fj as x,og as w,pg as g}from"./chunk-ryvmyskt.js";import{Un as S}from"./chunk-brpgjyqg.js";import{Mo as b}from"./chunk-5be9x5cq.js";import l from"path";var c=new Map;function N(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let o of(n[1]??"").split(",")){let r=((o.includes(":")?o.split(":").pop():o)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))s.add(r)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let o of(n[1]??"").split(",")){let r=o.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))s.add(r)}}async function F(a){let s;if(a)s=l.resolve(a);else{let t=await x();s=l.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),o=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=l.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;o.push(t)}}catch{return i(c,s,"",""),null}let r=v(o),u=_(c,s,r);if(u!==void 0)return u||null;if(o.length===0)return i(c,s,r,""),null;let f=[];for(let t of o){let e=await Bun.file(t).text();f.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}f.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let A=f.map((t)=>t.file),p=[],m=new Set,y=new Bun.Transpiler({loader:"ts",target:"browser",define:b()});for(let t of A)try{let e=await Bun.file(t).text(),B=l.basename(t,".ts");N(e,m),e=w(e),e=g(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=y.transformSync(e),p.push(`// Store: ${B}
|
|
3
|
-
${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(p.length===0)return i(c,s,r,""),null;let d=p.join(`
|
|
4
|
-
|
|
5
|
-
`),h=`;(function(){
|
|
6
|
-
var __stx = window.stx || {};
|
|
7
|
-
${S.filter((t)=>!m.has(t)&&new RegExp(`\\b${t}\\b`).test(d)).map((t)=>`var ${t} = __stx[${JSON.stringify(t)}];`).join(`
|
|
8
|
-
`)}
|
|
9
|
-
${d}
|
|
10
|
-
})();`;return i(c,s,r,h),h}function I(){c.clear()}
|
|
11
|
-
export{F as Bf,I as Cf};
|
package/dist/chunk-wm805tte.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{In as ue,Kn as fe}from"./chunk-58tfvayh.js";import{Mo as le}from"./chunk-5be9x5cq.js";import T from"path";import W from"process";class Le{source;pos=0;line=1;column=0;tokens=[];constructor(n){this.source=n}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let n=this.nextToken();if(n)this.tokens.push(n)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let n=this.pos,e=this.line,t=this.column,o=this.source[this.pos];if(/\s/.test(o))return this.readWhitespace(n,e,t);if(o==="/"&&this.peek(1)==="/")return this.readLineComment(n,e,t);if(o==="/"&&this.peek(1)==="*")return this.readBlockComment(n,e,t);if(o==='"'||o==="'")return this.readString(o,n,e,t);if(o==="`")return this.readTemplateString(n,e,t);if(/\d/.test(o)||o==="."&&/\d/.test(this.peek(1)||""))return this.readNumber(n,e,t);if(/[a-z_$]/i.test(o))return this.readIdentifier(n,e,t);if(o==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:n,end:this.pos,line:e,column:t};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:n,end:this.pos,line:e,column:t};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:n,end:this.pos,line:e,column:t}}if(o==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:n,end:this.pos,line:e,column:t};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:n,end:this.pos,line:e,column:t}}if(o==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:n,end:this.pos,line:e,column:t};if(o==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective(n,e,t);let i=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let s of i)if(this.source.slice(this.pos,this.pos+s.length)===s)return this.advance(s.length),{type:"OPERATOR",value:s,start:n,end:this.pos,line:e,column:t};if(/[+\-*/%<>=!&|^~?:]/.test(o))return this.advance(),{type:"OPERATOR",value:o,start:n,end:this.pos,line:e,column:t};if(/[()[\]{},;.]/.test(o))return this.advance(),{type:"PUNCTUATION",value:o,start:n,end:this.pos,line:e,column:t};return this.advance(),{type:"PUNCTUATION",value:o,start:n,end:this.pos,line:e,column:t}}readWhitespace(n,e,t){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice(n,this.pos),start:n,end:this.pos,line:e,column:t}}readLineComment(n,e,t){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
|
|
3
|
-
`)this.advance();return{type:"COMMENT",value:this.source.slice(n,this.pos),start:n,end:this.pos,line:e,column:t}}readBlockComment(n,e,t){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice(n,this.pos),start:n,end:this.pos,line:e,column:t}}readString(n,e,t,o){this.advance();while(this.pos<this.source.length){let i=this.source[this.pos];if(i==="\\"){this.advance(2);continue}if(i===n){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:o}}readTemplateString(n,e,t){this.advance();let o=0,i=256;while(this.pos<this.source.length){let s=this.source[this.pos];if(s==="\\"){this.advance(2);continue}if(s==="$"&&this.peek(1)==="{"){if(o>=i){this.pos=this.source.length;break}this.advance(2),o++;continue}if(s==="{"&&o>0){o++,this.advance();continue}if(s==="}"&&o>0){o--,this.advance();continue}if(s==="`"&&o===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice(n,this.pos),start:n,end:this.pos,line:e,column:t}}readNumber(n,e,t){if(this.source[this.pos]==="0"){let o=this.peek(1)?.toLowerCase();if(o==="x"||o==="o"||o==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice(n,this.pos),start:n,end:this.pos,line:e,column:t}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice(n,this.pos),start:n,end:this.pos,line:e,column:t}}readIdentifier(n,e,t){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice(n,this.pos),start:n,end:this.pos,line:e,column:t}}readDirective(n,e,t){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice(n,this.pos),start:n,end:this.pos,line:e,column:t}}advance(n=1){for(let e=0;e<n&&this.pos<this.source.length;e++){if(this.source[this.pos]===`
|
|
4
|
-
`)this.line++,this.column=0;else this.column++;this.pos++}}peek(n){return this.source[this.pos+n]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState(n){this.pos=n.pos,this.line=n.line,this.column=n.column}}function P(n,e,t,o=0){let i=0,s=o,r=null,a=0,c=!1;while(s<n.length){let l=n[s];if(r&&c){c=!1,s++;continue}if(r&&l==="\\"){c=!0,s++;continue}if(c=!1,(l==='"'||l==="'"||l==="`")&&!r){r=l,s++;continue}if(l===r&&r!=="`"){r=null,s++;continue}if(r==="`"&&l==="$"&&n[s+1]==="{"){a++,s+=2;continue}if(a>0&&l==="}"){a--,s++;continue}if(l==="`"&&r==="`"&&a===0){r=null,s++;continue}if(r){s++;continue}if(l===e)i++;else if(l===t){if(i--,i===0)return s}s++}return-1}function lt(n,e){let t=e,o={paren:0,bracket:0,brace:0},i=null,s=0;while(t<n.length){let r=n[t];if((t>0?n[t-1]:"")==="\\"&&i){t++;continue}if((r==='"'||r==="'")&&!i){i=r,t++;continue}if(r===i&&i!=="`"){i=null,t++;continue}if(r==="`"&&!i){i="`",t++;continue}if(r==="`"&&i==="`"&&s===0){i=null,t++;continue}if(i==="`"&&r==="$"&&n[t+1]==="{"){s++,t+=2;continue}if(s>0){if(r==="{")s++;else if(r==="}")s--;t++;continue}if(i){t++;continue}if(o.paren===0&&o.bracket===0&&o.brace===0){if(n.slice(t,t+2)==="}}"||n.slice(t,t+3)==="!!}")break;if(r===","||r===";")break}if(r==="(")o.paren++;else if(r===")"){if(o.paren--,o.paren<0)break}else if(r==="[")o.bracket++;else if(r==="]"){if(o.bracket--,o.bracket<0)break}else if(r==="{")o.brace++;else if(r==="}"){if(o.brace--,o.brace<0)break}t++}return{expression:n.slice(e,t),endPos:t}}function ut(n){let e=[],t="",o={paren:0,bracket:0,brace:0},i=null,s=0;for(let r=0;r<n.length;r++){let a=n[r];if((r>0?n[r-1]:"")==="\\"&&i){t+=a;continue}if((a==='"'||a==="'")&&!i){i=a,t+=a;continue}if(a===i&&i!=="`"){i=null,t+=a;continue}if(a==="`"&&!i){i="`",t+=a;continue}if(a==="`"&&i==="`"&&s===0){i=null,t+=a;continue}if(i==="`"&&a==="$"&&n[r+1]==="{"){s++,t+=a+n[r+1],r++;continue}if(s>0&&a==="{"){s++,t+=a;continue}if(s>0&&a==="}"){s--,t+=a;continue}if(i){t+=a;continue}if(a==="(")o.paren++;else if(a===")")o.paren--;else if(a==="[")o.bracket++;else if(a==="]")o.bracket--;else if(a==="{")o.brace++;else if(a==="}")o.brace--;if(a==="|"&&n[r+1]!=="|"&&(r===0||n[r-1]!=="|")&&n[r-1]!=="\\"&&o.paren===0&&o.bracket===0&&o.brace===0){e.push(t.trim()),t="";continue}if(a==="|"&&n[r-1]==="\\"&&!i){t=t.slice(0,-1)+a;continue}t+=a}if(t.trim())e.push(t.trim());return e}var Be={maxSanitizeDepth:10,allowBracketNotation:!1},K={...Be};var Q=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],qe=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),Y=new Set(["__proto__","constructor","prototype"]),Ue=/[\w)\]]\s*\[\s*['"]/;function ze(n){let e="",t=null,o=!1;for(let i=0;i<n.length;i++){let s=n[i];if(o){o=!1;continue}if(s==="\\"&&t){o=!0;continue}if(t){if(t==="`"&&s==="$"&&i+1<n.length&&n[i+1]==="{"){let r=1;i+=2;while(i<n.length&&r>0){if(n[i]==="{")r++;else if(n[i]==="}")r--;if(r>0)e+=n[i],i++}continue}if(s===t)t=null;continue}if(s==='"'||s==="'"||s==="`"){t=s;continue}e+=s}return e}function Ve(n,e){let t=/[$A-Z_a-z][$\w]*/g,o;while((o=t.exec(n))!==null){let i=o[0],s=n[o.index-1];if(qe.has(i))throw Error(`Potentially unsafe expression (matched /\\b${i}\\b/; identifier ${i}): ${e}`);if(s==="."&&Y.has(i))throw Error(`Potentially unsafe expression (matched /.${i}/; property ${i}): ${e}`)}}function Ge(n){let e=/\[\s*(['"])(.*?)\1\s*\]/g,t;while((t=e.exec(n))!==null){let o=t[2];if(!Y.has(o))continue;let i=n.slice(0,t.index).match(/\S(?=\s*$)/)?.[0],s=n.slice(t.index+t[0].length).match(/^\s*(\S)/)?.[1];if(!((i==="{"||i===",")&&s===":"))throw Error(`Potentially unsafe expression (bracket key ${t[2]}): ${n}`)}}function ee(n){let e=n.trim(),t=ze(e);Ve(t,e),Ge(e);for(let o of Q)if(o.test(t))throw Error(`Potentially unsafe expression (matched /${o.source}/): ${e}`);if(!K.allowBracketNotation&&Ue.test(e))throw Error(`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return e}function Ze(n){let e={};e.Math=Math,e.JSON=JSON,e.Date=Date,e.String=String,e.Number=Number,e.Boolean=Boolean,e.Array=Array,e.parseInt=Number.parseInt,e.parseFloat=Number.parseFloat,e.isNaN=Number.isNaN,e.isFinite=Number.isFinite,e.encodeURIComponent=encodeURIComponent,e.decodeURIComponent=decodeURIComponent;for(let[t,o]of Object.entries(n)){if(t.startsWith("__")||Q.some((i)=>i.test(t)))continue;if(o&&typeof o==="object"&&!Array.isArray(o))e[t]=q(o);else e[t]=o}return e}function q(n,e=0){if(e>=K.maxSanitizeDepth)return"[Object too deep]";if(n===null||typeof n!=="object")return n;if(Array.isArray(n))return n.map((o)=>q(o,e+1));if(n instanceof Date||n instanceof RegExp||n instanceof Map||n instanceof Set||n instanceof Error)return n;let t={};for(let[o,i]of Object.entries(n)){if(o.startsWith("__")||o==="constructor"||o==="prototype")continue;if(i&&typeof i==="object")t[o]=q(i,e+1);else t[o]=i}return t}function B(n,e){try{let t=Ze(e),o=Object.keys(t),i=Object.values(t);return Xe(n,o)(...i)}catch{return}}function ht(n){try{return ee(n),!0}catch{return!1}}function pt(n,e){try{let t=B(n,e);if(t&&typeof t==="object"&&!Array.isArray(t))return t;return{}}catch{return{}}}var te=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]);function Xe(n,e){let t=ee(n),o=/^[A-Za-z_$][\w$]*$/,i=[],s=[];for(let c=0;c<e.length;c++){let l=e[c];if(!o.test(l))continue;if(te.has(l))continue;i.push(c),s.push(l)}let r=(c)=>Function(...s,...c,`
|
|
5
|
-
'use strict';
|
|
6
|
-
try {
|
|
7
|
-
return ${t};
|
|
8
|
-
}
|
|
9
|
-
catch (e) {
|
|
10
|
-
if (e instanceof TypeError) {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
throw e;
|
|
14
|
-
}
|
|
15
|
-
`),a=r([]);if(s.length===e.length)return H(a,s,r);return H((...c)=>{let l=Array(i.length);for(let u=0;u<i.length;u++)l[u]=c[i[u]];return a(...l)},s,r,(c)=>{a=r(c)})}function H(n,e,t,o){let s=/^(\w+) is not defined$/,r=n,a=[],c=new Set(e);return(...l)=>{for(let u=0;u<=8;u++)try{return r(...l)}catch(p){let d=p instanceof Error?p.message:"",m=s.exec(d);if(!(p instanceof ReferenceError)||!m)return;let g=m[1];if(c.has(g)||te.has(g))return;c.add(g),a.push(g),r=t(a),o?.(a)}return}}function dt(n){let e=n.trim(),t=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let o of t)if(o.test(e))return!1;return!0}var{require:ne}=import.meta,he=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],ie=new Set(he),Je=new Set(["stx","@stacksjs/stx"]);function He(n){let e=[],t=0,o=n.split(`
|
|
16
|
-
`);for(let i of o){let s=t,r=null,a=!1;for(let c=0;c<i.length;c++){let l=i[c];if(a){a=!1;continue}if(l==="\\"){a=!0;continue}if(r){if(l===r)r=null;continue}if(l==="'"||l==='"'||l==="`"){r=l;continue}if(l==="/"&&c+1<i.length&&i[c+1]==="/")break;if(l==="{")t++;else if(l==="}")t--}if(s===0){let c=i.match(/(?:const|let|var)\s+(\w+)\s*=/);if(c)e.push(c[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(i)){let l=i.match(/(?:const|let|var)\s+(\w+)/);if(l)e.push(l[1])}else{let l=i.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(l){let u=l[1].slice(1,-1).split(",").map((p)=>{let d=p.split(":");return(d.length>1?d[1]:d[0]).trim()}).filter((p)=>/^\w+$/.test(p));e.push(...u)}}}}return[...new Set(e)]}function Ke(n){let e=n;e=e.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),e=e.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),e=e.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function t(o){if(!o.includes(":"))return o;let i=[],s="",r=0,a=0,c=null;for(let l=0;l<o.length;l++){let u=o[l];if(c){if(s+=u,u===c)c=null;continue}if(u==='"'||u==="'"||u==="`"){c=u,s+=u;continue}if(u==="<")r++;else if(u===">"&&r>0)r--;else if(u==="(")a++;else if(u===")")a--;if(u===","&&r===0&&a===0){i.push(s),s="";continue}s+=u}if(s)i.push(s);return i.map((l)=>{let u=l.trim(),p=u.startsWith("..."),d=p?u.slice(3):u,m=-1,g=0;for(let E=0;E<d.length;E++)if(d[E]==="<")g++;else if(d[E]===">")g--;else if(d[E]===":"&&g===0){m=E;break}if(m===-1)return l;let v=d.substring(0,m).trim().replace(/\?$/,""),S=d.substring(m+1),_=-1,x=0;for(let E=0;E<S.length;E++)if(S[E]==="<")x++;else if(S[E]===">")x--;else if(S[E]==="="&&x===0){_=E;break}let I=p?"...":"";if(_!==-1)return`${I}${v} = ${S.substring(_+1).trim()}`;return`${I}${v}`}).join(", ")}e=e.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(o,i,s)=>{if(!s.includes(":"))return o;return`${i}(${t(s)})`});{let o=/\b(function\s+\w*\s*)\(/g,i,s=[];while((i=o.exec(e))!==null){let r=i.index+i[0].length-1,a=1,c=r+1,l=0,u=null;while(c<e.length&&a>0){let m=e[c];if(u){if(m===u)u=null;c++;continue}if(m==='"'||m==="'"||m==="`"){u=m,c++;continue}if(m==="<")l++;else if(m===">"&&l>0)l--;else if(l===0){if(m==="(")a++;else if(m===")")a--}if(a>0)c++}if(a!==0)continue;let p=e.substring(r+1,c);if(!p.includes(":"))continue;let d=t(p);s.push({start:r+1,end:c,replacement:d})}for(let r=s.length-1;r>=0;r--){let{start:a,end:c,replacement:l}=s[r];e=e.substring(0,a)+l+e.substring(c)}}return e=e.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(o,i)=>{if(!i.includes(":"))return o;if(i.includes("{")||i.includes("}"))return o;return`(${i.split(",").map((s)=>{let[r,...a]=s.split("="),c=r.split(":")[0].trim();if(a.length>0)return`${c} = ${a.join("=").trim()}`;return c}).join(", ")}) =>`}),e=e.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),e=e.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),e=e.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),e=e.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),e=e.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),e=e.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),e=e.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),e=e.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),e=e.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),e=e.replace(/\n\s*\n\s*\n/g,`
|
|
17
|
-
|
|
18
|
-
`),e}function Qe(n){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(n)}function Ye(n){if(!/is not defined|can't find variable/i.test(n))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(n)}async function $t(n,e,t,o={}){if(!n.trim())return;let i;try{let f=new Bun.Transpiler({loader:"ts",target:"browser",define:le()}),h=n.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");h=h.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),i=f.transformSync(h)}catch{i=Ke(n)}let s={exports:{}},r=s.exports,a=W.cwd(),c={},l=[...i.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((f)=>f[1]).filter((f)=>!f.startsWith("node:")&&!f.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(f));for(let f of l)try{let h=T.resolve(a,"node_modules",f),b=T.join(h,"package.json"),y=JSON.parse(ne("fs").readFileSync(b,"utf8")),k=y.main||"index.js";if(y.exports){let A=typeof y.exports==="string"?y.exports:y.exports["."];if(typeof A==="string")k=A;else if(A?.bun)k=A.bun;else if(A?.import)k=A.import;else if(A?.default)k=A.default}c[f]=await import(T.resolve(h,k))}catch{}let u=(f)=>{if(c[f])return c[f];return ne(f)},p=e.props||{},d=(f)=>{if(!f)return p;let h={};for(let[b,y]of Object.entries(f)){let k=p[b];if(k!==void 0)h[b]=k;else if(typeof y==="function")h[b]=y();else h[b]=y}return h};for(let[f,h]of Object.entries(p))Object.defineProperty(d,f,{value:h,enumerable:!0,configurable:!0,writable:!0});for(let f of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(p,f))continue;try{Object.defineProperty(d,f,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let m=(f)=>{if(!f)return p;let h={...p};for(let[b,y]of Object.entries(f)){let k=y&&typeof y==="object"&&!Array.isArray(y)?y:{type:y};if(h[b]===void 0&&k.default!==void 0)h[b]=typeof k.default==="function"?k.default():k.default}return h},g=()=>e.slots||{},v=(f,h)=>{let b={...f};for(let[y,k]of Object.entries(h))if(b[y]===void 0)if(typeof k==="function")b[y]=k();else b[y]=k;return b},S=(f)=>{let h=()=>f;return h.set=(b)=>{},h.update=(b)=>{},h},_=(f)=>{let h,b=!1;return()=>{if(!b)try{h=f(),b=!0}catch{h=void 0}return h}},x=(f)=>{},I=(f)=>f(),E=(f)=>{},C=(f)=>{};function R(f){let h=f||{};if(h.title!==void 0||h.description!==void 0)V({title:h.title,description:h.description})}function N(f){if(!f||typeof f!=="object")return;let h=e.__stxClientPayload??{};Object.assign(h,f),e.__stxClientPayload=h}let D=()=>{let f=e.__stxServeContext,h=e.__stxServeSearch??f?.search??"",b=f?.path??"",y=Object.fromEntries(new URLSearchParams(h)),k=e.query,A=Object.keys(y).length>0?y:k??{},L=h||(Object.keys(A).length>0?`?${new URLSearchParams(A).toString()}`:"");return{params:e.params??{},query:A,path:b,name:"",fullPath:b+L,hash:"",matched:[]}},O=()=>({push:(f)=>{},replace:(f)=>{},back:()=>{},forward:()=>{},go:(f)=>{}}),z=(f)=>{let h=e.__stx_runtime_head||{};e.__stx_runtime_head=ue(h,f||{})},V=(f)=>{z(fe(f||{}))},ve=(f)=>({value:f}),be=(f)=>f,ye=(f)=>({value:typeof f==="function"?f():f}),xe=(f,h)=>{},we=(f)=>{},$e=(f)=>{},Se=(f)=>f?f():Promise.resolve(),ke=(f)=>(h,...b)=>{},_e=(f)=>{},Ee=(f,h)=>{},Ie=(f,h)=>h,Ae=()=>({value:"light"}),Ne=()=>S(!1),M=(f)=>S(!1),Re=()=>S(!1),Ce=()=>M("(prefers-color-scheme: dark)"),Te=()=>M("(prefers-color-scheme: light)"),Pe=()=>M("(prefers-reduced-motion: reduce)"),Oe=()=>M("(prefers-contrast: more)"),F={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},We=new Proxy(F,{get(f,h){if(h in f)return f[h];return},set(f,h,b){return f[h]=b,!0}}),De={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Me=console;try{let f=nt(i,t),h=new Set(Object.keys(p)),b=(w)=>/^[a-z_$][\w$]*$/i.test(w),y=Object.keys(e).filter((w)=>!h.has(w)&&w!=="props"&&b(w)),k=y.map((w)=>e[w]);if(!y.includes("__stxServeContext"))y.push("__stxServeContext"),k.push(void 0);let A=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),L=[],G=[];for(let[w,j]of Object.entries(p)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(w))continue;if(A.has(w))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${w}\\b`).test(f))continue;L.push(w),G.push(j)}let je=He(f).map((w)=>`module.exports.${w} = typeof ${w} !== 'undefined' ? ${w} : module.exports.${w};`).join(`
|
|
19
|
-
`),Fe=e.params??{},Z=[],X=[];for(let w=0;w<y.length;w++){if(y[w]==="params")continue;Z.push(y[w]),X.push(k[w])}let J=await Function(...he,...L,...Z,`return (async () => {
|
|
20
|
-
${f}
|
|
21
|
-
${je}
|
|
22
|
-
return module.exports
|
|
23
|
-
})()`)(s,r,u,p,d,m,v,N,S,_,x,I,E,C,R,D,O,z,V,ve,be,ye,xe,we,$e,Se,ke,_e,g,Ee,Ie,Ae,Ne,M,Re,Ce,Te,Pe,Oe,We,De,Me,F.confirm,F.alert,F.fetch,Fe,...G,...X);if(o.preserveExisting){for(let[w,j]of Object.entries(J))if(!(w in e)||e[w]===void 0)e[w]=j}else Object.assign(e,J);for(let[w,j]of Object.entries(p))if(!(w in e))e[w]=j}catch(f){let h=f instanceof Error?f.message:String(f);if(Qe(h))console.warn(`[stx] server <script> in ${t??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${h}`);else if(Ye(h))console.warn(`[stx] server <script> in ${t??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${h}`);else if(W.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${t??"<unknown>"} \u2014 falling back to static extraction. Cause: ${h}`);try{await ct(i,e,t)}catch(b){if(W.env.STX_DEBUG){let y=b instanceof Error?b.message:String(b);console.warn(`[stx] fallback extraction also failed in ${t??"<unknown>"}: ${y}`)}}}}function et(n){let e=0,t=null,o=!1,i=!1;for(let s=0;s<n.length;s++){let r=n[s];if(t){if(r===t){if(t=null,o||e===0)i=!0}continue}if(r==="'"||r==='"'||r==="`"){t=r;continue}if(r==="{")e++;else if(r==="}")e--;else if(n.startsWith("from",s)&&e===0)o=!0}return t===null&&e===0&&i}var tt=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function nt(n,e){let t=e?T.dirname(e):W.cwd(),o=W.cwd(),i=n.split(`
|
|
24
|
-
`),s=[],r=0;while(r<i.length){let a=i[r].trim();if(a.startsWith("interface ")||a.startsWith("export interface ")||a.startsWith("type ")||a.startsWith("export type ")){if(a.includes("{")&&!a.includes("}")){let c=0;for(;r<i.length;r++){for(let l of i[r])if(l==="{")c++;else if(l==="}")c--;if(c<=0)break}}r++;continue}if(a.startsWith("definePageMeta(")){let c=0,l=!1,u=r;for(let m=r;m<i.length&&!l;m++){let g=null,v=!1,S=i[m];for(let _=0;_<S.length;_++){let x=S[_];if(v){v=!1;continue}if(x==="\\"){v=!0;continue}if(g){if(x===g)g=null;continue}if(x==='"'||x==="'"||x==="`"){g=x;continue}if(x==="(")c++;else if(x===")"){if(c--,c===0){r=m+1,l=!0;break}}}}if(!l)r=i.length;let p=i.slice(u,r).join(`
|
|
25
|
-
`),d=[];for(let m of["title","description"]){let g=new RegExp(`\\b${m}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(p);if(g)d.push(`${m}: ${JSON.stringify(g[2])}`)}if(d.length>0)s.push(`useSeoMeta({ ${d.join(", ")} });`);continue}if(a.startsWith("import ")||a==="import"||a.startsWith("import{")){let c=a,l=0;while(!et(c)&&r+l+1<i.length)l++,c=`${c} ${i[r+l].trim()}`;r+=l;let u=c.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),p=c.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),d=c.match(/^import\s+['"](.+?)['"]/),m=c,g=(v)=>{if(v.startsWith("."))return T.resolve(t,v);if(v.startsWith("~/")||v.startsWith("@/"))return T.resolve(o,v.slice(2));return v};if(u){let[,v,S]=u,_=g(S);s.push(`const ${v} = (await import('${_}')).default`),s.push(`module.exports.${v} = ${v};`)}else if(p){let[,v,S]=p,_=g(S),x=[],I=[],E=Je.has(S);for(let C of v.split(",")){let R=C.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[D,O]=[N[0].trim(),N[1].trim()];if(E&&ie.has(D)){s.push(`const ${O} = ${D};`),I.push(O);continue}x.push(`${D}: ${O}`),I.push(O)}else{if(E&&ie.has(R)){I.push(R);continue}x.push(R),I.push(R)}}if(x.length>0)s.push(`const { ${x.join(", ")} } = await import('${_}')`);for(let C of I)s.push(`module.exports.${C} = ${C};`)}else if(d){let v=g(d[1]);s.push(`await import('${v}')`)}else s.push(m);r++;continue}if(tt.test(a))s.push(i[r]),r++;else if(a.startsWith("export const ")||a.startsWith("export let ")||a.startsWith("export var ")){let c=re(i,r),{type:l,name:u,value:p}=c;s.push(`${l} ${u} = ${p};`),s.push(`module.exports.${u} = ${u};`),r=c.nextIndex}else if(a.startsWith("export function ")||a.startsWith("export async function ")){let c=U(i,r);s.push(c.functionCode),s.push(`module.exports.${c.name} = ${c.name};`),r=c.nextIndex}else if(a.startsWith("const ")||a.startsWith("let ")||a.startsWith("var ")){let c=re(i,r),{type:l,name:u,value:p}=c;s.push(`${l} ${u} = ${p};`),s.push(`module.exports.${u} = ${u};`),r=c.nextIndex}else if(a.startsWith("function ")||a.startsWith("async function ")){let c=U(i,r);s.push(c.functionCode),s.push(`module.exports.${c.name} = ${c.name};`),r=c.nextIndex}else if(a.startsWith("export default function ")||a.startsWith("export default async function ")){let c=i[r].replace(/^(\s*)export\s+default\s+/,"$1"),l=[...i];l[r]=c;let u=U(l,r);if(s.push(u.functionCode),u.name)s.push(`module.exports.default = ${u.name};`);r=u.nextIndex}else if(a.startsWith("export default ")){let c=a.replace(/^export\s+default\s+/,"").replace(/;$/,"");s.push(`module.exports.default = ${c};`),r++}else if(a.startsWith("class ")||a.startsWith("export class ")){let c=a.match(/(?:export\s+)?class\s+(\w+)/);if(c){let l=c[1],u=i[r].replace(/^export\s+/,""),p=0,d=r;for(;d<i.length;d++){let m=i[d];for(let g of m)if(g==="{")p++;else if(g==="}")p--;if(d>r)u+=`
|
|
26
|
-
`+m;if(p<=0&&d>=r)break}s.push(u),s.push(`module.exports.${l} = ${l};`),r=d+1}else s.push(a),r++}else if(a.includes("module.exports"))s.push(a),r++;else if(a.trim()&&!a.startsWith("//"))s.push(a),r++;else r++}return it(s.join(`
|
|
27
|
-
`),t,o)}function it(n,e,t){let o=n.length,i="",s=0,r=null,a=!1,c=!1,l=0;while(s<o){let u=n[s],p=n[s+1];if(a){if(i+=u,u===`
|
|
28
|
-
`)a=!1;s++;continue}if(c){if(i+=u,u==="*"&&p==="/"){i+=p,s+=2,c=!1;continue}s++;continue}if(!r&&u==="/"&&p==="/"){a=!0,i+=u,s++;continue}if(!r&&u==="/"&&p==="*"){c=!0,i+=u,s++;continue}if(r){if(i+=u,u==="\\"){i+=p,s+=2;continue}if(u===r&&r!=="`"){r=null,s++;continue}if(r==="`"){if(u==="$"&&p==="{"){l++,i+=p,s+=2;continue}if(u==="`"){r=null,s++;continue}}s++;continue}if(l>0){if(u==="{")l++;else if(u==="}")l--}if(u==='"'||u==="'"||u==="`"){r=u,i+=u,s++;continue}if(u==="a"&&n.startsWith("await",s)){let d=st(n,s);if(d){let{quote:m,path:g,end:v}=d;if(g.startsWith(".")||g.startsWith("~/")||g.startsWith("@/")){let S=g.startsWith(".")?T.resolve(e,g):T.resolve(t,g.slice(2));i+=`await import(${m}${S}${m})`,s=v;continue}}}i+=u,s++}return i}function st(n,e){let t=e+5;if(t>=n.length)return null;if(!/\s/.test(n[t]))return null;while(t<n.length&&/\s/.test(n[t]))t++;if(!n.startsWith("import",t))return null;t+=6;while(t<n.length&&/\s/.test(n[t]))t++;if(n[t]!=="(")return null;t++;while(t<n.length&&/\s/.test(n[t]))t++;let o=n[t];if(o!=="'"&&o!=='"')return null;t++;let i=t;while(t<n.length&&n[t]!==o)if(n[t]==="\\")t+=2;else t++;if(t>=n.length)return null;let s=n.slice(i,t);t++;while(t<n.length&&/\s/.test(n[t]))t++;if(n[t]!==")")return null;return{quote:o,path:s,end:t+1}}function pe(n,e){let t=n[e];if(t!=="{"&&t!=="[")return null;let o=P(n,t,t==="{"?"}":"]",e);if(o===-1)return null;return{pattern:n.slice(e,o+1),endPos:o+1}}function de(n){let e=[],t=n.slice(1,-1).trim();if(!t)return e;let o=0,i=0,s="";while(o<t.length){let r=t[o];if(r==="{"||r==="["){let a=i===0?pe(t,o):null;if(a){e.push(...de(a.pattern)),o=a.endPos,s="";continue}i++}else if(r==="}"||r==="]")i--;if(i>0){o++;continue}if(r===","){if(s.trim())e.push(s.trim());s="",o++;continue}if(r===":"){s="",o++;continue}if(r==="="){if(s.trim())e.push(s.trim());s="",o++;while(o<t.length&&t[o]!==","&&i===0){if(t[o]==="{"||t[o]==="[")i++;else if(t[o]==="}"||t[o]==="]")i--;o++}continue}if(/[\w$]/.test(r))s+=r;o++}if(s.trim())e.push(s.trim());return e}function rt(n){let e=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(n);if(!e)return null;let t=e[0].length,o=(i)=>i===" "||i==="\t";while(t<n.length&&o(n[t]))t++;if(n[t]===":"){let i=0,s=null;t++;for(;t<n.length;t++){let r=n[t];if(s){if(r==="\\"){t++;continue}if(r===s)s=null;continue}if(r==="'"||r==='"'||r==="`"){s=r;continue}if(r==="("||r==="["||r==="{"||r==="<"){i++;continue}if(r===")"||r==="]"||r==="}"||r===">"){i--;continue}if(r==="="&&i<=0){let a=n[t+1],c=n[t-1];if(a!=="="&&a!==">"&&c!=="="&&c!=="!"&&c!=="<"&&c!==">")break}}if(n[t]!=="=")return null}while(t<n.length&&o(n[t]))t++;if(n[t]!=="=")return null;return{type:e[1],name:e[2],value:n.slice(t+1).trim()}}function se(n,e,t,o){let i=null,s=!1;for(let r of n){if(s){s=!1;continue}if(r==="\\"){s=!0;continue}if(i){if(r===i)i=null;continue}if(r==="'"||r==='"'||r==="`"){i=r;continue}if(r===e)o++;else if(r===t)o--}return o}function re(n,e){let t=n[e].trim(),o=rt(t),i=o?[t,o.type,o.name,o.value]:null;if(!i){let u=t.match(/^(?:export\s+)?(const|let|var)\s+/);if(u){let p=t.slice(u[0].length),d=e;if(p.startsWith("{")||p.startsWith("[")){let g=p[0],v=g==="{"?"}":"]",S=se(p,g,v,0),_=p;for(let x=e+1;x<n.length&&S>0;x++)_+=` ${n[x].trim()}`,d=x,S=se(n[x],g,v,S);if(S>0)_=p,d=e;p=_}let m=pe(p,0);if(m){let g=u[1],v=m.pattern,S=p.slice(m.endPos).trim();if(S.startsWith("=")){let _=S.slice(1).trim(),x=_,I=Math.max(d,e);if(oe(_)){let N=ae(n,I,_);x=N.value,I=N.nextIndex}else I=I+1;x=x.trim().replace(/;$/,"");let E=de(v),C=`__stx_src_${e}`,R=E.map((N)=>`module.exports.${N} = ${N};`).join(`
|
|
29
|
-
`);return{type:g,name:C,value:`${x}; ${g} ${v} = ${C};
|
|
30
|
-
${R}`,nextIndex:I}}}}throw Error(`Failed to parse variable declaration: ${t}`)}let[,s,r,a]=i,c=a,l=e;if(oe(a)){let u=ae(n,e,a);c=u.value,l=u.nextIndex}else l=e+1;while(l<n.length){let u=n[l].trim();if(u.startsWith(".")||u.startsWith("?."))c+=`
|
|
31
|
-
${n[l]}`,l++;else break}return c=c.trim().replace(/;$/,""),{type:s,name:r,value:c,nextIndex:l}}function U(n,e){let t=n[e].trim(),o=t.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!o)throw Error(`Failed to parse function declaration: ${t}`);let[,i]=o,s=t.replace(/^export\s+/,""),r=e;if(ot(t)){let a=at(n,e,s);s=a.functionCode,r=a.nextIndex}else r=e+1;return{name:i,functionCode:s,nextIndex:r}}function oe(n){let e=n.trim();if(e.startsWith("{"))return P(e,"{","}",0)===-1;if(e.startsWith("["))return P(e,"[","]",0)===-1;return!me(e)}function me(n){let e={paren:0,bracket:0,brace:0},t=null,o=0;for(let i=0;i<n.length;i++){let s=n[i];if((i>0?n[i-1]:"")==="\\"&&t)continue;if((s==='"'||s==="'")&&!t){t=s;continue}if(s===t&&t!=="`"){t=null;continue}if(s==="`"&&!t){t="`";continue}if(s==="`"&&t==="`"&&o===0){t=null;continue}if(t==="`"&&s==="$"&&n[i+1]==="{"){o++,i++;continue}if(o>0&&s==="{"){o++;continue}if(o>0&&s==="}"){o--;continue}if(t)continue;if(s==="(")e.paren++;else if(s===")")e.paren--;else if(s==="[")e.bracket++;else if(s==="]")e.bracket--;else if(s==="{")e.brace++;else if(s==="}")e.brace--}return e.paren===0&&e.bracket===0&&e.brace===0&&t===null}function ge(n){let e=n.indexOf("(");if(e===-1)return n.indexOf("{");let t=P(n,"(",")",e);if(t===-1)return-1;return n.indexOf("{",t)}function ot(n){let e=ge(n);if(e===-1)return!0;return P(n,"{","}",e)===-1}function ae(n,e,t){let o=t,i=e+1;while(i<n.length&&!me(o)){let s=n[i];o+=`
|
|
32
|
-
${s}`,i++}while(i<n.length){let s=n[i].trim();if(s.startsWith(".")||s.startsWith("?."))o+=`
|
|
33
|
-
${n[i]}`,i++;else break}return{value:o,nextIndex:i}}function at(n,e,t){let o=t,i=e+1;while(i<n.length){let s=ge(o);if(s!==-1){if(P(o,"{","}",s)!==-1)break}let r=n[i];o+=`
|
|
34
|
-
${r}`,i++}return{functionCode:o,nextIndex:i}}function ce(n,e){let t=B(n,e)??B(`(${n})`,e);if(t!==void 0)return t;if(!/\bprocess\b/.test(n))return;let o={...e,process:Object.freeze({env:{...W.env}})};try{return Function(...Object.keys(o),`'use strict'; return (${n});`)(...Object.values(o))}catch{try{return Function(...Object.keys(o),`'use strict'; return ${n};`)(...Object.values(o))}catch{return}}}async function ct(n,e,t){let o=n.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let s of o){let[,,r,a]=s;try{let c=a.trim().replace(/;$/,""),l=ce(c,e);if(l!==void 0)e[r]=l}catch(c){console.warn(`Failed to parse export ${r} in fallback:`,c)}}let i=n.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let s of i){let[,,r,a]=s;if(!(r in e))try{let c=a.trim().replace(/;$/,""),l=ce(c,e);if(l!==void 0)e[r]=l}catch{}}}function St(n){let e=n.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),t=e?e[1]:"",o=e?n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):n;return{scriptContent:t,templateWithoutScript:o}}function kt(n){let e=n.trim();if(!e)return!1;return/(?:const|let|var|function)\s+\w+/.test(e)}
|
|
35
|
-
export{ee as kn,B as ln,ht as mn,pt as nn,Xe as on,dt as pn,Le as qn,P as rn,lt as sn,ut as tn,he as un,Ke as vn,Qe as wn,Ye as xn,$t as yn,et as zn,nt as An,rt as Bn,St as Cn,kt as Dn};
|
package/dist/chunk-xg9xscqz.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
package/dist/chunk-xj9h6mc9.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{jm as a,km as b,lm as c,mm as d,nm as e,om as f,pm as g,qm as h,rm as i,sm as j,tm as k}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{d as convertSignalDirectivesToAttributes,f as convertSignalLoopsToAttributes,h as extractExports,j as findMarkupIndexOutsideScripts,c as hasSignalsSyntax,b as parseLoopExpression,e as preEvalLiteralReactiveIfs,g as processScriptSetup,i as processSignals,k as rewriteStxImportSpecifiers,a as scanScriptTags};
|