@stacksjs/stx 0.2.470 → 0.2.471
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-yv00fy8z.js → chunk-045kr10b.js} +1 -1
- package/dist/{chunk-f64rmdvt.js → chunk-0ax9kmf8.js} +2 -2
- package/dist/{chunk-r7m8dh2g.js → chunk-0r7gsny3.js} +5 -5
- package/dist/chunk-0xqy73ss.js +2 -0
- package/dist/chunk-106r55j4.js +2 -0
- package/dist/{chunk-2qz5gqqe.js → chunk-16h7wedx.js} +7 -7
- package/dist/chunk-1g8p13wt.js +2 -0
- package/dist/{chunk-9pjy59d6.js → chunk-1p7pws60.js} +65 -65
- package/dist/{chunk-qf7da9f6.js → chunk-2542vq5p.js} +1 -1
- package/dist/{chunk-9kb3my0w.js → chunk-27kb6nrb.js} +2 -2
- package/dist/{chunk-pz537q62.js → chunk-28s5x7wv.js} +2 -2
- package/dist/chunk-2njt4vbe.js +2 -0
- package/dist/chunk-2p7d1psf.js +2 -0
- package/dist/chunk-4aw47rmg.js +2 -0
- package/dist/{chunk-wc6k446y.js → chunk-5tgctj1p.js} +3 -3
- package/dist/chunk-71e050r2.js +2 -0
- package/dist/{chunk-y8h823cb.js → chunk-74j18qk0.js} +28 -28
- package/dist/{chunk-y42ge4xh.js → chunk-7ekp1tw8.js} +20 -20
- package/dist/chunk-8319g47g.js +2 -0
- package/dist/{chunk-8v24kvjk.js → chunk-86knxbhs.js} +1 -1
- package/dist/{chunk-594tt40e.js → chunk-8adstrk5.js} +2 -2
- package/dist/{chunk-wzeq29c1.js → chunk-8sxkvdz2.js} +2 -2
- package/dist/chunk-8y71t1j7.js +2 -0
- package/dist/chunk-93q4tw6z.js +2 -0
- package/dist/{chunk-scvzv5y2.js → chunk-99kt56fn.js} +2 -2
- package/dist/{chunk-250psr2a.js → chunk-9kzk7zyy.js} +1 -1
- package/dist/{chunk-mx446wgp.js → chunk-9ztdvnkk.js} +2 -2
- package/dist/chunk-a0grp45v.js +2 -0
- package/dist/chunk-bfvmkncd.js +2 -0
- package/dist/{chunk-tydxqfs6.js → chunk-bnd6kd6d.js} +1 -1
- package/dist/chunk-bp9snrj7.js +2 -0
- package/dist/{chunk-564pmmj3.js → chunk-bqx3dqv1.js} +1 -1
- package/dist/{chunk-xts31rkc.js → chunk-cetdwrqh.js} +96 -96
- package/dist/chunk-cg8hg6cs.js +3 -0
- package/dist/{chunk-a6amx427.js → chunk-crjmrhkh.js} +1 -1
- package/dist/{chunk-5rx7ptse.js → chunk-cxbp2m66.js} +2 -2
- package/dist/chunk-czxs5tf2.js +2 -0
- package/dist/{chunk-rvzx5s72.js → chunk-dts9z53c.js} +1 -1
- package/dist/{chunk-98gxw97n.js → chunk-ecr642nj.js} +1 -1
- package/dist/{chunk-6sken7b2.js → chunk-eqf8985n.js} +1 -1
- package/dist/chunk-ezf8r05n.js +2 -0
- package/dist/chunk-f5yg6sp3.js +2 -0
- package/dist/{chunk-xc27xdm6.js → chunk-f6kwahhn.js} +1 -1
- package/dist/{chunk-6vstn9dk.js → chunk-gkj42zq7.js} +1 -1
- package/dist/{chunk-rdn3egy7.js → chunk-h9afpxpp.js} +1 -1
- package/dist/chunk-hc01wxaf.js +2 -0
- package/dist/chunk-hr487qbk.js +2 -0
- package/dist/chunk-j338fs8k.js +2 -0
- package/dist/{chunk-3q9hhpvz.js → chunk-jzax5rnm.js} +1 -1
- package/dist/chunk-m5dgc757.js +2 -0
- package/dist/chunk-m8nn4fmg.js +2 -0
- package/dist/{chunk-dj3b04tn.js → chunk-m8w4hve0.js} +1 -1
- package/dist/chunk-mmh37ywa.js +2 -0
- package/dist/{chunk-cxkyt6ht.js → chunk-r6174yzb.js} +1 -1
- package/dist/{chunk-yd7g02v5.js → chunk-s10r6hxp.js} +7 -7
- package/dist/chunk-sx89w4af.js +2 -0
- package/dist/{chunk-mn6gcvk9.js → chunk-sxf8nb5z.js} +4 -4
- package/dist/chunk-t1x2gjtj.js +2 -0
- package/dist/{chunk-ktvr45qg.js → chunk-t61vdbje.js} +6 -6
- package/dist/{chunk-aw4jxj6a.js → chunk-t7s0pdtw.js} +2 -2
- package/dist/{chunk-gskjzw5r.js → chunk-tbef3yyk.js} +3 -3
- package/dist/{chunk-hvmtpe7w.js → chunk-tt28sg5z.js} +1 -1
- package/dist/{chunk-j3z1bfjt.js → chunk-vnaxhk3z.js} +1 -1
- package/dist/{chunk-71ttf2ne.js → chunk-vt5k0j68.js} +1 -1
- package/dist/chunk-w8qmc1mn.js +2 -0
- package/dist/chunk-wxaezzq7.js +33 -0
- package/dist/{chunk-3jjevm1j.js → chunk-x3vqyegd.js} +6 -6
- package/dist/chunk-x5yzgahy.js +2 -0
- package/dist/chunk-x7tsekgw.js +2 -0
- package/dist/{chunk-hjhz90kg.js → chunk-xnjcmhs5.js} +2 -2
- package/dist/{chunk-3c6v9hp1.js → chunk-ykfkvk67.js} +1 -1
- package/dist/chunk-zam9d5bk.js +2 -0
- package/dist/chunk-zb5p05v4.js +2 -0
- package/dist/{chunk-168dqya1.js → chunk-zkg0rbmp.js} +3 -3
- package/dist/chunk-znwpwae1.js +2 -0
- package/dist/cli.js +42 -42
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/headwind-to-style.js +28 -0
- package/dist/native/compiler/html-to-ir.js +67 -4
- package/dist/native/compiler/ir.d.ts +15 -1
- package/dist/native/compiler/svg.d.ts +86 -0
- package/dist/native/compiler/svg.js +414 -0
- package/dist/native/prop-names.js +2 -0
- package/dist/native/runtime/native-host.js +22 -9
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-0q8xacmn.js +0 -2
- package/dist/chunk-2a22ep8p.js +0 -2
- package/dist/chunk-4waxn99v.js +0 -2
- package/dist/chunk-695de40v.js +0 -2
- package/dist/chunk-6a1g18h4.js +0 -2
- package/dist/chunk-94d2t16y.js +0 -2
- package/dist/chunk-b5mfa6w6.js +0 -2
- package/dist/chunk-bprn7crb.js +0 -2
- package/dist/chunk-cxgr65kt.js +0 -33
- package/dist/chunk-ds6eqyq2.js +0 -2
- package/dist/chunk-dy0gm4e4.js +0 -2
- package/dist/chunk-e8ewjcmj.js +0 -2
- package/dist/chunk-fkgdbdqa.js +0 -2
- package/dist/chunk-g9dh9yat.js +0 -2
- package/dist/chunk-gg4hrjrf.js +0 -2
- package/dist/chunk-gna3h2yv.js +0 -2
- package/dist/chunk-gyfb3rj5.js +0 -2
- package/dist/chunk-gzk5ak8f.js +0 -2
- package/dist/chunk-j04s01mf.js +0 -2
- package/dist/chunk-kyda9myt.js +0 -2
- package/dist/chunk-m4sd2ker.js +0 -2
- package/dist/chunk-mhjndjjb.js +0 -2
- package/dist/chunk-nrjevcyh.js +0 -2
- package/dist/chunk-pq9978k5.js +0 -2
- package/dist/chunk-r0gx4p2m.js +0 -2
- package/dist/chunk-rskf20cw.js +0 -2
- package/dist/chunk-sz2cf4w6.js +0 -2
- package/dist/chunk-vbbrtrcg.js +0 -2
- package/dist/chunk-vc24bahj.js +0 -2
- package/dist/chunk-vkgsj6k0.js +0 -2
- package/dist/chunk-y51pb1tc.js +0 -2
- package/dist/chunk-yn2d8x8m.js +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-01nx6zcw.js";import"./chunk-pf0d8y9n.js";import{m,h,w,L}from"./chunk-
|
|
2
|
+
import"./chunk-01nx6zcw.js";import"./chunk-pf0d8y9n.js";import{m,h,w,L}from"./chunk-cetdwrqh.js";import"./chunk-ab7vh24b.js";import"./chunk-wkc34drs.js";import"./chunk-9ztdvnkk.js";import"./chunk-tbef3yyk.js";import"./chunk-s10r6hxp.js";import"./chunk-j4afmryj.js";import"./chunk-99kt56fn.js";import"./chunk-f6kwahhn.js";import"./chunk-pcq6vphz.js";import"./chunk-8adstrk5.js";import f from"path";var S=["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","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],_=new Set(S);var l=new Map,x=m(64),y=new Set,O=0,R=new Set(S);function W(){l.clear(),x.clear()}function P(o){let n=new Map;for(let r of o){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=n.get(t);if(i&&!i.endsWith(".js"))continue;n.set(t,r)}return[...n.values()].sort()}function I(o,n){let r=n.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(o)}function M(o){if(!o)return[];let n=h(o,O),r=x.get(n);if(r)return r.slice();let a=o.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(y.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),x.set(n,t),t.slice()}async function U(o,n){let r=M(o);if(r.length===0)return null;let a=n??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=L({loader:"ts",target:"browser",define:w()}),C=new Set(r),d=[],g=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 b=[];try{b=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!b.some((c)=>C.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,""),d.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${u.transformSync(e).trim()}`);for(let c of b)g.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let v=r.filter((s)=>!g.has(s)&&!I(o,s));if(v.length>0)console.warn(`[stx] could not bundle ${v.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(d.length===0)return l.set(t,""),null;let E=[...g].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
|
`),k=`<script data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Zt,ae}from"./chunk-8scw1bes.js";import{m,Qt,w,Me,o,R}from"./chunk-
|
|
2
|
+
import{Zt,ae}from"./chunk-8scw1bes.js";import{m,Qt,w,Me,o,R}from"./chunk-cetdwrqh.js";import{qr}from"./chunk-5tgctj1p.js";import{s,we}from"./chunk-ak95401g.js";import{a}from"./chunk-kk5cyjfs.js";import f from"path";import j from"fs";var pe=10;function V(e,n,i){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(f.basename(e))||qr(e,n,i)}var ne=1,re=new Map,P=600,fe=100,W=new Map;async function me(e){let n=W.get(e)??0;if(n>0&&n<fe){W.set(e,n+1);return}W.set(e,1);try{let i=(await j.promises.readdir(e)).filter((u)=>u.endsWith(".js"));if(i.length<=P)return;let g=(await Promise.all(i.map(async(u)=>{try{return{name:u,at:(await j.promises.stat(f.join(e,u))).mtimeMs}}catch{return null}}))).filter((u)=>u!==null);g.sort((u,l)=>l.at-u.at);for(let u of g.slice(P)){let l=u.name.slice(0,-3);await j.promises.rm(f.join(e,`${l}.js`),{force:!0}),await j.promises.rm(f.join(e,`${l}.deps.json`),{force:!0})}I("pruned bundle cache to",P,"entries")}catch{}}function ie(e){return re.get(e)??[]}function X(e,n){if(e)re.set(e,n)}function La(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function I(...e){if(La())console.log("[stx:bundler]",...e)}var Z=[];function No(e,n,i){Z.push({filePath:e||"<inline>",message:n,details:i})}function gt(){return Z.slice()}function mt(){Z.length=0}var q;function bu(e){q=e}function Lo(){if(q)return q;try{let e=R.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var H=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function ht(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,i;while((i=n.exec(e))!==null){let g=i[1];if(!H.some((l)=>l.test(g)))return I("detected user import:",g),!0}let c=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((i=c.exec(e))!==null){let g=i[1];if(/\.css(?:\?.*)?$/.test(g))continue;if(!H.some((l)=>l.test(g)))return I("detected side-effect import:",g),!0}return!1}var Yt="stx-module:",ge=/\.(?:[cm]?[jt]sx?|json)$/i;function ja(e,n){return f.relative(e,n).split(f.sep).join("/")}function Ba(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,(i,c,g,u)=>{let l=n.get(u);return l&&!u.startsWith(Yt)?`${c}${g}${l}${g}`:i})}function Fa(e,n){let i=0,c=(u)=>{let l=`__stxMod${i++}`,v=JSON.stringify(u);return n.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${v}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(v)} + " is not registered on this page (#1957)");`),l},g=(u,l)=>{for(let v of u.split(",")){let M=v.trim();if(!M)continue;let p=M.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!p)continue;let t=p[1].startsWith('"')?JSON.parse(p[1]):p[1],r=p[2]??t;n.push(`var ${r} = ${l}[${JSON.stringify(t)}];`)}};return e=e.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(u,l,v)=>{let M=v.slice(Yt.length),p=c(M),t=l.trim(),r=t.match(/^([\w$]+)\s*(?:,\s*|$)/);if(r&&!t.startsWith("{")&&!t.startsWith("*"))n.push(`var ${r[1]} = ${p}.default;`),t=t.slice(r[0].length).trim();let d=t.match(/^\*\s*as\s+([\w$]+)$/);if(d)n.push(`var ${d[1]} = ${p};`);else if(t.startsWith("{"))g(t.replace(/^\{|\}$/g,""),p);return""}),e=e.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(u,l)=>(c(l.slice(Yt.length)),"")),e}function ee(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,f.join(e,"index.ts"),f.join(e,"index.tsx"),f.join(e,"index.js"),f.join(e,"index.mjs")];for(let i of n)try{if(j.existsSync(i)&&j.statSync(i,{throwIfNoEntry:!1})?.isFile())return i}catch{}return}function he(e,n,i,c,g,u=new Map,l){let v=(p,t,r)=>{if(V(t,e,l))return null;if(!g||p!==i||!ge.test(t))return null;try{if(!j.statSync(t,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(t);let d=`${Yt}${ja(process.cwd(),t)}`;return u.set(r,d),{path:d,external:!0}},M=(p,t)=>{let r=p===i?n:f.dirname(p),d=f.resolve(r,t);return ee(d)??d};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(t)=>({path:t.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(t)=>({path:t.path,external:!0})),p.onResolve({filter:/^\//},(t)=>{let r=ee(t.path);if(r){let d=v(t.importer,r,t.path);if(d)return d;if(r!==i)c.add(r);return{path:r}}return{path:t.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(t)=>{let r=M(t.importer,t.path),d=v(t.importer,r,t.path);if(d)return d;return c.add(r),{path:r}}),p.onResolve({filter:/^[@~]\//},(t)=>{let r=f.resolve(e,t.path.slice(2)),d=[r,`${r}.ts`,`${r}.tsx`,`${r}.js`,`${r}.mjs`,`${r}.jsx`,f.join(r,"index.ts"),f.join(r,"index.tsx"),f.join(r,"index.js"),f.join(r,"index.mjs")];for(let E of d)if(j.existsSync(E)&&j.statSync(E,{throwIfNoEntry:!1})?.isFile()){let C=v(t.importer,E,t.path);if(C)return C;return I(`resolved ${t.path[0]}/ import:`,t.path,"\u2192",E),c.add(E),{path:E}}return console.warn(`[stx:bundler] could not resolve ${t.path[0]}/ import:`,t.path),{path:r}}),g)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(t)=>{if(t.importer!==i)return;let r=`${Yt}npm:${t.path}`;return u.set(t.path,r),{path:r,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(t)=>{if(V(t.path,e,l))throw Error(`Server-only API source cannot be imported by a client script: ${t.path}`);let r=f.extname(t.path).toLowerCase(),d=r===".json"?"json":r===".tsx"?"tsx":r===".jsx"?"jsx":r===".ts"||r===".mts"||r===".cts"?"ts":"js";if(t.path!==i)c.add(t.path);return{contents:j.readFileSync(t.path,"utf8"),loader:d}})}}}var G=new Map,L=m(64),te=Symbol.for("stx.client-bundle-build-queue");function za(e){let n=globalThis,c=(n[te]??Promise.resolve()).then(e,e);return n[te]=c.then(()=>{return},()=>{return}),c}async function yt(e,n,i={}){let c=i.projectRoot||process.cwd(),g=(await o(c)).serverApi,u=i.minify??!1,l=i.externalizeUserModules??!0,v=i.expose?.length?[...new Set(i.expose)].sort():void 0,M=i.cacheDir||a(c,"bundle-cache"),p=new Bun.CryptoHasher("md5");p.update(`${pe}\x00${Me()}\x00${JSON.stringify(g??!1)}\x00${l?"registry":"inline"}\x00${v?v.join(","):"*"}\x00${e}\x00${n}`);let t=p.digest("hex").slice(0,12),r=f.join(M,`${t}.js`),d=L.get(r);if(d){if(Qt(d.files)&&d.files.every((A)=>!V(A.path,c,g))){I("memo hit:",t);let A=d.files.map((B)=>B.path);return X(n,A),i.collectInputs?.push(...A),d.code}L.delete(r),I("memo invalidated by dep change:",t)}let E=f.join(M,`${t}.deps.json`),C=Bun.file(r);if(await C.exists()){let A=Bun.file(E),B=!1,N=null;if(await A.exists())try{let O=JSON.parse(await A.text());if(O.metadataVersion!==ne||!Array.isArray(O.files))B=!1;else N=O.files,B=!0;if(N&&(!Qt(N)||N.some((D)=>V(D.path,c,g))))B=!1}catch{B=!1}if(B){if(I("cache hit:",t),N)X(n,N.map((D)=>D.path)),i.collectInputs?.push(...N.map((D)=>D.path));let O=await C.text();if(N)L.set(r,{code:O,files:N});return O}I("cache invalidated by dep change:",t)}let _=G.get(t);if(_){let A=await _;if(i.collectInputs)i.collectInputs.push(...(L.get(r)?.files??[]).map((B)=>B.path));return A}let z=za(()=>$e(e,n,{projectRoot:c,minify:u,cacheDir:M,hash:t,cachePath:r,depsPath:E,collectInputs:i.collectInputs,externalizeUserModules:l,serverApi:g,expose:v,throwOnFailure:i.throwOnFailure}));G.set(t,z);try{return await z}finally{G.delete(t)}}var xe=0;function Ha(e){return`${e}-${process.pid}-${++xe}`}async function $e(e,n,i){let{projectRoot:c,minify:g,cacheDir:u,hash:l,cachePath:v,depsPath:M,externalizeUserModules:p}=i,t=a(c,"bundle-tmp"),r=Ha(l),d=f.join(t,`${r}.ts`),E=f.join(t,"out",r);j.mkdirSync(t,{recursive:!0}),j.mkdirSync(E,{recursive:!0});let C=f.dirname(n),_=new Set,z=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,A=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,B=s(e),{depths:N,balanced:O}=we(B),D=(S)=>!O||N[S]===0,b;while((b=z.exec(B))!==null){if(b[1])continue;if(!D(b.index))continue;if(b[2])b[2].split(",").forEach((S)=>{let h=be(S);if(h)_.add(h)});else if(b[3])_.add(b[3])}while((b=A.exec(B))!==null){if(b[1])continue;if(!D(b.index))continue;_.add(b[2])}let se=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((b=se.exec(B))!==null){if(!D(b.index))continue;let S=/^\s*['"]([^'"]+)['"]/.exec(e.slice(b.index+b[0].length))?.[1];if(S&&H.some((h)=>h.test(S)))continue;if(b[1])_.add(b[1]);if(b[2])_.add(b[2]);for(let h of(b[3]??"").split(",")){let y=h.trim();if(!y||/^type\s/.test(y))continue;let U=/\bas\s+(\w+)\s*$/.exec(y)?.[1]??/^\w+$/.exec(y)?.[0];if(U)_.add(U)}}for(let S of B.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let h of S[1].split(",")){let y=/\bas\s+(\w+)\s*$/.exec(h)?.[1]??/^\s*(\w+)\s*$/.exec(h)?.[1];if(y)_.delete(y)}let oe=_.size>0?`
|
|
3
3
|
export { ${[..._].join(", ")} }`:"";await Bun.write(d,e+oe),I("bundling:",l,"from:",f.basename(n));let Y=new Set,Q=new Map;try{let S=await Bun.build({entrypoints:[d],outdir:E,target:"browser",format:"esm",minify:g,plugins:[he(c,C,d,Y,p,Q,i.serverApi)],define:{"process.env.NODE_ENV":g?'"production"':'"development"',...w()},root:c});if(!S.success){let F=S.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${f.basename(n)}`,k=Zt(S.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",F),No(n||"",F,k),i.throwOnFailure||Lo()==="error")throw Error(F);return e}let h="";for(let x of S.outputs){h=await x.text();break}let y=[];for(let x of h.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let k=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k){y.push([k[2],k[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))y.push([T,T])}if(i.expose){let x=new Set(i.expose);for(let F=y.length-1;F>=0;F--)if(!x.has(y[F][0]))y.splice(F,1)}let U=[];h=Fa(Ba(h,Q),U);let le=h.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];h=h.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let K=`__stxBundle_${l}`,ce=y.map(([x,F])=>`${JSON.stringify(x)}: ${F}`).join(", "),ue=y.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
4
|
`),de=y.map(([x])=>`${x} = ${K}[${JSON.stringify(x)}];`).join(`
|
|
5
5
|
`);if(h=`${le.join(`
|
|
@@ -12,4 +12,4 @@ ${h}
|
|
|
12
12
|
return { ${ce} };
|
|
13
13
|
})();
|
|
14
14
|
${de}`.trim(),I("bundled:",l,"output:",h.length,"bytes"),_.size>0&&y.length===0)return console.warn(`[stx:bundler] dropped every binding for ${f.basename(n)} (${l}); serving the unbundled source and not caching this result`),e;j.mkdirSync(u,{recursive:!0}),await Bun.write(v,h);let J=Array.from(Y).map((x)=>{try{return{path:x,mtimeMs:j.statSync(x).mtimeMs}}catch{return null}}).filter((x)=>x!==null);return await Bun.write(M,JSON.stringify({metadataVersion:ne,files:J})),X(n,J.map((x)=>x.path)),i.collectInputs?.push(...J.map((x)=>x.path)),L.set(v,{code:h,files:J}),await me(u),h}catch(S){let h=Zt(S,n||void 0),y=ae(S,n||void 0);if(console.warn(`[stx:bundler] error: ${y}`),No(n||"",y,h),i.throwOnFailure||Lo()==="error")throw S;return e}finally{try{j.rmSync(d,{force:!0}),j.rmSync(E,{recursive:!0,force:!0})}catch{}}}function be(e){let n=e.trim();if(!n)return null;let i=n.indexOf("=");if(i!==-1)n=n.slice(0,i).trim();let c=n.indexOf(":");if(c!==-1)n=n.slice(c+1).trim();if(n.startsWith("..."))n=n.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(n)?n:null}
|
|
15
|
-
export{ie,La,No,gt,mt,
|
|
15
|
+
export{ie,La,No,gt,mt,bu,Lo,ht,Yt,ja,Ba,Fa,za,yt,Ha};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dn,Oe,Ne,he,qo,jn,Z,K,sn,
|
|
2
|
+
import{Dn,Oe,Ne,he,qo,jn,Z,K,sn,d,n,I}from"./chunk-cetdwrqh.js";import{dirname as C,resolve as R}from"path";function h(o){return o.endsWith(".md")||o.endsWith(".markdown")}function _(o){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(s,p){let u;while((u=s.exec(o))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((s,p)=>s.start-p.start);let a="",c=0;for(let s of e){if(s.start<c)continue;a+=o.slice(c,s.start),a+=`@raw${o.slice(s.start,s.end)}@endraw`,c=s.end}return a+=o.slice(c),a}async function b(o,e={}){let{data:r,content:m}=Dn(o),c=await(e.renderer??((s)=>Oe(s)))(m);return{html:_(c),frontmatter:r??{}}}function k(o){let e=o,r=Z(o);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],s=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(o))!==null){let i=u[1],l=u[2],f=u[0],g=i.includes("server");if(p(l))s.push(f);else if(g)c.push(l);else a.push(f)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,f=[];while((l=i.exec(t))!==null){let g=l.index+l[0].length,x=t.indexOf("</script>",g);if(x===-1)continue;f.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let g=f.length-1;g>=0;g--)t=t.substring(0,f[g].start)+t.substring(f[g].end)}for(let i of a)t=t.replace(i,"");return{templateContent:t,serverScripts:c,clientScripts:a,signalsScripts:s}}function v(o,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -9,10 +9,10 @@ import{Dn,Oe,Ne,he,qo,jn,Z,K,sn,u,n,I}from"./chunk-xts31rkc.js";import{dirname a
|
|
|
9
9
|
<body>
|
|
10
10
|
${o}
|
|
11
11
|
</body>
|
|
12
|
-
</html>`}async function To(o,e={}){let r=R(o),
|
|
12
|
+
</html>`}async function To(o,e={}){let r=R(o),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let a=await m.text(),c=null;if(h(r)){let s=await b(a,{renderer:e.markdownRenderer});a=s.html,c=s.frontmatter}if(c)e={...e,context:{...c,...e.context||{}}};if(e.layout){let s=R(e.layout),p=Bun.file(s);if(!await p.exists())throw Error(`Layout template not found: ${s}`);let{layout:u,injectCSS:t,...i}=e,l={...e.context||{}};sn(l);let f=await S(a,r,{...i,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),g=await p.text(),x={...l,content:f},w={...i,context:x,injectCSS:t};return S(g,s,w)}return S(a,r,e)}async function S(o,e,r={}){let{templateContent:m,serverScripts:a,clientScripts:c}=k(o),s={...I,...r.options},p={__filename:e,__dirname:C(e),__stx:{},__stx_options:s,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...jn(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let i of a)await d(i,p,e);let u=new Set,t=m;if(t=await n(t,p,e,s,u),qo(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),c.length>0)t+=`
|
|
13
13
|
${c.join(`
|
|
14
|
-
`)}`}else{if(r.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=Ne(p),
|
|
15
|
-
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${
|
|
14
|
+
`)}`}else{if(r.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=Ne(p),g=(await Promise.all(c.map(async(w)=>{let y=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!y)return w;return await he(y[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})}))).join(`
|
|
15
|
+
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${g}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${
|
|
17
|
+
${g}`}t=await K(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=v(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-x7tsekgw.js");t=await i(t)}catch{}return t}
|
|
18
18
|
export{To};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{bt,Vr,Ur,Wr,wu,qr}from"./chunk-5tgctj1p.js";import"./chunk-j4afmryj.js";import"./chunk-99kt56fn.js";import"./chunk-9ztdvnkk.js";export{Ur as buildServerApi,wu as createServerApi,bt as discoverServerApi,Vr as generateApiTypes,qr as isServerApiSource,Wr as productionApiDispatcher};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ju,ic,is,as,ei,ti,cs,ls,zn,ac,ni,ri,cc,He}from"./chunk-cetdwrqh.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-f6kwahhn.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{ju as clearScriptScanCache,cs as convertServerLoopAttributesToDirectives,ei as convertSignalDirectivesToAttributes,ls as convertSignalLoopsToAttributes,ac as extractExports,ri as findMarkupIndexOutsideScripts,as as hasSignalsSyntax,is as parseLoopExpression,ti as preEvalLiteralReactiveIfs,zn as processScriptSetup,ni as processSignals,cc as rewriteStxImportSpecifiers,ic as scanScriptTags,He as stripStxRuntimeImports};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ho,Yr,Y,Le,vt,x,Be,Fe,Hn,
|
|
2
|
+
import{Ho,Yr,Y,Le,vt,x,Be,Fe,Hn,d,on}from"./chunk-cetdwrqh.js";import{O}from"./chunk-29pn79t5.js";import v from"path";var D=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function F(t,n,e){let r={fullTag:e,content:n,attrs:t};if(/\bserver\b/.test(t))return{...r,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...r,type:"client"};if(D.test(n))return{...r,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...r,type:"client"};return{...r,type:"server"}}var H=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function no(t){let n=[],e=[],r=[],o=0;while(o<t.length){let s=t.indexOf("<",o);if(s===-1)break;let a=Le(t,s);if(a>s){o=a;continue}let i=Y(t,s);if(i>s){let c=t.slice(s,i),u=H.exec(c);if(u){let l=F(u[1],u[2],c);switch(l.type){case"signals":n.push(l);break;case"client":e.push(l);break;case"server":r.push(l);break}}o=i;continue}o=s+(t.startsWith("<!--",s)?4:1)}return{signals:n,client:e,server:r}}var L=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function V(t){let n=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=e.exec(t))!==null)n.push({start:r.index,end:r.index+r[0].length});return n}function P(t,n){return n.some((e)=>t>=e.start&&t<e.end)}function B(t){let n=(t||"").trim();if(!n)return null;if(/[\s>+~,:]/.test(n))return null;let e={},r=n,o=r.match(/^[a-z][\w-]*/i);if(o)e.tag=o[0].toLowerCase(),r=r.slice(o[0].length);while(r.length>0){let s=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(s){if(e.attr=s[1],s[3]!==void 0&&s[3]!=="")e.attrValue=s[3];r=r.slice(s[0].length);continue}let a=r.match(/^#([\w-]+)/);if(a){e.id=a[1],r=r.slice(a[0].length);continue}let i=r.match(/^\.([\w-]+)/);if(i){e.className=i[1],r=r.slice(i[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function q(t,n){if(n.attr){if(!(n.attrValue===void 0?new RegExp(`\\b${n.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${n.attr}\\s*=\\s*(["'])\\s*${n.attrValue}\\s*\\1`,"i")).test(t))return!1}if(n.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${n.id}\\s*\\1`,"i").test(t))return!1}if(n.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(n.className))return!1}return!0}function T(t,n="main"){let e=B(n);if(!e)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,o=V(t),s;while((s=r.exec(t))!==null){if(P(s.index,o))continue;let a=s[1].toLowerCase(),i=s[2]||"";if(i.trimEnd().endsWith("/")||L.has(a))continue;if(e.tag&&e.tag!==a)continue;if(!q(i,e))continue;let c=s[0],u=s.index+c.length,l=new RegExp(`<(/?)${a}\\b([^>]*)>`,"gi");l.lastIndex=u;let f=1,p;while((p=l.exec(t))!==null){if(P(p.index,o))continue;let h=p[1]==="/";if(!h&&(p[2]||"").trimEnd().endsWith("/"))continue;if(f+=h?-1:1,f===0)return{openTag:c,openIndex:s.index,start:u,end:p.index,tagName:a}}return null}return null}var Re="private, no-store";function ro(t){return t.replace(/&#(\d+);/g,(n,e)=>M(Number(e),n)).replace(/&#x([0-9a-f]+);/gi,(n,e)=>M(Number.parseInt(e,16),n)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function M(t,n){if(!Number.isInteger(t)||t<0||t>1114111)return n;try{return String.fromCodePoint(t)}catch{return n}}function ne(t){return t.headers.get("X-STX-Router")==="true"}function z(t,n){if(!t)return n;return t.split(",").some((r)=>r.trim().toLowerCase()===n.toLowerCase())?t:`${t}, ${n}`}function _(t){return{Vary:z(t,"X-STX-Router")}}var G="stx-page-head:",U=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,A={dev:null,prod:null};function W(){let t=O()?"dev":"prod",n=A[t];if(n!==null)return n;try{let e=import.meta.require("./chunk-ecr642nj.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;A[t]=`<script>${r()}</script>`}catch{A[t]=""}return A[t]}async function so(t,n){if(n===!1)return null;if(n&&typeof n==="string"){let r=v.resolve(t,n);if(await Bun.file(r).exists())return r;return null}let e=v.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Sr(t,n){try{let e=await Bun.file(t).text(),r=e,o=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(o)r=o[1].trim();let s=no(e),a=[...s.client.map((m)=>m.fullTag),...s.signals.map((m)=>m.fullTag)],i=[],c=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=c.exec(e))!==null)i.push(u[0]);let l=r;for(let m of s.server)l=l.replace(m.fullTag,"");for(let m of s.client)l=l.replace(m.fullTag,"");l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let f="<!--__STX_PAGE_SLOT__-->";if(l=l.replace(/<slot\s*\/>/gi,f).replace(/<slot\s*>\s*<\/slot>/gi,f),!l.includes(f))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:p,extractVariables:h,defaultConfig:S,loadStxConfig:b}=await import("./chunk-1g8p13wt.js"),R=await b(),g={__filename:t,__dirname:v.dirname(t)};for(let m of a){let C=m.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!m.includes("client")&&!m.includes('type="module"'))await h(C[1],g,t)}let y=await p(l,g,t,{...S,...R,...n},new Set),w=y.indexOf(f);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:y.substring(0,w),afterSlot:y.substring(w+f.length),filePath:t,shellScripts:a,shellStyles:i}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function $n(t,n,e){let r,o="",s=n.match(U);if(s){n=n.replace(s[0],"");try{let l=Buffer.from(s[1],"base64").toString("utf8"),f=l.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(f)r=f[1].trim();o=l.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let a=e||r||"stx App",i=W(),c="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -18,13 +18,13 @@ ${t.shellScripts.filter((l)=>!l.includes("server")).join(`
|
|
|
18
18
|
${c}
|
|
19
19
|
${i}
|
|
20
20
|
</body>
|
|
21
|
-
</html>`}function me(t,n={}){let e=t.trim();if(!on(e))return t;let r=[],o=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(o){let c=o[1],
|
|
22
|
-
`),"utf8").toString("base64")}-->`)}let s=e.match(/<body\b[^>]*>/i),a=e.lastIndexOf("</body>");if(s&&a!==-1){let c=s.index+s[0].length,
|
|
21
|
+
</html>`}function me(t,n={}){let e=t.trim();if(!on(e))return t;let r=[],o=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(o){let c=o[1],u=/<style\b[^>]*>[\s\S]*?<\/style>/gi,l;while((l=u.exec(c))!==null)r.push(l[0]);let f=c.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(f)r.push(f[0]);let p=c.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(p)r.push(p[0])}if(n.preserveHead&&o){let c=[],u=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,l;while((l=u.exec(o[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(l[0]))continue;c.push(l[0])}if(c.length>0)r.unshift(`<!--${G}${Buffer.from(c.join(`
|
|
22
|
+
`),"utf8").toString("base64")}-->`)}let s=e.match(/<body\b[^>]*>/i),a=e.lastIndexOf("</body>");if(s&&a!==-1){let c=s.index+s[0].length,u=e.slice(c,a).trim();if(r.length>0)return r.join(`
|
|
23
23
|
`)+`
|
|
24
|
-
`+
|
|
25
|
-
`));return i=i.replace(/<body\b[^>]*>/i,""),i=i.replace(/<\/body\s*>/i,""),i.trim()}var N=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function X(t,n,e,r){if(!N.test(n))return!1;let o=n.slice(0,n.indexOf(">")+1),s=/\sdata-stx-owner="([^"]+)"/i.exec(o)?.[1];if(!s)return!0;let a=`data-stx-scope="${s}"`;for(let i=t.indexOf(a);i!==-1;i=t.indexOf(a,i+a.length))if(i>=e&&i<r)return!1;return!0}function oo(t){return ne(t)}function re(t,n="main"){let e=t.trim(),r=[],o=[],s=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(s){let b=s[1],R=/<style\b[^>]*>[\s\S]*?<\/style>/gi,
|
|
24
|
+
`+u;return u}let i=e;if(i=i.replace(/<!DOCTYPE\b[^>]*>/i,""),i=i.replace(/<html\b[^>]*>/i,""),i=i.replace(/<\/html\s*>/i,""),o)i=i.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,r.join(`
|
|
25
|
+
`));return i=i.replace(/<body\b[^>]*>/i,""),i=i.replace(/<\/body\s*>/i,""),i.trim()}var N=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function X(t,n,e,r){if(!N.test(n))return!1;let o=n.slice(0,n.indexOf(">")+1),s=/\sdata-stx-owner="([^"]+)"/i.exec(o)?.[1];if(!s)return!0;let a=`data-stx-scope="${s}"`;for(let i=t.indexOf(a);i!==-1;i=t.indexOf(a,i+a.length))if(i>=e&&i<r)return!1;return!0}function oo(t){return ne(t)}function re(t,n="main"){let e=t.trim(),r=[],o=[],s=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(s){let b=s[1],R=/<style\b[^>]*>[\s\S]*?<\/style>/gi,g;while((g=R.exec(b))!==null)r.push(g[0]);let y=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((g=y.exec(b))!==null){if(N.test(g[0])||g[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(g[0]))continue;o.push(g[0])}}let a=T(e,n);if(!a)return me(t);let{tagName:i,start:c,end:u}=a,l=e.slice(c,u).trim(),f=[],p=e.match(/<body\b[^>]*>/i),h=e.lastIndexOf("</body>");if(p&&p.index!==void 0&&h!==-1){let R=[[p.index+p[0].length,a.openIndex],[u+`</${i}>`.length,h]],g=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[y,w]of R){if(y>=w)continue;let m=e.slice(y,w),C;g.lastIndex=0;while((C=g.exec(m))!==null){if(X(e,C[0],c,u))continue;f.push(C[0])}}}let S=[];if(r.length>0)S.push(r.join(`
|
|
26
26
|
`));if(o.length>0)S.push(o.join(`
|
|
27
|
-
`));if(
|
|
27
|
+
`));if(f.length>0)S.push(f.join(`
|
|
28
28
|
`));return S.push(l),S.join(`
|
|
29
|
-
`)}function E(t,n,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function J(t){let n=t.headers.get("content-type")||"",e={},r=(o,s)=>{let a=e[o];if(a===void 0)e[o]=s;else if(Array.isArray(a))a.push(s);else e[o]=[a,s]};if(n.includes("multipart/form-data")){let o=await t.formData();for(let[s,a]of o.entries())if(typeof a==="string")r(s,a);return e}if(n.includes("application/x-www-form-urlencoded")){for(let[o,s]of new URLSearchParams(await t.text()).entries())r(o,s);return e}return e}function kr(t){if(!t)return!1;let n=t.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function I(t,n={}){let e=n.request,r=n.method??e?.method;if(!e||!kr(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let o={};try{o=await J(e)}catch{}let s=await t.action({request:e,form:o,params:n.params??{},query:t.query??{},cookies:n.cookies??{}});if(s&&typeof s==="object"){let a=s,i=K(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...i.length>0?{cookies:i}:{}};let{cookies:
|
|
29
|
+
`)}function E(t,n,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function J(t){let n=t.headers.get("content-type")||"",e={},r=(o,s)=>{let a=e[o];if(a===void 0)e[o]=s;else if(Array.isArray(a))a.push(s);else e[o]=[a,s]};if(n.includes("multipart/form-data")){let o=await t.formData();for(let[s,a]of o.entries())if(typeof a==="string")r(s,a);return e}if(n.includes("application/x-www-form-urlencoded")){for(let[o,s]of new URLSearchParams(await t.text()).entries())r(o,s);return e}return e}function kr(t){if(!t)return!1;let n=t.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function I(t,n={}){let e=n.request,r=n.method??e?.method;if(!e||!kr(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let o={};try{o=await J(e)}catch{}let s=await t.action({request:e,form:o,params:n.params??{},query:t.query??{},cookies:n.cookies??{}});if(s&&typeof s==="object"){let a=s,i=K(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...i.length>0?{cookies:i}:{}};let{cookies:u,redirect:l,...f}=a;if(Object.assign(t,f),i.length>0)return{ran:!0,cookies:i}}return{ran:!0}}function K(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let n=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){n.push(E(e,r));continue}if(r&&typeof r==="object"){let o=r;if(typeof o.value!=="string")continue;n.push(E(e,o.value,o))}}return n}function lo(t,n=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let o of n)r.append("Set-Cookie",o);for(let[o,s]of Object.entries(e??{}))if(o.toLowerCase()!=="location")r.set(o,s);return new Response(null,{status:303,headers:r})}import k from"fs";import j from"path";function io(t,n,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:n,outputDir:e}}function ao(t,n){let e=j.join(n,"manifest.json");k.writeFileSync(e,JSON.stringify(t,null,2))}function co(t){let n=j.join(t,"manifest.json");if(!k.existsSync(n))return null;try{let e=k.readFileSync(n,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}async function It(t,n={}){let{html:e,context:r,redirect:o,cookies:s}=await Z(t,n),a=Be(r),i=Fe(r);if(o)return{html:e,redirect:o,cookies:s,status:a,headers:i};let{extractStreamBoundaries:c}=await import("./chunk-a0grp45v.js"),u=c(r),l=t.streamTemplates;if(l&&Object.keys(l).length>0){let{processDirectives:f}=await import("./chunk-sx89w4af.js"),{defaultConfig:p}=await import("./chunk-bp9snrj7.js"),h=r.streamBoundaries||{},S={...p,autoShell:!1},b=Object.keys(l).map((g)=>({id:g,render:async()=>{let y=typeof h[g]==="function"?await h[g]():void 0;return f(l[g],{...r,$boundary:y},t.sourceFile,S,new Set)}})),R=new Set(b.map((g)=>g.id));u=[...(u||[]).filter((g)=>!R.has(g.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:s,status:a,headers:i}}async function Z(t,n){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...n};if(!t.hasServerScripts&&!Yr(t.html))return{html:t.html,context:e};for(let a of t.serverScriptContent)try{await d(a,e,t.sourceFile)}catch(i){if(n.__stx_strict_hydration)throw i;console.warn(`[stx] Server script error in ${t.sourceFile}:`,i)}let r=await I(e,{request:n.request,method:n.method,params:n.params??{},cookies:n.cookies??{}}),o=(a)=>{let i=a.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),c=Hn(e);if(!c)return i;let u=i.indexOf("</head>");return u<0?c+i:i.slice(0,u)+c+i.slice(u)};if(r.redirect)return{html:t.html,context:e,redirect:r.redirect,cookies:r.cookies};if(!Yr(t.html))return{html:o(t.html),context:e,cookies:r.cookies};let s=new Map;for(let[a,i]of Object.entries(t.placeholders))if(i.expression)try{let c=x(i.expression,e);if(i.type==="raw")s.set(a,c!==void 0&&c!==null?String(c):"");else s.set(a,c!==void 0&&c!==null?vt(String(c)):"")}catch(c){if(n.__stx_strict_hydration)throw c;s.set(a,"")}return{html:o(Ho(t.html,s)),context:e,cookies:r.cookies}}
|
|
30
30
|
export{no,Re,ro,ne,_,so,Sr,$n,me,oo,re,io,ao,co,kr,lo,It};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Mi,Ni}from"./chunk-1p7pws60.js";import"./chunk-ykfkvk67.js";import"./chunk-h9afpxpp.js";import"./chunk-tr25zcf1.js";import"./chunk-cxbp2m66.js";import"./chunk-eqf8985n.js";import"./chunk-4ebwk9cw.js";import"./chunk-tt28sg5z.js";import{no}from"./chunk-16h7wedx.js";import"./chunk-5x9ftmve.js";import"./chunk-gkj42zq7.js";import"./chunk-8sxkvdz2.js";import"./chunk-2542vq5p.js";import"./chunk-28s5x7wv.js";import"./chunk-jzax5rnm.js";import"./chunk-se55qe2x.js";import"./chunk-w6n2j62h.js";import"./chunk-v5rgebzz.js";import"./chunk-zkg0rbmp.js";import"./chunk-sarr8kz1.js";import"./chunk-3fjpg8kb.js";import"./chunk-vvs75dse.js";import"./chunk-vt5k0j68.js";import"./chunk-3pv6f998.js";import"./chunk-5t5ahhjp.js";import"./chunk-k4shjm8n.js";import"./chunk-cgf2a166.js";import"./chunk-7ejq9n1v.js";import"./chunk-r6174yzb.js";import"./chunk-nma8b17c.js";import"./chunk-x3vqyegd.js";import"./chunk-0r7gsny3.js";import"./chunk-2gmbxp60.js";import"./chunk-0ax9kmf8.js";import"./chunk-5tgctj1p.js";import"./chunk-8scw1bes.js";import{he,en,tn,K,d,n,Xn,I,o,le}from"./chunk-cetdwrqh.js";import"./chunk-8adstrk5.js";import"./chunk-wkc34drs.js";import"./chunk-j4afmryj.js";import"./chunk-f6kwahhn.js";import"./chunk-99kt56fn.js";import"./chunk-s10r6hxp.js";import"./chunk-tbef3yyk.js";import"./chunk-ab7vh24b.js";import"./chunk-pf0d8y9n.js";import"./chunk-01nx6zcw.js";import"./chunk-9ztdvnkk.js";import"./chunk-pcq6vphz.js";export{Xn as buildWebComponents,tn as cacheTemplate,en as checkCache,no as classifyAllScripts,Mi as createMiddleware,Ni as createRoute,I as defaultConfig,d as extractVariables,K as injectRouterScript,o as loadStxConfig,he as processClientScript,n as processDirectives,le as readMarkdownFile};
|