@stacksjs/stx 0.2.673 → 0.2.674
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-0jwdcqj8.js +2 -0
- package/dist/chunk-0mwdq478.js +2 -0
- package/dist/{chunk-npa7gze7.js → chunk-0nfqgv4n.js} +2 -2
- package/dist/chunk-1y6egkty.js +2 -0
- package/dist/{chunk-1sr6c0nk.js → chunk-25zmy8q6.js} +2 -2
- package/dist/chunk-2881tcqt.js +2 -0
- package/dist/chunk-2a775q7x.js +2 -0
- package/dist/chunk-2asdbd5e.js +2 -0
- package/dist/chunk-34yj93hh.js +2 -0
- package/dist/{chunk-30nes8ne.js → chunk-35ezh7de.js} +2 -2
- package/dist/{chunk-9tdnfztv.js → chunk-40tswfe7.js} +8 -8
- package/dist/chunk-41de209e.js +2 -0
- package/dist/{chunk-jst1fbdm.js → chunk-4b9s7wgy.js} +2 -2
- package/dist/{chunk-vhs13kbf.js → chunk-4bgjrrvz.js} +1 -1
- package/dist/{chunk-365vg0eg.js → chunk-4s8zacxg.js} +4 -4
- package/dist/chunk-4w6baw62.js +3 -0
- package/dist/{chunk-fbtv2k1p.js → chunk-506mv7hb.js} +2 -2
- package/dist/{chunk-fzqj1mjz.js → chunk-5qtthtg3.js} +7 -7
- package/dist/chunk-5s1ay9mv.js +2 -0
- package/dist/{chunk-wns8g6k9.js → chunk-5vt48yce.js} +6 -6
- package/dist/{chunk-qv6axke4.js → chunk-5zhp87wv.js} +2 -2
- package/dist/{chunk-hvf2e7pr.js → chunk-6s7tvmqp.js} +1 -1
- package/dist/{chunk-ecqrkyg8.js → chunk-6sjtyd0k.js} +4 -4
- package/dist/{chunk-a3d0g4mr.js → chunk-7adznted.js} +2 -2
- package/dist/chunk-7j1zgrnf.js +42 -0
- package/dist/chunk-7kznee1g.js +2 -0
- package/dist/{chunk-qjtpxsyx.js → chunk-7mvz972c.js} +3 -3
- package/dist/chunk-80zgyaqe.js +2 -0
- package/dist/chunk-84tqb1rn.js +2 -0
- package/dist/chunk-8azm7nha.js +2 -0
- package/dist/chunk-902qnyg0.js +2 -0
- package/dist/{chunk-3y41efsf.js → chunk-9dtbvjpp.js} +8 -8
- package/dist/chunk-9n6jwcpb.js +2 -0
- package/dist/{chunk-yfvm7q6t.js → chunk-a4p18ybc.js} +3 -3
- package/dist/chunk-a6y8td0d.js +2 -0
- package/dist/chunk-a7kt1ts4.js +2 -0
- package/dist/chunk-a81y8g40.js +2 -0
- package/dist/{chunk-jg5zt20a.js → chunk-aet1pgw7.js} +36 -36
- package/dist/chunk-aft1zc84.js +2 -0
- package/dist/{chunk-04kg16qs.js → chunk-am2w363p.js} +4 -4
- package/dist/{chunk-ym41ybz2.js → chunk-asezs2n3.js} +6 -6
- package/dist/{chunk-jefe0rgt.js → chunk-bawq4fqy.js} +4 -4
- package/dist/chunk-bdp2r0v4.js +2 -0
- package/dist/{chunk-m6q3f5rf.js → chunk-bkkpq8dx.js} +9 -9
- package/dist/chunk-brtvm8mb.js +2 -0
- package/dist/{chunk-2dp7hyv7.js → chunk-bsajk82t.js} +14 -14
- package/dist/chunk-bvzr9zqt.js +2 -0
- package/dist/{chunk-hzv2qj0t.js → chunk-cbjabv1w.js} +4 -4
- package/dist/chunk-cbvgtf3m.js +2 -0
- package/dist/chunk-cfydbaeq.js +2 -0
- package/dist/{chunk-t2pzy3x1.js → chunk-ck2e3e47.js} +3 -3
- package/dist/{chunk-wpmrz872.js → chunk-d09q93yf.js} +2 -2
- package/dist/{chunk-rcsgt4wy.js → chunk-d1a86qx8.js} +1 -1
- package/dist/{chunk-xqp4hstk.js → chunk-dgc1a3yt.js} +6 -6
- package/dist/chunk-dq8c3h4n.js +2 -0
- package/dist/chunk-e36pne7n.js +2 -0
- package/dist/chunk-e62qfexp.js +2 -0
- package/dist/chunk-eq5jzaj5.js +2 -0
- package/dist/{chunk-t0zh1dn9.js → chunk-f9zyf9n6.js} +65 -65
- package/dist/{chunk-dgb4z4kw.js → chunk-faakv1p6.js} +2 -2
- package/dist/{chunk-ynz7bzc6.js → chunk-fb7t1nn9.js} +3 -3
- package/dist/{chunk-ptcj11b4.js → chunk-fbmth6xv.js} +10 -10
- package/dist/{chunk-7met6yva.js → chunk-fd49fahd.js} +5 -5
- package/dist/chunk-fr39emcz.js +2 -0
- package/dist/chunk-fsq13amm.js +2 -0
- package/dist/chunk-fw413k9q.js +3 -0
- package/dist/chunk-fxh12vqd.js +2 -0
- package/dist/chunk-gcc9fa33.js +2 -0
- package/dist/chunk-h6t2ney6.js +2 -0
- package/dist/{chunk-kgfgb971.js → chunk-ham5x7ts.js} +4 -4
- package/dist/{chunk-n38yb274.js → chunk-hb3edeq9.js} +6 -6
- package/dist/{chunk-fvtwec1r.js → chunk-hegfgw27.js} +1 -1
- package/dist/{chunk-p472crv1.js → chunk-hgry3mjd.js} +1 -1
- package/dist/{chunk-sfc2v7rt.js → chunk-hsmcbh0p.js} +7 -7
- package/dist/{chunk-mxbc2ahy.js → chunk-hz4x7h0n.js} +5 -5
- package/dist/{chunk-jxda11cg.js → chunk-j6m8xqh3.js} +2 -2
- package/dist/chunk-j8g5cvvm.js +2 -0
- package/dist/chunk-jzjpyyw2.js +2 -0
- package/dist/chunk-k1b8x73j.js +2 -0
- package/dist/{chunk-h4dkvnhd.js → chunk-kdebh22m.js} +7 -7
- package/dist/{chunk-xwhmh0w0.js → chunk-mwnhdsbp.js} +2 -2
- package/dist/{chunk-0f4csefs.js → chunk-nj343mw2.js} +5 -5
- package/dist/chunk-nw9bdk2n.js +2 -0
- package/dist/chunk-p4jkswz8.js +2 -0
- package/dist/chunk-p4r90vqf.js +2 -0
- package/dist/{chunk-bnn7pd62.js → chunk-p6qd7ad0.js} +2 -2
- package/dist/chunk-p8bgy5tt.js +2 -0
- package/dist/{chunk-aprhqxky.js → chunk-pb6erpj3.js} +5 -5
- package/dist/{chunk-r3e6x87d.js → chunk-pg2v1pb5.js} +3 -3
- package/dist/{chunk-zvygkwyf.js → chunk-pqqe2b6m.js} +4 -4
- package/dist/chunk-q6nwcav4.js +2 -0
- package/dist/chunk-qmqavdz2.js +2 -0
- package/dist/chunk-qpw72bty.js +2 -0
- package/dist/chunk-qwnh1kj6.js +2 -0
- package/dist/chunk-qy9m6qdn.js +2 -0
- package/dist/chunk-qychcdsm.js +2 -0
- package/dist/{chunk-7d4z944r.js → chunk-qz5b8ed4.js} +7 -7
- package/dist/{chunk-6ajahb2x.js → chunk-r7fdw2v5.js} +3 -3
- package/dist/{chunk-mmwedr93.js → chunk-rdr09efy.js} +5 -5
- package/dist/chunk-rj3w1ama.js +2 -0
- package/dist/{chunk-prf164ct.js → chunk-rr527jt6.js} +2 -2
- package/dist/{chunk-1fd7x7b8.js → chunk-rv39s5az.js} +4 -4
- package/dist/{chunk-yg267y85.js → chunk-rym0309c.js} +3 -3
- package/dist/{chunk-chzgfna2.js → chunk-s0vtjyyj.js} +1 -1
- package/dist/{chunk-vqc4h16r.js → chunk-s2wptfm1.js} +2 -2
- package/dist/chunk-sf0r963g.js +2 -0
- package/dist/{chunk-qmfycza5.js → chunk-sqn3y9qt.js} +2 -2
- package/dist/{chunk-hmyb701s.js → chunk-srq9fqq8.js} +10 -10
- package/dist/chunk-ss820yys.js +2 -0
- package/dist/{chunk-pn1ehs6a.js → chunk-szevd7d5.js} +2 -2
- package/dist/{chunk-wbzmr6a4.js → chunk-t0k16vqv.js} +2 -2
- package/dist/chunk-t4j9g2vh.js +2 -0
- package/dist/chunk-t79jfpv6.js +3 -0
- package/dist/{chunk-rcadtv3x.js → chunk-t9kxhe46.js} +1 -1
- package/dist/{chunk-zqtbtqbq.js → chunk-tddnb5bv.js} +2 -2
- package/dist/{chunk-hvzzhkhr.js → chunk-thceyzj6.js} +2 -2
- package/dist/{chunk-8yqfpkp4.js → chunk-trh7s6k3.js} +5 -5
- package/dist/{chunk-dq56166k.js → chunk-trz8z4j4.js} +18 -18
- package/dist/chunk-ttemwrbx.js +2 -0
- package/dist/{chunk-agqcqf3q.js → chunk-twqzn21x.js} +7 -7
- package/dist/chunk-v14rq8b4.js +3 -0
- package/dist/{chunk-b4pcw34n.js → chunk-v21bhhjb.js} +1 -1
- package/dist/{chunk-ka8befem.js → chunk-v6peecfp.js} +2 -2
- package/dist/{chunk-g8r0km7g.js → chunk-vayhx642.js} +2 -2
- package/dist/{chunk-1ptwdkvn.js → chunk-vdxg7e1y.js} +2 -2
- package/dist/chunk-vq513cxx.js +2 -0
- package/dist/chunk-vvq8xe3n.js +2 -0
- package/dist/{chunk-tre98h62.js → chunk-w3d98907.js} +2 -2
- package/dist/{chunk-0qqvmfrw.js → chunk-w7t2cfgy.js} +42 -42
- package/dist/chunk-w8t31bn9.js +2 -0
- package/dist/chunk-x1kz4d7j.js +2 -0
- package/dist/chunk-xcsyqwxf.js +25 -0
- package/dist/{chunk-9p6efb17.js → chunk-xghcsg3f.js} +1 -1
- package/dist/chunk-xn9jrjzh.js +2 -0
- package/dist/{chunk-nrvwejdw.js → chunk-y1pcdeg9.js} +5 -5
- package/dist/{chunk-7b3kr56x.js → chunk-yx3dpdwc.js} +3 -3
- package/dist/{chunk-5xvan09w.js → chunk-z22zy22p.js} +2 -2
- package/dist/chunk-z97bwx8m.js +2 -0
- package/dist/{chunk-120ze5ms.js → chunk-zmg1peyg.js} +3 -3
- package/dist/{chunk-pxdww4rb.js → chunk-zp79zkkd.js} +2 -2
- package/dist/cli.js +20 -20
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/loops.js +12 -2
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.d.ts +12 -0
- package/dist/signal-processing.js +1 -1
- package/dist/ssg.js +6 -6
- package/package.json +5 -5
- package/dist/chunk-028ee6q5.js +0 -2
- package/dist/chunk-02ymqwmj.js +0 -2
- package/dist/chunk-1pnp91wx.js +0 -2
- package/dist/chunk-1v60t3sb.js +0 -2
- package/dist/chunk-2f17h17f.js +0 -2
- package/dist/chunk-4c183zem.js +0 -2
- package/dist/chunk-4yt8tg4j.js +0 -2
- package/dist/chunk-52gp2xxk.js +0 -2
- package/dist/chunk-5zgrvj4b.js +0 -2
- package/dist/chunk-67kj14at.js +0 -2
- package/dist/chunk-6rzshbey.js +0 -2
- package/dist/chunk-6vzktvyw.js +0 -2
- package/dist/chunk-81q3sc0w.js +0 -2
- package/dist/chunk-864qtx7y.js +0 -2
- package/dist/chunk-89jbdtgw.js +0 -3
- package/dist/chunk-8d33aqs5.js +0 -2
- package/dist/chunk-8tdz8svp.js +0 -2
- package/dist/chunk-99bhc1h1.js +0 -42
- package/dist/chunk-9rrnyd5m.js +0 -2
- package/dist/chunk-9szxxgv5.js +0 -2
- package/dist/chunk-amkwmxs8.js +0 -2
- package/dist/chunk-b1hxtn08.js +0 -2
- package/dist/chunk-b4fd2dtk.js +0 -2
- package/dist/chunk-b4vk2m82.js +0 -2
- package/dist/chunk-b58tv8jc.js +0 -25
- package/dist/chunk-b6nzy1rg.js +0 -2
- package/dist/chunk-b823zxq6.js +0 -3
- package/dist/chunk-bdg0fydw.js +0 -2
- package/dist/chunk-dpvxe52r.js +0 -2
- package/dist/chunk-e1fetwbr.js +0 -2
- package/dist/chunk-e4vpr36s.js +0 -2
- package/dist/chunk-e6p0k6br.js +0 -2
- package/dist/chunk-f8agvh5v.js +0 -2
- package/dist/chunk-fcn71bq1.js +0 -2
- package/dist/chunk-g2jmwh7p.js +0 -2
- package/dist/chunk-g64z2e92.js +0 -2
- package/dist/chunk-gw7h5k3b.js +0 -2
- package/dist/chunk-j0v970k3.js +0 -2
- package/dist/chunk-jk41jwsc.js +0 -2
- package/dist/chunk-jr9wfthg.js +0 -2
- package/dist/chunk-k2pa44rf.js +0 -2
- package/dist/chunk-kq9y6gfy.js +0 -2
- package/dist/chunk-md2qhahg.js +0 -2
- package/dist/chunk-p38m3947.js +0 -2
- package/dist/chunk-qcjh3pp8.js +0 -2
- package/dist/chunk-qw441qys.js +0 -2
- package/dist/chunk-qxmyaajq.js +0 -2
- package/dist/chunk-qyjsne99.js +0 -2
- package/dist/chunk-rermy54w.js +0 -2
- package/dist/chunk-rwjf25ht.js +0 -2
- package/dist/chunk-rx0ep3v1.js +0 -2
- package/dist/chunk-sf0wsq74.js +0 -2
- package/dist/chunk-shpc1ttk.js +0 -2
- package/dist/chunk-sy0z64yz.js +0 -2
- package/dist/chunk-ta7bmfvg.js +0 -3
- package/dist/chunk-weqc0ssb.js +0 -2
- package/dist/chunk-wq712sw1.js +0 -2
- package/dist/chunk-xr69d4tk.js +0 -2
- package/dist/chunk-xz6dw6yw.js +0 -2
- package/dist/chunk-y8kdy3d2.js +0 -2
- package/dist/chunk-yscr04dv.js +0 -2
- package/dist/chunk-z8p6tk5z.js +0 -2
- package/dist/chunk-zhf01af3.js +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{o}from"./chunk-
|
|
2
|
+
import{o}from"./chunk-srq9fqq8.js";import{Ve,te}from"./chunk-a4p18ybc.js";import{Xi}from"./chunk-cbjabv1w.js";import{f}from"./chunk-b7e07ybq.js";import{existsSync as A,mkdirSync as x,copyFileSync as T,chmodSync as P,rmSync as ue}from"fs";import{join as c,basename as be,resolve as H}from"path";import{spawn as q}from"child_process";import{platform as ge}from"os";var Jd=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -468,7 +468,7 @@ else if (data.type === 'event' && data.method) {
|
|
|
468
468
|
}
|
|
469
469
|
})();
|
|
470
470
|
</script>
|
|
471
|
-
`;function
|
|
471
|
+
`;function Bi(e={}){let{debug:r=!1,timeout:a=30000}=e;return`
|
|
472
472
|
<script>
|
|
473
473
|
(function() {
|
|
474
474
|
'use strict';
|
|
@@ -937,9 +937,9 @@ else if (data.type === 'event' && data.method) {
|
|
|
937
937
|
}
|
|
938
938
|
})();
|
|
939
939
|
</script>
|
|
940
|
-
`.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${a}`)}function
|
|
940
|
+
`.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${a}`)}function Yd(){return!1}function Zd(e,r={}){let a=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(a,(i,n)=>{let t={};if(n)try{t=JSON.parse(n.replace(/'/g,'"'))}catch{try{t=Function(`return ${n}`)()}catch{console.warn(`[stx] Invalid @craft config: ${n}`)}}return Bi(t)})}function Fi(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let a=Bi(r);if(e.includes("</head>"))return e.replace("</head>",`${a}
|
|
941
941
|
</head>`);if(e.includes("<body"))return e.replace(/(<body[^>]*>)/,`$1
|
|
942
|
-
${a}`);return a+e}var
|
|
942
|
+
${a}`);return a+e}var Ws={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let a=e.checked?"checked":"",i=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
943
943
|
<input type="checkbox" class="craft-checkbox" ${a} ${i}>
|
|
944
944
|
<span class="craft-checkbox-label">${r||e.label||""}</span>
|
|
945
945
|
</label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,r)=>{let a=e.min??0,i=e.max??100,n=e.step??1,t=e.value??50,s=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${a}" max="${i}" step="${n}" value="${t}" ${s}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,r)=>{let a=e.size||40,i=e.src,n=String(e.alt||""),t=e.fallback||(n?n.charAt(0).toUpperCase():"?");if(i)return`<img class="craft-avatar" src="${i}" alt="${n}" style="width:${a}px;height:${a}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${a}px;height:${a}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,r)=>{let a=Number(e.value)||0,i=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,a/i*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let a=e.size||24;return`<div class="craft-spinner" style="width:${a}px;height:${a}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,r)=>{let a=e.open?"open":"",i=e.title||"";return`<dialog class="craft-modal" ${a}>
|
|
@@ -953,7 +953,7 @@ ${a}`);return a+e}var Us={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
953
953
|
</details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:(e,r)=>{let a=e.variant||"info",i=e.title||"";return`<div class="craft-alert craft-alert-${a}" role="alert">
|
|
954
954
|
${i?`<div class="craft-alert-title">${i}</div>`:""}
|
|
955
955
|
<div class="craft-alert-content">${r}</div>
|
|
956
|
-
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let a=e.content||"",i=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${a}" data-position="${i}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:Y},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:
|
|
956
|
+
</div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let a=e.content||"",i=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${a}" data-position="${i}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:Y},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:Q},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:G},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:X},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let a=e.value||"",i=e.min||"",n=e.max||"";return`<input type="date" class="craft-date-picker" value="${a}" min="${i}" max="${n}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},zi=`
|
|
957
957
|
<style id="craft-component-styles">
|
|
958
958
|
/* Craft Component Base Styles */
|
|
959
959
|
.craft-button {
|
|
@@ -1371,7 +1371,7 @@ ${a}`);return a+e}var Us={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
1373
|
</style>
|
|
1374
|
-
`,
|
|
1374
|
+
`,Qd=`
|
|
1375
1375
|
<script id="craft-component-runtime">
|
|
1376
1376
|
(function() {
|
|
1377
1377
|
if (window.__stxCraftComponentRuntime) return;
|
|
@@ -1475,7 +1475,7 @@ ${a}`);return a+e}var Us={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
1475
1475
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
1476
1476
|
})();
|
|
1477
1477
|
</script>
|
|
1478
|
-
`;function
|
|
1478
|
+
`;function Hi(e,r={}){let{classPrefix:a="craft"}=r;if(!e.includes("craft-component-styles"))if(e.includes("</head>"))e=e.replace("</head>",`${`
|
|
1479
1479
|
<style id="craft-component-styles">
|
|
1480
1480
|
/* Craft Component Base Styles */
|
|
1481
1481
|
.craft-button {
|
|
@@ -2940,17 +2940,17 @@ ${a}`);return a+e}var Us={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
2940
2940
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
2941
2941
|
})();
|
|
2942
2942
|
</script>
|
|
2943
|
-
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,n,t)=>O("sidebar",n,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,n)=>O("sidebar",n,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,n,t)=>O(n,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,n,t,s)=>O(n,t,s.trim(),r,a)),e}function O(e,r,a,i,n){let t=i.components?.[e]||
|
|
2943
|
+
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(i,n,t)=>O("sidebar",n,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(i,n)=>O("sidebar",n,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(i,n,t)=>O(n,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(i,n,t,s)=>O(n,t,s.trim(),r,a)),e}function O(e,r,a,i,n){let t=i.components?.[e]||Ws[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${n}-unknown" data-component="${e}">${a}</div>`;let s=N(r),d=[t.fallbackClasses||`${n}-${e}`];if(s.class)d.push(s.class),delete s.class;if(t.render)return s.__fallbackClasses=d.join(" "),t.render(s,a);let l=se(s,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${l}>`;return`<${t.fallbackTag} ${l}>${a}</${t.fallbackTag}>`}function N(e){let r={},a=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,i;while((i=a.exec(e))!==null){let[n,t,s,d]=i,l=s??d;if(n.startsWith(":"))r[t]=l;else if(n.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=l;else if(l===void 0)r[t]=!0;else r[t]=l}return r}function Y(e,r){let a=I(String(e.id||`craft-sidebar-${ie(r||JSON.stringify(e))}`)),i=ee(e.spaces)||Z(r),n=i.length?[]:ae(e.sections)||z(r),t=String(e.selectedSpace||i[0]?.id||""),s=i.find((w)=>w.id===t)||i[0],d=String(e.selectedItem||e.selected||(i.length?s?.sections[0]?.items[0]?.id:n[0]?.items[0]?.id)||""),l={id:a,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:n,spaces:i,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),p=Number(e.width||e.sidebarWidth||286),b=e.native===!1||e.native==="false"?"false":"true",y=l.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${k(l.searchPlaceholder)}"></div>`:"",g;if(i.length)g=re(i,t,d);else if(n.length)g=n.map((w)=>M(w,d)).join("");else g=r;return`<aside class="${v(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${v(a)}" data-native="${b}" style="--craft-sidebar-width:${p}px">
|
|
2944
2944
|
${y}
|
|
2945
2945
|
${g}
|
|
2946
2946
|
</aside>
|
|
2947
|
-
<script type="application/json" data-craft-sidebar-config="${v(a)}">${ne(l)}</script>`}function
|
|
2947
|
+
<script type="application/json" data-craft-sidebar-config="${v(a)}">${ne(l)}</script>`}function Q(e,r){let a=I(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${v(a)}">
|
|
2948
2948
|
${e.label?`<div class="craft-sidebar-space-title">${k(String(e.label))}</div>`:""}
|
|
2949
2949
|
${r}
|
|
2950
|
-
</section>`}function
|
|
2950
|
+
</section>`}function G(e,r){let a=String(e.header||e.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${v(String(e.id||"section"))}">
|
|
2951
2951
|
${a?`<div class="craft-sidebar-section-title">${k(a)}</div>`:""}
|
|
2952
2952
|
${r}
|
|
2953
|
-
</section>`}function
|
|
2953
|
+
</section>`}function X(e,r){let a={id:String(e.id||I(String(e.label||r||"item"))),label:String(e.label||r||""),icon:e.icon?String(e.icon):void 0,badge:e.badge?String(e.badge):void 0,tintColor:e.tintColor?String(e.tintColor):void 0};return U(a,String(e.selected||"")==="true")}function z(e){let r=[],a=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,i;while((i=a.exec(e))!==null){let n=N(i[1]||""),t=i[2]||"",s=String(n.id||I(String(n.header||n.title||`section-${r.length+1}`))),d=String(n.header||n.title||s),l=K(t);r.push({id:s,header:d,title:d,items:l})}return r}function K(e){let r=[],a=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,i;while((i=a.exec(e))!==null){let n=N(i[1]||""),t=String(n.label||(i[2]||"").replace(/<[^>]*>/g,"").trim()),s=String(n.id||I(t||`item-${r.length+1}`));r.push({id:s,label:t,icon:n.icon?String(n.icon):void 0,badge:n.badge?String(n.badge):void 0,tintColor:n.tintColor?String(n.tintColor):void 0})}return r}function Z(e){let r=[],a=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,i;while((i=a.exec(e))!==null){let n=N(i[1]||""),t=i[2]||"",s=String(n.label||n.title||`Space ${r.length+1}`);r.push({id:String(n.id||I(s)),label:s,icon:n.icon?String(n.icon):void 0,tint:n.tint?String(n.tint):void 0,sections:z(t)})}return r}function ee(e){if(!e)return;if(Array.isArray(e))return e;if(typeof e!=="string")return;try{let r=JSON.parse(e);return Array.isArray(r)?r:void 0}catch{return}}function re(e,r,a){let i=e.map((t)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${v(t.id)}" data-selected="${t.id===r?"true":"false"}" title="${v(t.label||t.id)}">${t.icon?`<span class="craft-sidebar-item-icon" data-icon="${v(t.icon)}"></span>`:k((t.label||t.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${e.map((t)=>`<section class="craft-sidebar-space" data-space-id="${v(t.id)}" data-selected="${t.id===r?"true":"false"}">
|
|
2954
2954
|
${t.label?`<div class="craft-sidebar-space-title">${k(t.label)}</div>`:""}
|
|
2955
2955
|
${t.sections.map((s)=>M(s,a)).join("")}
|
|
2956
2956
|
</section>`).join("")}</div>
|
|
@@ -2961,13 +2961,13 @@ ${a}`);return a+e}var Us={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
2961
2961
|
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${v(e.icon)}"${a}></span>`:""}
|
|
2962
2962
|
<span class="craft-sidebar-item-label">${k(e.label)}</span>
|
|
2963
2963
|
${e.badge?`<span class="craft-sidebar-item-badge">${k(e.badge)}</span>`:""}
|
|
2964
|
-
</button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ie(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function k(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function v(e){return k(e).replace(/`/g,"`")}function ne(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function se(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[n,t]of Object.entries(e))if(t===!0)i.push(n);else if(t!==!1&&t!==void 0&&t!==null){let s=String(t).replace(/"/g,""");i.push(`${n}="${s}"`)}return i.join(" ")}function
|
|
2965
|
-
</head>`)}let d=e.name||be(e.input,".stx"),l=e.version||"1.0.0",u=e.craftPath||await
|
|
2964
|
+
</button>`}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function ie(e){let r=5381;for(let a=0;a<e.length;a++)r=r*33^e.charCodeAt(a);return(r>>>0).toString(36)}function k(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function v(e){return k(e).replace(/`/g,"`")}function ne(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function se(e,r,a){let i=[];i.push(`class="${a.join(" ")}"`),i.push(`data-craft="${r.nativeType}"`);for(let[n,t]of Object.entries(e))if(t===!0)i.push(n);else if(t!==!1&&t!==void 0&&t!==null){let s=String(t).replace(/"/g,""");i.push(`${n}="${s}"`)}return i.join(" ")}function ep(e,r){Ws[e]=r}function tp(){return{...Ws}}import{copyFileSync as oe,mkdtempSync as ce,rmSync as de,writeFileSync as le}from"fs";import{tmpdir as fe}from"os";import{join as F}from"path";function pe(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let a=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(a.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${a.stderr.toString().trim()||a.stdout.toString().trim()}`);let i=JSON.parse(a.stdout.toString());if(!i||typeof i!=="object"||Array.isArray(i))throw Error("The macOS profile entitlements must be a dictionary.");return i}async function L(e,r=[],a={}){if(process.platform!=="darwin")return;let i=a.entitlements,n;try{if(a.provisioningProfile){if(!a.identity||a.identity==="-")throw Error("A provisioning profile requires a signing identity.");let l=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",a.provisioningProfile]);if(l.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let u=pe(l.stdout),p={};if(a.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",a.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");p=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(u[b])p[b]=u[b];if(n=ce(F(fe(),"stx-entitlements-")),i=F(n,"entitlements.plist"),le(i,JSON.stringify(p)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",i]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");oe(a.provisioningProfile,F(e,"Contents","embedded.provisionprofile"))}for(let l of[...r,e]){let u=a.hardenedRuntime?["--options","runtime"]:[];if(l===e&&i)u.push("--entitlements",i);let p=a.identity&&a.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",a.identity||"-",p,...u,l],{stdout:"pipe",stderr:"pipe"}),[y,g]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(g!==0)throw Error(`Could not sign native bundle ${l}: ${y.trim()}`)}let t=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[s,d]=await Promise.all([new Response(t.stderr).text(),t.exited]);if(d!==0)throw Error(`Invalid native bundle signature: ${s.trim()}`)}finally{if(n)de(n,{recursive:!0,force:!0})}}async function Vi(e){let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||R(),format:e.format||"app",error:`Input file not found: ${e.input}`};let a=e.target||R(),i=e.format||ke(a);if(e.backend&&a!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!A(H(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let n=e.output||c(process.cwd(),"dist","native");if(!A(n))x(n,{recursive:!0});let t=await o(process.cwd()),s=await Xi(e.input,{context:e.context,options:{...t,isDev:!1}});if(s=Fi(s,{debug:e.verbose}),s=Hi(s),!s.includes("craft-component-styles")){if(s.includes("</head>"))s=s.replace("</head>",`${zi}
|
|
2965
|
+
</head>`)}let d=e.name||be(e.input,".stx"),l=e.version||"1.0.0",u=e.craftPath||await Ui();if(!u)return{success:!1,target:a,format:i,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${a}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${n}`),console.log(` Craft: ${u}`);let p;switch(a){case"macos":p=await me(s,d,l,n,i,e,u);break;case"windows":p=await xe(s,d,l,n,i,e,u);break;case"linux":p=await ye(s,d,l,n,i,e,u);break;case"ios":p=await Se(s,d,l,n,e,u);break;case"android":p=await Ce(s,d,l,n,e,u);break;default:p={success:!1,target:a,format:i,error:`Unsupported target: ${a}`}}return p.duration=Date.now()-r,p}catch(a){return{success:!1,target:e.target||R(),format:e.format||"app",error:a.message,duration:Date.now()-r}}}async function me(e,r,a,i,n,t,s){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=c(i,`${r}.app`),u=c(l,"Contents"),p=c(u,"MacOS"),b=c(u,"Resources");ue(l,{recursive:!0,force:!0}),x(p,{recursive:!0}),x(b,{recursive:!0});let y=c(b,"index.html");await Bun.write(y,e);let g="";if(t.sidebar?.enabled&&t.sidebar?.config)g=c(b,"sidebar-config.json"),await Bun.write(g,JSON.stringify(t.sidebar.config));let w=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",C=t.menubarOnly??t.systemTray,m=t.bundleStyle||(await we(s)?"executable":"launcher");if(t.backend){if(!await he(s))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");T(s,c(p,r)),P(c(p,r),493);let S=Ve("native-backend");try{let h=c(S,"launcher.ts"),_=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(h,`import { runNativeBackend } from ${JSON.stringify(_)}
|
|
2966
2966
|
import handler from ${JSON.stringify(H(t.backend.entry))}
|
|
2967
2967
|
await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: handler,
|
|
2968
2968
|
maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
|
|
2969
2969
|
`);let B=Bun.spawn([process.execPath,"build",h,"--compile","--minify","--no-compile-autoload-bunfig","--no-compile-autoload-dotenv","--outfile",c(p,"stx-backend")],{stdout:"pipe",stderr:"pipe"}),[E,W,J]=await Promise.all([new Response(B.stdout).text(),new Response(B.stderr).text(),B.exited]);if(J!==0)throw Error(`Native backend compilation failed: ${E}
|
|
2970
|
-
${W}`)}finally{
|
|
2970
|
+
${W}`)}finally{te(S)}await Bun.write(c(b,"craft.json"),`${JSON.stringify({backend:{executable:"stx-backend"},title:t.window?.title||r,appName:r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools),frameless:Boolean(t.window?.frameless),transparent:Boolean(t.window?.transparent),alwaysOnTop:Boolean(t.window?.alwaysOnTop),resizable:t.window?.resizable!==!1,...t.trayPopover?{trayPopover:!0}:C?{menubarOnly:!0}:t.systemTray?{systemTray:!0}:{}},null,2)}
|
|
2971
2971
|
`)}else if(m==="executable"){let S=c(p,r);T(s,S),P(S,493);let h={html:"index.html",title:t.window?.title||r,width:t.window?.width||1200,height:t.window?.height||800,devTools:Boolean(t.devTools)};if(t.trayPopover)h.trayPopover=!0;else if(C)h.menubarOnly=!0;else if(t.systemTray)h.systemTray=!0;if(t.window?.frameless)h.frameless=!0;if(t.window?.transparent)h.transparent=!0;if(t.window?.alwaysOnTop)h.alwaysOnTop=!0;if(t.window?.resizable===!1)h.resizable=!1;await Bun.write(c(b,"craft.json"),`${JSON.stringify(h,null,2)}
|
|
2972
2972
|
`)}else{let S=c(p,"craft");T(s,S),P(S,493);let h=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",B=`#!/bin/bash
|
|
2973
2973
|
set -euo pipefail
|
|
@@ -3008,7 +3008,7 @@ Name=${r}
|
|
|
3008
3008
|
Exec=${b}
|
|
3009
3009
|
Terminal=false
|
|
3010
3010
|
Categories=Utility;
|
|
3011
|
-
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),y),n==="deb"){let g=c(i,`${r.toLowerCase()}_${a}_amd64.deb`),w=await Pe(d,g,r,a,t);if(!w.success)return{success:!1,target:"linux",format:"deb",error:w.error};return{success:!0,target:"linux",format:"deb",outputPath:g}}if(n==="appimage"){let g=c(i,`${r}-${a}-x86_64.AppImage`),w=await Ie(d,g,r,t);if(!w.success)return{success:!1,target:"linux",format:"appimage",error:w.error};return{success:!0,target:"linux",format:"appimage",outputPath:g}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Se(e,r,a,i,n,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ce(e,r,a,i,n,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function
|
|
3011
|
+
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),y),n==="deb"){let g=c(i,`${r.toLowerCase()}_${a}_amd64.deb`),w=await Pe(d,g,r,a,t);if(!w.success)return{success:!1,target:"linux",format:"deb",error:w.error};return{success:!0,target:"linux",format:"deb",outputPath:g}}if(n==="appimage"){let g=c(i,`${r}-${a}-x86_64.AppImage`),w=await Ie(d,g,r,t);if(!w.success)return{success:!1,target:"linux",format:"appimage",error:w.error};return{success:!0,target:"linux",format:"appimage",outputPath:g}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Se(e,r,a,i,n,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ce(e,r,a,i,n,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Ui(){let e=process.env.CRAFT_BIN;if(e){if(!A(e))throw Error(`CRAFT_BIN points to a missing file: ${e}`);return e}return Bun.which("craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function R(){switch(ge()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function ke(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function $e(e,r,a){return new Promise((i)=>{let n=q("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);n.on("close",(t)=>{if(t===0)i({success:!0});else i({success:!1,error:`hdiutil exited with code ${t}`})}),n.on("error",(t)=>{i({success:!1,error:t.message})})})}async function Te(e,r){return new Promise((a)=>{let i=q("zip",["-r",r,"."],{cwd:e});i.on("close",(n)=>{if(n===0)a({success:!0});else a({success:!1,error:`zip exited with code ${n}`})}),i.on("error",(n)=>{a({success:!1,error:n.message})})})}async function Pe(e,r,a,i,n){return new Promise((t)=>{let s=Ve("deb");try{let d=c(s,"pkg"),l=c(d,"DEBIAN"),u=c(d,"usr","bin"),p=c(d,"usr","share","applications"),b=c(d,"usr","share",a.toLowerCase());x(l,{recursive:!0}),x(u,{recursive:!0}),x(p,{recursive:!0}),x(b,{recursive:!0});let y=f("fs").readdirSync(e);for(let m of y)T(c(e,m),c(b,m));let g=`#!/bin/bash
|
|
3012
3012
|
exec /usr/share/${a.toLowerCase()}/${a.toLowerCase()} "$@"`;f("fs").writeFileSync(c(u,a.toLowerCase()),g),P(c(u,a.toLowerCase()),493);let w=`Package: ${a.toLowerCase()}
|
|
3013
3013
|
Version: ${i}
|
|
3014
3014
|
Section: utils
|
|
@@ -3017,7 +3017,7 @@ Architecture: amd64
|
|
|
3017
3017
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
3018
3018
|
Maintainer: ${n.author||"Unknown"}
|
|
3019
3019
|
Description: ${n.description||a}
|
|
3020
|
-
`;f("fs").writeFileSync(c(l,"control"),w);let C=q("dpkg-deb",["--build",d,r]);C.on("close",(m)=>{if(
|
|
3020
|
+
`;f("fs").writeFileSync(c(l,"control"),w);let C=q("dpkg-deb",["--build",d,r]);C.on("close",(m)=>{if(te(s),m===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${m}`})}),C.on("error",(m)=>{te(s),t({success:!1,error:m.message})})}catch(d){te(s),t({success:!1,error:d.message})}})}async function Ie(e,r,a,i){return new Promise((n)=>{let t=Ve("appimage");try{let s=c(t,`${a}.AppDir`),d=c(s,"usr"),l=c(d,"bin"),u=c(d,"share");x(l,{recursive:!0}),x(u,{recursive:!0});let p=c(u,a.toLowerCase());x(p,{recursive:!0});let b=f("fs").readdirSync(e);for(let m of b)T(c(e,m),c(p,m));let y=`#!/bin/bash
|
|
3021
3021
|
SELF=$(readlink -f "$0")
|
|
3022
3022
|
HERE=\${SELF%/*}
|
|
3023
3023
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
@@ -3029,5 +3029,5 @@ Exec=${a.toLowerCase()}
|
|
|
3029
3029
|
Terminal=false
|
|
3030
3030
|
Categories=Utility;
|
|
3031
3031
|
Icon=${a.toLowerCase()}
|
|
3032
|
-
`;f("fs").writeFileSync(c(s,`${a.toLowerCase()}.desktop`),g);let w=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(f("fs").writeFileSync(c(s,`${a.toLowerCase()}.png`),w),i.icon&&A(i.icon))T(i.icon,c(s,`${a.toLowerCase()}.png`));let C=q("appimagetool",[s,r],{env:{...process.env,ARCH:"x86_64"}});C.on("close",(m)=>{if(
|
|
3033
|
-
export{
|
|
3032
|
+
`;f("fs").writeFileSync(c(s,`${a.toLowerCase()}.desktop`),g);let w=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(f("fs").writeFileSync(c(s,`${a.toLowerCase()}.png`),w),i.icon&&A(i.icon))T(i.icon,c(s,`${a.toLowerCase()}.png`));let C=q("appimagetool",[s,r],{env:{...process.env,ARCH:"x86_64"}});C.on("close",(m)=>{if(te(t),m===0)P(r,493),n({success:!0});else n({success:!1,error:`appimagetool exited with code ${m}. Install from https://appimage.github.io/appimagetool/`})}),C.on("error",(m)=>{te(t),n({success:!1,error:`appimagetool not found: ${m.message}`})})}catch(s){te(t),n({success:!1,error:s.message})}})}function Wi(){return[R()]}function qi(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var Be={buildNative:Vi,getAvailableTargets:Wi,getAvailableFormats:qi,detectPlatform:R},np=Be;
|
|
3033
|
+
export{Jd,Bi,Yd,Zd,Fi,Ws,zi,Qd,Hi,ep,tp,Vi,Ui,Wi,qi,np};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`+e.slice(t);let n=
|
|
2
|
+
import{er}from"./chunk-4s8zacxg.js";import{pr}from"./chunk-bsajk82t.js";import{o}from"./chunk-srq9fqq8.js";import{W,Ge}from"./chunk-p6qd7ad0.js";import{ua}from"./chunk-vayhx642.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function Kn(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let u=p.exec(e);if(u){x.lastIndex=n+u[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let c=b.exec(e);if(c){if(t===0)s=n;t++,r=n+c[0].length;continue}S.lastIndex=n;let a=S.exec(e);if(a){if(t>0)t--;r=n+a[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function U(e,r={}){return new er(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let a=await o();t||=a?.pagesDir||"pages",s||=a?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),u=T.get(n);if(u)return u;let c=[];try{c=U(".",{pagesDir:n,emit:!1}).map((a)=>a.regex.source).filter(Boolean)}catch{c=[]}return T.set(n,c),c}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function me(e){return e.includes("data-stx-runtime")}function ca(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function f(e,r){let t=Kn(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
|
|
3
|
+
`+e.slice(t);let n=pr(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
4
|
${r}${e.slice(n)}`;if(e.includes("</head>")){let c=e.indexOf("</head>");return e.slice(0,c)+r+`
|
|
5
|
-
`+e.slice(c)}if(
|
|
5
|
+
`+e.slice(c)}if(W(e))return Ge(e,(c)=>`${c}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function
|
|
7
|
+
${e}`}async function Xn(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-34yj93hh.js"),{url:u}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-34yj93hh.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function la(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${ua()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function
|
|
9
|
+
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function he(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-34yj93hh.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=g}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:u,getServeClientAsset:c}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:u,getServeClientAsset:c}=await import("./chunk-34yj93hh.js"),a=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await c("router")).url}"></script>`:`<script data-stx-router>${await u()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+a+`
|
|
13
13
|
</body>`+e.slice(d+7)}
|
|
14
|
-
export{
|
|
14
|
+
export{Kn,U,me,ca,Xn,la,he};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import i from"path";var nn=".stx",o="STX_DIR",e=null;function Ea(t){e=t?.trim()||null}function nr(){return process.env[o]?.trim()||e||nn}function c(t=process.cwd(),...n){let r=nr();return i.isAbsolute(r)?i.join(r,...n):i.join(t,r,...n)}function rr(t){if(!t||i.isAbsolute(t))return t;let n=t.replace(/\\/g,"/");if(n!==nn&&!n.startsWith(`${nn}/`))return t;let r=n.slice(nn.length+1);return r?i.join(nr(),r):nr()}
|
|
3
|
+
export{nn,Ea,nr,c,rr};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{it,at,ct}from"./chunk-tp4eqfxq.js";import{Bt,Ft,ot,
|
|
2
|
+
import{it,at,ct}from"./chunk-tp4eqfxq.js";import{Bt,Ft,ot,ui,zt,Ht}from"./chunk-szevd7d5.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();Bt();let t=await it({mode:"build"});if(!t.config.enabled){ot("Story feature is disabled in config.");return}let n=await zt(t);at(t,n);let l=Ht(t.config,n);ct(t,l),Ft(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;ui(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{l,p,Qa,u,t,a}from"./chunk-2dp7hyv7.js";import{Ke,yt,tn,lo}from"./chunk-p472crv1.js";function L(w,e){try{let f=w.trim();if(p(f))return u(f,Object.keys(e))(...Object.values(e));else return l(f,e)}catch{return!1}}function Q(w,e,f){let n=w,v=!0;while(v){v=!1;let h=n.match(/@switch\s*\(/);if(!h||h.index===void 0)break;let b=h.index,s=lo(n,b);if(!s)break;try{let o;if(p(s.expression))o=u(s.expression,Object.keys(e))(...Object.values(e));else o=l(s.expression,e);let r="",g=!1;for(let i of s.cases)if(i.type==="default"){if(!g)r=i.content.trim()}else try{let y;if(i.value&&p(i.value))y=u(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=l(i.value,e);if(o===y){r=i.content.trim(),g=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),g=a("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+g+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(f,n)=>e[Number(n)]??f)}function ee(w,e,f){let{masked:n,scripts:v}=H(w);return J(K(n,e,f),v)}function K(w,e,f){let n=w;n=Q(n,e,f);{let h=!0;while(h){h=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Ke(n,s+7);if(!o)break;let r=o.endPos,g=yt(n,"unless","endunless",r);if(g===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,g),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,d=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=d.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let c;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);c=`@if (${y})${k}@else ${x}@endif`}else c=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+c+n.substring(g+10),h=!0}}n=ro(n,e,f),n=so(n,e,f),n=no(n,e);let v=()=>{let h=tn(n);if(h.length===0)return!1;let b=Array(h.length);for(let r=h.length-1;r>=0;r--){let g=h[r];try{let i="",y=!1;for(let m of g.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?Qa(m.condition,e):!1)i=m.content,y=!0}catch(c){i=a(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${c instanceof Error?c.message:String(c)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=a("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(h.length*2+1),o=0;for(let r=0;r<h.length;r++){let g=h[r];s[r*2]=n.slice(o,g.start),s[r*2+1]=b[r],o=g.end}return s[h.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let h=n;if(!v())break;if(n===h)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let f=w[e];if(f!=="'"&&f!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===f){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function no(w,e){let f=w;function n(s,o,r,g){let i=1,y=g,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),c=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,c.lastIndex=y;let x=m.exec(s),k=c.exec(s),d=x?x.index:1/0,E=k?k.index:1/0;if(d<E)i++,y=d+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let g=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,c=[],x;while((x=i.exec(s))!==null)c.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)c.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)c.push({pos:x.index,type:"else"});c.sort((k,d)=>k.pos-d.pos);for(let k of c)if(k.type==="open")g++;else if(k.type==="close")g--;else if(k.type==="else"&&g===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=f.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=f.slice(r+5),m=q(y);if(m)g=m.value,i=r+5+m.consumed;else i=r+5;let c=n(f,"auth","endauth",i);if(c===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=f.slice(i,c),k=v(x,"auth","endauth"),d;if(!e.auth)d=!1;else d=g?L(`auth?.check && auth?.user?.[${g}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=d?S:C}else E=d?x:"";f=f.substring(0,r)+E+f.substring(c+8),s=!0}}{let s=!0;while(s){s=!1;let o=f.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=f.slice(r+6),m=q(y);if(m)g=m.value,i=r+6+m.consumed;else i=r+6;let c=n(f,"guest","endguest",i);if(c===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=f.slice(i,c),k=v(x,"guest","endguest"),d;if(!e.auth)d=!0;else d=g?L(`!auth?.check || !auth?.user?.[${g}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=d?S:C}else E=d?x:"";f=f.substring(0,r)+E+f.substring(c+9),s=!0}}function h(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let g=[s];if(o)g.push(o);if(r){let i=L(r,e);g.push(i)}return e.permissions.check(...g)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",g=!0;while(g){g=!1;let i=f.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=f.slice(y+`@${s}`.length),c=b(m);if(!c)break;let x=y+`@${s}`.length+c.paramsEnd,k=n(f,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let d=f.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(d))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(d))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(d))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(d))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:d.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=d.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:d.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:d.length;I.push({content:d.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<d.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:d.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:d.slice(F)})}let O=h(c.ability,c.type,c.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=h(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}f=f.substring(0,y)+V+f.substring(k+`@${o}`.length),g=!0}}return f}function ro(w,e,f){let n=w;function v(h,b,s,o,r){let g=!0;while(g){g=!1;let i=new RegExp(`@${b}\\s*\\(`),y=h.match(i);if(!y||y.index===void 0)break;let m=y.index,c=Ke(h,m+`@${b}`.length);if(!c)break;let x=c.endPos,k=yt(h,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let d=h.slice(x,k),E=c.expression,S=-1,C=0,P=0;while(P<d.length){let R=d.indexOf("@",P);if(R===-1)break;let T=d.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=d.slice(0,S),M=d.slice(S+5);T=R?_:M}else T=R?d:"";h=h.substring(0,m)+T+h.substring(k+`@${s}`.length),g=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=a(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);h=h.substring(0,m)+_+h.substring(k+`@${s}`.length);break}}return h}return n=v(n,"isset","endisset",(h)=>{let b=L(h,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(h)=>{let b=L(h,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function so(w,e,f){let n=w,v="development";function h(b,s,o,r){let g=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),c=b,x=!0;while(x){x=!1,g.lastIndex=0;let k=g.exec(c);if(!k)break;let d=k.index,E=d+k[0].length;if(s==="env"){let O=c.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<c.length){g.lastIndex=C,i.lastIndex=C;let O=g.exec(c),j=i.exec(c),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${d} has no matching @${o} \u2014 the block was skipped.`);break}let R=c.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;c=c.substring(0,d)+I+c.substring(P+F),x=!0}return c}return n=h(n,"env","endenv",!1),n=h(n,"production","endproduction",v==="production"),n=h(n,"development","enddevelopment",v==="development"),n=h(n,"staging","endstaging",v==="staging"),n=h(n,"testing","endtesting",v==="testing"),n}
|
|
3
|
-
export{
|
|
2
|
+
import{l,p,ec,u,t,a}from"./chunk-bsajk82t.js";import{Ke,yt,tn,uo}from"./chunk-hgry3mjd.js";function L(w,e){try{let f=w.trim();if(p(f))return u(f,Object.keys(e))(...Object.values(e));else return l(f,e)}catch{return!1}}function Q(w,e,f){let n=w,v=!0;while(v){v=!1;let h=n.match(/@switch\s*\(/);if(!h||h.index===void 0)break;let b=h.index,s=uo(n,b);if(!s)break;try{let o;if(p(s.expression))o=u(s.expression,Object.keys(e))(...Object.values(e));else o=l(s.expression,e);let r="",g=!1;for(let i of s.cases)if(i.type==="default"){if(!g)r=i.content.trim()}else try{let y;if(i.value&&p(i.value))y=u(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=l(i.value,e);if(o===y){r=i.content.trim(),g=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),g=a("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+g+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(f,n)=>e[Number(n)]??f)}function ne(w,e,f){let{masked:n,scripts:v}=H(w);return J(K(n,e,f),v)}function K(w,e,f){let n=w;n=Q(n,e,f);{let h=!0;while(h){h=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Ke(n,s+7);if(!o)break;let r=o.endPos,g=yt(n,"unless","endunless",r);if(g===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,g),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,d=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=d.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let c;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);c=`@if (${y})${k}@else ${x}@endif`}else c=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+c+n.substring(g+10),h=!0}}n=so(n,e,f),n=oo(n,e,f),n=ro(n,e);let v=()=>{let h=tn(n);if(h.length===0)return!1;let b=Array(h.length);for(let r=h.length-1;r>=0;r--){let g=h[r];try{let i="",y=!1;for(let m of g.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?ec(m.condition,e):!1)i=m.content,y=!0}catch(c){i=a(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${c instanceof Error?c.message:String(c)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=a("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(h.length*2+1),o=0;for(let r=0;r<h.length;r++){let g=h[r];s[r*2]=n.slice(o,g.start),s[r*2+1]=b[r],o=g.end}return s[h.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let h=n;if(!v())break;if(n===h)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let f=w[e];if(f!=="'"&&f!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===f){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function ro(w,e){let f=w;function n(s,o,r,g){let i=1,y=g,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),c=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,c.lastIndex=y;let x=m.exec(s),k=c.exec(s),d=x?x.index:1/0,E=k?k.index:1/0;if(d<E)i++,y=d+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let g=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,c=[],x;while((x=i.exec(s))!==null)c.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)c.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)c.push({pos:x.index,type:"else"});c.sort((k,d)=>k.pos-d.pos);for(let k of c)if(k.type==="open")g++;else if(k.type==="close")g--;else if(k.type==="else"&&g===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=f.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=f.slice(r+5),m=q(y);if(m)g=m.value,i=r+5+m.consumed;else i=r+5;let c=n(f,"auth","endauth",i);if(c===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=f.slice(i,c),k=v(x,"auth","endauth"),d;if(!e.auth)d=!1;else d=g?L(`auth?.check && auth?.user?.[${g}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=d?S:C}else E=d?x:"";f=f.substring(0,r)+E+f.substring(c+8),s=!0}}{let s=!0;while(s){s=!1;let o=f.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=f.slice(r+6),m=q(y);if(m)g=m.value,i=r+6+m.consumed;else i=r+6;let c=n(f,"guest","endguest",i);if(c===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=f.slice(i,c),k=v(x,"guest","endguest"),d;if(!e.auth)d=!0;else d=g?L(`!auth?.check || !auth?.user?.[${g}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=d?S:C}else E=d?x:"";f=f.substring(0,r)+E+f.substring(c+9),s=!0}}function h(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let g=[s];if(o)g.push(o);if(r){let i=L(r,e);g.push(i)}return e.permissions.check(...g)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",g=!0;while(g){g=!1;let i=f.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=f.slice(y+`@${s}`.length),c=b(m);if(!c)break;let x=y+`@${s}`.length+c.paramsEnd,k=n(f,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let d=f.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(d))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(d))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(d))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(d))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:d.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=d.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:d.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:d.length;I.push({content:d.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<d.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:d.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:d.slice(F)})}let O=h(c.ability,c.type,c.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=h(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}f=f.substring(0,y)+V+f.substring(k+`@${o}`.length),g=!0}}return f}function so(w,e,f){let n=w;function v(h,b,s,o,r){let g=!0;while(g){g=!1;let i=new RegExp(`@${b}\\s*\\(`),y=h.match(i);if(!y||y.index===void 0)break;let m=y.index,c=Ke(h,m+`@${b}`.length);if(!c)break;let x=c.endPos,k=yt(h,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let d=h.slice(x,k),E=c.expression,S=-1,C=0,P=0;while(P<d.length){let R=d.indexOf("@",P);if(R===-1)break;let T=d.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=d.slice(0,S),M=d.slice(S+5);T=R?_:M}else T=R?d:"";h=h.substring(0,m)+T+h.substring(k+`@${s}`.length),g=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=a(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);h=h.substring(0,m)+_+h.substring(k+`@${s}`.length);break}}return h}return n=v(n,"isset","endisset",(h)=>{let b=L(h,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(h)=>{let b=L(h,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function oo(w,e,f){let n=w,v="development";function h(b,s,o,r){let g=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),c=b,x=!0;while(x){x=!1,g.lastIndex=0;let k=g.exec(c);if(!k)break;let d=k.index,E=d+k[0].length;if(s==="env"){let O=c.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<c.length){g.lastIndex=C,i.lastIndex=C;let O=g.exec(c),j=i.exec(c),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${d} has no matching @${o} \u2014 the block was skipped.`);break}let R=c.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;c=c.substring(0,d)+I+c.substring(P+F),x=!0}return c}return n=h(n,"env","endenv",!1),n=h(n,"production","endproduction",v==="production"),n=h(n,"development","enddevelopment",v==="development"),n=h(n,"staging","endstaging",v==="staging"),n=h(n,"testing","endtesting",v==="testing"),n}
|
|
3
|
+
export{ne,ro,so,oo};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ye}from"./chunk-
|
|
2
|
+
import{Ye}from"./chunk-4s8zacxg.js";import{ft,On}from"./chunk-9dtbvjpp.js";import{Ie,cn,Ja,Ya}from"./chunk-f9zyf9n6.js";import{fr,gr,mr,yr,xe}from"./chunk-bsajk82t.js";import{A}from"./chunk-25zmy8q6.js";import{Bo}from"./chunk-mwnhdsbp.js";import{h}from"./chunk-kdebh22m.js";import{s}from"./chunk-aet1pgw7.js";import{N,o}from"./chunk-srq9fqq8.js";import{xa}from"./chunk-am2w363p.js";import{He,ke,Ri,Ai,kn}from"./chunk-bawq4fqy.js";import{Zt,Xs}from"./chunk-hz4x7h0n.js";import{_n}from"./chunk-s2wptfm1.js";import{qt,jn,Bn}from"./chunk-xaa36b0x.js";import{U}from"./chunk-twqzn21x.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(i){return Q("sha256").update(i).digest("hex").slice(0,8)}function J(i=!1){let l=i?On():ft(),a=W(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let i=Ye(),l=W(i);return{content:i,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(i={}){let l=new Set;return{context:new Proxy(i,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(i,l,a={}){let r=q.resolve(i),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Ja();let _={};try{_=await o(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f;while((f=d.exec(e))!==null){let R=f[1];if(/\bserver\b/.test(R))y.push(f[2])}let u=new Set(y.flatMap((R)=>Ie(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...N,..._,...a,buildMode:"compile",strict:!1},b=await s(e,D,r,j,w),C=He(b),P=Ya();return{route:l,sourceFile:i,html:b,fragment:C,placeholders:P,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:cn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(i,l){let a=0,r=0;if(!m.existsSync(i))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let f=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(f,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(f,u),a++,r+=m.statSync(u).size}}}return e(i,l),{copied:a,bytes:r}}async function Lu(i={}){let l=Date.now(),a=c.resolve(i.root||process.cwd()),r=c.resolve(a,i.outputDir||".output");console.log("[stx build] Starting production build...");let e=await o(a),S=c.resolve(a,i.componentsDir??e.componentsDir??"components"),_=c.resolve(a,i.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,i.layoutsDir??e.layoutsDir??"layouts"),d=i.publicDir??e.publicDir??"public",f=xe(e.app?.head,{known:yr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=i.routeRules??e.routeRules??{},j=_n(w),b=i.serverApi??e.serverApi,C=typeof b==="object"?b:{};if(b)Zt(a,C);if(e.runtimeConfig)A(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let n of P)m.mkdirSync(n,{recursive:!0});console.log("[stx build] Discovering routes...");let R=U(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((n)=>!Y.some((g)=>n.pattern.startsWith(`/${g}/`)||n.pattern===`/${g}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(i.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let n of B){let g=j(n.pattern),O=g.rendering==="prerender";if(O&&(n.pattern.includes(":")||n.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${n.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(n.filePath,n.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:i.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=mr(t.html,f,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=fr(t.html,u);if(f.htmlAttrs)t.html=gr(t.html,f.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await h(t.html),O){let p=await kn(t,{params:{},request:new Request(`http://stx.build${n.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${n.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=ke(t.html,D);let L=n.pattern==="/"?"index":n.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),k.push({pattern:n.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:n.pattern.includes(":")||n.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${n.pattern}`)}catch(t){if(Object.keys(g).length)throw t;console.error(`[stx build] \u2717 ${n.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(a,d);if(m.existsSync(E)){let{copied:n,bytes:g}=Z(E,c.join(r,"public"));if(n>0)console.log(`[stx build] Copied ${n} public asset${n===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${d}/`)}let H=Bn(a);if(H){let{copied:n,bytes:g}=Z(H,c.join(r,"public",jn));if(n>0)console.log(`[stx build] Copied ${n} asset${n===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${qt}/`)}let F={runtime:v.filename,router:x.filename},T=Ri(k,F,r);if(T.routeRules=w,T.routerContainer=D,b)T.apiRoutes=await Xs(a,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Bo(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(xa(e._layerGraph),null,2));Ai(T,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:F,outputDir:r,duration:K}}
|
|
4
|
-
export{
|
|
4
|
+
export{Lu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Li,nl,Pn,nd,rl,sl,ol,rd}from"./chunk-yx3dpdwc.js";import"./chunk-f9zyf9n6.js";import"./chunk-mwnhdsbp.js";import"./chunk-25zmy8q6.js";import"./chunk-bsajk82t.js";import"./chunk-ce6zddpf.js";import"./chunk-zp79zkkd.js";export{Pn as Validator,nl as defineForm,rl as processErrorDirective,sl as processErrorsDirective,rd as processFormValidationDirectives,ol as processHasErrorsDirective,Li as useForm,nd as v};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function
|
|
3
|
-
export{
|
|
2
|
+
import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function il(e,r){let a=r.formats??d;if(!r.publicDir)return e;let i=y(e),o=[],m=/<img\b[^>]*?>/gi,c=[],u;while((u=m.exec(e))!==null){let t=u[0],n=t.match(/\bsrc=["']([^"']+)["']/i);if(!n)continue;if(A(u.index,i))continue;c.push({idx:u.index,length:t.length,src:n[1],raw:t})}if(c.length===0)return e;let f=await Promise.all(c.map(async(t)=>{let n=await S(t.src,r.publicDir,a);return{match:t,sources:n}}));for(let{match:t,sources:n}of f){if(n.length===0)continue;let x=`<picture>${n.map((p)=>`<source type="${p.mime}" srcset="${P(p.url)}">`).join("")}${t.raw}</picture>`;o.push({start:t.idx,end:t.idx+t.length,replacement:x})}if(o.length===0)return e;let l="",g=0;for(let t of o)l+=e.slice(g,t.start),l+=t.replacement,g=t.end;return l+=e.slice(g),l}async function S(e,r,a){if(!w(e))return[];let i=s.extname(e).toLowerCase();if(!h.has(i))return[];if(!e.startsWith("/"))return[];let o=s.join(r,e.slice(1)),m=s.dirname(o),c=s.basename(o,i),u=s.resolve(m),f=s.resolve(r);if(!u.startsWith(f))return[];let l=s.posix.dirname(e),g=a.map(async(n)=>{let b=s.join(m,`${c}${n.ext}`);if(!await Bun.file(b).exists())return null;return{url:s.posix.join(l,`${c}${n.ext}`),mime:n.mime}});return(await Promise.all(g)).filter((n)=>n!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function y(e){let r=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,i;while((i=a.exec(e))!==null)r.push([i.index,i.index+i[0].length]);return r}function A(e,r){for(let[a,i]of r)if(e>=a&&e<i)return!0;return!1}function P(e){return e.replace(/&/g,"&").replace(/"/g,""")}
|
|
3
|
+
export{il};
|