@stacksjs/stx 0.2.783 → 0.2.784
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-dg0jp3s3.js → chunk-03zdbm2r.js} +1 -1
- package/dist/chunk-0d8vq9dz.js +2 -0
- package/dist/{chunk-rgvrt6mw.js → chunk-10az8e1m.js} +2 -2
- package/dist/{chunk-76g51m0r.js → chunk-1165h1nv.js} +1 -1
- package/dist/{chunk-5pjvhgej.js → chunk-16yv309r.js} +1 -1
- package/dist/{chunk-pty7k0d2.js → chunk-1gt56hdz.js} +1 -1
- package/dist/{chunk-88jqeekv.js → chunk-1kxj9mh7.js} +1 -1
- package/dist/chunk-1p8rbjf9.js +2 -0
- package/dist/{chunk-dnr8jmcy.js → chunk-2303xycv.js} +1 -1
- package/dist/chunk-32s07ych.js +2 -0
- package/dist/{chunk-t371tew4.js → chunk-3q807nyz.js} +1 -1
- package/dist/{chunk-wbtca8ga.js → chunk-5hy66mfn.js} +4 -4
- package/dist/{chunk-9cmvsbpe.js → chunk-5r1rdpeg.js} +2 -2
- package/dist/{chunk-g1sg1w0g.js → chunk-5rf2j30w.js} +1 -1
- package/dist/{chunk-7nvxgt19.js → chunk-64gbacyk.js} +1 -1
- package/dist/{chunk-pnn0x21f.js → chunk-7k27y6z1.js} +1 -1
- package/dist/{chunk-kc5npv29.js → chunk-7v0psycp.js} +1 -1
- package/dist/chunk-7xh512ta.js +2 -0
- package/dist/chunk-8ge4x4yx.js +2 -0
- package/dist/{chunk-h2tkfak2.js → chunk-8rn1m9d1.js} +1 -1
- package/dist/{chunk-emjt4a58.js → chunk-9j4xbeqs.js} +1 -1
- package/dist/{chunk-x9ev48te.js → chunk-asbpp9m0.js} +1 -1
- package/dist/{chunk-bys2jh42.js → chunk-bc91m8x8.js} +1 -1
- package/dist/{chunk-sgj36ds4.js → chunk-dqpqc5ps.js} +1 -1
- package/dist/{chunk-pet0pact.js → chunk-e22v0ad2.js} +1 -1
- package/dist/{chunk-8n4zff12.js → chunk-ert36h3v.js} +2 -2
- package/dist/{chunk-zds8fmd3.js → chunk-fs0nrg7g.js} +5 -5
- package/dist/chunk-g2gk5qen.js +3 -0
- package/dist/chunk-ghn1y4ky.js +2 -0
- package/dist/chunk-ghxsmeh8.js +2 -0
- package/dist/chunk-gt8n286r.js +2 -0
- package/dist/{chunk-9wb2kk92.js → chunk-h5tjm191.js} +1 -1
- package/dist/chunk-hp44x2dq.js +2 -0
- package/dist/{chunk-dd6ekezj.js → chunk-j288z01t.js} +2 -2
- package/dist/{chunk-yewd8836.js → chunk-j2qv5ra2.js} +9 -4
- package/dist/{chunk-6wttrxfq.js → chunk-jqnkcekm.js} +1 -1
- package/dist/{chunk-jvpp6ds2.js → chunk-k86mzdbd.js} +1 -1
- package/dist/{chunk-m24mv9fe.js → chunk-kcfvdw3r.js} +1 -1
- package/dist/chunk-kv9qbqr9.js +2 -0
- package/dist/{chunk-9sp2jz6a.js → chunk-kzn32p5w.js} +1 -1
- package/dist/{chunk-dd9bt8df.js → chunk-mcxk1ajm.js} +4 -4
- package/dist/{chunk-s0t7ffrx.js → chunk-n70ry0hg.js} +4 -4
- package/dist/{chunk-8dgxebzq.js → chunk-ne3hamzf.js} +1 -1
- package/dist/{chunk-8wt4c799.js → chunk-nw355jn6.js} +1 -1
- package/dist/{chunk-70ete7t4.js → chunk-nzec39ym.js} +1 -1
- package/dist/{chunk-3jgb1vcc.js → chunk-p3t400qx.js} +3 -3
- package/dist/{chunk-1cm6011j.js → chunk-p8185yw2.js} +1 -1
- package/dist/{chunk-gnkyh1ax.js → chunk-p9gkz451.js} +4 -4
- package/dist/{chunk-efz96s8y.js → chunk-pagra8jv.js} +1 -1
- package/dist/{chunk-412jdkys.js → chunk-qbtb9pwe.js} +1 -1
- package/dist/{chunk-npav1grn.js → chunk-rn9m8bmc.js} +1 -1
- package/dist/{chunk-9073rpgf.js → chunk-rtam1h61.js} +1 -1
- package/dist/{chunk-83yd1h6k.js → chunk-s2cj9jq6.js} +1 -1
- package/dist/{chunk-mj7agxkf.js → chunk-sckd8v0d.js} +1 -1
- package/dist/{chunk-681t1ts7.js → chunk-skn2n8jt.js} +2 -2
- package/dist/{chunk-qtcxy3y3.js → chunk-t619ap22.js} +1 -1
- package/dist/{chunk-jbw2dpx1.js → chunk-tshgbpwy.js} +1 -1
- package/dist/{chunk-sdtmerd5.js → chunk-v4a9dv4h.js} +1 -1
- package/dist/chunk-vasw2fn4.js +2 -0
- package/dist/{chunk-krkzkp91.js → chunk-wfefjm2x.js} +2 -2
- package/dist/{chunk-v4dwt843.js → chunk-wphv66vs.js} +2 -2
- package/dist/{chunk-6w2zqayq.js → chunk-ww636tcm.js} +1 -1
- package/dist/{chunk-rmg1eesq.js → chunk-wx6h1xs3.js} +6 -6
- package/dist/{chunk-h232y76x.js → chunk-x5a7sm43.js} +1 -1
- package/dist/{chunk-cfyntnhe.js → chunk-xzb6gaq4.js} +1 -1
- package/dist/chunk-z9wzmdvp.js +2 -0
- 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-03vwhpj8.js +0 -2
- package/dist/chunk-0f6h23m1.js +0 -3
- package/dist/chunk-2xafghw0.js +0 -2
- package/dist/chunk-6eck3ner.js +0 -2
- package/dist/chunk-81x01c9b.js +0 -2
- package/dist/chunk-86rnatzb.js +0 -2
- package/dist/chunk-8w211y5h.js +0 -2
- package/dist/chunk-cernr99x.js +0 -2
- package/dist/chunk-d0mrdbdw.js +0 -2
- package/dist/chunk-fcb9c5p6.js +0 -2
- package/dist/chunk-jrhttwd8.js +0 -2
- package/dist/chunk-vyy6768n.js +0 -2
- package/dist/chunk-y1zq7txb.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lr,no,Dg,Sl,ro}from"./chunk-
|
|
2
|
+
import{Lr,no,Dg,Sl,ro}from"./chunk-wfefjm2x.js";export{Dg as buildModuleRegistryScript,ro as buildSharedModuleRegistries,Sl as exportsMutableBinding,Lr as registeredModuleIdsIn,no as registeredModuleNamesIn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{us,or,Pf}from"./chunk-dqpqc5ps.js";import"./chunk-he85ksa7.js";import"./chunk-5r1rdpeg.js";import"./chunk-p9gkz451.js";import"./chunk-wj78td69.js";import"./chunk-skn2n8jt.js";import"./chunk-1165h1nv.js";import"./chunk-zxfptbac.js";import"./chunk-605b93pe.js";import"./chunk-x8js27hd.js";import"./chunk-j2qv5ra2.js";import{Pt}from"./chunk-wx6h1xs3.js";import"./chunk-64gbacyk.js";import"./chunk-27rzdq3n.js";import"./chunk-bq9xf8nq.js";import"./chunk-2yxva96k.js";import"./chunk-9f6qx8b9.js";export{Pf as declareBareLoopHead,Pt as parseLoopBinding,or as processLoops,us as reportDeferredLoopWarnings};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{b,x,ui,fn}from"./chunk-
|
|
2
|
+
import{b,x,ui,fn}from"./chunk-wx6h1xs3.js";import{qo}from"./chunk-nw355jn6.js";import{l}from"./chunk-jdj1358b.js";import M from"fs";import d from"path";import{hasLocalConfig as le}from"bunfig";var bt={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Xe(n){return`--stx-${n}`}function F(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var xe=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function X(n,t){let s=t.trim();return F(n,s)??(xe.test(s)?s:void 0)}function Z(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!bt[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!ye[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!Ae[t]).map((t)=>`density.${t}`)]}function q(n){let t={};for(let[s,r]of Object.entries(bt)){let i=F(n,r.light);if(i===void 0)continue;t[s]=`var(${Xe(s)}, ${i})`}return t}function ee(n,t={}){let s=[],r=[];for(let[i,o]of Object.entries(bt)){let a=t[i],g=typeof a==="string"?a:a?.light,c=typeof a==="string"?a:a?.dark,u=g&&X(n,g)||F(n,o.light),m=c&&X(n,c)||F(n,o.dark);if(u===void 0)continue;if(s.push(` ${Xe(i)}: ${u};`),m!==void 0)r.push(` ${Xe(i)}: ${m};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
|
|
3
3
|
`)}var ye={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function an(n){return`--stx-radius-${n}`}function te(){let n={};for(let[t,s]of Object.entries(ye))n[t]=`var(${an(t)}, ${s.value})`;return n}function ne(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(ye).map(([t,s])=>` ${an(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
4
4
|
`)}var Ae={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},nr={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},rr={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function Ge(n){return`--stx-${n}`}function V(n){let t=Ae[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${Ge(n)}, ${t.value})`}function se(){let n={};for(let[t,s]of Object.entries(nr))n[t]=V(s);return n}function re(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(rr))n[t]=[V(s),{lineHeight:V(r)}];return n}function ie(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Ae).map(([t,s])=>` ${Ge(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
5
5
|
`)}function oe(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function U(n,t){let s={...n};for(let[r,i]of Object.entries(t))s[r]=oe(i)&&oe(s[r])?U(s[r],i):i;return s}function ce(n,t){if(!t.fonts)return"";let s=new n({...t.config,fonts:t.fonts,cssVariables:!1}).toCSS(!1,t.minify);return s&&!t.minify?`${s}
|
|
6
|
-
`:s}function ae(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...o}=r,{extend:a,...g}=s,c=g.colors||{};g.colors={...c,...q(c)};let u=g.borderRadius||{};g.borderRadius={...u,...te()};let m=g.spacing||{};g.spacing={...m,...se()};let H=g.fontSize||{};g.fontSize={...H,...re()};let R=U(g,o),k=U(a||{},i||{});if(Object.keys(k).length>0)R.extend=k;let E=[...n.safelist||[],...t.safelist||[]],_={...n.shortcuts||{},...t.shortcuts||{}},P=[...n.preflights||[],...t.preflights||[]],{fonts:K,...D}=n,{fonts:O,roles:T,shapes:N,density:C,...w}=t,f={roles:T,shapes:N,density:C},j=O??K;return{config:{...D,...w,theme:R,safelist:E,shortcuts:_,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:E,shortcuts:_,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ee({...c,...R.colors},T)+ne(N)+ie(C),unknownRoles:Z(f),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var p=null,A="";function de(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;A=`${t}@${Math.trunc(M.statSync(t).mtimeMs)}`}catch{A=n}}var Q=!1,v=null,I="",B=!1,pe=256,S=new Map,h=new Map,z=null,he=null,G=new Map,ge=new Set;function L(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function W(n,t){if(S.has(n))S.delete(n);else if(S.size>=pe)S.delete(S.keys().next().value);S.set(n,t)}function ke(n){let t=L(n);if(h.has(t))h.delete(t);else if(h.size>=pe)h.delete(h.keys().next().value);return h.set(t,n),t}function xh(n){let t=h.get(n);if(t===void 0)return;return h.delete(n),h.set(n,t),t}async function Ce(n,t=z){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${L(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Se(n,t,s=z){if(!s)return;try{if(!M.existsSync(s))M.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${L(n)}.css`),t)}catch{}}async function ue(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var we=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],be=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ve(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of we)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Re(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function nc(){if(Q)return p;Q=!0;try{let n=async(i)=>{for(let o of i){if(!await Bun.file(o).exists())continue;let a=await ue(o);if(a){if(de(o),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(o))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),o=await n([i]);if(!o)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=o,p}let t=await n(ve());if(t)return p=t,p;let s=be;for(let i of s){let o=await ue(i);if(o){p=o;try{de(import.meta.resolve(i))}catch{A=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Re());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Sh(){Y.clear(),p=null,Q=!1,v=null,I="",S.clear(),h.clear(),he=null,G.clear()}var fe=!1;async function rc(n){try{let t=le({name:"css",cwd:n})?"css":le({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!fe)fe=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function Cf(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-
|
|
6
|
+
`:s}function ae(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...o}=r,{extend:a,...g}=s,c=g.colors||{};g.colors={...c,...q(c)};let u=g.borderRadius||{};g.borderRadius={...u,...te()};let m=g.spacing||{};g.spacing={...m,...se()};let H=g.fontSize||{};g.fontSize={...H,...re()};let R=U(g,o),k=U(a||{},i||{});if(Object.keys(k).length>0)R.extend=k;let E=[...n.safelist||[],...t.safelist||[]],_={...n.shortcuts||{},...t.shortcuts||{}},P=[...n.preflights||[],...t.preflights||[]],{fonts:K,...D}=n,{fonts:O,roles:T,shapes:N,density:C,...w}=t,f={roles:T,shapes:N,density:C},j=O??K;return{config:{...D,...w,theme:R,safelist:E,shortcuts:_,...P.length>0?{preflights:P}:{},content:[],output:""},safelist:E,shortcuts:_,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ee({...c,...R.colors},T)+ne(N)+ie(C),unknownRoles:Z(f),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var p=null,A="";function de(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;A=`${t}@${Math.trunc(M.statSync(t).mtimeMs)}`}catch{A=n}}var Q=!1,v=null,I="",B=!1,pe=256,S=new Map,h=new Map,z=null,he=null,G=new Map,ge=new Set;function L(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function W(n,t){if(S.has(n))S.delete(n);else if(S.size>=pe)S.delete(S.keys().next().value);S.set(n,t)}function ke(n){let t=L(n);if(h.has(t))h.delete(t);else if(h.size>=pe)h.delete(h.keys().next().value);return h.set(t,n),t}function xh(n){let t=h.get(n);if(t===void 0)return;return h.delete(n),h.set(n,t),t}async function Ce(n,t=z){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${L(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function Se(n,t,s=z){if(!s)return;try{if(!M.existsSync(s))M.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${L(n)}.css`),t)}catch{}}async function ue(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var we=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],be=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ve(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of we)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Re(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function nc(){if(Q)return p;Q=!0;try{let n=async(i)=>{for(let o of i){if(!await Bun.file(o).exists())continue;let a=await ue(o);if(a){if(de(o),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(o))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),o=await n([i]);if(!o)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=o,p}let t=await n(ve());if(t)return p=t,p;let s=be;for(let i of s){let o=await ue(i);if(o){p=o;try{de(import.meta.resolve(i))}catch{A=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Re());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Sh(){Y.clear(),p=null,Q=!1,v=null,I="",S.clear(),h.clear(),he=null,G.clear()}var fe=!1;async function rc(n){try{let t=le({name:"css",cwd:n})?"css":le({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!fe)fe=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function Cf(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-1kxj9mh7.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let o=await import(i);t=o.default||o,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let o=await import(i);t={...o.default||o,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await rc(n)}function Ef(n){try{let t=new WeakSet;return L(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function cn(n){if(B)return I;B=!0;try{let t=await nc();if(!t||!t.build)return B=!1,"";if(!v)v=await rc(n);if(!v)return B=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},o=performance.now(),a=await t.build(i),g=performance.now()-o;if(I=a.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${a.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let c=d.isAbsolute(i.output)?i.output:d.join(n,i.output),u=d.dirname(c);if(!M.existsSync(u))M.mkdirSync(u,{recursive:!0});await Bun.write(c,a.css)}return B=!1,a.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),B=!1,I}}async function sr(n){v=null,await cn(n)}function kh(){return I}function Tf(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let a of r[1].split(/\s+/))if(a.trim())t.add(a.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,o=i.exec(n);while(o!==null){let a=o[1].match(/'([^']+)'/g);if(a){for(let g of a)for(let c of g.slice(1,-1).split(/\s+/))if(c.trim())t.add(c.trim())}o=i.exec(n)}return t}var Y=b(64);async function $f(n,t){let s=()=>G.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=Y.get(x(n,t,s()));if(r!==void 0)return r;let i=await $e(n,t);if(i)Y.set(x(n,t,s()),i);return i}function*me(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=qo(r);if(i)yield i}}function _h(n){return[...me(n)].join(`
|
|
7
7
|
`)}async function $e(n,t){try{let s=await nc();if(!s)return"";let r=new Set;for(let f of me(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(f):Tf(f);for(let J of j)r.add(J)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),o=l(i,"cache");if(!z)z=o;let a=G.get(i);if(!a){let f=await Cf(i);a={config:f,fingerprint:Ef(f)},G.set(i,a),he=a.fingerprint}let g=[...r].sort().join(" "),c=`${A}::${a.fingerprint||"default"}::${g}`,u=S.get(c);if(u!==void 0)return W(c,u),u;let m=await Ce(c,o);if(m!==null)return W(c,m),m;let H=s.defaultConfig||s.config,R=a.config||{},k=ae(H,R),{safelist:E,includePreflight:_,minify:P,tokenCSS:K}=k;if(k.unknownRoles.length>0&&!ge.has(i))ge.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${k.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let D=k.config,O=new s.CSSGenerator(D),T=D.shortcuts||R.shortcuts||{},N=Object.keys(T).filter((f)=>r.has(f)||E.includes(f));for(let f of E)if(!T[f])O.generate(f);for(let f of r)if(!T[f])O.generate(f);let C="";if(N.length>0){let f=new s.CSSGenerator(D);for(let j of N)f.generate(j);if(C=f.toCSS(!1,P),C&&!C.endsWith(`
|
|
8
8
|
`))C+=`
|
|
9
9
|
`}let w=C+O.toCSS(_,P);return w=ce(s.CSSGenerator,k)+K+w,W(c,w),Se(c,w,o),w}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function y(n,t,s=!1,r=!1){let i=await $f(n,t);if(!i)return r?fn(n):n;let o=s?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${ke(i)}.css">`:`<style data-css="generated">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R,t,c}from"./chunk-bq9xf8nq.js";import{Z}from"./chunk-
|
|
2
|
+
import{R,t,c}from"./chunk-bq9xf8nq.js";import{Z}from"./chunk-wx6h1xs3.js";import{Xo}from"./chunk-zxfptbac.js";import C 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 P={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({...P,...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=T(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 T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.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 T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=C.join(i,`${e}${Q(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 Q(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 l=o.search(/\S/);if(l===-1)continue;while(n.length>1&&n[n.length-1].indent>=l)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:l});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 l=Number.parseInt(r[1],10);if(s===l)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&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 E(r[o],n,i);let l=ce(n);if(r[l])return E(r[l],n,i);if(r.other)return E(r.other,n,i);return String(n)}function E(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 l=String(o);if(be(l))return ie(l,n);if(l.includes("|")&&"count"in n){let u=Number(n.count),a=l.split("|");l=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}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 fc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...P,...n.i18n},u=await re(l.locale,n);s.__translations=u,s.__locale=l.locale,s.__i18nConfig=l,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:{}},()=>R(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,l.fallbackToKey,b);return y?Z(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return c("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:{}},()=>R(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 Z(r,w,O(f,u,l.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return c("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,...l)=>{let u=i(o,...l).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:l,replacement:u})=>o.replace(l,()=>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 gc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,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,(l,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,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,l)=>{let u=s.get(l);if(!u)u=`stx-a11y-component-${s.size}`,s.set(l,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,l,u)=>{let a=n.get(u);return a?`<${l}${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 l=/<a\s+([^>]*)>\s*<\/a>/gi;r=l.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=l.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")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=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 mc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],l=await Xo(o,{recursive:n,ignorePaths:r}),u=[];for(let a of l)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 hc={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},yc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
4
|
export{fc,gc,mc,hc,yc};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Rh,ds,zo,ps,ir,Ho,Vo,If,gs,ms,hs,Uo,ic,Of,wt}from"./chunk-
|
|
2
|
+
import{Rh,ds,zo,ps,ir,Ho,Vo,If,gs,ms,hs,Uo,ic,Of,wt}from"./chunk-5r1rdpeg.js";import"./chunk-p9gkz451.js";import"./chunk-wj78td69.js";import"./chunk-skn2n8jt.js";import"./chunk-1165h1nv.js";import"./chunk-zxfptbac.js";import"./chunk-605b93pe.js";import"./chunk-x8js27hd.js";import"./chunk-j2qv5ra2.js";import{z}from"./chunk-wx6h1xs3.js";import"./chunk-64gbacyk.js";import"./chunk-27rzdq3n.js";import"./chunk-bq9xf8nq.js";import"./chunk-2yxva96k.js";import"./chunk-9f6qx8b9.js";export{If as bindLoopInterpolations,Rh as clearScriptScanCache,gs as convertServerLoopAttributesToDirectives,Ho as convertSignalDirectivesToAttributes,ms as convertSignalLoopsToAttributes,ir as extractClientSignalNames,z as extractExports,ic as findMarkupIndexOutsideScripts,ps as hasSignalsSyntax,zo as parseLoopExpression,Vo as preEvalLiteralReactiveIfs,hs as processScriptSetup,Uo as processSignals,Of as rewriteStxImportSpecifiers,ds as scanScriptTags,wt as stripStxRuntimeImports};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{bf,wf,he,vf,Za,en,tn,bh,Qa,nn,Qn,xf,Sf,kf,rs,rn,_f,sn,ec,wh}from"./chunk-
|
|
2
|
+
import{bf,wf,he,vf,Za,en,tn,bh,Qa,nn,Qn,xf,Sf,kf,rs,rn,_f,sn,ec,wh}from"./chunk-7v0psycp.js";import"./chunk-ert36h3v.js";import"./chunk-7sh9fa3q.js";import"./chunk-skn2n8jt.js";import"./chunk-1165h1nv.js";import"./chunk-zxfptbac.js";import"./chunk-605b93pe.js";import"./chunk-x8js27hd.js";import"./chunk-j2qv5ra2.js";import"./chunk-wx6h1xs3.js";import"./chunk-64gbacyk.js";import"./chunk-27rzdq3n.js";import"./chunk-bq9xf8nq.js";import"./chunk-2yxva96k.js";import"./chunk-9f6qx8b9.js";export{Qn as MODULE_SPECIFIER_PREFIX,bf as bundleCacheDir,wf as bundleCacheEntryLimit,wh as bundleClientEntriesSplit,sn as bundleClientScript,tn as clearBundleFailures,he as clientBundleDependencies,en as getBundleFailures,nn as hasUserImports,rn as moduleSubstitutionKey,Sf as normalizeRegistrySpecifiers,_f as queueClientBundleBuild,Za as recordBundleFailure,xf as registryIdForPath,Qa as resolveBundlerFallback,kf as rewriteRegistryImports,bh as setBundlerFallbackMode,vf as shouldLogBundlerDiagnostics,ec as tempBuildName,rs as withModuleSubstitutes};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{j,Lf,Ko,a,P,Lh,jh}from"./chunk-
|
|
2
|
+
import{j,Lf,Ko,a,P,Lh,jh}from"./chunk-skn2n8jt.js";import"./chunk-1165h1nv.js";import"./chunk-zxfptbac.js";import"./chunk-605b93pe.js";import"./chunk-x8js27hd.js";import"./chunk-j2qv5ra2.js";import"./chunk-wx6h1xs3.js";import"./chunk-64gbacyk.js";import"./chunk-27rzdq3n.js";import"./chunk-bq9xf8nq.js";import"./chunk-2yxva96k.js";import"./chunk-9f6qx8b9.js";export{P as config,j as defaultConfig,Lh as defineStxConfig,Ko as discoverConfig,a as loadStxConfig,Lf as resolveStxDirectories,jh as validateConfig};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{yo,sh,oh}from"./chunk-3q807nyz.js";import"./chunk-7v0psycp.js";import"./chunk-ert36h3v.js";import"./chunk-7sh9fa3q.js";import"./chunk-5r1rdpeg.js";import"./chunk-p9gkz451.js";import"./chunk-wj78td69.js";import"./chunk-skn2n8jt.js";import"./chunk-1165h1nv.js";import"./chunk-zxfptbac.js";import"./chunk-605b93pe.js";import"./chunk-x8js27hd.js";import"./chunk-j2qv5ra2.js";import"./chunk-wx6h1xs3.js";import"./chunk-64gbacyk.js";import"./chunk-27rzdq3n.js";import"./chunk-bq9xf8nq.js";import"./chunk-2yxva96k.js";import"./chunk-9f6qx8b9.js";export{oh as clearComposableCache,sh as getComposableScript,yo as listComposableModules};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Qr}from"./chunk-qby3e5nm.js";import{S}from"./chunk-
|
|
2
|
+
import{Qr}from"./chunk-qby3e5nm.js";import{S}from"./chunk-wx6h1xs3.js";import{a}from"./chunk-skn2n8jt.js";import{Ke,re}from"./chunk-c0ejyxfj.js";import{Ka}from"./chunk-wphv66vs.js";import{L}from"./chunk-k3rcpnzm.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var du=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Vg}from"./chunk-rn9m8bmc.js";import"./chunk-skn2n8jt.js";import"./chunk-1165h1nv.js";import"./chunk-zxfptbac.js";import"./chunk-605b93pe.js";import"./chunk-x8js27hd.js";import"./chunk-j2qv5ra2.js";import"./chunk-wx6h1xs3.js";import"./chunk-64gbacyk.js";import"./chunk-27rzdq3n.js";import"./chunk-bq9xf8nq.js";import"./chunk-2yxva96k.js";import"./chunk-9f6qx8b9.js";export{Vg as buildApp};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{k}from"./chunk-9f6qx8b9.js";import{A,En}from"./chunk-2yxva96k.js";import{Ie,b,x,C,Y}from"./chunk-
|
|
2
|
+
import{k}from"./chunk-9f6qx8b9.js";import{A,En}from"./chunk-2yxva96k.js";import{Ie,b,x,C,Y}from"./chunk-wx6h1xs3.js";import{a}from"./chunk-skn2n8jt.js";import{he,nn,rn,sn}from"./chunk-7v0psycp.js";import{wt}from"./chunk-5r1rdpeg.js";import{mt,zn,Gt,ce}from"./chunk-tsvnhc0c.js";import{E,Cn}from"./chunk-bmfk3b29.js";import h from"path";var v=new Map,I=new Map,F=b(64),R=new Map,V=["composables","functions"];function H(e){let s=h.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function ee(e){if(e)return h.resolve(e);let s=`<default>:${process.cwd()}`,r=R.get(s);if(r!==void 0)return r;let t=await te();if(t!==null)R.set(s,t);return t}async function te(){let e=await a(),s=e.root||process.cwd(),r=e.composablesDir;if(r)return h.resolve(s,r);for(let t of V){let n=h.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let i of c.scan({cwd:n,absolute:!0}))if(!H(i))return n}catch{}}return null}async function W(e){let s=Array.isArray(e)?e:e?[h.resolve(e)]:(await a())._layerComposableDirs??[await ee()].filter((t)=>!!t),r=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let i=h.relative(t,c);if(!H(c)&&!r.has(i))r.set(i,c)}}catch{}}return{key:s.join("\x00"),files:[...r.values()].sort()}}async function yo(e){let{files:s}=await W(e),r=Y({loader:"ts",target:"browser",define:C()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),i=r.scan(c).exports.filter((u)=>u!=="default");if(i.length>0)t.push({file:n,names:i})}catch{}return t}function ne(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function P(e,s){let r=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?r.has(n):ne(e,n))t.add(n);return t}var J=b(64);function X(e,s){let r=x(e,s.size),t=J.get(r);if(t)return t;let n;try{n=Ie(e,s)}catch{n=P(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let i of c)for(let u of i[1].split(",")){let f=u.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return J.set(r,n),n}function se(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var L=b(256);function oe(e,s){let r=new Set(s),t="",n=0,c=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)){t+=e.slice(n,i.index),n=i.index+i[0].length;let u=i[1]??"",f=i[2]??"",d=/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(u),m=d?(d[1]??d[2]??d[3]??"").trim():void 0;if(!se(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let y=P(f,r);if(y.size===0)continue;let _=x(f,[...y].sort().join(",")),w=L.get(_);if(!w)w=X(f,y),L.set(_,w);for(let B of w)c.add(B)}t+=e.slice(n);for(let i of P(t,r))c.add(i);return c}function ie(e,s,r){let t=new Map;for(let{file:f,names:d}of e)for(let m of d)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let d=[];for(let m of X(f,n))d.push(t.get(m));return d},i=new Set,u=r.flatMap((f,d)=>d===0?[...oe(f,t.keys())].map((m)=>t.get(m)):c(f));while(u.length>0){let f=[];for(let d of u){if(i.has(d))continue;i.add(d);for(let m of c(s.get(d)??""))if(!i.has(m))f.push(m)}u=f}return i}async function sh(e,s,r,t){let{key:n,files:c}=await W(e);if(!n)return null;let i=()=>[...new Set([...c,...c.flatMap((o)=>he(o))])],u=mt(i());if(c.length===0)return ce(v,n,u,""),null;c.sort();let f=Y({loader:"ts",target:"browser",define:C()}),d=Gt(I,n,u);if(!d){let o=new Map,l=[];for(let p of c)try{let S=await Bun.file(p).text();o.set(p,S);let g=f.scan(S).exports.filter((Q)=>Q!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}d=ce(I,n,u,{codeByFile:o,modules:l})}let{codeByFile:m,modules:y}=d,_;if(s===void 0)_=new Set(c);else{let o=r?[s,...r]:[s],l=x(o.join("\x00"),n,o.length,u),p=F.get(l);if(_=p??ie(y,m,o),!p)F.set(l,_)}if(_.size===0)return null;let w=c.filter((o)=>_.has(o)),B=()=>{if(!t)return;for(let o of w)t.push(o,...he(o))},N=`${n}\x00${w.join("\x00")}\x00${rn()}`,U=Gt(v,N,u);if(U!==void 0)return B(),U||null;let D=[],M=new Set,T=new Set;for(let o of w)try{let l=m.get(o)??await Bun.file(o).text(),p=h.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])T.add(g[1]);let S=[];try{for(let g of f.scan(l).exports)if(g!=="default")M.add(g),S.push(g)}catch{}if(l=A(l),nn(l))l=await sn(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:S}),l=wt(l);l=En(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),D.push(`// Composable: ${p}
|
|
3
3
|
${l.trim()}`)}catch(l){console.warn(`[stx] Failed to load composable ${o}:`,l)}if(D.length===0||M.size===0)return ce(v,N,u,""),null;let Z=[...M].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
|
|
4
4
|
`),z=JSON.stringify([...M]),j=D.join(`
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{oi,Ec,o,At,oe,C,Oe,pn,Ne,pe,G,vr,fn,Ls,Lc,mn,_r,Bs,Fs,jc,di,Bc,Fc,zc,Hc,Me,Le,zs,Fe,r,bn,h,p,V,Z,Se,_,T}from"./chunk-
|
|
2
|
+
import{oi,Ec,o,At,oe,C,Oe,pn,Ne,pe,G,vr,fn,Ls,Lc,mn,_r,Bs,Fs,jc,di,Bc,Fc,zc,Hc,Me,Le,zs,Fe,r,bn,h,p,V,Z,Se,_,T}from"./chunk-wx6h1xs3.js";import{u,f,R,t,ae,q,c,ke,Si,B,Sn,ki,Ft,_i,tl,$r,nl,it,rl,Rr,sl,kn,Ci,ol,Ar,Ir,_e,Ei}from"./chunk-bq9xf8nq.js";import{Lt}from"./chunk-27rzdq3n.js";import{vn}from"./chunk-64gbacyk.js";import{y}from"./chunk-10az8e1m.js";import{gr,Rs}from"./chunk-j2qv5ra2.js";import{uc,dc,dr,Qe,pc,P}from"./chunk-skn2n8jt.js";import{Jo,Yo,Zo,Qo}from"./chunk-x8js27hd.js";import{oc,ls}from"./chunk-bc91m8x8.js";import{os,is,as}from"./chunk-n70ry0hg.js";import{ps,Ho,Vo,gs,ms,Uo}from"./chunk-5r1rdpeg.js";import{us,or}from"./chunk-dqpqc5ps.js";import{No}from"./chunk-2gqhfge6.js";import{se,jo,Bo,Fo}from"./chunk-he85ksa7.js";import{ar,be,ac,cr,cc}from"./chunk-p9gkz451.js";import{L,Ye}from"./chunk-k3rcpnzm.js";import{fc,gc}from"./chunk-1165h1nv.js";import{E,_n,Ti}from"./chunk-bmfk3b29.js";import fs from"fs";import ce from"path";function dt(){return`
|
|
3
3
|
// STX Lifecycle Runtime
|
|
4
4
|
(function() {
|
|
5
5
|
if (typeof window === 'undefined') return;
|
|
@@ -1558,7 +1558,7 @@ ${M}
|
|
|
1558
1558
|
</style>`;a=a.replace(x,I),v.lastIndex=0}catch(M){}}}return a}import ot from"path";var rs=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,cs=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function ds(s,e){if(!e||!s.includes("/"))return s;let l=ot.dirname(e);return s.replace(rs,(a,d,n,g)=>{let v=ot.resolve(l,g);return`${d}${n}${v.split(ot.sep).join("/")}${n}`})}function un(s,e){if(!e||!s.includes("<script"))return s;return s.replace(cs,(l,a,d,n)=>`${a}${ds(d,e)}${n}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function dn(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function En(s,e){let l=s.length,a=e,d=!0,n=[],g=(v)=>v+9<=l&&s[v]==="<"&&s[v+1]==="/"&&(s[v+2]==="s"||s[v+2]==="S")&&(s[v+3]==="c"||s[v+3]==="C")&&(s[v+4]==="r"||s[v+4]==="R")&&(s[v+5]==="i"||s[v+5]==="I")&&(s[v+6]==="p"||s[v+6]==="P")&&(s[v+7]==="t"||s[v+7]==="T")&&(s[v+8]===">"||/\s/.test(s[v+8]));while(a<l){let v=s[a];if(g(a))return a;if(v==="/"&&s[a+1]==="/"){if(a=s.indexOf(`
|
|
1559
1559
|
`,a+2),a===-1)return-1;a+=1,d=!0;continue}if(v==="/"&&s[a+1]==="*"){let m=s.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,d=!0;continue}if(v==="/"&&d){let m=a+1,x=!1;while(m<l){let b=s[m];if(b==="\\"){m+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){m++;break}else if(b===`
|
|
1560
1560
|
`){m=-1;break}m++}if(m===-1){a++,d=!1;continue}while(m<l&&/[a-z]/.test(s[m]))m++;a=m,d=!1;continue}if(v==="'"||v==='"'){let m=v;a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]===m){a++;break}if(s[a]===`
|
|
1561
|
-
`)break;a++}d=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}if(n.length===0)d=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,d=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))d=!1;else d=!0;a++}return-1}function Tn(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let d=a.index+a[0].length,n=s.indexOf("</script>",d);if(n===-1)return null;let g=s.indexOf(">",n);if(g===-1)return null;return{start:a.index,end:g+1}}var hs=4096;async function at(s,e,l){if(l.buildMode!=="serve"||e.length<hs)return null;let{registerServeModuleBundle:a}=await import("./chunk-
|
|
1561
|
+
`)break;a++}d=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}if(n.length===0)d=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,d=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))d=!1;else d=!0;a++}return-1}function Tn(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let d=a.index+a[0].length,n=s.indexOf("</script>",d);if(n===-1)return null;let g=s.indexOf(">",n);if(g===-1)return null;return{start:a.index,end:g+1}}var hs=4096;async function at(s,e,l){if(l.buildMode!=="serve"||e.length<hs)return null;let{registerServeModuleBundle:a}=await import("./chunk-5rf2j30w.js");return`<script ${s} src="${a(e)}"></script>`}async function tr(s,e,l,a){try{let{registeredModuleIdsIn:d,buildModuleRegistryScript:n}=await o("stx/client-module-registry",()=>import("./chunk-03zdbm2r.js")),g=[],v=await n(d(...s),{minify:Ti(e.buildMode,e.minifyClient),collectInputs:g});for(let m of g)l?.add(m);if(a)a.inputs=g,a.code=v??void 0;if(!v)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-5rf2j30w.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(v)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${v.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function ys(s,e,l,a){let d={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:S}=await o("stx/framework-composables",()=>import("./chunk-sckd8v0d.js"));d.frameworkScript=await S(s)}catch{}let n=null;try{n=await o("stx/store-loader",()=>import("./chunk-7xh512ta.js"))}catch{}let g=e.storesDir,v=!!a.__stx_native_screen||(n?.pageStoresAll()??!0),m=v?"":s.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],b=[],w=null;for(let S=0;S<8;S++){let k=null,D="",A=!1;try{if(n){let H=v?await n.getStoreScript(g).then((U)=>U?{code:U,stores:["*"],functions:null}:null):await n.getStoreScriptFor(g,[m],{reads:n.storesReadInFiles([...x,...b]),runOnce:!0});if(H)k=H.code,D=H.stores.join(","),A=!!H.functions&&!v}}catch{}if(w!==null&&D===w)break;w=D;let M=A?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",I=k?`<script ${M}>${k}</script>`:null;d.storeCode=k,d.storeTag=k?await at(M,k,e)??I:null;let N={};d.modulesTag=await tr([s,I],e,l,N),d.modulesCode=N.code??null,x=N.inputs??[],d.composableTag=null,d.composableCode=null,b=[];try{let{getComposableScript:H}=await o("stx/composable-loader",()=>import("./chunk-1p8rbjf9.js")),U=e.composablesDir,O=[d.modulesCode??d.modulesTag,I,d.frameworkScript].filter((F)=>F!==null),j=await H(e._layerComposableDirs??U,s,O,b);if(j)d.composableCode=j,d.composableTag=await at('data-stx-scoped data-stx-run="always" data-stx-composables',j,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${j}</script>`}catch{}if(v||!n)break}return d}async function vs(s,e,l,a={}){let{withModuleSubstitutes:d,moduleSubstitutionKey:n}=await import("./chunk-1gt56hdz.js"),g=await import("./chunk-q71qqjy7.js"),{messages:v,webModules:m}=e,x=null,b=null,w=n()===""&&!a.__stx_native_screen;if(v&&g.pageMessagesEnabled(e)&&w)try{x=await g.loadPageMessages(process.cwd(),v)}catch(M){bs(M)}if(m&&Object.keys(m).length&&w)try{b=await(await import("./chunk-tyjzye2d.js")).loadWebModules(process.cwd(),m)}catch(M){ws(M)}let S=new Map([...b??[],...x?.stubs??[]]),k=()=>ys(s,e,l,a),D=S.size?await d(S,k):await k(),A=null;if(x){let M=g.messageAreasIn(D.modulesCode,D.storeCode,D.composableCode),I=g.pageMessagesScript(x,g.pageLanguages(s,x),M);if(I)A=await at('data-stx-scoped data-stx-run="always" data-stx-messages',I,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${I.replace(/<\/script/gi,"<\\/script")}</script>`}return[A,D.modulesTag,D.storeTag,D.composableTag,D.frameworkScript].filter((M)=>M!==null)}var gn=!1;function bs(s){if(gn)return;gn=!0,console.warn(`[stx] messages: ${s instanceof Error?s.message:String(s)}; pages ship every language`)}var hn=!1;function ws(s){if(hn)return;hn=!0,console.warn(`[stx] ${s instanceof Error?s.message:String(s)}; pages bundle the real modules`)}function xs(s,e=""){let l=Tn(s,"data-stx-runtime");if(!l)return s;let a=ar(s);if(a===-1||a===l.start){if(!e)return s;return s.slice(0,l.end)+e+s.slice(l.end)}if(a<l.start)return s.slice(0,a)+s.slice(l.start,l.end)+e+`
|
|
1562
1562
|
`+s.slice(a,l.start)+s.slice(l.end);let d=s.slice(l.start,l.end),n=s.slice(0,l.start)+s.slice(l.end),g=ar(n);if(g===-1)return d+e+`
|
|
1563
1563
|
`+n;return n.slice(0,g)+d+e+`
|
|
1564
1564
|
`+n.slice(g)}function Ss(s){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return s.replace(e,(l,a,d)=>{let n=s.slice(0,d);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(s,e,l,a,d){if(a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return s;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Se(s,l);let n=!e.__stxProcessingDepth;mn(e);for(let g of a._layerGraph?.configDependencies??[])d.add(g);if(n&&a.runtimeConfig)await vn(e,l,a.runtimeConfig);if(n)zc(e),e.__stx_scope_seq??={n:0,key:zs(String(e.__filename??l))},e.__stx_head_injections=_i(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!E()&&!_n())&&l&&l.endsWith(".stx"))No(s,l);try{return await oe.timeAsync("template-processing",async()=>{let g=await ks(s,e,l,a,d);if(n)g=di(g);if(n&&a.autoShell&&a.buildMode!=="compile"){let v=_e(a.app?.head,{known:Ir,source:"app.head"}),x=(e.__stx_runtime_head||null)??Ei(),b=(e.__stx_head_raw||"").trim(),w,S=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(S)w=S[1].trim(),b=b.replace(S[0],"").trim();let k=e.__sections?.title,D=k?_(k,e,l):void 0,A=x.title||w||D,M=!x.title&&(!!w||!!D),I=x.meta||[],N=new Set(I.map((X)=>it(X)).filter(Boolean)),H={...v,...A&&{title:A},meta:[...(v.meta||[]).filter((X)=>!N.has(it(X))),...I],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
|
|
@@ -1573,7 +1573,7 @@ ${m.trim()}
|
|
|
1573
1573
|
@endsection`}}if(I&&m.includes("<script")){let O=G(m),j=O.scripts.map((F)=>yn(F,l)??F);m=vr(O.output,j)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,j,F)=>(M[j]=F,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,j,F)=>{if(/^(['"]).*\1$/.test(F.trim()))return O;try{let X=u(F.trim(),e);if(X===void 0)return O;let ee=(e.__stx_inline_section_values??=[]).push(X)-1;return M[j]=`{{ __stx_inline_section_values[${ee}] }}`,""}catch{return O}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,j,F)=>{if(F.includes("@parent"))M[j]=F.replace("@parent",Te);else M[j]=F.trim();return""}),e.__sections=M,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,j,F)=>M[j]||F||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||"");if(m=as(m,A),I){let O=[],j=G(m),F=pe(j.output,pn,(X,K)=>`\x00STX_ORPHAN_STYLE_${K}\x00`);if(m=F.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(X,K,ee)=>{let te=K==="SCRIPT"?yn(j.scripts[Number(ee)],l):F.tokens[Number(ee)];if(te)O.push(te);return""}),O.length>0){let X=O.join(`
|
|
1574
1574
|
`);M.content=M.content?`${M.content}
|
|
1575
1575
|
${X}`:X,e.__sections=M}}if(I)try{let O;if(ce.isAbsolute(I))O=I,d.add(I);else O=await ke(()=>bn(I,l,g,d),null,()=>{throw new ae(`Failed to resolve layout path: ${I}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!O){let te=(J)=>{if(!J)return[];try{let me=ce.isAbsolute(J)?J:ce.resolve(process.cwd(),J);return fs.readdirSync(me).filter((we)=>we.endsWith(".stx")).map((we)=>we.replace(/\.stx$/,""))}catch{return[]}},ne=[...te(g.layoutsDir),...te(g.fallbackLayoutsDir)].filter((J,me,we)=>we.indexOf(J)===me).sort(),le=[g.layoutsDir,g.fallbackLayoutsDir].filter((J)=>typeof J==="string"&&J.length>0),de=le.length>0?` Searched: ${le.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ie=`Layout not found: ${I} (referenced from ${l})`+(ne.length>0?`. Available layouts: ${ne.join(", ")}`:g.layoutsDir?`. No .stx layouts found in ${g.layoutsDir}`:"")+de;if(B.log(Error(ie),{layoutPath:I,filePath:l,available:ne},"error"),console.error(`[stx] ${ie}`),g.debug)throw new ae(ie,l);return m}let j=await ke(()=>Bun.file(O).text(),"",()=>{throw new ae(`Failed to read layout file: ${O}`,l,void 0,void 0,"Layout content could not be loaded")});j=un(j,O);let F=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F){if(g.debug)console.log(`Found nested layout: ${F[1]} in ${O}`);let te={},ne=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,J,me)=>(te[J]=me.trim(),""));for(let[ie,J]of Object.entries(te))if(M[ie]&&M[ie].includes(Te)){let me=M[ie].indexOf(Te);M[ie]=M[ie].slice(0,me)+J+M[ie].slice(me+Te.length)}else if(!M[ie])M[ie]=J;let le={...e,__sections:M},de=`@layout('${F[1]}')${ne}`;return await i(de,le,O,g,d)}let X=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),K=is(X,A),ee={};return K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(te,ne,le)=>(ee[ne]=le.trim(),`@slot('${ne}')`)),K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(te,ne,le)=>{if(M[ne]){let de=M[ne];if(de.includes(Te)){let ie=ee[ne]||"",J=de.indexOf(Te);de=de.slice(0,J)+ie+de.slice(J+Te.length)}return de}return le||""}),K=$s(K,M),K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||""),K=as(K,A),e.__originalFilePath=l,m=await $n(K,e,O,g,d),m=`<!-- stx-layout: ${I} -->
|
|
1576
|
-
${m}`,w(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await $n(m,e,l,g,d))}function $s(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,d)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return d||""})}function Es(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[d,n]of Object.entries(process.env))if(d.startsWith(l)&&n!==void 0)a[d]=n;s.$env=a}async function _s(s,e){await ke(()=>Jt(s,e),void 0,(l)=>{B.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ct="data-stx-source";function yn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ct))return s;return`<script ${ct}="${encodeURIComponent(e)}"${s.slice(7)}`}function Ts(s){let e=new RegExp(`${ct}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function wn(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${wn(s)}</span><span style="display:block;margin-top:4px">${wn(l)}</span></div>`}async function Cs(s,e,l,a){let{scanScriptTags:d}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1576
|
+
${m}`,w(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await $n(m,e,l,g,d))}function $s(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,d)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return d||""})}function Es(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[d,n]of Object.entries(process.env))if(d.startsWith(l)&&n!==void 0)a[d]=n;s.$env=a}async function _s(s,e){await ke(()=>Jt(s,e),void 0,(l)=>{B.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ct="data-stx-source";function yn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ct))return s;return`<script ${ct}="${encodeURIComponent(e)}"${s.slice(7)}`}function Ts(s){let e=new RegExp(`${ct}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function wn(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${wn(s)}</span><span style="display:block;margin-top:4px">${wn(l)}</span></div>`}async function Cs(s,e,l,a){let{scanScriptTags:d}=await o("stx/signal-processing",()=>import("./chunk-16yv309r.js")),n=[],g=!E()&&!_n();for(let m of d(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=En(s,b);if(w===-1)continue;let S=s.slice(b,w);if(!S.trim())continue;let k=Ts(x)??l,D={index:m.start,length:w+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-tshgbpwy.js"));await A(S,e,k,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:k,kind:M.kind,message:M.message}),!g)return;n.push({...D,markup:xn(k,M.kind,M.message)})}})}catch(A){let M=A instanceof Error?A:Error(String(A));if(B.log(M,{filePath:k,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${k}: ${M.message}`),g)n.push({...D,markup:xn(k,"unknown",M.message)})}}if(n.length===0)return s;let v=s;for(let m of n.sort((x,b)=>b.index-x.index))v=v.slice(0,m.index)+m.markup+v.slice(m.index+m.length);return v}async function As(s,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-pagra8jv.js"));return a(s,e,{skipServer:!0})}catch(a){let d=a instanceof Error?a:Error(String(a));return B.log(d,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${d.message}`),s}}async function $n(s,e,l,a,d){let n=s,g=a;if(n=await Cs(n,e,l,a),n=await qt(n,e,l),n=await Ut(n,e,l),n=await As(n,e,l),n=await Mt(n,e,l,g),Se(n))n=Ho(n,e),n=ms(n,e),n=gs(n,e);n=Vo(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-ghn1y4ky.js"));n=v(n,e),n=or(n,e,l,g,!0),n=await nn(n,e,l,g,d),n=await ls(n,e,l,g,d),n=uc(n,e,l,g);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-p43hw6ef.js"));n=m(n,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-nx20kccb.js"));n=x(n,e,l);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-cpq9b0fx.js"));n=b(n,e,l),n=w(n);let{processErrorBoundaryDirectives:S,stripRenderFailedMarkers:k}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=S(n,e,l),n=k(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-yrdxvphr.js"));n=D(n,e,l);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-7y2h7nfd.js"));n=A(n,e,l);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-m90wyzhd.js"));n=M(n,e,l);let{processVirtualListDirectives:I,processVirtualGridDirectives:N,processInfiniteListDirectives:H}=await o("stx/virtual-scrolling",()=>import("./chunk-713az4kg.js"));n=I(n,e,l),n=N(n,e,l),n=H(n,e,l);let{processPartialHydrationDirectives:U,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-x756yzrc.js"));n=U(n,e,l),n=O(n);let{processComputedDirectives:j,processWatchDirectives:F}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=j(n,e,l),n=F(n,e,l);let{processFormValidationDirectives:X}=await o("stx/forms-validation",()=>import("./chunk-jqnkcekm.js"));n=X(n,e,l);let{processHeadDirective:K,processTitleDirective:ee,processMetaDirective:te,resetHead:ne}=await o("stx/head",()=>import("./chunk-t482tgm6.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ne();let le=K(n);if(n=le.content,le.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${le.headContent}
|
|
1577
1577
|
`;if(n=ee(n,e),n=te(n,e,l),n=Gt(n),n=jo(n,e),n=Rt(n),n=zt(n),n=await os(n,e,l,g,d),n=await ls(n,e,l,g,d),n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=di(n),n=se(n,e,l),n=us(n),e.__stxProcessingDepth===1)n=Hc(n,e);if(n=Lc(n,e,{filePath:l,buildMode:g.buildMode}),n=Bo(n,e),n=Fo(n,e),n=We(n,e),n=Ht(n,e),n=Bt(n,e),n=await xt(n,e,l,g),n=await pc(n,e,l),n=await fc(n,e,l,g),n=gc(n,e,l,g),n=Jo(n,e,l,g),n=Yo(n,e,l),n=Zo(n,e,l,g),n=Tt(n,e,l,g),n=Bs(n,e),n=Fs(n),n=jc(n),!g.skipEventDirectives)n=Ec(n,e,l);if(n=wt(n,e,l),g.debug){let z=/\bx-data\s*=/.test(n),W=ps(s);if(z&&W)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1578
1578
|
Both work on the same page, but they manage separate scopes.
|
|
1579
1579
|
Prefer signals (state/derived/effect) for new components.`)}n=oc(n,e),n=await _(n,e,l),n=Bc(n),n=Fc(n),n=gt(n);let{processXElementDirectives:de}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=de(n);let ie=e.__originalFilePath||l,J=Me(e);if(n=await Uo(n,g,ie,J),n=Pt(n,e),n=await Kt(n,e,l,g),g.media?.image?.autoSiblings){let z=g.publicDir||"public",{rewriteImagesWithSiblings:W}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-gbgbhpms.js"));n=await W(n,{publicDir:z})}if(g.seo?.enabled)n=Qo(n,e,g);let me=(z,W,Q=!0)=>{if(!W)return z;let he=W.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),re=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(z),fe=re?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(re[0]):null;if(he&&re&&fe){if(Q){let Ce=re.index+fe.index;z=z.slice(0,Ce)+he[0]+z.slice(Ce+fe[0].length)}if(W=W.replace(he[0],"").trim(),!W)return z}if(/<\/head>/i.test(z))return z.replace(/<\/head>/i,`${W}
|
|
@@ -1587,6 +1587,6 @@ ${dt()}
|
|
|
1587
1587
|
`+Ce}else n=n.replace("</head>",`${W}
|
|
1588
1588
|
</head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
|
|
1589
1589
|
${W}`);else n=W+`
|
|
1590
|
-
`+n}{let{scanScriptTags:z}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1590
|
+
`+n}{let{scanScriptTags:z}=await o("stx/signal-processing",()=>import("./chunk-16yv309r.js")),W=[];for(let Q of z(n)){if(!/\bserver\b/i.test(Q.attrs))continue;let he=Q.start+Q.fullMatch.indexOf(">")+1,re=En(n,he);if(re===-1)continue;let fe=re+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;W.push({start:Q.start,end:fe})}if(W.length>0){let Q=Array(W.length+1),he=0;for(let re=0;re<W.length;re++){let{start:fe,end:Ce}=W[re];Q[re]=n.slice(he,fe),he=Ce}Q[W.length]=n.slice(he),n=Q.join("")}}let lt=Ls(n,l);if(lt.hasScoped)n=lt.html;let Dn=e.__stx_event_bindings||[],Ke=!1,ut=[],In=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:On}=await o("stx/signal-processing",()=>import("./chunk-16yv309r.js"));for(let z of On(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ut.push({match:z.fullMatch,attrs:z.attrs,content:z.body});for(let{match:z,attrs:W,content:Q}of ut){Ke=!0;let he=Q;Oe(Q,l,a.strict,e.__originalFilePath);let re=await Le(Q,{eventBindings:Dn,attrs:W,hasColonDirectives:In,templateContent:s,filePath:l,projectRoot:process.cwd(),production:Ti(a.buildMode,a.minifyClient),serverData:J});n=n.replace(z,()=>re)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let z=e.__stx_event_bindings||[];if(z.length>0){let W=oi(z);if(W){let Q=n.lastIndexOf("</body>");n=Q===-1?n+W:n.slice(0,Q)+W+`
|
|
1591
1591
|
`+n.slice(Q)}e.__stx_event_bindings=[]}}if(!be(n)&&ac(n))n=await cr(n,g);if(n=cc(n),g.csp?.enabled&&g.csp.useNonce&&typeof e.cspNonce==="string")n=_t(n,e.cspNonce);return n}
|
|
1592
1592
|
export{yt,Re,tc,ss,Io,Oo,tr,i};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{at,ll}from"./chunk-9f6qx8b9.js";import{A}from"./chunk-2yxva96k.js";import{z,Ps,o,dn,W,S,$c,Dt,yn,je,Be}from"./chunk-
|
|
2
|
+
import{at,ll}from"./chunk-9f6qx8b9.js";import{A}from"./chunk-2yxva96k.js";import{z,Ps,o,dn,W,S,$c,Dt,yn,je,Be}from"./chunk-wx6h1xs3.js";import{cr}from"./chunk-p9gkz451.js";import{L}from"./chunk-k3rcpnzm.js";import{ln}from"./chunk-wj78td69.js";var D=`(?:"[^"]*"|'[^']*'|[^>"'])*`,q=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,J=65536,K=4,M=new Map;function Rh(){M.clear()}function Y(e){let i=[];for(let n of S(e,W)){let t=n.token.match(/^<script\b([^>]*)>/i),s=n.token.match(/<\/script\s*>$/i);if(!t||!s)continue;let a=t[0].length,f=n.token.length-s[0].length;i.push(Object.freeze({fullMatch:n.token,attrs:t[1],body:n.token.slice(a,f),start:n.start,end:n.end}))}return i}function ds(e,i={}){let n=e.length>=J,t=n?M.get(e):void 0;if(t===void 0){if(t=Y(e),n)$c(M,K),M.set(e,t)}let s=i.skipAttrs;if(!s)return t.slice();let a=[];for(let f of t)if(s.lastIndex=0,!s.test(f.attrs))a.push(f);return a}function zo(e){let i=e.trim(),n=i.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(n){let s=n[1].trim(),a=n[2].trim(),{itemVar:f,indexVar:c}=F(a);if(f)return{style:"as",iterable:s,itemVar:f,indexVar:c}}let t=i.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(t){let s=t[1].trim(),a=t[2].trim(),{itemVar:f,indexVar:c}=F(s);if(f)return{style:"in",iterable:a,itemVar:f,indexVar:c}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function F(e){let i=e.trim(),n=i.match(/^(\w+)\s*=>\s*(\w+)$/);if(n)return{itemVar:n[2],indexVar:n[1]};let t=i.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(t)return{itemVar:t[1],indexVar:t[2]||null};let s=i.match(/^(\w+)\s*,\s*(\w+)$/);if(s)return{itemVar:s[1],indexVar:s[2]};let a=i.match(/^(\w+)$/);if(a)return{itemVar:a[1],indexVar:null};return{itemVar:null,indexVar:null}}function ps(e,i){return ll(e,i)}function ee(e){let i=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,n=0,t;while((t=i.exec(e))!==null){let s=t[1];if(s.startsWith("if"))n++;else if(s==="endif")n--;else if(n===0)return!0}return!1}function ir(e){let i=new Set,n=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,s;while((s=n.exec(e))!==null){let a=s[1],f;while((f=t.exec(a))!==null)i.add(f[1])}return i}function te(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let i=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${D})>`,"iy"),n=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,t=S(e,(a,f)=>{i.lastIndex=f;let c=i.exec(a);if(!c||c.index!==f||!n.test(c[2]))return-1;return i.lastIndex}),s=[];for(let a of t){i.lastIndex=0;let f=i.exec(a.token);if(!f)continue;let c=f[2].match(n),p=zo(c?.[1]??c?.[2]??""),h=[p.itemVar,p.indexVar].filter(Boolean);if(h.length===0)continue;let r=f[1],g=/\/\s*>$/.test(a.token)||P.has(r.toLowerCase())?a.end:Z(e,a.start,r,a.end);if(g!==-1)s.push({start:a.start,end:g,vars:new Set(h)})}return s}var U=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function ne(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function G(e,i,n,t){if(!e)return!1;let s=ne(e),a=!1,f=!1,c=!1,p=/([a-zA-Z_$][\w$]*)/g,h;while((h=p.exec(s))!==null){let u=h[1];if(s.slice(0,h.index).trimEnd().endsWith("."))continue;if(U.has(u))continue;if(i.has(u)||t?.has(u))a=!0;else if(n&&u in n)f=!0}let r=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,l;while((l=r.exec(s))!==null){let u=l[1];if(s.slice(0,l.index).trimEnd().endsWith("."))continue;if(U.has(u)||n&&u in n)continue;c=!0}return(a||c)&&!f}function O(e,i,n){let t=n===void 0?` ${i}`:` ${i}="${n.replace(/"/g,""")}"`,s=e.trim(),a=s.match(q);if(a&&se(a[3],a[1])){let[,f,c,p]=a;return`<${f}${c}${t}>${p}</${f}>`}return`<template${t}>${s}</template>`}function se(e,i){let n=new RegExp(`<(/)?${i}(?=[\\s/>])`,"gi"),t=0,s;while((s=n.exec(e))!==null)if(s[1]){if(t--,t<0)return!1}else t++;return!0}function Ho(e,i){let n=ir(e);function t(s){let a=s,f=te(s),c=(l)=>{let g=new Set;for(let u of f)if(l>u.start&&l<u.end)for(let d of u.vars)g.add(d);return g},p=/@if\s*\(/g,h,r=[];while((h=p.exec(a))!==null){let l=h.index,g=l+h[0].length,u=1,d=g;while(d<a.length&&u>0){if(a[d]==="(")u++;else if(a[d]===")")u--;d++}if(u!==0)continue;let b=a.substring(g,d-1).trim(),w=d,E=1,y=w,m=/@(if\s*\(|endif)/g;m.lastIndex=w;let x;while((x=m.exec(a))!==null)if(x[1].startsWith("if"))E++;else if(x[1]==="endif"){if(E--,E===0){y=x.index+x[0].length;break}}if(E!==0)continue;let R=a.substring(w,y-6).trim(),v;if(ee(R)){let I=ln(a.substring(l,y));if(I.length===0)continue;let k=I[0].branches.filter((C)=>C.type!=="else"),V=c(l);if(!(k.length>0&&k.every((C)=>G(C.condition,n,i,V))))continue;v=I[0].branches.map((C)=>{let N=t(C.content);if(C.type==="elseif")return O(N,"@else-if",C.condition??"");if(C.type==="else")return O(N,"@else");return O(N,"@if",C.condition??"")}).join(`
|
|
3
3
|
`)}else{if(!G(b,n,i,c(l)))continue;v=O(t(R),"@if",b)}r.push({start:l,end:y,replacement:v}),p.lastIndex=y}for(let l=r.length-1;l>=0;l--){let{start:g,end:u,replacement:d}=r[l];a=a.substring(0,g)+d+a.substring(u)}return a}return t(e)}function re(e){let i=e.trim();if(i==="")return;if(i==="true")return!0;if(i==="false")return!1;if(i==="null")return!1;if(i==="undefined")return!1;if(i==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(i)){let s=Number(i);return s!==0&&!Number.isNaN(s)}let n=i.match(/^'((?:\\.|[^'\\])*)'$/);if(n)return n[1].length>0;let t=i.match(/^"((?:\\.|[^"\\])*)"$/);if(t)return t[1].length>0;return}var P=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),X=/<(script|style)\b/iy,ie=/<\/script/gi,oe=/<\/style/gi;function Z(e,i,n,t){if(P.has(n.toLowerCase()))return t;let s=n.toLowerCase(),a=e.length,f=1,c=t;while(c<a){let p=e.indexOf("<",c);if(p===-1)return-1;if(c=p,e.startsWith("<!--",c)){let g=e.indexOf("-->",c+4);if(g===-1)return-1;c=g+3;continue}X.lastIndex=c;let h=X.exec(e);if(h){let g=e.indexOf(">",c);if(g===-1)return-1;if(e[g-1]==="/"){c=g+1;continue}let u=h[1].toLowerCase()==="script"?ie:oe;u.lastIndex=c;let d=u.exec(e);if(d===null)return-1;let b=e.indexOf(">",d.index);if(b===-1)return-1;c=b+1;continue}if(e[c+1]==="/"){let g=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(c,c+64));if(!g){c++;continue}if(g[1].toLowerCase()===s){if(f--,c+=g[0].length,f===0)return c;continue}c+=g[0].length;continue}let r=/^<([a-z][\w-]*)\b/i.exec(e.slice(c,c+64));if(!r){c++;continue}let l=e.indexOf(">",c);if(l===-1)return-1;if(r[1].toLowerCase()===s){let g=e.slice(c,l+1);if(!(/\/\s*>$/.test(g)||P.has(s)))f++}c=l+1}return-1}var ce=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ae(e,i){let n=i,t=e.length;for(;;){while(n<t&&e[n]!=="<")n++;if(n>=t)return!1;if(e.startsWith("<!--",n)){let f=e.indexOf("-->",n+4);if(f===-1)return!1;n=f+3;continue}break}if(e[n+1]==="/")return!1;let s=e.indexOf(">",n);if(s===-1)return!1;let a=e.slice(n,s+1);return ce.test(a)}function Vo(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let i=[],n=/<([a-zA-Z][\w-]*)/y,t=/\s/,s=new Set([":if",":show","x-if","x-show","@if","@show"]);S(e,(r,l)=>{n.lastIndex=l;let g=n.exec(r);if(!g||/^(?:script|style)$/i.test(g[1]))return-1;let u=n.lastIndex,d;while(u<r.length){let b=u;while(u<r.length&&t.test(r[u]))u++;let w=u;if(r[w]==="/"){w++;while(w<r.length&&t.test(r[w]))w++}if(r[w]===">"){if(d)i.push({start:l,end:w+1,tag:g[1],...d});return-1}if(u===b)return-1;let E=u;while(u<r.length&&!t.test(r[u])&&r[u]!=="="&&r[u]!==">")u++;if(u===E)return-1;let y=r.slice(E,u);if(y.startsWith("@")&&y.includes("("))return-1;let m=u,x=u;while(x<r.length&&t.test(r[x]))x++;if(r[x]!=="="){u=m;continue}x++;while(x<r.length&&t.test(r[x]))x++;let R=r[x];if(R==='"'||R==="'"){let v=r.indexOf(R,x+1);if(v===-1)return-1;if(!d&&R==='"'&&s.has(y))d={attrName:y,attrStart:b,attrEnd:v+1,value:r.slice(x+1,v)};u=v+1}else{u=x;while(u<r.length&&!t.test(r[u])&&r[u]!==">")u++}}return-1});let a=[],f=-1;for(let r of i){let{start:l,end:g,tag:u,attrName:d,value:b}=r;if(l<f)continue;let w=re(b);if(w===void 0)continue;let m=/\/\s*>$/.test(e.slice(l,g))||P.has(u.toLowerCase())?g:Z(e,l,u,g);if(m===-1)continue;if((d===":if"||d==="x-if"||d==="@if")&&ae(e,m))continue;if(w===!0){let R=e.slice(l,r.attrStart)+e.slice(r.attrEnd,g);a.push({start:l,end:g,replacement:R});continue}a.push({start:l,end:m,replacement:""}),f=m}if(a.length===0)return e;a.sort((r,l)=>r.start-l.start);let c=[],p=-1;for(let r of a){if(r.start<p)continue;c.push(r),p=r.end}let h=e;for(let r=c.length-1;r>=0;r--){let{start:l,end:g,replacement:u}=c[r];h=h.substring(0,l)+u+h.substring(g)}return h}var H=[":for","@for","x-for"];function If(e){let i=/(\s)((?::|@|x-|v-)[\w.:-]+)\s*=\s*"([^"]*\{\{[^"]*)"/g;return e.replace(i,(n,t,s,a)=>{let f=a.replace(/'((?:[^'\\]|\\.)*)'/g,(c,p)=>{if(!p.includes("{{"))return c;return`\`${p.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{\s*([^}]+?)\s*\}\}/g,(r,l)=>`\${${l}}`)}\``});return`${t}${s}="${f}"`})}function gs(e,i){if(!i||Object.keys(i).length===0)return e;if(!H.some((c)=>e.includes(`${c}=`)))return e;let n=ir(e);if(Array.isArray(i.__stx_client_signal_names)){for(let c of i.__stx_client_signal_names)if(typeof c==="string")n.add(c)}let t=e,s=[],a=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,f;while((f=a.exec(t))!==null){let[c,p,h]=f,r=f.index,l=r+c.length,g=H.map((v)=>({attr:v,m:new RegExp(`\\s${v}="([^"]*)"`).exec(h)})).find((v)=>v.m!==null);if(!g||!g.m)continue;let u=zo(g.m[1]);if(!u.iterable||!u.itemVar)continue;let d=u.iterable.trim().split(/[.[(]/)[0].trim();if(!d||n.has(d)||!(d in i))continue;let b=Z(t,r,p,l);if(b===-1)continue;let w=h.replace(new RegExp(`\\s${g.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),E=t.slice(l,b-`</${p}>`.length),y={...i,[u.itemVar]:void 0};if(u.indexVar)y[u.indexVar]=void 0;let m=gs(E,y),x=u.indexVar?`${u.iterable} as ${u.indexVar} => ${u.itemVar}`:`${u.iterable} as ${u.itemVar}`,R=p.toLowerCase()==="template"?m:`<${p}${w}>${m}</${p}>`;s.push({start:r,end:b,replacement:`@foreach(${x})${R}@endforeach`}),a.lastIndex=b}for(let c=s.length-1;c>=0;c--){let{start:p,end:h,replacement:r}=s[c];t=t.slice(0,p)+r+t.slice(h)}return t}function ms(e,i){let n=e,t=/@(for|foreach)\s*\(/g,s,a=[],f=[];while((s=t.exec(n))!==null){let c=s[1],p=s.index,h=p+s[0].length,r=1,l=h;while(l<n.length&&r>0){if(n[l]==="(")r++;else if(n[l]===")")r--;l++}if(r!==0)continue;let g=n.substring(h,l-1).trim(),u=l,d=zo(g),b=c==="for"?"@endfor":"@endforeach",w=1,E=u,y=c==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${c}\\s*\\(|end${c})`,"g");y.lastIndex=u;let m;while((m=y.exec(n))!==null)if(m[1].startsWith(c))w++;else if(w--,w===0){E=m.index+m[0].length;break}if(w!==0)continue;let x=()=>{let _=[d.itemVar,d.indexVar].filter(Boolean);if(_.length)f.push({start:p,end:E,vars:_})};if(d.iterable){let _=d.iterable.trim();if(_.startsWith("[")||_.startsWith("{")||_.startsWith("'")||_.startsWith('"')||_.startsWith("`")||/^-?\d/.test(_)){x();continue}let T=_.split(/[.[(]/)[0].trim(),C=i?T in i:!1,N=f.some((j)=>p>j.start&&p<j.end&&j.vars.includes(T));if(T&&(C||N)){x();continue}}if(d.style==="as")g=d.indexVar?`(${d.itemVar}, ${d.indexVar}) in ${d.iterable}`:`${d.itemVar} in ${d.iterable}`;let R=n.substring(u,E-b.length).trim(),v=i?{...i}:{};if(d.itemVar)delete v[d.itemVar];if(d.indexVar)delete v[d.indexVar];let I=If(ms(R,v)),k=I.match(q),V;if(k){let[,_,T,C]=k;V=`<${_}${T} @for="${g}">${C}</${_}>`}else V=`<template @for="${g}">${I}</template>`;a.push({start:p,end:E,replacement:V}),t.lastIndex=E}for(let c=a.length-1;c>=0;c--){let{start:p,end:h,replacement:r}=a[c];n=n.substring(0,p)+r+n.substring(h)}return n}function le(e){let i=new Set,n=[],t=0,s=0,a=e.length,f=(r)=>{let l=t+1;while(l<a){let g=e[l];if(g==="\\"){l+=2;continue}if(g===r)return l+1;l++}return a},c=()=>{let r=t+2;while(r<a&&e[r]!==`
|
|
4
4
|
`)r++;return r},p=()=>{let r=t+2;while(r<a-1){if(e[r]==="*"&&e[r+1]==="/")return r+2;r++}return a},h=(r)=>{let l=r,g=0;while(l<a){let u=e[l];if(u==="/"&&e[l+1]==="/"){let d=l+2;while(d<a&&e[d]!==`
|
|
5
|
-
`)d++;l=d;continue}if(u==="/"&&e[l+1]==="*"){let d=l+2;while(d<a-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;l=d+2;continue}if(u==='"'||u==="'"||u==="`"){let d=l+1;while(d<a){if(e[d]==="\\"){d+=2;continue}if(e[d]===u){d++;break}d++}l=d;continue}if(u==="("||u==="["||u==="{"){g++,l++;continue}if(u===")"||u==="]"||u==="}"){g--,l++;continue}if(u===";"&&g===0)return l+1;l++}return a};while(t<a){let r=e[t];if(r==="/"&&e[t+1]==="/"){let l=c();n.push(e.slice(t,l)),t=l;continue}if(r==="/"&&e[t+1]==="*"){let l=p();n.push(e.slice(t,l)),t=l;continue}if(r==='"'||r==="'"||r==="`"){let l=f(r);n.push(e.slice(t,l)),t=l;continue}if(r==="{"){s++,n.push(r),t++;continue}if(r==="}"){s--,n.push(r),t++;continue}if(s===0){let l=t>0?e[t-1]:"";if(l===""||/\s/.test(l)||l===";"||l==="}"||l==="{"){let u=e.slice(t).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(u){let d=u[2],b=h(t+u[0].length);if(i.has(d)){n.push(`/* stx: deduped const ${d} */`),t=b;continue}i.add(d),n.push(e.slice(t,b)),t=b;continue}}}n.push(r),t++}return n.join("")}var ue=new Set(["script","style","html","head","meta","link","title","!doctype"]);function B(e,i,n){for(let t of n){if(t.start>=i)return!1;if(t.end>e)return!0}return!1}function fe(e,i,n){let t=0;while(t<e.length){let s=e.indexOf(i,t);if(s===-1)return!1;if(!B(s,s+i.length,n))return!0;t=s+i.length}return!1}function de(e,i){if(fe(e,"<body",i)){let s=new RegExp(`<body(${D})>`,"g"),a;while((a=s.exec(e))!==null)if(!B(a.index,a.index+a[0].length,i))return a.index+a[0].length-1;return null}let n=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${D})>`,"gi"),t;while((t=n.exec(e))!==null){if(B(t.index,t.index+t[0].length,i))continue;if(ue.has(t[1].toLowerCase()))continue;return t.index+t[0].length-1}return null}function ge(e,i,n,t){let s=[],a=` data-stx="${t}"`,f=0,c=!1,p=(h)=>{if(n!==null&&!c&&n>=f&&n<=h)s.push(e.slice(f,n),a,e.slice(n,h)),c=!0;else s.push(e.slice(f,h))};for(let h of i){if(h.start<f)continue;p(h.start),f=h.end}return p(e.length),s.join("")}async function hs(e,i,n,t={}){let s=ds(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),a=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:c,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
5
|
+
`)d++;l=d;continue}if(u==="/"&&e[l+1]==="*"){let d=l+2;while(d<a-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;l=d+2;continue}if(u==='"'||u==="'"||u==="`"){let d=l+1;while(d<a){if(e[d]==="\\"){d+=2;continue}if(e[d]===u){d++;break}d++}l=d;continue}if(u==="("||u==="["||u==="{"){g++,l++;continue}if(u===")"||u==="]"||u==="}"){g--,l++;continue}if(u===";"&&g===0)return l+1;l++}return a};while(t<a){let r=e[t];if(r==="/"&&e[t+1]==="/"){let l=c();n.push(e.slice(t,l)),t=l;continue}if(r==="/"&&e[t+1]==="*"){let l=p();n.push(e.slice(t,l)),t=l;continue}if(r==='"'||r==="'"||r==="`"){let l=f(r);n.push(e.slice(t,l)),t=l;continue}if(r==="{"){s++,n.push(r),t++;continue}if(r==="}"){s--,n.push(r),t++;continue}if(s===0){let l=t>0?e[t-1]:"";if(l===""||/\s/.test(l)||l===";"||l==="}"||l==="{"){let u=e.slice(t).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(u){let d=u[2],b=h(t+u[0].length);if(i.has(d)){n.push(`/* stx: deduped const ${d} */`),t=b;continue}i.add(d),n.push(e.slice(t,b)),t=b;continue}}}n.push(r),t++}return n.join("")}var ue=new Set(["script","style","html","head","meta","link","title","!doctype"]);function B(e,i,n){for(let t of n){if(t.start>=i)return!1;if(t.end>e)return!0}return!1}function fe(e,i,n){let t=0;while(t<e.length){let s=e.indexOf(i,t);if(s===-1)return!1;if(!B(s,s+i.length,n))return!0;t=s+i.length}return!1}function de(e,i){if(fe(e,"<body",i)){let s=new RegExp(`<body(${D})>`,"g"),a;while((a=s.exec(e))!==null)if(!B(a.index,a.index+a[0].length,i))return a.index+a[0].length-1;return null}let n=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${D})>`,"gi"),t;while((t=n.exec(e))!==null){if(B(t.index,t.index+t[0].length,i))continue;if(ue.has(t[1].toLowerCase()))continue;return t.index+t[0].length-1}return null}function ge(e,i,n,t){let s=[],a=` data-stx="${t}"`,f=0,c=!1,p=(h)=>{if(n!==null&&!c&&n>=f&&n<=h)s.push(e.slice(f,n),a,e.slice(n,h)),c=!0;else s.push(e.slice(f,h))};for(let h of i){if(h.start<f)continue;p(h.start),f=h.end}return p(e.length),s.join("")}async function hs(e,i,n,t={}){let s=ds(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),a=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:c,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-1gt56hdz.js"));for(let m of s){let x=m.body;if(je(m.attrs))x=Be(x);if(t.forceClientSetup||a.test(x)){f.push({content:x,start:m.start,end:m.end});continue}if(!c(x))continue;try{let R=await p(Dt(x).code,i||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(a.test(R))f.push({content:x,start:m.start,end:m.end})}catch{}}if(f.length===0)return{output:e,setupCode:null};let h=`${i??""}\x00${f.map((m)=>m.content).join("\x00")}`,r=`__stx_setup_${Bun.hash(h).toString(36).slice(0,10)}`,l=[];for(let m=0;m<f.length;m++){let x=f[m].bundled??Dt(f[m].content).code;if(!f[m].bundled&&c(x))x=await p(x,i||"",{projectRoot:process.cwd()});x=wt(x);let R=A(x);l.push(`// \u2500\u2500 merged signal script #${m+1} \u2500\u2500
|
|
6
6
|
${R}`)}let g=l.join(`
|
|
7
7
|
|
|
8
8
|
`);g=le(g);let d=z(g).split(",").map((m)=>m.trim()).filter(Boolean),b=yn(g,n),w=`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Nf,Ah,Ph,Ih,Oh,Df,Mf,Nh,Dh,qo,Mh,lr,ur,bs}from"./chunk-
|
|
2
|
+
import{Nf,Ah,Ph,Ih,Oh,Df,Mf,Nh,Dh,qo,Mh,lr,ur,bs}from"./chunk-nw355jn6.js";import{nt}from"./chunk-5emrarpf.js";import"./chunk-wx6h1xs3.js";import"./chunk-64gbacyk.js";import"./chunk-27rzdq3n.js";import"./chunk-bq9xf8nq.js";import"./chunk-2yxva96k.js";import"./chunk-9f6qx8b9.js";export{Oh as __setSignalsGeneratorsForTest,nt as cacheEngineFingerprint,ur as cacheTemplate,lr as checkCache,Mh as clearDevCaches,Mf as getCachedRouterScript,Df as getCachedSignalsRuntime,Nh as getServeClientAsset,qo as getServeModuleBundle,bs as hashFilePath,Ph as invalidateFileCache,Ih as invalidateFileCacheByDir,Ah as readFileCached,Dh as registerServeModuleBundle,Nf as templateCache};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xn,O}from"./chunk-27rzdq3n.js";import m from"fs";import e from"path";async function vn(r,o,i){if(r.__stx_runtime_config)return;let n=xn();if(n||i){r.__stx_runtime_config=n??O(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-
|
|
2
|
+
import{xn,O}from"./chunk-27rzdq3n.js";import m from"fs";import e from"path";async function vn(r,o,i){if(r.__stx_runtime_config)return;let n=xn();if(n||i){r.__stx_runtime_config=n??O(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-1kxj9mh7.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=O(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function wi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xh,nc,Sh,rc,Cf,Ef,cn,sr,kh,Tf,$f,_h,y}from"./chunk-
|
|
2
|
+
import{xh,nc,Sh,rc,Cf,Ef,cn,sr,kh,Tf,$f,_h,y}from"./chunk-10az8e1m.js";import"./chunk-nw355jn6.js";import"./chunk-wx6h1xs3.js";import"./chunk-64gbacyk.js";import"./chunk-27rzdq3n.js";import"./chunk-bq9xf8nq.js";import"./chunk-2yxva96k.js";import"./chunk-9f6qx8b9.js";export{cn as buildCss,Tf as extractClassNames,Ef as fingerprintConfig,$f as generateCss,kh as getCachedCSS,xh as getCssServeAsset,y as injectCss,nc as loadCssEngine,rc as loadCssEngineConfig,sr as rebuildCss,Sh as resetCssCache,Cf as resolveUserCssConfig,_h as withLinkedModuleBundles};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{er,$e}from"./chunk-7sh9fa3q.js";import{z,b,br,Ds,C}from"./chunk-rmg1eesq.js";import{a,P}from"./chunk-681t1ts7.js";import{Po}from"./chunk-8n4zff12.js";import{nt}from"./chunk-5emrarpf.js";import{l}from"./chunk-jdj1358b.js";import{s,ge}from"./chunk-m4mpyq3d.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Po(t,e,n)}var at=2;function bf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=p.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((c,d)=>d.length-c.length),rt.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),c=t.startsWith(`${i}${p.sep}`);return{path:c?p.relative(i,t):t,...c?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let c=B.statSync(i);if(c.size!==n.size)return!1;if(c.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function wf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=wf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,w)=>w.at-o.at);for(let o of d.slice(i)){let w=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${w}.js`),{force:!0}),await B.promises.rm(p.join(t,`${w}.deps.json`),{force:!0})}k("pruned bundle cache to",i,"entries")}catch{}}function he(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function vf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function k(...t){if(vf())console.log("[stx:bundler]",...t)}var K=[];function Za(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function en(){return K.slice()}function tn(){K.length=0}var Q;function bh(t){Q=t}function Qa(){if(Q)return Q;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function nn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let c=n[1];if(!Y.some((o)=>o.test(c)))return k("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let c=n[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!Y.some((o)=>o.test(c)))return k("detected side-effect import:",c),!0}return!1}var Qn="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function xf(t,e){return p.relative(t,e).split(p.sep).join("/")}function Sf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,c,d)=>{let o=e.get(d);return o&&!d.startsWith(Qn)?`${i}${c}${o}${c}`:n})}function kf(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,w=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),o},c=(d,o)=>{for(let w of d.split(",")){let I=w.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,w)=>{let I=w.slice(Qn.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))c(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(Qn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function rs(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,c]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${c}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function rn(){return G.getStore()?.key??""}function ut(t,e,n,i,c,d,o=new Map,w,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,r,u)=>{if(X(r,t,w))return null;if(!d||!f(j)||!Bt.test(r))return null;try{if(!B.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let E=`${Qn}${xf(process.cwd(),r)}`;return o.set(u,E),{path:E,external:!0}},y=(j,r)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,r);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=it(r.path);if(u){let E=v(r.importer,u,r.path);if(E)return E;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(r)=>{let u=y(r.importer,r.path),E=v(r.importer,u,r.path);if(E)return E;return c.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(r)=>{let u=p.resolve(t,r.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,h,r.path);if(D)return D;return k(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",h),c.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${Qn}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(X(r.path,t,w))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=p.extname(r.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let h=I?.get(r.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(r.path,"utf8"),loader:E}})}}}var q=new Map,V=b(64),ot=Symbol.for("stx.client-bundle-build-queue");function _f(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function sn(t,e,n={}){let i=n.projectRoot||process.cwd(),c=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,w=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||bf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${nt()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=V.get(v);if(y){if(Ds(y.files)&&y.files.every((h)=>!X(h.path,i,c))){k("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}V.delete(v),k("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let h=Bun.file(j),D=!1,N=null;if(await h.exists())try{let O=JSON.parse(await h.text());if(O.metadataVersion===at&&Array.isArray(O.files)&&St(O.files,i))N=br(O.files.map((g)=>ct(g,i))),D=N.length===O.files.length&&!N.some((g)=>X(g.path,i,c))}catch{D=!1}if(D){if(k("cache hit:",f),N)Z(e,N.map((T)=>T.path)),n.collectInputs?.push(...N.map((T)=>T.path));let O=await r.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:O,files:N});return O}k("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return h}let E=_f(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:c,expose:w,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function ec(t){return`${t}-${process.pid}-${yt()}`}async function wh(t,e){let{projectRoot:n}=e,i=ec(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),c=p.join(l(n,"bundle-tmp"),"out",i);B.mkdirSync(c,{recursive:!0});let d=new Map,o=new Map,w=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${w++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let r=o.get(j.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:c,cacheDir:d,hash:o,cachePath:w,depsPath:I,externalizeUserModules:M}=n,S=l(i,"bundle-tmp"),f=ec(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=s(t),{depths:D,balanced:N}=ge(h),O=(R)=>!N||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(h))!==null){if(!O(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let U=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(U)r.add(U)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)r.delete(_)}let pt=r.size>0?`
|
|
2
|
+
import{er,$e}from"./chunk-7sh9fa3q.js";import{z,b,br,Ds,C}from"./chunk-wx6h1xs3.js";import{a,P}from"./chunk-skn2n8jt.js";import{Po}from"./chunk-ert36h3v.js";import{nt}from"./chunk-5emrarpf.js";import{l}from"./chunk-jdj1358b.js";import{s,ge}from"./chunk-m4mpyq3d.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Po(t,e,n)}var at=2;function bf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=p.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((c,d)=>d.length-c.length),rt.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),c=t.startsWith(`${i}${p.sep}`);return{path:c?p.relative(i,t):t,...c?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let c=B.statSync(i);if(c.size!==n.size)return!1;if(c.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function wf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=wf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,w)=>w.at-o.at);for(let o of d.slice(i)){let w=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${w}.js`),{force:!0}),await B.promises.rm(p.join(t,`${w}.deps.json`),{force:!0})}k("pruned bundle cache to",i,"entries")}catch{}}function he(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function vf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function k(...t){if(vf())console.log("[stx:bundler]",...t)}var K=[];function Za(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function en(){return K.slice()}function tn(){K.length=0}var Q;function bh(t){Q=t}function Qa(){if(Q)return Q;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function nn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let c=n[1];if(!Y.some((o)=>o.test(c)))return k("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let c=n[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!Y.some((o)=>o.test(c)))return k("detected side-effect import:",c),!0}return!1}var Qn="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function xf(t,e){return p.relative(t,e).split(p.sep).join("/")}function Sf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,c,d)=>{let o=e.get(d);return o&&!d.startsWith(Qn)?`${i}${c}${o}${c}`:n})}function kf(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,w=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),o},c=(d,o)=>{for(let w of d.split(",")){let I=w.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,w)=>{let I=w.slice(Qn.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))c(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(Qn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function rs(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,c]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${c}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function rn(){return G.getStore()?.key??""}function ut(t,e,n,i,c,d,o=new Map,w,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,r,u)=>{if(X(r,t,w))return null;if(!d||!f(j)||!Bt.test(r))return null;try{if(!B.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let E=`${Qn}${xf(process.cwd(),r)}`;return o.set(u,E),{path:E,external:!0}},y=(j,r)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,r);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=it(r.path);if(u){let E=v(r.importer,u,r.path);if(E)return E;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(r)=>{let u=y(r.importer,r.path),E=v(r.importer,u,r.path);if(E)return E;return c.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(r)=>{let u=p.resolve(t,r.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,h,r.path);if(D)return D;return k(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",h),c.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${Qn}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(X(r.path,t,w))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=p.extname(r.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let h=I?.get(r.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(r.path,"utf8"),loader:E}})}}}var q=new Map,V=b(64),ot=Symbol.for("stx.client-bundle-build-queue");function _f(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function sn(t,e,n={}){let i=n.projectRoot||process.cwd(),c=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,w=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||bf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${nt()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=V.get(v);if(y){if(Ds(y.files)&&y.files.every((h)=>!X(h.path,i,c))){k("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}V.delete(v),k("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let h=Bun.file(j),D=!1,N=null;if(await h.exists())try{let O=JSON.parse(await h.text());if(O.metadataVersion===at&&Array.isArray(O.files)&&St(O.files,i))N=br(O.files.map((g)=>ct(g,i))),D=N.length===O.files.length&&!N.some((g)=>X(g.path,i,c))}catch{D=!1}if(D){if(k("cache hit:",f),N)Z(e,N.map((T)=>T.path)),n.collectInputs?.push(...N.map((T)=>T.path));let O=await r.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:O,files:N});return O}k("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return h}let E=_f(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:c,expose:w,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function ec(t){return`${t}-${process.pid}-${yt()}`}async function wh(t,e){let{projectRoot:n}=e,i=ec(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),c=p.join(l(n,"bundle-tmp"),"out",i);B.mkdirSync(c,{recursive:!0});let d=new Map,o=new Map,w=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${w++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let r=o.get(j.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:c,cacheDir:d,hash:o,cachePath:w,depsPath:I,externalizeUserModules:M}=n,S=l(i,"bundle-tmp"),f=ec(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=s(t),{depths:D,balanced:N}=ge(h),O=(R)=>!N||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(h))!==null){if(!O(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let U=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(U)r.add(U)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)r.delete(_)}let pt=r.size>0?`
|
|
3
3
|
export { ${[...r].join(", ")} }`:"";k("bundling:",o,"from:",p.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:c?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ut(i,j,v,t+pt,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":c?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((A)=>A.level==="error").map((A)=>A.message).join(", ")||`Unable to bundle ${p.basename(e)}`,L=er(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),Za(e||"",F,L),n.throwOnFailure||Qa()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let L=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(L){_.push([L[2],L[1]]);continue}let A=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(A))_.push([A,A])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let U=[];m=kf(Sf(m,et),U);let dt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),c&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let J=`__stxBundle_${o}`,ft=new Set(z(t,!0).split(",").map((x)=>x.trim())),mt=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${ft.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),gt=_.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
4
|
`),ht=_.map(([x])=>`${x} = ${J}[${JSON.stringify(x)}];`).join(`
|
|
5
5
|
`);if(m=`${dt.join(`
|