@stacksjs/stx 0.2.256 → 0.2.258
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-zpqeanz0.js → chunk-0wppscm7.js} +1 -1
- package/dist/{chunk-evsjmnab.js → chunk-16awvchc.js} +1 -1
- package/dist/{chunk-6b5zavzf.js → chunk-22av7jsc.js} +1 -1
- package/dist/{chunk-8ja3f8j2.js → chunk-35p7ts50.js} +1 -1
- package/dist/{chunk-z26bejxp.js → chunk-385q36qn.js} +1 -1
- package/dist/{chunk-59ck17tv.js → chunk-3epp1pgx.js} +1 -1
- package/dist/{chunk-t6zmbx2w.js → chunk-6vgfcy8f.js} +1 -1
- package/dist/{chunk-s00b6dpf.js → chunk-90gket7c.js} +1 -1
- package/dist/{chunk-75qrx4ak.js → chunk-92v2162p.js} +1 -1
- package/dist/{chunk-w21mhwwj.js → chunk-9rw3z4t7.js} +27 -27
- package/dist/{chunk-45hcw6vg.js → chunk-ay8wwp7x.js} +1 -1
- package/dist/{chunk-pygn625j.js → chunk-b4th3fst.js} +2 -2
- package/dist/{chunk-b0qhq1ze.js → chunk-bsc8ggfh.js} +1 -1
- package/dist/{chunk-1kcc9prg.js → chunk-edxh2d0d.js} +1 -1
- package/dist/{chunk-s9npyz6a.js → chunk-hgssafhg.js} +1 -1
- package/dist/{chunk-q5p5wgr0.js → chunk-hp2tdpq2.js} +1 -1
- package/dist/{chunk-mne5mkv3.js → chunk-jengmn92.js} +1 -1
- package/dist/{chunk-j3mjn4k0.js → chunk-keeas4pc.js} +1 -1
- package/dist/{chunk-zap3w3y4.js → chunk-kfs48te0.js} +1 -1
- package/dist/{chunk-a6vjcam5.js → chunk-mxym7k6w.js} +1 -1
- package/dist/{chunk-h84j5t0v.js → chunk-ngjg4xth.js} +1 -1
- package/dist/{chunk-ezzc1210.js → chunk-npmp6a2c.js} +1 -1
- package/dist/{chunk-k6hqf109.js → chunk-p7vxtybd.js} +1 -1
- package/dist/{chunk-pbycsx6y.js → chunk-pb11vxep.js} +1 -1
- package/dist/{chunk-m093wakn.js → chunk-pqm9181x.js} +1 -1
- package/dist/{chunk-0t8ht3f7.js → chunk-qt0evm5e.js} +8 -8
- package/dist/{chunk-wwq97x6g.js → chunk-qxw0v2wz.js} +1 -1
- package/dist/{chunk-1p11nd9a.js → chunk-r8f2xb95.js} +1 -1
- package/dist/{chunk-460kaaht.js → chunk-t581wxnt.js} +1 -1
- package/dist/{chunk-0mafwk5m.js → chunk-tbx3d1j9.js} +1 -1
- package/dist/{chunk-bj2zzyys.js → chunk-td67r5qj.js} +1 -1
- package/dist/{chunk-8k3xs9yw.js → chunk-te87a619.js} +2 -2
- package/dist/{chunk-a04q05nt.js → chunk-vq6h3jv1.js} +1 -1
- package/dist/{chunk-f04h3ffv.js → chunk-w1sa237y.js} +1 -1
- package/dist/{chunk-12w8nzx5.js → chunk-w9q0zj9q.js} +1 -1
- package/dist/{chunk-e30y48zc.js → chunk-wwsrd40w.js} +1 -1
- package/dist/{chunk-2ttjcdyr.js → chunk-xjywr72b.js} +1 -1
- package/dist/{chunk-te6rd78j.js → chunk-xt5t2b88.js} +1 -1
- package/dist/{chunk-cnv1jvv5.js → chunk-yqknwa4r.js} +1 -1
- package/dist/{chunk-addhg02d.js → chunk-yz233j7e.js} +1 -1
- package/dist/{chunk-hwvqem4d.js → chunk-zcqadg47.js} +1 -1
- package/dist/{chunk-fqycvn7v.js → chunk-zsg2z6hb.js} +1 -1
- package/dist/{chunk-y3f3xdbz.js → chunk-ztkfhdf0.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/client-script.js +11 -2
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/includes.js +2 -0
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Pq as x,Sl as Y}from"./chunk-
|
|
2
|
+
import{Pq as x,Sl as Y}from"./chunk-9rw3z4t7.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-w9q0zj9q.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";import A from"path";var C=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],y=new Set(C);var Z=new Map,I=new Set,P=new Set(C);function R(){Z.clear()}function D(G){let H=new Map;for(let z of G){let K=A.basename(z);if(K.endsWith(".d.ts"))continue;let J=K.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===K)continue;let X=H.get(J);if(X&&!X.endsWith(".js"))continue;H.set(J,z)}return[...H.values()].sort()}function L(G,H){let z=H.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${z}\\b`).test(G)}function k(G){if(!G)return[];let H=G.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let K of P){if(I.has(K))continue;let J=K.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test(H))z.push(K)}return z.sort()}async function _(G,H){let z=k(G);if(z.length===0)return null;let K=H??A.join(import.meta.dir,"composables"),J=`${K}\x00${z.join(",")}`,X=Z.get(J);if(X!==void 0)return X||null;let T=x({loader:"ts",target:"browser",define:Y()}),B=new Set(z),F=[],w=new Set,$=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:K,absolute:!0}))$.push(j)}catch{return Z.set(J,""),null}$=D($);for(let q of $){let j;try{j=await Bun.file(q).text()}catch{continue}let W=[];try{W=T.scan(j).exports.filter((Q)=>Q!=="default")}catch{continue}if(!W.some((Q)=>B.has(Q)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),F.push(`// ${A.basename(q).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${T.transformSync(j).trim()}`);for(let Q of W)w.add(Q)}catch(Q){console.warn(`[stx] framework composable ${A.basename(q)} could not be bundled:`,Q)}}let U=z.filter((q)=>!w.has(q)&&!L(G,q));if(U.length>0)console.warn(`[stx] could not bundle ${U.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(F.length===0)return Z.set(J,""),null;let M=[...w].map((q)=>` try { if (!(${JSON.stringify(q)} in __s)) { __s[${JSON.stringify(q)}] = ${q}; if (!(${JSON.stringify(q)} in window)) window[${JSON.stringify(q)}] = ${q}; } } catch (e) {}`).join(`
|
|
4
4
|
`),V=`<script data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$l as k,Rl as c,Ul as d,Vl as e,Wl as f,Xl as g,Yl as h,Zl as i,_l as j,am as l,bm as m}from"./chunk-
|
|
2
|
+
import{$l as k,Rl as c,Ul as d,Vl as e,Wl as f,Xl as g,Yl as h,Zl as i,_l as j,am as l,bm as m}from"./chunk-9rw3z4t7.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import{Ls as a,Ms as b}from"./chunk-g8tce9rr.js";import"./chunk-w9q0zj9q.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{h as transformAutoImports,b as stripCommentsAndLiterals,e as renderVendorStyleTags,m as processClientScript,g as injectBrowserCoreAutoImports,l as generateServerDataBridge,j as generateBrowserAutoImportDestructuring,i as generateAutoImportDestructuring,a as findInterpolationEnd,k as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Aq as T,mm as E,nm as M}from"./chunk-
|
|
2
|
+
import{Aq as T,mm as E,nm as M}from"./chunk-9rw3z4t7.js";import{Fu as d,Hu as c,Iu as i}from"./chunk-aw651z2y.js";import{Pu as m,Su as p}from"./chunk-0y6f4037.js";var y=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function f(z,Q,F){let J={fullTag:F,content:Q,attrs:z};if(/\bserver\b/.test(z))return{...J,type:"server"};if(/\bdata-stx-scoped\b/.test(z))return{...J,type:"client"};if(y.test(Q))return{...J,type:"signals"};if(/\bclient\b/.test(z)||/\btype\s*=\s*["']module["']/.test(z)||/\bsrc\s*=/.test(z))return{...J,type:"client"};return{...J,type:"server"}}var g=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function P(z){let Q=[],F=[],J=[],$=0;while($<z.length){let Y=z.indexOf("<",$);if(Y===-1)break;let K=M(z,Y);if(K>Y){$=K;continue}let Z=E(z,Y);if(Z>Y){let B=z.slice(Y,Z),U=g.exec(B);if(U){let X=f(U[1],U[2],B);switch(X.type){case"signals":Q.push(X);break;case"client":F.push(X);break;case"server":J.push(X);break}}$=Z;continue}$=Y+(z.startsWith("<!--",Y)?4:1)}return{signals:Q,client:F,server:J}}var s="X-STX-Router",a="private, no-store";function R(z){return z.headers.get("X-STX-Router")==="true"}function u(z,Q){if(!z)return Q;return z.split(",").some((J)=>J.trim().toLowerCase()===Q.toLowerCase())?z:`${z}, ${Q}`}function t(z){return{Vary:u(z,"X-STX-Router")}}import L from"path";d();var h="stx-page-head:",o=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,I=null;function r(){if(I!==null)return I;try{let{getRouterScript:z}=(i(),m(c));I=`<script>${z()}</script>`}catch{I=""}return I}async function Yz(z,Q){if(Q===!1)return null;if(Q&&typeof Q==="string"){let J=L.resolve(z,Q);if(await Bun.file(J).exists())return J;return null}let F=L.join(z,"app.stx");if(await Bun.file(F).exists())return F;return null}async function Zz(z,Q){try{let F=await Bun.file(z).text(),J=F,$=F.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)J=$[1].trim();let Y=P(F),K=[...Y.client.map((j)=>j.fullTag),...Y.signals.map((j)=>j.fullTag)],Z=[],B=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,U;while((U=B.exec(F))!==null)Z.push(U[0]);let X=J;for(let j of Y.server)X=X.replace(j.fullTag,"");for(let j of Y.client)X=X.replace(j.fullTag,"");X=X.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let W="<!--__STX_PAGE_SLOT__-->";if(X=X.replace(/<slot\s*\/>/gi,W).replace(/<slot\s*>\s*<\/slot>/gi,W),!X.includes(W))return console.warn(`[stx] Shell ${z} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:q,extractVariables:k,defaultConfig:v,loadStxConfig:H}=await import("./chunk-t581wxnt.js"),w=await H(),A={__filename:z,__dirname:L.dirname(z)};for(let j of K){let N=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(N&&!j.includes("client")&&!j.includes('type="module"'))await k(N[1],A,z)}let V=await q(X,A,z,{...v,...w,...Q},new Set),G=V.indexOf(W);if(G===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:V.substring(0,G),afterSlot:V.substring(G+W.length),filePath:z,shellScripts:K,shellStyles:Z}}catch(F){return console.error(`[stx] Error processing shell ${z}:`,F),null}}function $z(z,Q,F){let J,$="",Y=Q.match(o);if(Y){Q=Q.replace(Y[0],"");try{let X=Buffer.from(Y[1],"base64").toString("utf8"),W=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(W)J=W[1].trim();$=X.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let K=F||J||"stx App",Z=r(),B="<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">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dp as a,Ep as b,Fp as c,Gp as d,Hp as e,Ip as f}from"./chunk-
|
|
2
|
+
import{Dp as a,Ep as b,Fp as c,Gp as d,Hp as e,Ip as f}from"./chunk-9rw3z4t7.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-w9q0zj9q.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Hq as H,Zq as x,cs as g,tm as O,vp as R}from"./chunk-
|
|
2
|
+
import{Hq as H,Zq as x,cs as g,tm as O,vp as R}from"./chunk-9rw3z4t7.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(Z.name,H(Z.content,j,q,G,$))}K.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{il as _,jl as u}from"./chunk-0ha9e1wt.js";import{Sl as h,fs as n}from"./chunk-
|
|
2
|
+
import{il as _,jl as u}from"./chunk-0ha9e1wt.js";import{Sl as h,fs as n}from"./chunk-9rw3z4t7.js";import{mt as N}from"./chunk-dnhckx52.js";import K from"path";import M from"fs";var s=5,c=1,p=new Map;function $w(z){return p.get(z)??[]}function o(z,w){if(z)p.set(z,w)}function t(z=process.env){return z.STX_DEBUG==="true"||z.STX_DEBUG==="1"}function T(...z){if(t())console.log("[stx:bundler]",...z)}var D=[];function b(z,w,Y){D.push({filePath:z||"<inline>",message:w,details:Y})}function Qw(){return D.slice()}function Xw(){D.length=0}var F;function Hw(z){F=z}function f(){if(F)return F;try{let z=n.strict;return typeof z==="object"&&z!==null?z.bundlerFallback??"warn":"warn"}catch{return"warn"}}var g=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function qw(z){let w=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=w.exec(z))!==null){let j=Y[1];if(!g.some((G)=>G.test(j)))return T("detected user import:",j),!0}let Z=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=Z.exec(z))!==null){let j=Y[1];if(/\.css(?:\?.*)?$/.test(j))continue;if(!g.some((G)=>G.test(j)))return T("detected side-effect import:",j),!0}return!1}function a(z,w,Y,Z){let j=(Q,G)=>{let J=Q===Y?w:K.dirname(Q),W=K.resolve(J,G),X=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,K.join(W,"index.ts"),K.join(W,"index.tsx"),K.join(W,"index.js"),K.join(W,"index.mjs")];for(let S of X)try{if(M.existsSync(S)&&M.statSync(S,{throwIfNoEntry:!1})?.isFile())return S}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(M.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let J=j(G.importer,G.path);return Z.add(J),{path:J}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let J=K.resolve(z,G.path.slice(2)),W=[J,`${J}.ts`,`${J}.tsx`,`${J}.js`,`${J}.mjs`,`${J}.jsx`,K.join(J,"index.ts"),K.join(J,"index.tsx"),K.join(J,"index.js"),K.join(J,"index.mjs")];for(let X of W)if(M.existsSync(X)&&M.statSync(X,{throwIfNoEntry:!1})?.isFile())return T(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",X),Z.add(X),{path:X};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:J}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let J=K.extname(G.path).toLowerCase(),W=J===".json"?"json":J===".tsx"?"tsx":J===".jsx"?"jsx":J===".ts"||J===".mts"||J===".cts"?"ts":"js";if(G.path!==Y)Z.add(G.path);return{contents:M.readFileSync(G.path,"utf8"),loader:W}})}}}var R=new Map,m=Symbol.for("stx.client-bundle-build-queue");function e(z){let w=globalThis,Z=(w[m]??Promise.resolve()).then(z,z);return w[m]=Z.then(()=>{return},()=>{return}),Z}async function Mw(z,w,Y={}){let Z=Y.projectRoot||process.cwd(),j=Y.minify??!1,Q=Y.cacheDir||N(Z,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${s}\x00${z}\x00${w}`);let J=G.digest("hex").slice(0,12),W=K.join(Q,`${J}.js`),X=K.join(Q,`${J}.deps.json`),S=Bun.file(W);if(await S.exists()){let k=Bun.file(X),I=!0;if(await k.exists())try{let O=JSON.parse(await k.text());if(O.metadataVersion!==c||!Array.isArray(O.files))I=!1;for(let q of Array.isArray(O.files)?O.files:[])try{if(M.statSync(q.path).mtimeMs!==q.mtimeMs){I=!1;break}}catch{I=!1;break}}catch{I=!1}if(I){T("cache hit:",J);try{let O=JSON.parse(await Bun.file(X).text());o(w,(O.files??[]).map((q)=>q.path))}catch{}return await S.text()}T("cache invalidated by dep change:",J)}let y=R.get(J);if(y)return await y;let x=e(()=>ww(z,w,{projectRoot:Z,minify:j,cacheDir:Q,hash:J,cachePath:W,depsPath:X}));R.set(J,x);try{return await x}finally{R.delete(J)}}async function ww(z,w,Y){let{projectRoot:Z,minify:j,cacheDir:Q,hash:G,cachePath:J,depsPath:W}=Y,X=N(Z,"bundle-tmp"),S=K.join(X,`${G}.ts`),y=K.join(X,"out",G);M.mkdirSync(X,{recursive:!0}),M.mkdirSync(y,{recursive:!0});let x=K.dirname(w),k=[],I=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,O=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,q;while((q=I.exec(z))!==null){if(q[1])continue;if(q[2])q[2].split(",").forEach((V)=>{let H=zw(V);if(H)k.push(H)});else if(q[3])k.push(q[3])}while((q=O.exec(z))!==null){if(q[1])continue;k.push(q[2])}let E=k.length>0?`
|
|
3
3
|
export { ${k.join(", ")} }`:"";await Bun.write(S,z+E),T("bundling:",G,"from:",K.basename(w));let B=new Set;try{let V=await Bun.build({entrypoints:[S],outdir:y,target:"browser",format:"esm",minify:j,plugins:[a(Z,x,S,B)],define:{"process.env.NODE_ENV":j?'"production"':'"development"',...h()},root:Z});if(!V.success){let U=V.logs.filter((L)=>L.level==="error").map((L)=>L.message).join(", ")||`Unable to bundle ${K.basename(w)}`,A=_(V.logs,w||void 0);if(console.warn("[stx:bundler] build failed:",U),b(w||"",U,A),f()==="error")throw Error(U);return z}let H="";for(let $ of V.outputs){H=await $.text();break}let C=[];for(let $ of H.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let U of $[1].split(",")){let A=U.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(A){C.push([A[2],A[1]]);continue}let L=U.trim();if(/^[A-Za-z_$][\w$]*$/.test(L))C.push([L,L])}let r=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 v=`__stxBundle_${G}`,d=C.map(([$,U])=>`${JSON.stringify($)}: ${U}`).join(", "),l=C.map(([$])=>`var ${$} = undefined;`).join(`
|
|
4
4
|
`),i=C.map(([$])=>`${$} = ${v}[${JSON.stringify($)}];`).join(`
|
|
5
5
|
`);if(H=`${r.join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Hq as X,zm as W}from"./chunk-
|
|
2
|
+
import{Hq as X,zm as W}from"./chunk-9rw3z4t7.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
|
|
3
3
|
${j.bold}${q[0]}${j.reset} - ${A.description}`),console.log(` Usage: ${j.cyan}${A.usage}${j.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${j.bold}Available Commands:${j.reset}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Am as m,Bm as n,Cm as o,om as a,pm as b,qm as c,rm as d,sm as e,tm as f,um as g,vm as h,wm as i,xm as j,ym as k,zm as l}from"./chunk-
|
|
2
|
+
import{Am as m,Bm as n,Cm as o,om as a,pm as b,qm as c,rm as d,sm as e,tm as f,um as g,vm as h,wm as i,xm as j,ym as k,zm as l}from"./chunk-9rw3z4t7.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-w9q0zj9q.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{h as usesSignalsInScript,o as unescapeHtml,c as registerFilters,b as registerFilter,l as processExpressions,k as interpolateScriptsInTemplate,i as interpolateScriptExpressions,j as interpolateScriptAttributes,d as getAllFilters,n as evaluateExpression,g as escapeHtmlValue,f as escapeHtml,a as defaultFilters,e as clearCustomFilters,m as applyFilters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ap as j,rp as a,sp as b,tp as c,up as d,vp as e,wp as f,xp as g,yp as h,zp as i}from"./chunk-
|
|
2
|
+
import{Ap as j,rp as a,sp as b,tp as c,up as d,vp as e,wp as f,xp as g,yp as h,zp as i}from"./chunk-9rw3z4t7.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-w9q0zj9q.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
|