@stacksjs/stx 0.2.830 → 0.2.832
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-xgjr0pzy.js → chunk-0cwn420q.js} +1 -1
- package/dist/{chunk-r4ncb4h4.js → chunk-27r7e2pv.js} +1 -1
- package/dist/{chunk-bmm6vtsx.js → chunk-32xv3q66.js} +1 -1
- package/dist/chunk-39k5bfmk.js +2 -0
- package/dist/{chunk-v8wtfrbr.js → chunk-44wcgf44.js} +1 -1
- package/dist/{chunk-en0xmvkx.js → chunk-5hm3aq74.js} +1 -1
- package/dist/{chunk-qkemyc40.js → chunk-5jkx1t6c.js} +4 -4
- package/dist/{chunk-z77hnfkb.js → chunk-6cayjtgq.js} +1 -1
- package/dist/{chunk-7zf4a66r.js → chunk-6m58mesb.js} +3 -3
- package/dist/{chunk-8kb9t029.js → chunk-7b3wjek8.js} +1 -1
- package/dist/{chunk-yng848qe.js → chunk-7jazxycb.js} +1 -1
- package/dist/{chunk-b5syjezp.js → chunk-7kzmfpcf.js} +1 -1
- package/dist/{chunk-0fthaykk.js → chunk-7qgegnxh.js} +1 -1
- package/dist/{chunk-f6wwwgsf.js → chunk-7zzz8r0d.js} +1 -1
- package/dist/{chunk-ckqgk94e.js → chunk-8ew4a7vy.js} +1 -1
- package/dist/chunk-8hhkqfb7.js +3 -0
- package/dist/{chunk-mww0j2w4.js → chunk-8nf8244n.js} +1 -1
- package/dist/chunk-8q6qp36z.js +2 -0
- package/dist/{chunk-zj50tqxf.js → chunk-8z2g630g.js} +1 -1
- package/dist/{chunk-yex0t4q2.js → chunk-9fw647px.js} +5 -5
- package/dist/chunk-9maxchrj.js +2 -0
- package/dist/{chunk-r14j0fx3.js → chunk-9pjmza44.js} +2 -2
- package/dist/{chunk-zxs92ebc.js → chunk-9vvvp4g3.js} +1 -1
- package/dist/{chunk-rb8rdpnt.js → chunk-a5kd0r75.js} +1 -1
- package/dist/{chunk-zhjr4xvv.js → chunk-any1jha4.js} +2 -2
- package/dist/chunk-asf2d722.js +2 -0
- package/dist/{chunk-pj49gnc8.js → chunk-asqznjzg.js} +1 -1
- package/dist/{chunk-0jhem1jn.js → chunk-atbzg7vw.js} +1 -1
- package/dist/{chunk-tx02ffyc.js → chunk-b5rxc6p1.js} +1 -1
- package/dist/chunk-bkf2z7zt.js +2 -0
- package/dist/{chunk-qw780t39.js → chunk-cnf9r95x.js} +1 -1
- package/dist/{chunk-7kecdwv3.js → chunk-d6qkykt6.js} +1 -1
- package/dist/chunk-dafwt7tk.js +2 -0
- package/dist/{chunk-8d7vh5kq.js → chunk-dnx152fg.js} +1 -1
- package/dist/{chunk-pj2t51hn.js → chunk-eaeyemgp.js} +2 -2
- package/dist/{chunk-t04jw3j4.js → chunk-ec45m14s.js} +1 -1
- package/dist/{chunk-xg4ww72k.js → chunk-egmxf96v.js} +1 -1
- package/dist/{chunk-e240xqcn.js → chunk-f9yqvq9t.js} +1 -1
- package/dist/{chunk-kny4jmyq.js → chunk-fgreefqz.js} +4 -4
- package/dist/{chunk-6fh00yz2.js → chunk-gj33636j.js} +1 -1
- package/dist/{chunk-54anhwg5.js → chunk-hdedvppk.js} +1 -1
- package/dist/chunk-hmnzsdc9.js +2 -0
- package/dist/{chunk-t37tszbc.js → chunk-hn3qmkx2.js} +1 -1
- package/dist/{chunk-47rbtjp1.js → chunk-hr4rd0rr.js} +4 -4
- package/dist/{chunk-dptjfnvq.js → chunk-jxjmbwb9.js} +1 -1
- package/dist/{chunk-267rpvw5.js → chunk-k58rsprz.js} +1 -1
- package/dist/{chunk-cdm6yc10.js → chunk-ke0w29sz.js} +1 -1
- package/dist/{chunk-s5bwrq6g.js → chunk-kmss70d5.js} +1 -1
- package/dist/{chunk-48jzgbbs.js → chunk-kqhq31nh.js} +1 -1
- package/dist/{chunk-zcnehb8p.js → chunk-kts0wcxn.js} +1 -1
- package/dist/{chunk-fykcqp0m.js → chunk-nd7z3syn.js} +2 -2
- package/dist/{chunk-ryxkgt1j.js → chunk-npk6j7a9.js} +1 -1
- package/dist/{chunk-g4yyfmje.js → chunk-q1nbsj9p.js} +1 -1
- package/dist/{chunk-webf565c.js → chunk-q2zsy8vk.js} +1 -1
- package/dist/chunk-qez22va2.js +2 -0
- package/dist/{chunk-j14fd8kd.js → chunk-qm2t1ftx.js} +1 -1
- package/dist/{chunk-8fys3apk.js → chunk-tdq1bq8x.js} +1 -1
- package/dist/{chunk-taws6jfs.js → chunk-v856z21j.js} +2 -2
- package/dist/{chunk-tgdswtya.js → chunk-v88bnrwx.js} +1 -1
- package/dist/chunk-wbmh106x.js +2 -0
- package/dist/{chunk-w80efvh7.js → chunk-xwjsbewa.js} +4 -4
- package/dist/{chunk-a5m09xb5.js → chunk-yw9g1ag1.js} +1 -1
- package/dist/{chunk-ddxbc914.js → chunk-zgf3nss0.js} +6 -6
- package/dist/{chunk-h5pmh5h3.js → chunk-zx85qm3n.js} +2 -2
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-0hnrc2z3.js +0 -2
- package/dist/chunk-4hq9v6hq.js +0 -2
- package/dist/chunk-5nwmwmjg.js +0 -2
- package/dist/chunk-6jpmjvbs.js +0 -2
- package/dist/chunk-gh439e80.js +0 -2
- package/dist/chunk-rgdyf3af.js +0 -3
- package/dist/chunk-vcsvhbtj.js +0 -2
- package/dist/chunk-wxj5srvb.js +0 -2
- package/dist/chunk-x6nrn79w.js +0 -2
- package/dist/chunk-y00nqtdw.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xn,Si}from"./chunk-
|
|
2
|
+
import{xn,Si}from"./chunk-tdq1bq8x.js";import"./chunk-2qngyyaz.js";export{Si as generateRuntimeConfigTypes,xn as prepareRuntimeConfig};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-04z1xyrb.js";import"./chunk-8y8kgw9s.js";import"./chunk-c9mdvpf5.js";import{w,S,C,Z}from"./chunk-
|
|
2
|
+
import"./chunk-04z1xyrb.js";import"./chunk-8y8kgw9s.js";import"./chunk-c9mdvpf5.js";import{w,S,C,Z}from"./chunk-zgf3nss0.js";import"./chunk-2qngyyaz.js";import"./chunk-tdq1bq8x.js";import f from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","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","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","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","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var l=new Map,h=w(64),x=new Set,k=0,R=new Set(b);function T(){l.clear(),h.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=S(n,k),r=h.get(o);if(r)return r.slice();let a=n.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,""),t=[];for(let i of R){if(x.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),h.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Z({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let y=r.filter((s)=>!d.has(s)&&!I(n,s));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(m.length===0)return l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
|
|
4
4
|
`),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Sf,kf,ye,_f,nc,tn,nn,Eh,rc,rn,er,Cf,Ef,Tf,ss,sn,$f,on,sc,Th}from"./chunk-
|
|
2
|
+
import{Sf,kf,ye,_f,nc,tn,nn,Eh,rc,rn,er,Cf,Ef,Tf,ss,sn,$f,on,sc,Th}from"./chunk-qm2t1ftx.js";import"./chunk-v88bnrwx.js";import"./chunk-6k26n0sj.js";import"./chunk-eaeyemgp.js";import"./chunk-7kzmfpcf.js";import"./chunk-cv1zc9dg.js";import"./chunk-7p8m82pj.js";import"./chunk-rkdsgfhd.js";import"./chunk-mxvevxb8.js";import"./chunk-zgf3nss0.js";import"./chunk-tdq1bq8x.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{er as MODULE_SPECIFIER_PREFIX,Sf as bundleCacheDir,kf as bundleCacheEntryLimit,Th as bundleClientEntriesSplit,on as bundleClientScript,nn as clearBundleFailures,ye as clientBundleDependencies,tn as getBundleFailures,rn as hasUserImports,sn as moduleSubstitutionKey,Ef as normalizeRegistrySpecifiers,$f as queueClientBundleBuild,nc as recordBundleFailure,Cf as registryIdForPath,rc as resolveBundlerFallback,Tf as rewriteRegistryImports,Eh as setBundlerFallbackMode,_f as shouldLogBundlerDiagnostics,sc as tempBuildName,ss as withModuleSubstitutes};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$l,Rl}from"./chunk-9fw647px.js";import"./chunk-e75dntfb.js";import"./chunk-ec45m14s.js";import"./chunk-8ew4a7vy.js";import"./chunk-5hm3aq74.js";import"./chunk-f6b7av6b.js";import"./chunk-4a3r1kh1.js";import"./chunk-cnf9r95x.js";import"./chunk-7qgegnxh.js";import"./chunk-6m58mesb.js";import"./chunk-f49x34sr.js";import"./chunk-6tjm38e4.js";import"./chunk-q5pwvr98.js";import"./chunk-hdedvppk.js";import"./chunk-m9bbhg46.js";import"./chunk-vyv76w55.js";import"./chunk-z25w7kmr.js";import"./chunk-ckg6q98b.js";import"./chunk-s5dhvnnd.js";import"./chunk-7k9yahng.js";import"./chunk-npk6j7a9.js";import"./chunk-dnx152fg.js";import"./chunk-b7tb00nz.js";import"./chunk-0rvntfhj.js";import"./chunk-myje6fhm.js";import"./chunk-f7jgda7x.js";import"./chunk-9vvvp4g3.js";import"./chunk-k58rsprz.js";import"./chunk-qy6dtm1a.js";import"./chunk-9pjmza44.js";import"./chunk-s53wjw7y.js";import"./chunk-ac9ncbfw.js";import{en}from"./chunk-8nf8244n.js";import"./chunk-qm2t1ftx.js";import"./chunk-v88bnrwx.js";import"./chunk-6k26n0sj.js";import{Ae,i}from"./chunk-hr4rd0rr.js";import"./chunk-nd7z3syn.js";import"./chunk-xwjsbewa.js";import"./chunk-c84pxd2k.js";import"./chunk-kts0wcxn.js";import"./chunk-8hhkqfb7.js";import"./chunk-d6qkykt6.js";import"./chunk-ekh3mxyp.js";import"./chunk-v856z21j.js";import{ve}from"./chunk-5jkx1t6c.js";import"./chunk-qadce16v.js";import{lr,ur}from"./chunk-7zzz8r0d.js";import{xs,F,a}from"./chunk-eaeyemgp.js";import"./chunk-7kzmfpcf.js";import"./chunk-cv1zc9dg.js";import"./chunk-7p8m82pj.js";import"./chunk-rkdsgfhd.js";import"./chunk-mxvevxb8.js";import{m,je}from"./chunk-zgf3nss0.js";import"./chunk-tdq1bq8x.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";import"./chunk-gcf97wgx.js";import"./chunk-xn9jg1q5.js";export{xs as buildWebComponents,ur as cacheTemplate,lr as checkCache,en as classifyAllScripts,$l as createMiddleware,Rl as createRoute,F as defaultConfig,m as extractVariables,ve as injectRouterScript,a as loadStxConfig,je as processClientScript,i as processDirectives,Ae as readMarkdownFile};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xe,Us,bg,Qh,wg,ey,Dt,p,W,Q,vn,ke,vg,xi,xg,ty,_,Sg,ny,R,ry}from"./chunk-
|
|
2
|
+
import{xe,Us,bg,Qh,wg,ey,Dt,p,W,Q,vn,ke,vg,xi,xg,ty,_,Sg,ny,R,ry}from"./chunk-zgf3nss0.js";import"./chunk-tdq1bq8x.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{Sg as applyFilters,ey as clearCustomFilters,vg as clientLoopScopes,Us as defaultFilters,vn as escapeAttributeValue,p as escapeHtml,W as escapeHtmlValue,Q as escapeInterpolatedHtmlValue,R as evaluateExpression,xe as findMustacheEnd,wg as getAllFilters,xg as interpolateScriptAttributes,xi as interpolateScriptExpressions,ty as interpolateScriptsInTemplate,_ as processExpressions,bg as registerFilter,Qh as registerFilters,Dt as replaceInterpolations,ny as resetRejectedExpressionWarnings,ry as unescapeHtml,ke as usesSignalsInScript};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{He,M,Lt}from"./chunk-2qngyyaz.js";import{T}from"./chunk-c9mdvpf5.js";import{gt,Ee,j,Ke,Te,fa,ho,ga,On}from"./chunk-7zf4a66r.js";import{kt,de,tt}from"./chunk-mxvevxb8.js";import{Io}from"./chunk-tgdswtya.js";import{Nn}from"./chunk-wr7bmkne.js";import{we}from"./chunk-qkemyc40.js";import Z from"fs";import P from"path";var{serve:ce}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var K=Q(F.brotliCompress),ee=Q(F.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((a)=>e.startsWith(a)))return!1;return te.some((a)=>e.startsWith(a))}function oe(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ie(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[a,r]of H){if(U<=Y)break;H.delete(a),U-=r.length}}async function Rn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(i.length<(a.threshold??re))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=H.get(g);if(!l)l=r==="br"?await K(i,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await ee(i),ie(g,l);if(l.length>=i.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",j(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ee(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,k=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let B=await s.clone().arrayBuffer();if(B.byteLength>1048576)return null;s.headers.set("Vary",j(s.headers.get("Vary")).Vary);let n={body:B,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=k().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let E=await x;return E?l(E):i()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Yg(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=fa(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Nn(r.routeRules),f=new G,h=Io(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?M(l):void 0,v=new Map,k=new Map,x=new Map,E=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Lt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,tt(c.html)),E.set(n.pattern,we(c.html));let _=P.join(e,n.fragmentPath);if(Ke(c.html,r.routerContainer||"main")&&await Bun.file(_).exists()){let A=await Bun.file(_).text();k.set(n.pattern,m?Lt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=de(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let B=ce({port:a,async fetch(n){return Rn(n,await He(m??M(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),L=pe[R]||"application/octet-stream",N=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Ee(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,L)=>{q[R]=o[L+1]});break}}if(!C){let p=kt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=i(c),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=k.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(C.pattern)?{"X-STX-Runtime":E.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...j(),...O.cache?{}:{"Cache-Control":gt}}})}}let d=ho(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...j(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:L,cookies:N,status:I,headers:D}=await On(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return ga(L,N,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:z}=await import("./chunk-8kb9t029.js"),X=new Headers({...j(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(A&&!d&&Ke(o,r.routerContainer||"main")){let V=tt(o);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",we(o)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return z(S(A&&!d&&Ke(o,r.routerContainer||"main")?Te(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let w=new Headers({"Content-Type":"text/html",...j(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of N??[])w.append("Set-Cookie",S);for(let[S,z]of Object.entries(D??{}))w.set(S,z);if(w.set("Vary",j(w.get("Vary")).Vary),A&&!d&&Ke(o,r.routerContainer||"main")){let S=tt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",we(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Te(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:w})}return new Response(o,{status:I??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
2
|
+
import{He,M,Lt}from"./chunk-2qngyyaz.js";import{T}from"./chunk-c9mdvpf5.js";import{gt,Ee,j,Ke,Te,fa,ho,ga,On}from"./chunk-6m58mesb.js";import{kt,de,tt}from"./chunk-mxvevxb8.js";import{Io}from"./chunk-v88bnrwx.js";import{Nn}from"./chunk-wr7bmkne.js";import{we}from"./chunk-5jkx1t6c.js";import Z from"fs";import P from"path";var{serve:ce}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var K=Q(F.brotliCompress),ee=Q(F.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((a)=>e.startsWith(a)))return!1;return te.some((a)=>e.startsWith(a))}function oe(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ie(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[a,r]of H){if(U<=Y)break;H.delete(a),U-=r.length}}async function Rn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(i.length<(a.threshold??re))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=H.get(g);if(!l)l=r==="br"?await K(i,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await ee(i),ie(g,l);if(l.length>=i.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",j(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ee(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,k=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let B=await s.clone().arrayBuffer();if(B.byteLength>1048576)return null;s.headers.set("Vary",j(s.headers.get("Vary")).Vary);let n={body:B,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=k().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let E=await x;return E?l(E):i()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Yg(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=fa(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=Nn(r.routeRules),f=new G,h=Io(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?M(l):void 0,v=new Map,k=new Map,x=new Map,E=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Lt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,tt(c.html)),E.set(n.pattern,we(c.html));let _=P.join(e,n.fragmentPath);if(Ke(c.html,r.routerContainer||"main")&&await Bun.file(_).exists()){let A=await Bun.file(_).text();k.set(n.pattern,m?Lt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=de(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let B=ce({port:a,async fetch(n){return Rn(n,await He(m??M(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),L=pe[R]||"application/octet-stream",N=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Ee(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,L)=>{q[R]=o[L+1]});break}}if(!C){let p=kt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=i(c),W=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=k.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(C.pattern)?{"X-STX-Runtime":E.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...j(),...O.cache?{}:{"Cache-Control":gt}}})}}let d=ho(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...j(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:L,cookies:N,status:I,headers:D}=await On(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return ga(L,N,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:z}=await import("./chunk-7b3wjek8.js"),X=new Headers({...j(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(A&&!d&&Ke(o,r.routerContainer||"main")){let V=tt(o);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",we(o)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return z(S(A&&!d&&Ke(o,r.routerContainer||"main")?Te(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let w=new Headers({"Content-Type":"text/html",...j(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of N??[])w.append("Set-Cookie",S);for(let[S,z]of Object.entries(D??{}))w.set(S,z);if(w.set("Vary",j(w.get("Vary")).Vary),A&&!d&&Ke(o,r.routerContainer||"main")){let S=tt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",we(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Te(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:w})}return new Response(o,{status:I??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${B.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:B.port,stop:()=>{f.invalidate(),B.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
3
|
export{Rn,Yg};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fr}from"./chunk-mxvevxb8.js";import{Tr}from"./chunk-c9mdvpf5.js";import{a}from"./chunk-
|
|
2
|
+
import{fr}from"./chunk-mxvevxb8.js";import{Tr}from"./chunk-c9mdvpf5.js";import{a}from"./chunk-eaeyemgp.js";import{B,Ze}from"./chunk-ybq56wam.js";import{fc}from"./chunk-2x9zhezb.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function ar(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function G(e,r={}){return new fr(e,r).routes}import w from"path";var y=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=y.get(n);if(c)return c;let o=[];try{o=G(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return y.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function g(e){return O(JSON.stringify(e))}function we(e){return e.includes("data-stx-runtime")}function dc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function l(e,r){let t=ar(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
|
|
3
3
|
`+e.slice(t);let n=Tr(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
4
|
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=e.indexOf("</head>");return e.slice(0,o)+r+`
|
|
5
5
|
`+e.slice(o)}if(B(e))return Ze(e,(o)=>`${o}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function cr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-
|
|
7
|
+
${e}`}async function cr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-kmss70d5.js"),{url:c}=await n("runtime",r.debug===!0);return l(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return l(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-kmss70d5.js"),s=await t(r.debug);return l(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function pc(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${fc()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function ve(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:T}=await import("./chunk-
|
|
9
|
+
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function ve(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:T}=await import("./chunk-kmss70d5.js");n=`<script data-stx-owned-routes src="${T(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${g(f)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${g(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-kmss70d5.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
|
|
13
13
|
</body>`+e.slice(d+7)}
|
|
14
14
|
export{ar,G,we,dc,cr,pc,ve};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{yn,tg,ng,rg,sg,og,m,ig,hi,ag,Kc,Xc}from"./chunk-
|
|
2
|
+
import{yn,tg,ng,rg,sg,og,m,ig,hi,ag,Kc,Xc}from"./chunk-zgf3nss0.js";import"./chunk-tdq1bq8x.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{yn as STX_ENGINE_BINDING_NAMES,hi as convertToCommonJS,Kc as extractScriptFromTemplate,m as extractVariables,Xc as hasVariables,ig as isCompleteImport,og as isMissingBindingFailure,rg as isModuleResolutionFailure,sg as isSyntaxFailure,ag as splitDeclaration,tg as stripTypeScript,ng as withoutStxReferrer};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_n}from"./chunk-c9mdvpf5.js";import{q,y,Ot,Nt,_r,m,nl,vi,W,R}from"./chunk-
|
|
3
|
-
`}import O from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=X()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-8n8vj099.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function la(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=O.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=O.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function mo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=en(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:S,defaultConfig:w,loadStxConfig:b}=await import("./chunk-
|
|
2
|
+
import{_n}from"./chunk-c9mdvpf5.js";import{q,y,Ot,Nt,_r,m,nl,vi,W,R}from"./chunk-zgf3nss0.js";import{en}from"./chunk-8nf8244n.js";import{n}from"./chunk-8hhkqfb7.js";import{X}from"./chunk-t59bc7na.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function N(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function J(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function P(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(N(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!J(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(N(h.index,a))continue;let S=h[1]==="/";if(!S&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=S?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var gt="private, no-store";function Pn(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ee(t){return t.headers.get("X-STX-Router")==="true"}function K(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function j(t){return{Vary:K(t,"X-STX-Router")}}function k(t){return t.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function In(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=y(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${k(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=Pn(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${k(o.content??"")}">`)}else{let l=Pn(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${k(o.href??"")}"${l==="alternate"?` hreflang="${k(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
|
|
3
|
+
`}import O from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=X()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-8n8vj099.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function la(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=O.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=O.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function mo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=en(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:S,defaultConfig:w,loadStxConfig:b}=await import("./chunk-39k5bfmk.js"),E=await b(),d={__filename:t,__dirname:O.dirname(t)};for(let g of o){let A=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!g.includes("client")&&!g.includes('type="module"'))await S(A[1],d,t)}let x=await h(f,d,t,{...w,...E,...r},new Set),C=x.indexOf(p);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,C),afterSlot:x.substring(C+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function qr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -28,5 +28,5 @@ ${c}
|
|
|
28
28
|
`));if(i.length>0)d.push(i.filter((x)=>!u.has(x)).join(`
|
|
29
29
|
`));if(w.length>0)d.push(w.filter((x)=>!u.has(x)).join(`
|
|
30
30
|
`));return d.push(S),d.join(`
|
|
31
|
-
`)}import T from"fs";import H from"path";function da(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function pa(t,r){let e=H.join(r,"manifest.json");T.writeFileSync(e,JSON.stringify(t,null,2))}function fa(t){let r=H.join(t,"manifest.json");if(!T.existsSync(r))return null;try{let e=T.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function ho(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function V(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!ho(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function ga(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function On(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Ot(s),c=Nt(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-
|
|
31
|
+
`)}import T from"fs";import H from"path";function da(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function pa(t,r){let e=H.join(r,"manifest.json");T.writeFileSync(e,JSON.stringify(t,null,2))}function fa(t){let r=H.join(t,"manifest.json");if(!T.existsSync(r))return null;try{let e=T.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function ho(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function V(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!ho(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function ga(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function On(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Ot(s),c=Nt(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-7b3wjek8.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-bkf2z7zt.js"),{defaultConfig:h}=await import("./chunk-egmxf96v.js"),S=s.streamBoundaries||{},w={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof S[d]==="function"?await S[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,w,new Set)}})),E=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!E.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!vi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await V(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=_r(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!vi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=R(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?W(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(nl(t.html,i)),context:e,cookies:s.cookies}}
|
|
32
32
|
export{gt,Pn,Ee,j,In,la,mo,qr,qe,ua,Ke,Te,da,pa,fa,ho,ga,On};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lm,va,pu,jm,Bm,Fm,zm,Hm,fu,gu,Vm,Um,Wm,qm}from"./chunk-
|
|
2
|
+
import{Lm,va,pu,jm,Bm,Fm,zm,Hm,fu,gu,Vm,Um,Wm,qm}from"./chunk-dnx152fg.js";import"./chunk-hr4rd0rr.js";import"./chunk-nd7z3syn.js";import"./chunk-xwjsbewa.js";import"./chunk-c84pxd2k.js";import"./chunk-kts0wcxn.js";import"./chunk-8hhkqfb7.js";import"./chunk-d6qkykt6.js";import"./chunk-ekh3mxyp.js";import"./chunk-v856z21j.js";import"./chunk-5jkx1t6c.js";import"./chunk-qadce16v.js";import"./chunk-7zzz8r0d.js";import"./chunk-eaeyemgp.js";import"./chunk-7kzmfpcf.js";import"./chunk-cv1zc9dg.js";import"./chunk-7p8m82pj.js";import"./chunk-rkdsgfhd.js";import"./chunk-mxvevxb8.js";import"./chunk-zgf3nss0.js";import"./chunk-tdq1bq8x.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{pu as SUSPENSE_RESOLVER_RUNTIME,va as buildSuspenseResolveScript,Hm as createStreamRenderer,Fm as extractStreamBoundaries,qm as generateHydrationRuntime,gu as islandDirective,Um as processSectionDirectives,Bm as processStreamDirectives,Vm as registerStreamingDirectives,jm as renderStreamingPage,Lm as streamTemplate,zm as streamTemplateSimple,Wm as streamToResponse,fu as streamingSuspenseDirective};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Rf,ic,Rh,ac,Af,Pf,ln,or,Ah,If,Of,Ph,b}from"./chunk-
|
|
2
|
+
import{Rf,ic,Rh,ac,Af,Pf,ln,or,Ah,If,Of,Ph,b}from"./chunk-nd7z3syn.js";import"./chunk-7zzz8r0d.js";import"./chunk-zgf3nss0.js";import"./chunk-tdq1bq8x.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{ln as buildCss,If as extractClassNames,Pf as fingerprintConfig,Of as generateCss,Ah as getCachedCSS,Rf as getCssServeAsset,b as injectCss,ic as loadCssEngine,ac as loadCssEngineConfig,or as rebuildCss,Rh as resetCssCache,Af as resolveUserCssConfig,Ph as withLinkedModuleBundles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{P,t,l}from"./chunk-c9mdvpf5.js";import{Q}from"./chunk-
|
|
2
|
+
import{P,t,l}from"./chunk-c9mdvpf5.js";import{Q}from"./chunk-zgf3nss0.js";import{Yo}from"./chunk-cv1zc9dg.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...T,...s.i18n}.cache&&v[e]){let r=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=C(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function C(e,s){let i={...T,...s.i18n},n=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Y(e,i,n);if(o===void 0){let u=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=o;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=E.join(i,`${e}${Z(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
|
|
3
3
|
`),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let c=o.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:c});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let c=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=c&&s<=u)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),o=`=${n}`;if(r[o])return R(r[o],n,i);let c=ce(n);if(r[c])return R(r[c],n,i);if(r.other)return R(r.other,n,i);return String(n)}function R(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let u of r){if(o===void 0||o===null)break;o=o[u]}if(o===void 0||o===null)return i?e:"";let c=String(o);if(be(c))return ie(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),a=c.split("|");c=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function yc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await re(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>P(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,c.fallbackToKey,b);return y?Q(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return l("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>P(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Q(r,w,O(f,u,c.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return l("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...c)=>{let u=i(o,...c).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:c,replacement:u})=>o.replace(c,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function bc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${o}${u}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,c,u)=>{let a=n.get(u);return a?`<${c}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=o.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function wc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],c=await Yo(o,{recursive:n,ignorePaths:r}),u=[];for(let a of c)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(u.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var vc={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${o||u} -->${e}`},hasEndTag:!1},xc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
4
|
export{yc,bc,wc,vc,xc};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{nt}from"./chunk-mxvevxb8.js";import{yt,Vn}from"./chunk-qy6dtm1a.js";import{$r,Rr,Ar,Ir,Ce}from"./chunk-c9mdvpf5.js";import{De,mn,el,tl}from"./chunk-
|
|
2
|
+
import{nt}from"./chunk-mxvevxb8.js";import{yt,Vn}from"./chunk-qy6dtm1a.js";import{$r,Rr,Ar,Ir,Ce}from"./chunk-c9mdvpf5.js";import{De,mn,el,tl}from"./chunk-zgf3nss0.js";import{M}from"./chunk-2qngyyaz.js";import{Si}from"./chunk-tdq1bq8x.js";import{b}from"./chunk-nd7z3syn.js";import{i}from"./chunk-hr4rd0rr.js";import{F,a}from"./chunk-eaeyemgp.js";import{_c}from"./chunk-7p8m82pj.js";import{In,qe,Te,da,pa,On}from"./chunk-6m58mesb.js";import{an,Po}from"./chunk-v88bnrwx.js";import{Nn}from"./chunk-wr7bmkne.js";import{Qt,Zn,Qn}from"./chunk-4z0jpzdq.js";import{G}from"./chunk-5jkx1t6c.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Vn():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);el();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>De(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},y=await i(e,D,r,T,A),w=In(y)+qe(y),j=tl();return{route:l,sourceFile:n,html:y,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:mn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function om(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Ir,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Nn(A),y=n.serverApi??e.serverApi,w=typeof y==="object"?y:{};if(y)an(o,w);if(e.runtimeConfig)M(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],H=[];for(let s of P){let f=T(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Ar(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=$r(t.html,u);if(g.htmlAttrs)t.html=Rr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await On(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=Qn(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",Zn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Qt}/`)}let N={runtime:v.filename,router:x.filename},C=da(H,N,r);if(C.routeRules=A,C.routerContainer=D,y)C.apiRoutes=await Po(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Si(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(_c(e._layerGraph),null,2));pa(C,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:N,outputDir:r,duration:K}}
|
|
4
4
|
export{om};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Pc,s,ge}from"./chunk-
|
|
2
|
+
import{Pc,s,ge}from"./chunk-zgf3nss0.js";import{rt}from"./chunk-car6nhfe.js";import{c}from"./chunk-k6ye0159.js";import o from"fs";import l from"path";var Ff=new Map,m=new Map;async function Lh(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function jh(e){m.delete(e)}function Bh(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function Fh(e){x=e}async function zf(e=!1){let t=x??await import("./chunk-zt74q4c8.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function Hf(){if(S===null){let{getRouterScript:e}=await import("./chunk-8n8vj099.js");S=e()}return S}var y={};async function zh(e,t=!1){let n=e==="runtime"?await zf(t):await Hf(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,u=new Map,p=0;function C(e){return c(process.cwd(),"module-bundles",`${e}.js`)}function Hh(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=u.get(t),i=n!==void 0;if(i)u.delete(t),p-=n.length*2;u.set(t,e),p+=e.length*2;while(u.size>1&&(u.size>E||p>T)){let r=u.keys().next().value;p-=u.get(r).length*2,u.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(l.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function Go(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=u.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function Vh(){m.clear(),ge(),Pc(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function lr(e,t){try{if(!t.cachePath)return null;let n=l.resolve(t.cachePath),i=l.join(n,`${ws(e)}.html`),r=l.join(n,`${ws(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==rt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function ur(e,t,n,i){try{if(!i.cachePath)return;let r=l.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=l.join(r,`${ws(e)}.html`),a=l.join(r,`${ws(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:rt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),Ff.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function ws(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
3
|
export{Ff,Lh,jh,Bh,Fh,zf,Hf,zh,Hh,Go,Vh,lr,ur,ws};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-eaeyemgp.js";import{yo}from"./chunk-wr7bmkne.js";import p from"path";async function Jg(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(yo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-asf2d722.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
|
|
3
3
|
export{Jg};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{q,Me}from"./chunk-
|
|
2
|
+
import{q,Me}from"./chunk-zgf3nss0.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function en(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Me(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
|
|
3
3
|
export{en};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Yg}from"./chunk-5hm3aq74.js";import"./chunk-6m58mesb.js";import"./chunk-8nf8244n.js";import"./chunk-v88bnrwx.js";import"./chunk-8hhkqfb7.js";import"./chunk-5jkx1t6c.js";import"./chunk-eaeyemgp.js";import"./chunk-7kzmfpcf.js";import"./chunk-cv1zc9dg.js";import"./chunk-7p8m82pj.js";import"./chunk-rkdsgfhd.js";import"./chunk-mxvevxb8.js";import"./chunk-zgf3nss0.js";import"./chunk-tdq1bq8x.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{Yg as startProductionServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{an,Ao,Po,Io,$h,Oo}from"./chunk-
|
|
2
|
+
import{an,Ao,Po,Io,$h,Oo}from"./chunk-v88bnrwx.js";import"./chunk-7p8m82pj.js";import"./chunk-mxvevxb8.js";import"./chunk-2qngyyaz.js";export{Po as buildServerApi,$h as createServerApi,an as discoverServerApi,Ao as generateApiTypes,Oo as isServerApiSource,Io as productionApiDispatcher};
|