@stacksjs/stx 0.2.365 → 0.2.366
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-p8nasx5y.js → chunk-09xgdh4x.js} +1 -1
- package/dist/{chunk-346jyc33.js → chunk-09ypvk2t.js} +1 -1
- package/dist/{chunk-tfnq0cj6.js → chunk-0jp8bx88.js} +1 -1
- package/dist/{chunk-atf4tj9y.js → chunk-0vary9ym.js} +1 -1
- package/dist/{chunk-7ptewn2w.js → chunk-264fwxyv.js} +2 -2
- package/dist/{chunk-kmd694ky.js → chunk-2d737x81.js} +2 -2
- package/dist/{chunk-wkeymrkg.js → chunk-2hpey68b.js} +1 -1
- package/dist/{chunk-jerrq5k1.js → chunk-2wbs79rn.js} +1 -1
- package/dist/{chunk-0thch80p.js → chunk-34thbja9.js} +1 -1
- package/dist/{chunk-n5791wn3.js → chunk-3vctbh57.js} +1 -1
- package/dist/{chunk-p33qyhtc.js → chunk-53breaeh.js} +1 -1
- package/dist/{chunk-a47e67th.js → chunk-5gwf1fxm.js} +1 -1
- package/dist/{chunk-bh1m0x85.js → chunk-5yhbx6em.js} +1 -1
- package/dist/{chunk-8zdq8kk5.js → chunk-65nbdz3c.js} +1 -1
- package/dist/{chunk-g63sh9bx.js → chunk-8czscsf3.js} +1 -1
- package/dist/{chunk-k3ktx8w2.js → chunk-9n4wz4p2.js} +1 -1
- package/dist/{chunk-1nv116m3.js → chunk-b3yn2q9z.js} +1 -1
- package/dist/{chunk-1q2b0r3v.js → chunk-bxgq1ec0.js} +1 -1
- package/dist/{chunk-bszp4vx1.js → chunk-chnhccbg.js} +1 -1
- package/dist/{chunk-0t0b5yex.js → chunk-cvpr7j0a.js} +1 -1
- package/dist/{chunk-xr8ergcp.js → chunk-dvzxdyth.js} +1 -1
- package/dist/{chunk-7yyfbhna.js → chunk-e16evm88.js} +1 -1
- package/dist/{chunk-pbt7f5h9.js → chunk-e2wkw0mv.js} +1 -1
- package/dist/{chunk-2aqq5j7c.js → chunk-exve9vx9.js} +1 -1
- package/dist/{chunk-hyrm54da.js → chunk-g1wgckhg.js} +1 -1
- package/dist/{chunk-eczq4cxz.js → chunk-hd3g347d.js} +1 -1
- package/dist/{chunk-5qs1t2cd.js → chunk-hdpcrf2k.js} +1 -1
- package/dist/{chunk-4dzsp35z.js → chunk-ht2neybr.js} +1 -1
- package/dist/{chunk-czzy14fj.js → chunk-jf9mv5tq.js} +75 -32
- package/dist/{chunk-5t826ypq.js → chunk-jq1pddw6.js} +1 -1
- package/dist/{chunk-mks2cgty.js → chunk-jxc8ezvk.js} +1 -1
- package/dist/{chunk-q28ekhhb.js → chunk-k2sdmmmq.js} +2 -2
- package/dist/{chunk-6tk817fg.js → chunk-ksfnb7rd.js} +1 -1
- package/dist/{chunk-bxnx8sga.js → chunk-m883x1fp.js} +1 -1
- package/dist/{chunk-y3ns6824.js → chunk-nfmdrmgz.js} +1 -1
- package/dist/{chunk-d5r4zwyd.js → chunk-nhshe26k.js} +8 -8
- package/dist/{chunk-r8hr3jhh.js → chunk-r92073jh.js} +1 -1
- package/dist/{chunk-6njr31wk.js → chunk-rg473fqn.js} +1 -1
- package/dist/{chunk-11v2ysbe.js → chunk-t0bnbghk.js} +1 -1
- package/dist/{chunk-ry56srm9.js → chunk-t6928tnd.js} +1 -1
- package/dist/{chunk-ttw7qrz0.js → chunk-tc8yfmm5.js} +1 -1
- package/dist/{chunk-syy0njsk.js → chunk-v8ncfppj.js} +1 -1
- package/dist/{chunk-77g77ygz.js → chunk-vd3ja1q9.js} +1 -1
- package/dist/{chunk-zjqw2fde.js → chunk-vr3a5wma.js} +1 -1
- package/dist/{chunk-z274qgsn.js → chunk-wb2y68dk.js} +1 -1
- package/dist/{chunk-k10f0c00.js → chunk-y1twpva6.js} +1 -1
- package/dist/{chunk-r5dta1qf.js → chunk-y3gd1g9s.js} +16 -16
- package/dist/{chunk-v8ccphfs.js → chunk-y4j6br2e.js} +1 -1
- package/dist/{chunk-se8fh272.js → chunk-z541dzm4.js} +1 -1
- package/dist/{chunk-dk40tcv1.js → chunk-z9zayxg4.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/signals.js +75 -32
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
|
@@ -186,6 +186,46 @@ console.log('[stx] entering IIFE');
|
|
|
186
186
|
return fn;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
// The names an expression mentions, by its text.
|
|
190
|
+
const __stxIdentifiers = new Map();
|
|
191
|
+
function __stxNamesIn(body) {
|
|
192
|
+
let names = __stxIdentifiers.get(body);
|
|
193
|
+
if (!names) {
|
|
194
|
+
names = Array.from(new Set(body.match(/[A-Za-z_$][\\w$]*/g) || []));
|
|
195
|
+
if (__stxIdentifiers.size >= 5000) __stxIdentifiers.clear();
|
|
196
|
+
__stxIdentifiers.set(body, names);
|
|
197
|
+
}
|
|
198
|
+
return names;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Compile an expression over just the names in scope it mentions.
|
|
202
|
+
//
|
|
203
|
+
// It was compiled over every name in scope and called with every value,
|
|
204
|
+
// read through the auto-unwrap proxy. Reading a signal subscribes the
|
|
205
|
+
// running effect, so every binding depended on every signal on the page:
|
|
206
|
+
// changing one unrelated value re-ran every binding of every row. The proxy
|
|
207
|
+
// also tested each signal against the expression with fresh regexes. Now an
|
|
208
|
+
// expression sees, reads and subscribes to what it names; a mention inside
|
|
209
|
+
// a string only widens that, never narrows it.
|
|
210
|
+
function __stxCompileScoped(scope, extraParams, body) {
|
|
211
|
+
const keys = [];
|
|
212
|
+
const names = __stxNamesIn(body);
|
|
213
|
+
for (let i = 0; i < names.length; i++) {
|
|
214
|
+
if (Object.prototype.propertyIsEnumerable.call(scope, names[i])) keys.push(names[i]);
|
|
215
|
+
}
|
|
216
|
+
const fn = __stxCompile(extraParams.length ? keys.concat(extraParams) : keys, body);
|
|
217
|
+
// The cache keys on the parameter list, so a function always has these keys.
|
|
218
|
+
fn.__stxKeys = keys;
|
|
219
|
+
return fn;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function __stxArgs(fn, scope) {
|
|
223
|
+
const keys = fn.__stxKeys;
|
|
224
|
+
const args = new Array(keys.length);
|
|
225
|
+
for (let i = 0; i < keys.length; i++) args[i] = scope[keys[i]];
|
|
226
|
+
return args;
|
|
227
|
+
}
|
|
228
|
+
|
|
189
229
|
let activeEffect = null;
|
|
190
230
|
const effectStack = [];
|
|
191
231
|
const pendingEffects = new Set();
|
|
@@ -775,8 +815,8 @@ else {
|
|
|
775
815
|
// First evaluate the base expression
|
|
776
816
|
let value;
|
|
777
817
|
try {
|
|
778
|
-
const fn =
|
|
779
|
-
value = fn(...
|
|
818
|
+
const fn = __stxCompileScoped(scope, [], 'return ' + valueExpr);
|
|
819
|
+
value = fn(...__stxArgs(fn, scope));
|
|
780
820
|
}
|
|
781
821
|
catch (e) {
|
|
782
822
|
if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] Pipe base expression error:', valueExpr, e);
|
|
@@ -796,8 +836,8 @@ catch (e) {
|
|
|
796
836
|
if (/^['"].*['"]$/.test(arg)) return arg.slice(1, -1);
|
|
797
837
|
// Try to evaluate as expression in scope
|
|
798
838
|
try {
|
|
799
|
-
const fn =
|
|
800
|
-
return fn(...
|
|
839
|
+
const fn = __stxCompileScoped(scope, [], 'return ' + arg);
|
|
840
|
+
return fn(...__stxArgs(fn, scope));
|
|
801
841
|
}
|
|
802
842
|
catch (e) {
|
|
803
843
|
return arg;
|
|
@@ -2088,8 +2128,8 @@ finally {
|
|
|
2088
2128
|
|| expressionUsesSignalApi(expr, prop);
|
|
2089
2129
|
})
|
|
2090
2130
|
: baseScope;
|
|
2091
|
-
const fn =
|
|
2092
|
-
const result = fn(...
|
|
2131
|
+
const fn = __stxCompileScoped(baseScope, [], 'return ' + expr);
|
|
2132
|
+
const result = fn(...__stxArgs(fn, scope));
|
|
2093
2133
|
// Post-eval unwrap \u2014 see evalAttrExpr note for the reason.
|
|
2094
2134
|
return (result && typeof result === 'function' && (result._isSignal || result._isDerived)) ? result() : result;
|
|
2095
2135
|
}
|
|
@@ -2256,8 +2296,8 @@ catch (e) {
|
|
|
2256
2296
|
const v = scope[k];
|
|
2257
2297
|
handlerScope[k] = (v && typeof v === 'function' && v._isStxLoopItem) ? v() : v;
|
|
2258
2298
|
});
|
|
2259
|
-
const fn =
|
|
2260
|
-
fn(...
|
|
2299
|
+
const fn = __stxCompileScoped(handlerScope, ['$event'], expr);
|
|
2300
|
+
fn(...__stxArgs(fn, handlerScope), event);
|
|
2261
2301
|
}
|
|
2262
2302
|
catch (e) {
|
|
2263
2303
|
// Event handlers fire on user interaction, not reactive re-runs \u2014 there's no
|
|
@@ -2774,8 +2814,8 @@ catch (e) {
|
|
|
2774
2814
|
var memoExpr = el.getAttribute('data-stx-memo');
|
|
2775
2815
|
try {
|
|
2776
2816
|
var memoScope = { ...globalHelpers, ...scope, ...(findElementScope(el) || {}) };
|
|
2777
|
-
var memoFn =
|
|
2778
|
-
var memoVals = JSON.stringify(memoFn(...
|
|
2817
|
+
var memoFn = __stxCompileScoped(memoScope, [], 'return ' + memoExpr);
|
|
2818
|
+
var memoVals = JSON.stringify(memoFn(...__stxArgs(memoFn, memoScope)));
|
|
2779
2819
|
if (el.__stx_memo_prev === memoVals) {
|
|
2780
2820
|
return; // Dependencies unchanged \u2014 skip re-processing
|
|
2781
2821
|
}
|
|
@@ -2827,8 +2867,8 @@ catch (e) {
|
|
|
2827
2867
|
else {
|
|
2828
2868
|
// Use auto-unwrap proxy (Feature #1)
|
|
2829
2869
|
const unwrapScope = createExpressionAutoUnwrapProxy(capturedScope, expr);
|
|
2830
|
-
const fn =
|
|
2831
|
-
bindingNode.textContent = fn(...
|
|
2870
|
+
const fn = __stxCompileScoped(capturedScope, [], 'return ' + expr);
|
|
2871
|
+
bindingNode.textContent = fn(...__stxArgs(fn, unwrapScope));
|
|
2832
2872
|
}
|
|
2833
2873
|
}
|
|
2834
2874
|
catch (e) {
|
|
@@ -2836,8 +2876,8 @@ catch (e) {
|
|
|
2836
2876
|
// because it converts the signal to its value before the expression runs.
|
|
2837
2877
|
// Retry without auto-unwrap so signal functions remain callable.
|
|
2838
2878
|
try {
|
|
2839
|
-
const fn =
|
|
2840
|
-
bindingNode.textContent = fn(...
|
|
2879
|
+
const fn = __stxCompileScoped(capturedScope, [], 'return ' + expr);
|
|
2880
|
+
bindingNode.textContent = fn(...__stxArgs(fn, capturedScope));
|
|
2841
2881
|
}
|
|
2842
2882
|
catch (e2) {
|
|
2843
2883
|
if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Expression error:', expr, e2);
|
|
@@ -3302,8 +3342,8 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
|
|
|
3302
3342
|
var fn3 = __stxCompile(['__s', '$event'], unwrapVars + ';' + value);
|
|
3303
3343
|
fn3(eventCapturedScope, handlerEvent);
|
|
3304
3344
|
} else {
|
|
3305
|
-
var fn =
|
|
3306
|
-
fn(...
|
|
3345
|
+
var fn = __stxCompileScoped(eventCapturedScope, ['$event'], value);
|
|
3346
|
+
fn(...__stxArgs(fn, eventCapturedScope), handlerEvent);
|
|
3307
3347
|
}
|
|
3308
3348
|
}
|
|
3309
3349
|
catch (e) {
|
|
@@ -3428,14 +3468,14 @@ catch (e) {
|
|
|
3428
3468
|
var value;
|
|
3429
3469
|
try {
|
|
3430
3470
|
var unwrapScope = createExpressionAutoUnwrapProxy(capturedScope, expr);
|
|
3431
|
-
var fn =
|
|
3432
|
-
value = fn(...
|
|
3471
|
+
var fn = __stxCompileScoped(capturedScope, [], 'return ' + expr);
|
|
3472
|
+
value = fn(...__stxArgs(fn, unwrapScope));
|
|
3433
3473
|
} catch (e1) {
|
|
3434
3474
|
// Retry without unwrapping \u2014 handles edge cases where the proxy
|
|
3435
3475
|
// interferes with certain expression patterns
|
|
3436
3476
|
try {
|
|
3437
|
-
var fn2 =
|
|
3438
|
-
value = fn2(...
|
|
3477
|
+
var fn2 = __stxCompileScoped(capturedScope, [], 'return ' + expr);
|
|
3478
|
+
value = fn2(...__stxArgs(fn2, capturedScope));
|
|
3439
3479
|
} catch (e2) {
|
|
3440
3480
|
// Suppress ReferenceError/TypeError during async init \u2014 a signal
|
|
3441
3481
|
// or object may not be ready yet on the first effect run, and
|
|
@@ -3618,8 +3658,11 @@ else {
|
|
|
3618
3658
|
const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };
|
|
3619
3659
|
const keys = Object.keys(capturedScope);
|
|
3620
3660
|
|
|
3621
|
-
// Pre-compile \u2014
|
|
3622
|
-
|
|
3661
|
+
// Pre-compile \u2014 only the names the expression mentions (see
|
|
3662
|
+
// __stxCompileScoped: reading every signal subscribed the class binding to
|
|
3663
|
+
// every signal on the page), and only valid JS identifiers.
|
|
3664
|
+
const mentioned = new Set(__stxNamesIn(expr));
|
|
3665
|
+
const safeKeys = keys.filter(k => mentioned.has(k) && /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(k));
|
|
3623
3666
|
let fn;
|
|
3624
3667
|
try {
|
|
3625
3668
|
fn = __stxCompile(safeKeys, 'return ' + expr);
|
|
@@ -3691,13 +3734,13 @@ else {
|
|
|
3691
3734
|
// throw TypeError.
|
|
3692
3735
|
try {
|
|
3693
3736
|
const unwrapScope = createExpressionAutoUnwrapProxy(capturedScope, expr);
|
|
3694
|
-
const fn =
|
|
3695
|
-
return fn(...
|
|
3737
|
+
const fn = __stxCompileScoped(capturedScope, [], 'return ' + expr);
|
|
3738
|
+
return fn(...__stxArgs(fn, unwrapScope));
|
|
3696
3739
|
}
|
|
3697
3740
|
catch (e1) {
|
|
3698
3741
|
try {
|
|
3699
|
-
const fn2 =
|
|
3700
|
-
return fn2(...
|
|
3742
|
+
const fn2 = __stxCompileScoped(capturedScope, [], 'return ' + expr);
|
|
3743
|
+
return fn2(...__stxArgs(fn2, capturedScope));
|
|
3701
3744
|
}
|
|
3702
3745
|
catch (e2) {
|
|
3703
3746
|
if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Style expression error:', expr, e2);
|
|
@@ -4182,8 +4225,8 @@ else {
|
|
|
4182
4225
|
return expressionCallsSignal(expression, prop)
|
|
4183
4226
|
|| expressionUsesSignalApi(expression, prop);
|
|
4184
4227
|
});
|
|
4185
|
-
const fn =
|
|
4186
|
-
return fn(...
|
|
4228
|
+
const fn = __stxCompileScoped(scope, [], 'return ' + expression);
|
|
4229
|
+
return fn(...__stxArgs(fn, unwrapScope));
|
|
4187
4230
|
}
|
|
4188
4231
|
catch (e) {
|
|
4189
4232
|
if (!(e instanceof ReferenceError) && !(e instanceof TypeError)) console.warn('[STX] Expression error:', expression, e);
|
|
@@ -8272,8 +8315,8 @@ else {
|
|
|
8272
8315
|
if (matches) {
|
|
8273
8316
|
matches.forEach(match => {
|
|
8274
8317
|
const expr = match.replace(/^\\{\\{\\s*|\\s*\\}\\}$/g, '');
|
|
8275
|
-
const fn =
|
|
8276
|
-
const value = fn(...
|
|
8318
|
+
const fn = __stxCompileScoped(componentScope, [], 'return ' + expr);
|
|
8319
|
+
const value = fn(...__stxArgs(fn, componentScope));
|
|
8277
8320
|
result = result.replace(match, value != null ? value : '');
|
|
8278
8321
|
});
|
|
8279
8322
|
}
|
|
@@ -8299,8 +8342,8 @@ else if (el.tagName === 'META') {
|
|
|
8299
8342
|
matches.forEach(match => {
|
|
8300
8343
|
const expr = match.replace(/^\\{\\{\\s*|\\s*\\}\\}$/g, '');
|
|
8301
8344
|
if (/^__[A-Z_]+__$/.test(expr.trim())) return;
|
|
8302
|
-
const fn =
|
|
8303
|
-
const value = fn(...
|
|
8345
|
+
const fn = __stxCompileScoped(componentScope, [], 'return ' + expr);
|
|
8346
|
+
const value = fn(...__stxArgs(fn, componentScope));
|
|
8304
8347
|
result = result.replace(match, value != null ? value : '');
|
|
8305
8348
|
});
|
|
8306
8349
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{go as b,ho as c,io as d}from"./chunk-
|
|
2
|
+
import{go as b,ho as c,io as d}from"./chunk-y3gd1g9s.js";import"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import"./chunk-y4j6br2e.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-rg473fqn.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import{rv as a}from"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import"./chunk-m8kem5ca.js";export{b as rendersAsElement,c as processESImports,d as processComponents,a as freeIdentifiers};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{bm as x,fq as M}from"./chunk-
|
|
2
|
+
import{bm as x,fq as M}from"./chunk-y3gd1g9s.js";import"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import{Ks as B,Ms as P}from"./chunk-y4j6br2e.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-rg473fqn.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import"./chunk-m8kem5ca.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${A.transformSync(j).trim()}`);for(let $ of I)C.add($)}catch($){console.warn(`[stx] framework composable ${G.basename(q)} could not be bundled:`,$)}}let Y=Q.filter((q)=>!C.has(q)&&!g(H,q));if(Y.length>0)console.warn(`[stx] could not bundle ${Y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return K.set(z,""),null;let k=[...C].map((q)=>` try { if (!(${JSON.stringify(q)} in __s)) { __s[${JSON.stringify(q)}] = ${q}; if (!(${JSON.stringify(q)} in window)) window[${JSON.stringify(q)}] = ${q}; } } catch (e) {}`).join(`
|
|
4
4
|
`),w=`<script data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$m as l,Cm as P,Co as i,Ep as h,Io as T,Km as k,_m as c,sm as R,tm as O}from"./chunk-
|
|
2
|
+
import{$m as l,Cm as P,Co as i,Ep as h,Io as T,Km as k,_m as c,sm as R,tm as O}from"./chunk-y3gd1g9s.js";import{Ps as S,Rs as y}from"./chunk-y4j6br2e.js";import{Lu as m}from"./chunk-met6wtbk.js";import{Ew as YJ,Hw as ZJ,Iw as $J}from"./chunk-e03m4har.js";import{Pw as XJ,Sw as q}from"./chunk-m8kem5ca.js";var r=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function s(J,Y,Q){let X={fullTag:Q,content:Y,attrs:J};if(/\bserver\b/.test(J))return{...X,type:"server"};if(/\bdata-stx-scoped\b/.test(J))return{...X,type:"client"};if(r.test(Y))return{...X,type:"signals"};if(/\bclient\b/.test(J)||/\btype\s*=\s*["']module["']/.test(J)||/\bsrc\s*=/.test(J))return{...X,type:"client"};return{...X,type:"server"}}var o=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function C(J){let Y=[],Q=[],X=[],$=0;while($<J.length){let Z=J.indexOf("<",$);if(Z===-1)break;let U=y(J,Z);if(U>Z){$=U;continue}let W=S(J,Z);if(W>Z){let j=J.slice(Z,W),F=o.exec(j);if(F){let K=s(F[1],F[2],j);switch(K.type){case"signals":Y.push(K);break;case"client":Q.push(K);break;case"server":X.push(K);break}}$=W;continue}$=Z+(J.startsWith("<!--",Z)?4:1)}return{signals:Y,client:Q,server:X}}var a=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function t(J){let Y=[],Q=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Q.exec(J))!==null)Y.push({start:X.index,end:X.index+X[0].length});return Y}function v(J,Y){return Y.some((Q)=>J>=Q.start&&J<Q.end)}function e(J){let Y=(J||"").trim();if(!Y)return null;if(/[\s>+~,:]/.test(Y))return null;let Q={},X=Y,$=X.match(/^[a-z][\w-]*/i);if($)Q.tag=$[0].toLowerCase(),X=X.slice($[0].length);while(X.length>0){let Z=X.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(Z){if(Q.attr=Z[1],Z[3]!==void 0&&Z[3]!=="")Q.attrValue=Z[3];X=X.slice(Z[0].length);continue}let U=X.match(/^#([\w-]+)/);if(U){Q.id=U[1],X=X.slice(U[0].length);continue}let W=X.match(/^\.([\w-]+)/);if(W){Q.className=W[1],X=X.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function JJ(J,Y){if(Y.attr){if(!(Y.attrValue===void 0?new RegExp(`\\b${Y.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${Y.attr}\\s*=\\s*(["'])\\s*${Y.attrValue}\\s*\\1`,"i")).test(J))return!1}if(Y.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${Y.id}\\s*\\1`,"i").test(J))return!1}if(Y.className){let Q=J.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(Y.className))return!1}return!0}function x(J,Y="main"){let Q=e(Y);if(!Q)return null;let X=/<([a-z][\w-]*)\b([^>]*)>/gi,$=t(J),Z;while((Z=X.exec(J))!==null){if(v(Z.index,$))continue;let U=Z[1].toLowerCase(),W=Z[2]||"";if(W.trimEnd().endsWith("/")||a.has(U))continue;if(Q.tag&&Q.tag!==U)continue;if(!JJ(W,Q))continue;let j=Z[0],F=Z.index+j.length,K=new RegExp(`<(/?)${U}\\b([^>]*)>`,"gi");K.lastIndex=F;let G=1,B;while((B=K.exec(J))!==null){if(v(B.index,$))continue;let w=B[1]==="/";if(!w&&(B[2]||"").trimEnd().endsWith("/"))continue;if(G+=w?-1:1,G===0)return{openTag:j,openIndex:Z.index,start:F,end:B.index,tagName:U}}return null}return null}var NJ="X-STX-Router",_J="private, no-store";function AJ(J){return J.replace(/&#(\d+);/g,(Y,Q)=>f(Number(Q),Y)).replace(/&#x([0-9a-f]+);/gi,(Y,Q)=>f(Number.parseInt(Q,16),Y)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function f(J,Y){if(!Number.isInteger(J)||J<0||J>1114111)return Y;try{return String.fromCodePoint(J)}catch{return Y}}function g(J){return J.headers.get("X-STX-Router")==="true"}function QJ(J,Y){if(!J)return Y;return J.split(",").some((X)=>X.trim().toLowerCase()===Y.toLowerCase())?J:`${J}, ${Y}`}function IJ(J){return{Vary:QJ(J,"X-STX-Router")}}import E from"path";YJ();var UJ="stx-page-head:",WJ=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,D={dev:null,prod:null};function jJ(){let J=m()?"dev":"prod",Y=D[J];if(Y!==null)return Y;try{let Q=($J(),XJ(ZJ)),X=J==="dev"&&typeof Q.getRouterScriptDev==="function"?Q.getRouterScriptDev:Q.getRouterScript;D[J]=`<script>${X()}</script>`}catch{D[J]=""}return D[J]}async function RJ(J,Y){if(Y===!1)return null;if(Y&&typeof Y==="string"){let X=E.resolve(J,Y);if(await Bun.file(X).exists())return X;return null}let Q=E.join(J,"app.stx");if(await Bun.file(Q).exists())return Q;return null}async function PJ(J,Y){try{let Q=await Bun.file(J).text(),X=Q,$=Q.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)X=$[1].trim();let Z=C(Q),U=[...Z.client.map((V)=>V.fullTag),...Z.signals.map((V)=>V.fullTag)],W=[],j=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,F;while((F=j.exec(Q))!==null)W.push(F[0]);let K=X;for(let V of Z.server)K=K.replace(V.fullTag,"");for(let V of Z.client)K=K.replace(V.fullTag,"");K=K.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let G="<!--__STX_PAGE_SLOT__-->";if(K=K.replace(/<slot\s*\/>/gi,G).replace(/<slot\s*>\s*<\/slot>/gi,G),!K.includes(G))return console.warn(`[stx] Shell ${J} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:B,extractVariables:w,defaultConfig:N,loadStxConfig:A}=await import("./chunk-09xgdh4x.js"),I=await A(),z={__filename:J,__dirname:E.dirname(J)};for(let V of U){let L=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(L&&!V.includes("client")&&!V.includes('type="module"'))await w(L[1],z,J)}let _=await B(K,z,J,{...N,...I,...Y},new Set),H=_.indexOf(G);if(H===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:_.substring(0,H),afterSlot:_.substring(H+G.length),filePath:J,shellScripts:U,shellStyles:W}}catch(Q){return console.error(`[stx] Error processing shell ${J}:`,Q),null}}function kJ(J,Y,Q){let X,$="",Z=Y.match(WJ);if(Z){Y=Y.replace(Z[0],"");try{let K=Buffer.from(Z[1],"base64").toString("utf8"),G=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(G)X=G[1].trim();$=K.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let U=Q||X||"stx App",W=jJ(),j="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -26,5 +26,5 @@ ${W}
|
|
|
26
26
|
`));if($.length>0)N.push($.join(`
|
|
27
27
|
`));if(G.length>0)N.push(G.join(`
|
|
28
28
|
`));return N.push(K),N.join(`
|
|
29
|
-
`)}import M from"fs";import p from"path";function fJ(J,Y,Q){return{version:1,buildTime:new Date().toISOString(),routes:J,assets:Y,outputDir:Q}}function gJ(J,Y){let Q=p.join(Y,"manifest.json");M.writeFileSync(Q,JSON.stringify(J,null,2))}function uJ(J){let Y=p.join(J,"manifest.json");if(!M.existsSync(Y))return null;try{let Q=M.readFileSync(Y,"utf-8"),X=JSON.parse(Q);if(X.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${X.version}`),null;return X}catch(Q){return console.warn("[stx] Failed to load manifest:",Q),null}}function b(J,Y,Q={}){let X=`${encodeURIComponent(J)}=${encodeURIComponent(Y)}`;if(Q.maxAge!==void 0)X+=`; Max-Age=${Q.maxAge}`;if(Q.expires)X+=`; Expires=${Q.expires.toUTCString()}`;if(Q.path)X+=`; Path=${Q.path}`;if(Q.domain)X+=`; Domain=${Q.domain}`;if(Q.secure)X+="; Secure";if(Q.httpOnly)X+="; HttpOnly";if(Q.sameSite)X+=`; SameSite=${Q.sameSite}`;return X}async function FJ(J){let Y=J.headers.get("content-type")||"",Q={},X=($,Z)=>{let U=Q[$];if(U===void 0)Q[$]=Z;else if(Array.isArray(U))U.push(Z);else Q[$]=[U,Z]};if(Y.includes("multipart/form-data")){let $=await J.formData();for(let[Z,U]of $.entries())if(typeof U==="string")X(Z,U);return Q}if(Y.includes("application/x-www-form-urlencoded")){for(let[$,Z]of new URLSearchParams(await J.text()).entries())X($,Z);return Q}return Q}function GJ(J){if(!J)return!1;let Y=J.toUpperCase();return Y!=="GET"&&Y!=="HEAD"}async function d(J,Y={}){let Q=Y.request,X=Y.method??Q?.method;if(!Q||!GJ(X))return{ran:!1};if(typeof J.action!=="function")return{ran:!1};let $={};try{$=await FJ(Q)}catch{}let Z=await J.action({request:Q,form:$,params:Y.params??{},query:J.query??{},cookies:Y.cookies??{}});if(Z&&typeof Z==="object"){let U=Z,W=zJ(U.cookies),j=U.redirect;if(typeof j==="string"&&j)return{redirect:j,ran:!0,...W.length>0?{cookies:W}:{}};let{cookies:F,redirect:K,...G}=U;if(Object.assign(J,G),W.length>0)return{ran:!0,cookies:W}}return{ran:!0}}function zJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return[];let Y=[];for(let[Q,X]of Object.entries(J)){if(!Q)continue;if(typeof X==="string"){Y.push(b(Q,X));continue}if(X&&typeof X==="object"){let $=X;if(typeof $.value!=="string")continue;Y.push(b(Q,$.value,$))}}return Y}function dJ(J,Y=[],Q){let X=new Headers({Location:J,"Cache-Control":"no-store"});for(let $ of Y)X.append("Set-Cookie",$);for(let[$,Z]of Object.entries(Q??{}))if($.toLowerCase()!=="location")X.set($,Z);return new Response(null,{status:303,headers:X})}async function aJ(J,Y={}){return(await n(J,Y)).html}async function tJ(J,Y={}){let{html:Q,context:X,redirect:$,cookies:Z}=await n(J,Y),U=c(X),W=l(X);if($)return{html:Q,redirect:$,cookies:Z,status:U,headers:W};let{extractStreamBoundaries:j}=await import("./chunk-
|
|
29
|
+
`)}import M from"fs";import p from"path";function fJ(J,Y,Q){return{version:1,buildTime:new Date().toISOString(),routes:J,assets:Y,outputDir:Q}}function gJ(J,Y){let Q=p.join(Y,"manifest.json");M.writeFileSync(Q,JSON.stringify(J,null,2))}function uJ(J){let Y=p.join(J,"manifest.json");if(!M.existsSync(Y))return null;try{let Q=M.readFileSync(Y,"utf-8"),X=JSON.parse(Q);if(X.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${X.version}`),null;return X}catch(Q){return console.warn("[stx] Failed to load manifest:",Q),null}}function b(J,Y,Q={}){let X=`${encodeURIComponent(J)}=${encodeURIComponent(Y)}`;if(Q.maxAge!==void 0)X+=`; Max-Age=${Q.maxAge}`;if(Q.expires)X+=`; Expires=${Q.expires.toUTCString()}`;if(Q.path)X+=`; Path=${Q.path}`;if(Q.domain)X+=`; Domain=${Q.domain}`;if(Q.secure)X+="; Secure";if(Q.httpOnly)X+="; HttpOnly";if(Q.sameSite)X+=`; SameSite=${Q.sameSite}`;return X}async function FJ(J){let Y=J.headers.get("content-type")||"",Q={},X=($,Z)=>{let U=Q[$];if(U===void 0)Q[$]=Z;else if(Array.isArray(U))U.push(Z);else Q[$]=[U,Z]};if(Y.includes("multipart/form-data")){let $=await J.formData();for(let[Z,U]of $.entries())if(typeof U==="string")X(Z,U);return Q}if(Y.includes("application/x-www-form-urlencoded")){for(let[$,Z]of new URLSearchParams(await J.text()).entries())X($,Z);return Q}return Q}function GJ(J){if(!J)return!1;let Y=J.toUpperCase();return Y!=="GET"&&Y!=="HEAD"}async function d(J,Y={}){let Q=Y.request,X=Y.method??Q?.method;if(!Q||!GJ(X))return{ran:!1};if(typeof J.action!=="function")return{ran:!1};let $={};try{$=await FJ(Q)}catch{}let Z=await J.action({request:Q,form:$,params:Y.params??{},query:J.query??{},cookies:Y.cookies??{}});if(Z&&typeof Z==="object"){let U=Z,W=zJ(U.cookies),j=U.redirect;if(typeof j==="string"&&j)return{redirect:j,ran:!0,...W.length>0?{cookies:W}:{}};let{cookies:F,redirect:K,...G}=U;if(Object.assign(J,G),W.length>0)return{ran:!0,cookies:W}}return{ran:!0}}function zJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return[];let Y=[];for(let[Q,X]of Object.entries(J)){if(!Q)continue;if(typeof X==="string"){Y.push(b(Q,X));continue}if(X&&typeof X==="object"){let $=X;if(typeof $.value!=="string")continue;Y.push(b(Q,$.value,$))}}return Y}function dJ(J,Y=[],Q){let X=new Headers({Location:J,"Cache-Control":"no-store"});for(let $ of Y)X.append("Set-Cookie",$);for(let[$,Z]of Object.entries(Q??{}))if($.toLowerCase()!=="location")X.set($,Z);return new Response(null,{status:303,headers:X})}async function aJ(J,Y={}){return(await n(J,Y)).html}async function tJ(J,Y={}){let{html:Q,context:X,redirect:$,cookies:Z}=await n(J,Y),U=c(X),W=l(X);if($)return{html:Q,redirect:$,cookies:Z,status:U,headers:W};let{extractStreamBoundaries:j}=await import("./chunk-v8ncfppj.js"),F=j(X),K=J.streamTemplates;if(K&&Object.keys(K).length>0){let{processDirectives:G}=await import("./chunk-9n4wz4p2.js"),{defaultConfig:B}=await import("./chunk-5gwf1fxm.js"),w=X.streamBoundaries||{},N={...B,autoShell:!1},A=Object.keys(K).map((z)=>({id:z,render:async()=>{let _=typeof w[z]==="function"?await w[z]():void 0;return G(K[z],{...X,$boundary:_},J.sourceFile,N,new Set)}})),I=new Set(A.map((z)=>z.id));F=[...(F||[]).filter((z)=>!I.has(z.id)),...A]}return{html:Q,boundaries:F&&F.length>0?F:void 0,cookies:Z,status:U,headers:W}}async function n(J,Y){let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...Y};if(!J.hasServerScripts&&!O(J.html))return{html:J.html,context:Q};for(let U of J.serverScriptContent)try{await T(U,Q,J.sourceFile)}catch(W){if(Y.__stx_strict_hydration)throw W;console.warn(`[stx] Server script error in ${J.sourceFile}:`,W)}let X=await d(Q,{request:Y.request,method:Y.method,params:Y.params??{},cookies:Y.cookies??{}}),$=(U)=>{let W=U.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),j=i(Q);if(!j)return W;let F=W.indexOf("</head>");return F<0?j+W:W.slice(0,F)+j+W.slice(F)};if(X.redirect)return{html:J.html,context:Q,redirect:X.redirect,cookies:X.cookies};if(!O(J.html))return{html:$(J.html),context:Q,cookies:X.cookies};let Z=new Map;for(let[U,W]of Object.entries(J.placeholders))if(W.expression)try{let j=k(W.expression,Q);if(W.type==="raw")Z.set(U,j!==void 0&&j!==null?String(j):"");else Z.set(U,j!==void 0&&j!==null?P(String(j)):"")}catch(j){if(Y.__stx_strict_hydration)throw j;Z.set(U,"")}return{html:$(R(J.html,Z)),context:Q,cookies:X.cookies}}async function eJ(J,Y={}){if(!J.hasServerScripts&&!O(J.fragment))return J.fragment;let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...Y};for(let $ of J.serverScriptContent)try{await T($,Q,J.sourceFile)}catch(Z){console.warn(`[stx] Server script error in ${J.sourceFile}:`,Z)}if(!O(J.fragment))return J.fragment;let X=new Map;for(let[$,Z]of Object.entries(J.placeholders))if(Z.expression)try{let U=k(Z.expression,Q);if(Z.type==="raw")X.set($,U!==void 0&&U!==null?String(U):"");else X.set($,U!==void 0&&U!==null?P(String(U)):"")}catch{X.set($,"")}return R(J.fragment,X)}
|
|
30
30
|
export{s as Yf,C as Zf,e as _f,x as $f,NJ as ag,_J as bg,AJ as cg,g as dg,QJ as eg,IJ as fg,RJ as gg,PJ as hg,kJ as ig,KJ as jg,TJ as kg,SJ as lg,fJ as mg,gJ as ng,uJ as og,b as pg,FJ as qg,GJ as rg,d as sg,dJ as tg,aJ as ug,tJ as vg,eJ as wg};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Kj as b,Lj as c,Mj as d,Nj as e,Oj as f,Pj as g,Qj as h,Rj as i,Sj as j,Tj as k,Uj as l,Vj as m,Wj as n,Xj as o}from"./chunk-
|
|
2
|
+
import{Kj as b,Lj as c,Mj as d,Nj as e,Oj as f,Pj as g,Qj as h,Rj as i,Sj as j,Tj as k,Uj as l,Vj as m,Wj as n,Xj as o}from"./chunk-2wbs79rn.js";import{ul as a}from"./chunk-qjvny3wf.js";import"./chunk-y3gd1g9s.js";import"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import"./chunk-y4j6br2e.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-rg473fqn.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import"./chunk-m8kem5ca.js";export{b as templateCache,j as registerServeModuleBundle,c as readFileCached,e as invalidateFileCacheByDir,d as invalidateFileCache,o as hashFilePath,k as getServeModuleBundle,i as getServeClientAsset,g as getCachedSignalsRuntime,h as getCachedRouterScript,l as clearDevCaches,m as checkCache,n as cacheTemplate,a as cacheEngineFingerprint,f as __setSignalsGeneratorsForTest};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bm as b}from"./chunk-
|
|
2
|
+
import{Bm as b}from"./chunk-y3gd1g9s.js";import{pv as L,tv as R}from"./chunk-met6wtbk.js";function P(j,U){let Q=1,J=U,B="<template",z="</template";while(J<j.length&&Q>0){let G=j.indexOf("<",J);if(G===-1)break;if(J=G,j.startsWith(B,J)&&(J+B.length>=j.length||/[\s>\/]/.test(j[J+B.length]))){Q++,J+=B.length;continue}if(j.startsWith(z,J)){let W=j.indexOf(">",J+z.length);if(W!==-1){if(Q--,Q===0)return W+1;J=W+1;continue}}J++}return Q===0?J:-1}var F=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function O(j,U){let Q=null;for(let J=U;J<j.length;J++){let B=j[J];if(Q){if(B==="\\"){J++;continue}if(B===Q)Q=null;continue}if(B==='"'||B==="'"){Q=B;continue}if(B===">")return J+1}return-1}function I(j,U,Q){let J=U.toLowerCase(),B=1,z=Q;while(z<j.length){let G=j.indexOf("<",z);if(G===-1)return-1;if(j.startsWith("<!--",G)){let $=j.indexOf("-->",G+4);z=$===-1?j.length:$+3;continue}let W=O(j,G+1);if(W===-1)return-1;let Z=j.slice(G,W),Y=Z.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(Y&&Y[2].toLowerCase()===J){if(Y[1]==="/"){if(B--,B===0)return W}else if(!/\/\s*>$/.test(Z))B++}z=W}return-1}function w(j){let U=[],Q=[],J=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,B=0;while(B<j.length){let z=j.indexOf("<",B);if(z===-1)break;if(j.startsWith("<!--",z)){let X=j.indexOf("-->",z+4);B=X===-1?j.length:X+3;continue}let G=O(j,z+1);if(G===-1)break;let W=j.slice(z,G),Z=W.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Z){B=G;continue}let Y=Z[2].toLowerCase();if(Z[1]==="/"){let X=Q.lastIndexOf(Y);if(X!==-1)Q.splice(X);B=G;continue}let $=/\/\s*>$/.test(W),K=Q.length===0?W.match(J):null;if(K){let X=K[1]||K[2],H=W.replace(J,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),_=$||F.has(Y)?-1:I(j,Y,G);if(_===-1)U.push({start:z,end:G,slotName:X,element:H}),B=G;else U.push({start:z,end:_,slotName:X,element:H+j.slice(G,_)}),B=_;continue}if(!$&&!F.has(Y)){if(Q.push(Y),Y==="script"||Y==="style"){let X=j.toLowerCase().indexOf(`</${Y}>`,G);if(X!==-1){B=X;continue}}}B=G}return U}function D(j){let U=[],Q=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,B=0;while(B<j.length){let z=j.indexOf("<",B);if(z===-1)break;if(j.startsWith("<!--",z)){let X=j.indexOf("-->",z+4);B=X===-1?j.length:X+3;continue}let G=O(j,z+1);if(G===-1)break;let W=j.slice(z,G),Z=W.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!Z){B=G;continue}let Y=Z[1]==="/",$=Z[2].toLowerCase();if(Y){let X=Q.lastIndexOf($);if(X!==-1)Q.splice(X);B=G;continue}if($==="template"&&Q.length===0){let X=W.match(J);if(X){let H=P(j,G);if(H!==-1){let _=X[1]||X[2]||X[3];U.push({start:z,end:H,slotName:_,content:j.slice(G,H-11).trim(),propsBinding:X[4]||void 0}),B=H;continue}}}if(!/\/\s*>$/.test(W)&&!F.has($)){if(Q.push($),$==="script"||$==="style"){let X=j.toLowerCase().indexOf(`</${$}>`,G);if(X!==-1){B=X;continue}}}B=G}return U}function v(j){let U={default:"",named:new Map},Q=j,J=D(j);for(let z of J)U.named.set(z.slotName,{name:z.slotName,content:z.content,propsBinding:z.propsBinding});J.sort((z,G)=>G.start-z.start);for(let z of J)Q=Q.slice(0,z.start)+Q.slice(z.end);let B=w(Q);for(let z of B){let G=U.named.get(z.slotName);if(G)G.content+=z.element;else U.named.set(z.slotName,{name:z.slotName,content:z.element})}for(let z=B.length-1;z>=0;z--){let G=B[z];Q=Q.slice(0,G.start)+Q.slice(G.end)}return U.default=Q.trim(),U}function S(j){let U=j.match(/name\s*=\s*["']([^"']+)["']/),Q=U?U[1]:"",J={},B=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,z;while((z=B.exec(j))!==null)J[z[1]]=z[2];let G=j.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),W=G?G[1].trim():"";return{name:Q,props:J,defaultContent:W}}async function k(j,U,Q,J){if(!j)return Q;let B=j.content;if(j.propsBinding&&Object.keys(U).length>0){let z=j.propsBinding.trim(),G={...J};if(z.startsWith("{")&&z.endsWith("}")){let W=z.slice(1,-1).split(",").map((Z)=>Z.trim()).filter(Boolean);for(let Z of W){let[Y,$]=Z.split(":").map((X)=>X.trim()),K=$||Y;if(U[Y]!==void 0)G[K]=U[Y]}}else G[z]=U;B=N(B,G)}return B}function N(j,U){return j.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Q,J)=>{try{let B=J.trim(),z=y(B,U);return b(String(z??""))}catch{return`{{ ${J} }}`}})}function y(j,U){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(j)){let J=j.split("."),B=U;for(let z of J)if(B&&typeof B==="object"&&z in B)B=B[z];else return;return B}let Q=j.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Q){let[,J,B,z]=Q,G=U[J],W=parseInt(z,10);if(typeof G==="number")switch(B){case"+":return G+W;case"-":return G-W;case"*":return G*W;case"/":return G/W}}try{if(!L(j))return;return R(j,Object.keys(U))(...Object.values(U))}catch{return}}async function T(j,U,Q){let J=j;J=await C(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,W,Z,Y)=>{let $=U.named.get(W),K=Y?.trim()||"",X=Z||"",H={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,q;while((q=_.exec(X))!==null){let A=q[1],V=q[2];H[A]=y(V,Q)}return await k($,H,K,Q)});let z=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(z,(G,W,Z)=>{if(/\bname\s*=/.test(W||""))return G;let Y=Z?.trim()||"";return U.default||Y}),J}async function C(j,U,Q){let J=[],B=[];j.replace(U,(W,...Z)=>{let Y=Z[Z.length-2];return B.push({match:W,index:Y}),J.push(Q(W,...Z.slice(0,-2))),W});let z=await Promise.all(J),G=j;for(let W=B.length-1;W>=0;W--){let{match:Z,index:Y}=B[W];G=G.slice(0,Y)+z[W]+G.slice(Y+Z.length)}return G}function E(j){let U=v(j);return{defaultSlot:U.default,namedSlots:U.named}}async function x(j,U,Q,J){return await T(j,{default:U,named:Q},J)}
|
|
3
3
|
export{v as Lg,S as Mg,k as Ng,T as Og,E as Pg,x as Qg};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bm as O,Io as R,Lp as H,qq as x,vr as g}from"./chunk-
|
|
2
|
+
import{Bm as O,Io as R,Lp as H,qq as x,vr as g}from"./chunk-y3gd1g9s.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(Z.name,H(Z.content,j,q,G,$))}K.enqueue(`
|
|
5
5
|
<script>
|