@stacksjs/stx 0.2.674 → 0.2.676
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-szevd7d5.js → chunk-028e9fty.js} +2 -2
- package/dist/{chunk-rr527jt6.js → chunk-078qg8r5.js} +2 -2
- package/dist/chunk-0gk78x3r.js +2 -0
- package/dist/{chunk-fw413k9q.js → chunk-1b9thkg5.js} +2 -2
- package/dist/chunk-1e73whqh.js +2 -0
- package/dist/chunk-1rztwjdj.js +130 -0
- package/dist/{chunk-srq9fqq8.js → chunk-245sas8r.js} +38 -38
- package/dist/chunk-248a88mc.js +2 -0
- package/dist/chunk-2nqtmp8c.js +2 -0
- package/dist/chunk-2pga7zzb.js +4 -0
- package/dist/{chunk-bkkpq8dx.js → chunk-304dbbsw.js} +10 -10
- package/dist/{chunk-z22zy22p.js → chunk-34e8e8te.js} +2 -2
- package/dist/{chunk-md2jn67b.js → chunk-374nhgyf.js} +2 -2
- package/dist/chunk-3bfegbpw.js +2 -0
- package/dist/chunk-3gdt16xa.js +2 -0
- package/dist/chunk-3wsm9g9c.js +2 -0
- package/dist/chunk-3xx9d934.js +2 -0
- package/dist/{chunk-ham5x7ts.js → chunk-4fhbh04h.js} +4 -4
- package/dist/{chunk-5vt48yce.js → chunk-4jnv2v5e.js} +9 -9
- package/dist/chunk-4rk5qnqf.js +24 -0
- package/dist/chunk-526mf3fr.js +4 -0
- package/dist/chunk-54zkkxmb.js +2 -0
- package/dist/{chunk-kdebh22m.js → chunk-551s7ha0.js} +10 -10
- package/dist/chunk-5v7vm8cv.js +14 -0
- package/dist/{chunk-rdr09efy.js → chunk-5z0q3qv3.js} +5 -5
- package/dist/{chunk-6sjtyd0k.js → chunk-5z8mq37c.js} +4 -4
- package/dist/{chunk-ce6zddpf.js → chunk-6beg47t4.js} +2 -2
- package/dist/{chunk-trz8z4j4.js → chunk-6bwca55g.js} +37 -37
- package/dist/chunk-6kam8r5y.js +2 -0
- package/dist/{chunk-tddnb5bv.js → chunk-6ycyaf5g.js} +2 -2
- package/dist/chunk-707sx5sk.js +20 -0
- package/dist/chunk-78d5tn4r.js +2 -0
- package/dist/{chunk-pb6erpj3.js → chunk-78x52gz3.js} +5 -5
- package/dist/{chunk-zp79zkkd.js → chunk-78yjmbbs.js} +2 -2
- package/dist/{chunk-v21bhhjb.js → chunk-7j7h1eg3.js} +1 -1
- package/dist/{chunk-zmg1peyg.js → chunk-8aq07a1j.js} +3 -3
- package/dist/chunk-8p92r2sc.js +2 -0
- package/dist/chunk-909ymsjz.js +2 -0
- package/dist/{chunk-r7fdw2v5.js → chunk-97h9ga3b.js} +3 -3
- package/dist/chunk-9859r1d5.js +2 -0
- package/dist/{chunk-25zmy8q6.js → chunk-9wdd7eq6.js} +2 -2
- package/dist/{chunk-p6qd7ad0.js → chunk-a2zb5fgg.js} +2 -2
- package/dist/chunk-arh1qgmp.js +2 -0
- package/dist/chunk-b18x0v21.js +2 -0
- package/dist/chunk-b23vscaq.js +2 -0
- package/dist/{chunk-4b9s7wgy.js → chunk-be2rswkw.js} +2 -2
- package/dist/{chunk-qz5b8ed4.js → chunk-bh19ezq0.js} +5 -5
- package/dist/chunk-bm42rsaa.js +2 -0
- package/dist/{chunk-cbjabv1w.js → chunk-bpj387yx.js} +6 -6
- package/dist/chunk-c4enpsj8.js +2 -0
- package/dist/chunk-cdbaanmx.js +2 -0
- package/dist/chunk-cfm6a679.js +2 -0
- package/dist/chunk-cs8wq7nv.js +2 -0
- package/dist/{chunk-hegfgw27.js → chunk-cxgremn0.js} +5 -5
- package/dist/chunk-d2xf5hh9.js +2 -0
- package/dist/{chunk-rym0309c.js → chunk-d4ch6exz.js} +3 -3
- package/dist/chunk-dda8pdya.js +2 -0
- package/dist/{chunk-7adznted.js → chunk-dera8fmc.js} +2 -2
- package/dist/chunk-dmd7mgjw.js +3 -0
- package/dist/chunk-ds91e0fe.js +2 -0
- package/dist/{chunk-hgry3mjd.js → chunk-dxh45gve.js} +1 -1
- package/dist/chunk-e492je6q.js +2 -0
- package/dist/{chunk-7j1zgrnf.js → chunk-ehzd1yc6.js} +9 -9
- package/dist/chunk-etz2dmec.js +2 -0
- package/dist/{chunk-4s8zacxg.js → chunk-f26n6y9p.js} +4 -4
- package/dist/{chunk-4w6baw62.js → chunk-fbrgz3s8.js} +2 -2
- package/dist/chunk-fd72t30s.js +2 -0
- package/dist/{chunk-sqn3y9qt.js → chunk-fdvfzknd.js} +2 -2
- package/dist/chunk-ft3f9nj0.js +2 -0
- package/dist/{chunk-dgc1a3yt.js → chunk-fzc98qgn.js} +7 -7
- package/dist/{chunk-s0vtjyyj.js → chunk-g12ht81a.js} +2 -2
- package/dist/chunk-g6gqja52.js +2 -0
- package/dist/{chunk-hb3edeq9.js → chunk-ga5kjf9b.js} +6 -6
- package/dist/chunk-ggwvnpwj.js +2 -0
- package/dist/{chunk-hsmcbh0p.js → chunk-ghm9f13q.js} +5 -5
- package/dist/chunk-gx6wxmbv.js +2 -0
- package/dist/chunk-gz5rvwgx.js +2 -0
- package/dist/chunk-hamk3dky.js +2 -0
- package/dist/{chunk-vayhx642.js → chunk-haz2ezyk.js} +2 -2
- package/dist/chunk-hh58k0nh.js +3 -0
- package/dist/chunk-hqj28381.js +3 -0
- package/dist/chunk-j60jye3e.js +25 -0
- package/dist/chunk-jjet6qxq.js +2 -0
- package/dist/chunk-jk7chxkt.js +2 -0
- package/dist/{chunk-d09q93yf.js → chunk-jv021x8e.js} +2 -2
- package/dist/{chunk-pg2v1pb5.js → chunk-k06n5bjp.js} +3 -3
- package/dist/{chunk-35ezh7de.js → chunk-k72jqz6a.js} +3 -3
- package/dist/chunk-kn34esxw.js +2 -0
- package/dist/chunk-kqbpkg8n.js +2 -0
- package/dist/{chunk-aet1pgw7.js → chunk-krcd3039.js} +74 -74
- package/dist/{chunk-asezs2n3.js → chunk-kxj8e1gd.js} +6 -6
- package/dist/{chunk-5zhp87wv.js → chunk-mabja59q.js} +2 -2
- package/dist/chunk-mf19qxgv.js +3 -0
- package/dist/chunk-mjsebtg6.js +2 -0
- package/dist/{chunk-fd49fahd.js → chunk-mn47s2ef.js} +5 -5
- package/dist/{chunk-nj343mw2.js → chunk-mq915g3j.js} +5 -5
- package/dist/chunk-n63r9b4f.js +2 -0
- package/dist/{chunk-j6m8xqh3.js → chunk-n8wvqnfc.js} +2 -2
- package/dist/chunk-n94ts3t9.js +21 -0
- package/dist/{chunk-w7t2cfgy.js → chunk-p27ptd9f.js} +65 -65
- package/dist/{chunk-t0k16vqv.js → chunk-p9az13b2.js} +2 -2
- package/dist/chunk-pwn0j1vq.js +2 -0
- package/dist/chunk-q1jcf6vm.js +2 -0
- package/dist/{chunk-am2w363p.js → chunk-q3gactm1.js} +4 -4
- package/dist/chunk-q3nnaxf9.js +2 -0
- package/dist/{chunk-w3d98907.js → chunk-q4rejyd2.js} +2 -2
- package/dist/{chunk-hz4x7h0n.js → chunk-qbzqary0.js} +5 -5
- package/dist/{chunk-a4p18ybc.js → chunk-qr7a378v.js} +3 -3
- package/dist/{chunk-bsajk82t.js → chunk-qwdcts9w.js} +19 -19
- package/dist/chunk-rc79yyqx.js +2 -0
- package/dist/{chunk-yx3dpdwc.js → chunk-rfc5pdv2.js} +3 -3
- package/dist/chunk-rnws0dh3.js +2 -0
- package/dist/chunk-rxxajm31.js +31 -0
- package/dist/{chunk-thceyzj6.js → chunk-rza1p6e4.js} +2 -2
- package/dist/chunk-s73z8zss.js +11 -0
- package/dist/chunk-s8qe247r.js +2 -0
- package/dist/{chunk-d1a86qx8.js → chunk-sptewgky.js} +1 -1
- package/dist/{chunk-mwnhdsbp.js → chunk-sqh3tvtw.js} +2 -2
- package/dist/{chunk-6s7tvmqp.js → chunk-sr3hmrah.js} +2 -2
- package/dist/chunk-sswy3tfc.js +2 -0
- package/dist/chunk-swxznm5v.js +2 -0
- package/dist/{chunk-9dtbvjpp.js → chunk-tmqrbs98.js} +31 -20
- package/dist/chunk-tst8p27s.js +12 -0
- package/dist/chunk-tz09earb.js +2 -0
- package/dist/{chunk-fbmth6xv.js → chunk-vay5v6sj.js} +13 -13
- package/dist/{chunk-ck2e3e47.js → chunk-vd5w1jaz.js} +3 -3
- package/dist/chunk-vewt3464.js +2 -0
- package/dist/{chunk-xghcsg3f.js → chunk-vg1pg6yt.js} +1 -1
- package/dist/{chunk-s2wptfm1.js → chunk-wav0xbnb.js} +2 -2
- package/dist/chunk-whzvx5w5.js +2 -0
- package/dist/chunk-wk1gt95z.js +2 -0
- package/dist/{chunk-t9kxhe46.js → chunk-wr1gm35v.js} +1 -1
- package/dist/{chunk-faakv1p6.js → chunk-wscnjtss.js} +2 -2
- package/dist/{chunk-t79jfpv6.js → chunk-x4q4bx3q.js} +2 -2
- package/dist/chunk-x63f2ywm.js +2 -0
- package/dist/{chunk-y1pcdeg9.js → chunk-x7wr720m.js} +5 -5
- package/dist/chunk-xk7cp691.js +2 -0
- package/dist/chunk-xna6b7km.js +2 -0
- package/dist/{chunk-v6peecfp.js → chunk-xnx06qqt.js} +2 -2
- package/dist/chunk-xw4rm5zj.js +2 -0
- package/dist/{chunk-5qtthtg3.js → chunk-y34tyrpb.js} +7 -7
- package/dist/chunk-yar7fwrb.js +2 -0
- package/dist/{chunk-2zzc7006.js → chunk-yn9kvsk1.js} +2 -2
- package/dist/chunk-yt33wzqk.js +2 -0
- package/dist/chunk-z35ftpqp.js +421 -0
- package/dist/{chunk-4bgjrrvz.js → chunk-z7ghjs7w.js} +1 -1
- package/dist/chunk-zq7xbc1k.js +2 -0
- package/dist/cli.js +22 -22
- package/dist/client/signals-for-runtime.js +16 -5
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/headwind-to-style.js +13 -1
- package/dist/native/compiler/html-to-ir.d.ts +2 -0
- package/dist/native/compiler/html-to-ir.js +9 -0
- package/dist/native/compiler/ir.d.ts +1 -0
- package/dist/native/compiler/render-screen.js +4 -3
- package/dist/native/compiler/style-config.d.ts +3 -0
- package/dist/native/compiler/style-config.js +5 -0
- package/dist/native/components/primitives.d.ts +2 -0
- package/dist/native/event-names.js +2 -0
- package/dist/native/prop-names.js +1 -0
- package/dist/native/runtime/craft-bridge.js +15 -8
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.js +75 -16
- package/dist/ssg-static-paths.d.ts +12 -0
- package/dist/ssg-static-paths.js +62 -0
- package/dist/ssg.d.ts +2 -4
- package/dist/ssg.js +43 -47
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-0jwdcqj8.js +0 -2
- package/dist/chunk-0mwdq478.js +0 -2
- package/dist/chunk-0nfqgv4n.js +0 -4
- package/dist/chunk-1y6egkty.js +0 -2
- package/dist/chunk-280p4q7a.js +0 -2
- package/dist/chunk-2881tcqt.js +0 -2
- package/dist/chunk-2a775q7x.js +0 -2
- package/dist/chunk-2asdbd5e.js +0 -2
- package/dist/chunk-34yj93hh.js +0 -2
- package/dist/chunk-40tswfe7.js +0 -21
- package/dist/chunk-41de209e.js +0 -2
- package/dist/chunk-506mv7hb.js +0 -3
- package/dist/chunk-5s1ay9mv.js +0 -2
- package/dist/chunk-7kznee1g.js +0 -2
- package/dist/chunk-7mvz972c.js +0 -12
- package/dist/chunk-80zgyaqe.js +0 -2
- package/dist/chunk-84tqb1rn.js +0 -2
- package/dist/chunk-8azm7nha.js +0 -2
- package/dist/chunk-902qnyg0.js +0 -2
- package/dist/chunk-9n6jwcpb.js +0 -2
- package/dist/chunk-a6y8td0d.js +0 -2
- package/dist/chunk-a7kt1ts4.js +0 -2
- package/dist/chunk-a81y8g40.js +0 -2
- package/dist/chunk-aft1zc84.js +0 -2
- package/dist/chunk-bawq4fqy.js +0 -31
- package/dist/chunk-bdp2r0v4.js +0 -2
- package/dist/chunk-brtvm8mb.js +0 -2
- package/dist/chunk-bvzr9zqt.js +0 -2
- package/dist/chunk-cbvgtf3m.js +0 -2
- package/dist/chunk-cfydbaeq.js +0 -2
- package/dist/chunk-dq8c3h4n.js +0 -2
- package/dist/chunk-e36pne7n.js +0 -2
- package/dist/chunk-e62qfexp.js +0 -2
- package/dist/chunk-eq5jzaj5.js +0 -2
- package/dist/chunk-f9zyf9n6.js +0 -421
- package/dist/chunk-fb7t1nn9.js +0 -24
- package/dist/chunk-fr39emcz.js +0 -2
- package/dist/chunk-fsq13amm.js +0 -2
- package/dist/chunk-fxh12vqd.js +0 -2
- package/dist/chunk-gcc9fa33.js +0 -2
- package/dist/chunk-h6t2ney6.js +0 -2
- package/dist/chunk-hvtzw1jh.js +0 -2
- package/dist/chunk-j8g5cvvm.js +0 -2
- package/dist/chunk-jzjpyyw2.js +0 -2
- package/dist/chunk-k1b8x73j.js +0 -2
- package/dist/chunk-nw9bdk2n.js +0 -2
- package/dist/chunk-p4jkswz8.js +0 -2
- package/dist/chunk-p4r90vqf.js +0 -2
- package/dist/chunk-p8bgy5tt.js +0 -2
- package/dist/chunk-pqqe2b6m.js +0 -11
- package/dist/chunk-q6nwcav4.js +0 -2
- package/dist/chunk-qmqavdz2.js +0 -2
- package/dist/chunk-qpw72bty.js +0 -2
- package/dist/chunk-qwnh1kj6.js +0 -2
- package/dist/chunk-qy9m6qdn.js +0 -2
- package/dist/chunk-qychcdsm.js +0 -2
- package/dist/chunk-rj3w1ama.js +0 -2
- package/dist/chunk-rv39s5az.js +0 -20
- package/dist/chunk-sf0r963g.js +0 -2
- package/dist/chunk-ss820yys.js +0 -2
- package/dist/chunk-t4j9g2vh.js +0 -2
- package/dist/chunk-trh7s6k3.js +0 -130
- package/dist/chunk-ttemwrbx.js +0 -2
- package/dist/chunk-twqzn21x.js +0 -14
- package/dist/chunk-v14rq8b4.js +0 -3
- package/dist/chunk-vdxg7e1y.js +0 -4
- package/dist/chunk-vq513cxx.js +0 -2
- package/dist/chunk-vvq8xe3n.js +0 -2
- package/dist/chunk-w8t31bn9.js +0 -2
- package/dist/chunk-x1kz4d7j.js +0 -2
- package/dist/chunk-xaa36b0x.js +0 -3
- package/dist/chunk-xcsyqwxf.js +0 -25
- package/dist/chunk-xn9jrjzh.js +0 -2
- package/dist/chunk-z97bwx8m.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{He,Sn,Qo}from"./chunk-k72jqz6a.js";function Rs(e,a){let t=e.pwa;if(!t?.enabled)return"";let c=t.serviceWorker||{},d=t.routes||[],i=c.cacheVersion||"1.0.0",o=t.offline,l=o?.page?"/offline.html":"/offline.html",{push:r,backgroundSync:s,cacheStorage:n}=t,u=a?He(a,e):null,h=u?Sn(u):"[]",f=["/","/manifest.json",...o?.enabled?[l]:[],...o?.precacheAssets||[]];return`/**
|
|
3
3
|
* Service Worker - Auto-generated by stx
|
|
4
4
|
* Cache Version: ${i}
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@ import{ze,wn,Yo}from"./chunk-35ezh7de.js";function Ts(e,a){let t=e.pwa;if(!t?.en
|
|
|
13
13
|
* Additional features:
|
|
14
14
|
* - Push notifications: ${r?.enabled?"enabled":"disabled"}
|
|
15
15
|
* - Background sync: ${s?.enabled?"enabled":"disabled"}
|
|
16
|
-
* - Cache limits: ${n?.maxSize?`${
|
|
16
|
+
* - Cache limits: ${n?.maxSize?`${Qo(n.maxSize*1024*1024)}`:"unlimited"}
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
const CACHE_VERSION = '${i}';
|
|
@@ -825,5 +825,5 @@ self.addEventListener('message', (event) => {
|
|
|
825
825
|
event.waitUntil(registerFormSync(event.data.payload));
|
|
826
826
|
}
|
|
827
827
|
});
|
|
828
|
-
`}function
|
|
829
|
-
export{
|
|
828
|
+
`}function Bt(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function xc(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function yu(e,a){if(!e.pwa?.enabled)return"";if(xc(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-sr3hmrah.js");return t(e,a)}return Rs(e,a)}
|
|
829
|
+
export{Rs,Bt,xc,yu};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function T(s){let o=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;s=s.replace(o,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
3
3
|
`);let n=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return s=s.replace(n,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
4
|
-
`),s}function
|
|
5
|
-
export{T,
|
|
4
|
+
`),s}function xn(s){return s.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
|
|
5
|
+
export{T,xn};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{i}from"./chunk-245sas8r.js";import{Ue,te}from"./chunk-qr7a378v.js";import{Ji}from"./chunk-bpj387yx.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 Zd=`
|
|
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 Fi(e={}){let{debug:r=!1,timeout:a=30000}=e;return`
|
|
472
472
|
<script>
|
|
473
473
|
(function() {
|
|
474
474
|
'use strict';
|
|
@@ -937,23 +937,23 @@ 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 Qd(){return!1}function ep(e,r={}){let a=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(a,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return Fi(t)})}function zi(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let a=Fi(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
|
|
943
|
-
<input type="checkbox" class="craft-checkbox" ${a} ${
|
|
942
|
+
${a}`);return a+e}var Ks={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":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
943
|
+
<input type="checkbox" class="craft-checkbox" ${a} ${n}>
|
|
944
944
|
<span class="craft-checkbox-label">${r||e.label||""}</span>
|
|
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,
|
|
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,n=e.max??100,s=e.step??1,t=e.value??50,o=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${a}" max="${n}" step="${s}" value="${t}" ${o}>`}},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,n=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(n)return`<img class="craft-avatar" src="${n}" alt="${s}" 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,n=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,a/n*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":"",n=e.title||"";return`<dialog class="craft-modal" ${a}>
|
|
946
946
|
<div class="craft-modal-content">
|
|
947
|
-
${
|
|
947
|
+
${n?`<div class="craft-modal-header"><h2>${n}</h2></div>`:""}
|
|
948
948
|
<div class="craft-modal-body">${r}</div>
|
|
949
949
|
</div>
|
|
950
|
-
</dialog>`}},tabs:{nativeType:"craft-tabs",fallbackTag:"div",fallbackClasses:"craft-tabs",nativeProps:["activeTab","tabs"]},accordion:{nativeType:"craft-accordion",fallbackTag:"details",fallbackClasses:"craft-accordion",nativeProps:["open","title"],render:(e,r)=>{let a=e.open?"open":"",
|
|
951
|
-
<summary class="craft-accordion-header">${
|
|
950
|
+
</dialog>`}},tabs:{nativeType:"craft-tabs",fallbackTag:"div",fallbackClasses:"craft-tabs",nativeProps:["activeTab","tabs"]},accordion:{nativeType:"craft-accordion",fallbackTag:"details",fallbackClasses:"craft-accordion",nativeProps:["open","title"],render:(e,r)=>{let a=e.open?"open":"",n=e.title||"Details";return`<details class="craft-accordion" ${a}>
|
|
951
|
+
<summary class="craft-accordion-header">${n}</summary>
|
|
952
952
|
<div class="craft-accordion-content">${r}</div>
|
|
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",
|
|
954
|
-
${
|
|
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",n=e.title||"";return`<div class="craft-alert craft-alert-${a}" role="alert">
|
|
954
|
+
${n?`<div class="craft-alert-title">${n}</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||"",
|
|
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||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${a}" data-position="${n}">${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||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${a}" min="${n}" max="${s}">`}},"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||""}">`}},Hi=`
|
|
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 Ws={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
1373
|
</style>
|
|
1374
|
-
`,
|
|
1374
|
+
`,tp=`
|
|
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 Ws={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
1475
1475
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
1476
1476
|
})();
|
|
1477
1477
|
</script>
|
|
1478
|
-
`;function
|
|
1478
|
+
`;function Vi(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,7 +2940,7 @@ ${a}`);return a+e}var Ws={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,(
|
|
2943
|
+
`;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>O("sidebar",s,t.trim(),r,a)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>O("sidebar",s,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>O(s,t,"",r,a)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>O(s,t,o.trim(),r,a)),e}function O(e,r,a,n,s){let t=n.components?.[e]||Ks[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${a}</div>`;let o=N(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,a);let l=se(o,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,n;while((n=a.exec(e))!==null){let[s,t,o,d]=n,l=o??d;if(s.startsWith(":"))r[t]=l;else if(s.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))}`)),n=ee(e.spaces)||Z(r),s=n.length?[]:ae(e.sections)||z(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((w)=>w.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[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:s,spaces:n,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(n.length)g=re(n,t,d);else if(s.length)g=s.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>
|
|
@@ -2950,42 +2950,42 @@ ${a}`);return a+e}var Ws={button:{nativeType:"craft-button",fallbackTag:"button"
|
|
|
2950
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 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,
|
|
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,n;while((n=a.exec(e))!==null){let s=N(n[1]||""),t=n[2]||"",o=String(s.id||I(String(s.header||s.title||`section-${r.length+1}`))),d=String(s.header||s.title||o),l=K(t);r.push({id:o,header:d,title:d,items:l})}return r}function K(e){let r=[],a=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,n;while((n=a.exec(e))!==null){let s=N(n[1]||""),t=String(s.label||(n[2]||"").replace(/<[^>]*>/g,"").trim()),o=String(s.id||I(t||`item-${r.length+1}`));r.push({id:o,label:t,icon:s.icon?String(s.icon):void 0,badge:s.badge?String(s.badge):void 0,tintColor:s.tintColor?String(s.tintColor):void 0})}return r}function Z(e){let r=[],a=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,n;while((n=a.exec(e))!==null){let s=N(n[1]||""),t=n[2]||"",o=String(s.label||s.title||`Space ${r.length+1}`);r.push({id:String(s.id||I(o)),label:o,icon:s.icon?String(s.icon):void 0,tint:s.tint?String(s.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 n=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
|
-
${t.sections.map((
|
|
2955
|
+
${t.sections.map((o)=>M(o,a)).join("")}
|
|
2956
2956
|
</section>`).join("")}</div>
|
|
2957
|
-
<div class="craft-sidebar-space-switcher">${
|
|
2957
|
+
<div class="craft-sidebar-space-switcher">${n}</div>`}function ae(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 M(e,r){let a=e.header||e.title||e.id;return`<section class="craft-sidebar-section" data-section-id="${v(e.id)}">
|
|
2958
2958
|
<div class="craft-sidebar-section-title">${k(a)}</div>
|
|
2959
|
-
${e.items.map((
|
|
2959
|
+
${e.items.map((n)=>U(n,n.id===r)).join("")}
|
|
2960
2960
|
</section>`}function U(e,r){let a=e.tintColor?` style="--craft-sidebar-icon-color:${v(e.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${v(e.id)}" data-selected="${r?"true":"false"}">
|
|
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
|
|
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 n=[];n.push(`class="${a.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");n.push(`${s}="${o}"`)}return n.join(" ")}function np(e,r){Ks[e]=r}function rp(){return{...Ks}}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 n=JSON.parse(a.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}async function L(e,r=[],a={}){if(process.platform!=="darwin")return;let n=a.entitlements,s;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(s=ce(F(fe(),"stx-entitlements-")),n=F(s,"entitlements.plist"),le(n,JSON.stringify(p)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).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&&n)u.push("--entitlements",n);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"}),[o,d]=await Promise.all([new Response(t.stderr).text(),t.exited]);if(d!==0)throw Error(`Invalid native bundle signature: ${o.trim()}`)}finally{if(s)de(s,{recursive:!0,force:!0})}}async function Ui(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(),n=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 s=e.output||c(process.cwd(),"dist","native");if(!A(s))x(s,{recursive:!0});let t=await i(process.cwd()),o=await Ji(e.input,{context:e.context,options:{...t,isDev:!1}});if(o=zi(o,{debug:e.verbose}),o=Vi(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${Hi}
|
|
2965
|
+
</head>`)}let d=e.name||be(e.input,".stx"),l=e.version||"1.0.0",u=e.craftPath||await Wi();if(!u)return{success:!1,target:a,format:n,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: ${s}`),console.log(` Craft: ${u}`);let p;switch(a){case"macos":p=await me(o,d,l,s,n,e,u);break;case"windows":p=await xe(o,d,l,s,n,e,u);break;case"linux":p=await ye(o,d,l,s,n,e,u);break;case"ios":p=await Se(o,d,l,s,e,u);break;case"android":p=await Ce(o,d,l,s,e,u);break;default:p={success:!1,target:a,format:n,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,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,l=c(n,`${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(o)?"executable":"launcher");if(t.backend){if(!await he(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");T(o,c(p,r)),P(c(p,r),493);let S=Ue("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
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
|
-
`)}else if(m==="executable"){let S=c(p,r);T(
|
|
2972
|
-
`)}else{let S=c(p,"craft");T(
|
|
2971
|
+
`)}else if(m==="executable"){let S=c(p,r);T(o,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
|
+
`)}else{let S=c(p,"craft");T(o,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
|
|
2974
2974
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
2975
2975
|
RESOURCES="$DIR/../Resources"
|
|
2976
2976
|
exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
|
|
2977
2977
|
${[`--title "${t.window?.title||r}"`,`--width ${t.window?.width||1200}`,`--height ${t.window?.height||800}`,t.trayPopover?"--tray-popover":C?"--menubar-only":t.systemTray?"--system-tray":"",t.devTools?"":"--no-devtools",t.window?.frameless?"--frameless":"",t.window?.transparent?"--transparent":"",t.window?.alwaysOnTop?"--always-on-top":"",t.window?.resizable===!1?"--no-resize":"",h].filter(Boolean).join(" \\\n ")}
|
|
2978
|
-
`,E=c(p,r);await Bun.write(E,B),P(E,493)}let D=Boolean(t.icon&&await Bun.file(t.icon).exists());if(D)T(t.icon,c(b,"AppIcon.icns"));let V={CFBundleInfoDictionaryVersion:"6.0",CFBundleExecutable:r,CFBundleIdentifier:d,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:a,CFBundleVersion:a,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...D?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(c(u,"Info.plist"),ve(V)),await L(l,t.backend?[c(p,"stx-backend")]:m==="launcher"?[c(p,"craft")]:[],t.macosSigning),
|
|
2979
|
-
${
|
|
2978
|
+
`,E=c(p,r);await Bun.write(E,B),P(E,493)}let D=Boolean(t.icon&&await Bun.file(t.icon).exists());if(D)T(t.icon,c(b,"AppIcon.icns"));let V={CFBundleInfoDictionaryVersion:"6.0",CFBundleExecutable:r,CFBundleIdentifier:d,CFBundleName:r,CFBundleDisplayName:r,CFBundleShortVersionString:a,CFBundleVersion:a,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:t.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:t.trayPopover||(t.menubarOnly??Boolean(t.systemTray)),...D?{CFBundleIconFile:"AppIcon"}:{},...t.category?{LSApplicationCategoryType:t.category}:{},...t.copyright?{NSHumanReadableCopyright:t.copyright}:{},...t.infoPlist||{}};if(await Bun.write(c(u,"Info.plist"),ve(V)),await L(l,t.backend?[c(p,"stx-backend")]:m==="launcher"?[c(p,"craft")]:[],t.macosSigning),s==="dmg"){let S=c(n,`${r}-${a}.dmg`),h=await $e(l,S,r);if(!h.success)return{success:!1,target:"macos",format:"dmg",error:h.error};return{success:!0,target:"macos",format:"dmg",outputPath:S}}return{success:!0,target:"macos",format:"app",outputPath:l}}async function he(e){let r=Bun.spawn([e,"--capabilities"],{stdout:"pipe",stderr:"pipe"}),a=setTimeout(()=>r.kill(),5000);try{let[n,s,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text(),r.exited]);if(t!==0)return!1;return JSON.parse(`${n}${s}`.trim()).bundleBackend===!0}catch{return!1}finally{clearTimeout(a)}}async function we(e){try{let r=Bun.spawn([e,"--version"],{stdout:"pipe",stderr:"pipe"}),[a,n]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]);await r.exited;let t=`${a}
|
|
2979
|
+
${n}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;let[o,d,l]=t.slice(1).map(Number);if(o>0||d>0)return!0;return l>=57}catch{return!1}}function j(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function ve(e){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2980
2980
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
2981
2981
|
<plist version="1.0">
|
|
2982
2982
|
<dict>
|
|
2983
|
-
${Object.entries(e).map(([a,
|
|
2984
|
-
${
|
|
2983
|
+
${Object.entries(e).map(([a,n])=>{let s=typeof n==="boolean"?`<${n}/>`:typeof n==="number"?`<integer>${n}</integer>`:`<string>${j(String(n))}</string>`;return` <key>${j(a)}</key>
|
|
2984
|
+
${s}`}).join(`
|
|
2985
2985
|
`)}
|
|
2986
2986
|
</dict>
|
|
2987
2987
|
</plist>
|
|
2988
|
-
`}async function xe(e,r,a,
|
|
2988
|
+
`}async function xe(e,r,a,n,s,t,o){let d=c(n,r);x(d,{recursive:!0});let l=c(d,"index.html");await Bun.write(l,e),T(o,c(d,"craft.exe"));let u=`@echo off
|
|
2989
2989
|
set DIR=%~dp0
|
|
2990
2990
|
"%DIR%craft.exe" --html-file "%DIR%index.html" ^
|
|
2991
2991
|
--title "${t.window?.title||r}" ^
|
|
@@ -2993,7 +2993,7 @@ set DIR=%~dp0
|
|
|
2993
2993
|
--height ${t.window?.height||800} ^
|
|
2994
2994
|
${t.systemTray?"--system-tray":""} ^
|
|
2995
2995
|
${t.devTools?"":"--no-devtools"}
|
|
2996
|
-
`;if(await Bun.write(c(d,`${r}.bat`),u),
|
|
2996
|
+
`;if(await Bun.write(c(d,`${r}.bat`),u),s==="zip"){let p=c(n,`${r}-${a}-windows.zip`),b=await Te(d,p);if(!b.success)return{success:!1,target:"windows",format:"zip",error:b.error};return{success:!0,target:"windows",format:"zip",outputPath:p}}return{success:!0,target:"windows",format:"app",outputPath:d}}async function ye(e,r,a,n,s,t,o){let d=c(n,r);x(d,{recursive:!0});let l=c(d,"index.html");await Bun.write(l,e);let u=c(d,"craft");T(o,u),P(u,493);let p=`#!/bin/bash
|
|
2997
2997
|
set -euo pipefail
|
|
2998
2998
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
2999
2999
|
exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
@@ -3008,26 +3008,26 @@ 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),
|
|
3011
|
+
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),y),s==="deb"){let g=c(n,`${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(s==="appimage"){let g=c(n,`${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,n,s,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,n,s,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 Wi(){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((n)=>{let s=q("hdiutil",["create","-volname",a,"-srcfolder",e,"-ov","-format","UDZO",r]);s.on("close",(t)=>{if(t===0)n({success:!0});else n({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{n({success:!1,error:t.message})})})}async function Te(e,r){return new Promise((a)=>{let n=q("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)a({success:!0});else a({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{a({success:!1,error:s.message})})})}async function Pe(e,r,a,n,s){return new Promise((t)=>{let o=Ue("deb");try{let d=c(o,"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
|
-
Version: ${
|
|
3013
|
+
Version: ${n}
|
|
3014
3014
|
Section: utils
|
|
3015
3015
|
Priority: optional
|
|
3016
3016
|
Architecture: amd64
|
|
3017
3017
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
3018
|
-
Maintainer: ${
|
|
3019
|
-
Description: ${
|
|
3020
|
-
`;f("fs").writeFileSync(c(l,"control"),w);let C=q("dpkg-deb",["--build",d,r]);C.on("close",(m)=>{if(te(
|
|
3018
|
+
Maintainer: ${s.author||"Unknown"}
|
|
3019
|
+
Description: ${s.description||a}
|
|
3020
|
+
`;f("fs").writeFileSync(c(l,"control"),w);let C=q("dpkg-deb",["--build",d,r]);C.on("close",(m)=>{if(te(o),m===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${m}`})}),C.on("error",(m)=>{te(o),t({success:!1,error:m.message})})}catch(d){te(o),t({success:!1,error:d.message})}})}async function Ie(e,r,a,n){return new Promise((s)=>{let t=Ue("appimage");try{let o=c(t,`${a}.AppDir`),d=c(o,"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}"
|
|
3024
3024
|
exec "\${HERE}/usr/share/${a.toLowerCase()}/${a.toLowerCase()}" "$@"
|
|
3025
|
-
`;f("fs").writeFileSync(c(
|
|
3025
|
+
`;f("fs").writeFileSync(c(o,"AppRun"),y),P(c(o,"AppRun"),493);let g=`[Desktop Entry]
|
|
3026
3026
|
Type=Application
|
|
3027
3027
|
Name=${a}
|
|
3028
3028
|
Exec=${a.toLowerCase()}
|
|
3029
3029
|
Terminal=false
|
|
3030
3030
|
Categories=Utility;
|
|
3031
3031
|
Icon=${a.toLowerCase()}
|
|
3032
|
-
`;f("fs").writeFileSync(c(
|
|
3033
|
-
export{
|
|
3032
|
+
`;f("fs").writeFileSync(c(o,`${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(o,`${a.toLowerCase()}.png`),w),n.icon&&A(n.icon))T(n.icon,c(o,`${a.toLowerCase()}.png`));let C=q("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});C.on("close",(m)=>{if(te(t),m===0)P(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${m}. Install from https://appimage.github.io/appimagetool/`})}),C.on("error",(m)=>{te(t),s({success:!1,error:`appimagetool not found: ${m.message}`})})}catch(o){te(t),s({success:!1,error:o.message})}})}function qi(){return[R()]}function Ki(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:Ui,getAvailableTargets:qi,getAvailableFormats:Ki,detectPlatform:R},sp=Be;
|
|
3033
|
+
export{Zd,Fi,Qd,ep,zi,Ks,Hi,tp,Vi,np,rp,Ui,Wi,qi,Ki,sp};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var{WebView:p}=globalThis.Bun;import{existsSync as y,mkdirSync as b,readdirSync as v,statSync as S}from"fs";import l from"path";var h=16384;function M(e){if(/^https?:\/\//.test(e)||e.startsWith("file://"))return e;return`file://${l.resolve(e)}`}function g(e,n,t,o){return new Promise((s)=>{let i=!1,r,m,c=()=>{if(!i){if(i=!0,clearTimeout(m),r)clearTimeout(r);e.onNavigated=void 0,s()}};m=setTimeout(c,o),e.onNavigated=()=>{if(!i)r=setTimeout(c,t)};try{let u=e.navigate(n);if(u&&typeof u.catch==="function")u.catch(c)}catch{c()}})}async function w(e,n,t){let o=`!!document.querySelector(${JSON.stringify(n)})`,s=Date.now()+t;while(Date.now()<s){try{if(await e.evaluate(o))return}catch{}await new Promise((i)=>setTimeout(i,100))}}async function T(e){try{let n=await e.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof n==="number"&&Number.isFinite(n)&&n>0?Math.min(n,h):0}catch{return 0}}async function
|
|
3
|
-
export{
|
|
2
|
+
var{WebView:p}=globalThis.Bun;import{existsSync as y,mkdirSync as b,readdirSync as v,statSync as S}from"fs";import l from"path";var h=16384;function M(e){if(/^https?:\/\//.test(e)||e.startsWith("file://"))return e;return`file://${l.resolve(e)}`}function g(e,n,t,o){return new Promise((s)=>{let i=!1,r,m,c=()=>{if(!i){if(i=!0,clearTimeout(m),r)clearTimeout(r);e.onNavigated=void 0,s()}};m=setTimeout(c,o),e.onNavigated=()=>{if(!i)r=setTimeout(c,t)};try{let u=e.navigate(n);if(u&&typeof u.catch==="function")u.catch(c)}catch{c()}})}async function w(e,n,t){let o=`!!document.querySelector(${JSON.stringify(n)})`,s=Date.now()+t;while(Date.now()<s){try{if(await e.evaluate(o))return}catch{}await new Promise((i)=>setTimeout(i,100))}}async function T(e){try{let n=await e.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof n==="number"&&Number.isFinite(n)&&n>0?Math.min(n,h):0}catch{return 0}}async function Lc(e,n,t={}){let o=Math.min(t.width??1440,h),s=Math.min(t.height??2200,h),i=t.waitMs??800,r=t.timeoutMs??15000,m=t.format??"png",c=M(e),u=(f)=>new p({width:o,height:f,headless:!0,...t.backend?{backend:t.backend}:{}}),a=u(s);try{if(await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r);if(t.fullPage){let d=await T(a);if(d>s){if(a.close(),a=u(d),await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r)}}let f=await a.screenshot({encoding:"buffer",format:m});b(l.dirname(l.resolve(n)),{recursive:!0}),await Bun.write(n,f)}finally{a.close()}if(!y(n))throw Error(`Screenshot was not produced for ${e}`);return{input:e,output:n,bytes:S(n).size}}async function ju(e,n,t={}){b(n,{recursive:!0});let o;if(!/^https?:\/\//.test(e)&&y(e)&&S(e).isDirectory())o=v(e).filter((r)=>r.endsWith(".html")).map((r)=>l.join(e,r));else o=[e];let s=t.format??"png",i=[];for(let r of o){let m=/^https?:\/\//.test(r)?new URL(r).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":l.basename(r).replace(/\.html?$/,"");i.push(await Lc(r,l.join(n,`${m}.${s}`),t))}return i}
|
|
3
|
+
export{Lc,ju};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Vn,Te}from"./chunk-374nhgyf.js";import{L,b,ir,us,S}from"./chunk-z35ftpqp.js";import{i,R}from"./chunk-245sas8r.js";import{Qs}from"./chunk-qbzqary0.js";import{Qe}from"./chunk-yn9kvsk1.js";import{c}from"./chunk-mf19qxgv.js";import{r,fe}from"./chunk-tst8p27s.js";import d from"path";import y from"fs";import{AsyncLocalStorage as gt}from"async_hooks";var ht=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Qs(t,e,n)}var ot=2;function pl(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let o of xt(e))if(o!==d.sep)n=n.split(o).join("\x00root");return n}var st=new Map;function xt(t){let e=d.resolve(t),n=st.get(e);if(!n){let o=e;try{o=y.realpathSync(e)}catch{}n=[...new Set([e,o])].sort((u,m)=>m.length-u.length),st.set(e,n)}return n}function $t(t,e){try{let n=y.statSync(t),o=d.resolve(e),u=t.startsWith(`${o}${d.sep}`);return{path:u?d.relative(o,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(y.readFileSync(t)).toString(36)}}catch{return null}}function at(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function yt(t,e){for(let n of t){let o=at(n,e);try{let u=y.statSync(o);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(y.readFileSync(o)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var ct=new Map,bt=100;function fl(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function wt(t){let e=G.get(t)??0;if(e>0&&e<bt){G.set(t,e+1);return}G.set(t,1);try{let n=(await y.promises.readdir(t)).filter((l)=>l.endsWith(".js")),o=fl();if(n.length<=o)return;let m=(await Promise.all(n.map(async(l)=>{try{return{name:l,at:(await y.promises.stat(d.join(t,l))).mtimeMs}}catch{return null}}))).filter((l)=>l!==null);m.sort((l,w)=>w.at-l.at);for(let l of m.slice(o)){let w=l.name.slice(0,-3);await y.promises.rm(d.join(t,`${w}.js`),{force:!0}),await y.promises.rm(d.join(t,`${w}.deps.json`),{force:!0})}C("pruned bundle cache to",o,"entries")}catch{}}function Ee(t){return ct.get(t)??[]}function q(t,e){if(t)ct.set(t,e)}function gl(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function C(...t){if(gl())console.log("[stx:bundler]",...t)}var Y=[];function ta(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Xt(){return Y.slice()}function Jt(){Y.length=0}var Z;function ip(t){Z=t}function na(){if(Z)return Z;try{let t=R.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Yt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((l)=>l.test(u)))return C("detected user import:",u),!0}let o=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=o.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((l)=>l.test(u)))return C("detected side-effect import:",u),!0}return!1}var Hn="stx-module:",St=/\.(?:[cm]?[jt]sx?|json)$/i;function ml(t,e){return d.relative(t,e).split(d.sep).join("/")}function hl(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,o,u,m)=>{let l=e.get(m);return l&&!m.startsWith(Hn)?`${o}${u}${l}${u}`:n})}function yl(t,e){let n=0,o=(m)=>{let l=`__stxMod${n++}`,w=JSON.stringify(m);return e.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),l},u=(m,l)=>{for(let w of m.split(",")){let F=w.trim();if(!F)continue;let j=F.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!j)continue;let p=j[1].startsWith('"')?JSON.parse(j[1]):j[1],s=j[2]??p;e.push(`var ${s} = ${l}[${JSON.stringify(p)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,l,w)=>{let F=w.slice(Hn.length),j=o(F),p=l.trim(),s=p.match(/^([\w$]+)\s*(?:,\s*|$)/);if(s&&!p.startsWith("{")&&!p.startsWith("*"))e.push(`var ${s[1]} = ${j}.default;`),p=p.slice(s[0].length).trim();let a=p.match(/^\*\s*as\s+([\w$]+)$/);if(a)e.push(`var ${a[1]} = ${j};`);else if(p.startsWith("{"))u(p.replace(/^\{|\}$/g,""),j);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,l)=>(o(l.slice(Hn.length)),"")),t}function rt(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(y.existsSync(n)&&y.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new gt;function Xs(t,e){let n=new Bun.CryptoHasher("md5");for(let[o,u]of[...t].sort(([m],[l])=>m<l?-1:m>l?1:0))n.update(`${o}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function Zt(){return K.getStore()?.key??""}function vt(t,e,n,o,u,m=new Map,l,w){let F=(p,s,a)=>{if(X(s,t,l))return null;if(!u||p!==n||!St.test(s))return null;try{if(!y.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}o.add(s);let h=`${Hn}${ml(process.cwd(),s)}`;return m.set(a,h),{path:h,external:!0}},j=(p,s)=>{let a=p===n?e:d.dirname(p),h=d.resolve(a,s);return rt(h)??h};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),p.onResolve({filter:/^\//},(s)=>{let a=rt(s.path);if(a){let h=F(s.importer,a,s.path);if(h)return h;if(a!==n)o.add(a);return{path:a}}return{path:s.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(s)=>{let a=j(s.importer,s.path),h=F(s.importer,a,s.path);if(h)return h;return o.add(a),{path:a}}),p.onResolve({filter:/^[@~]\//},(s)=>{let a=d.resolve(t,s.path.slice(2)),h=[a,`${a}.ts`,`${a}.tsx`,`${a}.js`,`${a}.mjs`,`${a}.jsx`,d.join(a,"index.ts"),d.join(a,"index.tsx"),d.join(a,"index.js"),d.join(a,"index.mjs")];for(let I of h)if(y.existsSync(I)&&y.statSync(I,{throwIfNoEntry:!1})?.isFile()){let E=F(s.importer,I,s.path);if(E)return E;return C(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",I),o.add(I),{path:I}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:a}}),u)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(s.importer!==n)return;let a=`${Hn}npm:${s.path}`;return m.set(s.path,a),{path:a,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(X(s.path,t,l))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let a=d.extname(s.path).toLowerCase(),h=a===".json"?"json":a===".tsx"?"tsx":a===".jsx"?"jsx":a===".ts"||a===".mts"||a===".cts"?"ts":"js";if(s.path!==n)o.add(s.path);let I=w?.get(s.path);if(I!==void 0)return{contents:I,loader:"js"};return{contents:y.readFileSync(s.path,"utf8"),loader:h}})}}}var H=new Map,z=b(64),it=Symbol.for("stx.client-bundle-build-queue");function bl(t){let e=globalThis,o=(e[it]??Promise.resolve()).then(t,t);return e[it]=o.then(()=>{return},()=>{return}),o}async function Qt(t,e,n={}){let o=n.projectRoot||process.cwd(),u=(await i(o)).serverApi,m=n.minify??!1,l=n.externalizeUserModules??!0,w=n.expose?.length?[...new Set(n.expose)].sort():void 0,F=n.cacheDir||pl(o),j=K.getStore(),p=new Bun.CryptoHasher("md5");p.update(`${ht}\x00${Qe()}\x00${JSON.stringify(u??!1)}\x00${l?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${m?"minified":"readable"}\x00${j?.key??""}\x00${nt(t,o)}\x00${nt(e,o)}`);let s=p.digest("hex").slice(0,12),a=d.join(F,`${s}.js`),h=z.get(a);if(h){if(us(h.files)&&h.files.every((M)=>!X(M.path,o,u))){C("memo hit:",s);let M=h.files.map((A)=>A.path);return q(e,M),n.collectInputs?.push(...M),h.code}z.delete(a),C("memo invalidated by dep change:",s)}let I=d.join(F,`${s}.deps.json`),E=Bun.file(a);if(await E.exists()){let M=Bun.file(I),A=!1,O=null;if(await M.exists())try{let D=JSON.parse(await M.text());if(D.metadataVersion===ot&&Array.isArray(D.files)&&yt(D.files,o))O=ir(D.files.map((g)=>at(g,o))),A=O.length===D.files.length&&!O.some((g)=>X(g.path,o,u))}catch{A=!1}if(A){if(C("cache hit:",s),O)q(e,O.map((T)=>T.path)),n.collectInputs?.push(...O.map((T)=>T.path));let D=await E.text(),g=new Date;if(y.promises.utimes(a,g,g).catch(()=>{}),O)z.set(a,{code:D,files:O});return D}C("cache invalidated by dep change:",s)}let P=H.get(s);if(P){let M=await P;if(n.collectInputs)n.collectInputs.push(...(z.get(a)?.files??[]).map((A)=>A.path));return M}let V=bl(()=>jt(t,e,{projectRoot:o,minify:m,cacheDir:F,hash:s,cachePath:a,depsPath:I,collectInputs:n.collectInputs,externalizeUserModules:l,serverApi:u,expose:w,throwOnFailure:n.throwOnFailure,substitutes:j?.modules}));H.set(s,V);try{return await V}finally{H.delete(s)}}var Bt=0;function vl(t){return`${t}-${process.pid}-${++Bt}`}async function jt(t,e,n){let{projectRoot:o,minify:u,cacheDir:m,hash:l,cachePath:w,depsPath:F,externalizeUserModules:j}=n,p=c(o,"bundle-tmp"),s=vl(l),a=d.join(p,`${s}.ts`),h=d.join(p,"out",s);y.mkdirSync(p,{recursive:!0}),y.mkdirSync(h,{recursive:!0});let I=d.dirname(e),E=new Set,P=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=r(t),{depths:A,balanced:O}=fe(M),D=(B)=>!O||A[B]===0,g;while((g=P.exec(M))!==null){if(g[1])continue;if(!D(g.index))continue;if(g[2])g[2].split(",").forEach((B)=>{let f=Et(B);if(f)E.add(f)});else if(g[3])E.add(g[3])}while((g=V.exec(M))!==null){if(g[1])continue;if(!D(g.index))continue;E.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(M))!==null){if(!D(g.index))continue;let B=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(B&&Q.some((f)=>f.test(B)))continue;if(g[1])E.add(g[1]);if(g[2])E.add(g[2]);for(let f of(g[3]??"").split(",")){let v=f.trim();if(!v||/^type\s/.test(v))continue;let U=/\bas\s+(\w+)\s*$/.exec(v)?.[1]??/^\w+$/.exec(v)?.[0];if(U)E.add(U)}}for(let B of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of B[1].split(",")){let v=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(v)E.delete(v)}let lt=E.size>0?`
|
|
3
|
+
export { ${[...E].join(", ")} }`:"";await Bun.write(a,t+lt),C("bundling:",l,"from:",d.basename(e));let tt=new Set,et=new Map;try{let B=await Bun.build({entrypoints:[a],outdir:h,target:"browser",format:"esm",minify:u?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[vt(o,I,a,tt,j,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...S()},root:o});if(!B.success){let _=B.logs.filter((N)=>N.level==="error").map((N)=>N.message).join(", ")||`Unable to bundle ${d.basename(e)}`,k=Vn(B.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",_),ta(e||"",_,k),n.throwOnFailure||na()==="error")throw Error(_);return t}let f="";for(let x of B.outputs){f=await x.text();break}let v=[];for(let x of f.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let _ of x[1].split(",")){let k=_.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k){v.push([k[2],k[1]]);continue}let N=_.trim();if(/^[A-Za-z_$][\w$]*$/.test(N))v.push([N,N])}if(n.expose){let x=new Set(n.expose);for(let _=v.length-1;_>=0;_--)if(!x.has(v[_][0]))v.splice(_,1)}let U=[];f=yl(hl(f,et),U);let ut=f.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(f=f.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),u&&f)try{f=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(f)}catch{}let J=`__stxBundle_${l}`,dt=new Set(L(t,!0).split(",").map((x)=>x.trim())),pt=v.map(([x,_])=>`get ${JSON.stringify(x)}() { return ${_} }${dt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${_}) { ${_} = __stxValue_${_} }`:""}`).join(", "),ft=v.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
|
+
`),mt=v.map(([x])=>`${x} = ${J}[${JSON.stringify(x)}];`).join(`
|
|
5
|
+
`);if(f=`${ut.join(`
|
|
6
|
+
`)}
|
|
7
|
+
${ft}
|
|
8
|
+
var ${J} = (function() {
|
|
9
|
+
${U.join(`
|
|
10
|
+
`)}
|
|
11
|
+
${f}
|
|
12
|
+
return { ${pt} };
|
|
13
|
+
})();
|
|
14
|
+
${mt}
|
|
15
|
+
var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiveBindings;
|
|
16
|
+
Object.keys(${J}).forEach(function(name) {
|
|
17
|
+
if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
|
|
18
|
+
Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${J}, name));
|
|
19
|
+
});`.trim(),C("bundled:",l,"output:",f.length,"bytes"),E.size>0&&v.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${l}); serving the unbundled source and not caching this result`),t;y.mkdirSync(m,{recursive:!0}),await Bun.write(w,f);let W=ir(tt);return await Bun.write(F,JSON.stringify({metadataVersion:ot,files:W.map((x)=>$t(x.path,o)).filter((x)=>x!==null)})),q(e,W.map((x)=>x.path)),n.collectInputs?.push(...W.map((x)=>x.path)),z.set(w,{code:f,files:W}),await wt(m),f}catch(B){let f=Vn(B,e||void 0),v=Te(B,e||void 0);if(console.warn(`[stx:bundler] error: ${v}`),ta(e||"",v,f),n.throwOnFailure||na()==="error")throw B;return t}finally{try{y.rmSync(a,{force:!0}),y.rmSync(h,{recursive:!0,force:!0})}catch{}}}function Et(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let o=e.indexOf(":");if(o!==-1)e=e.slice(o+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
|
|
20
|
+
export{pl,fl,Ee,gl,ta,Xt,Jt,ip,na,Yt,Hn,ml,hl,yl,Xs,Zt,bl,Qt,vl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{cp,sa,lp,oa,wl,xl,nn,Kn,up,Sl,kl,dp,h}from"./chunk-551s7ha0.js";import"./chunk-be2rswkw.js";import"./chunk-z35ftpqp.js";import"./chunk-sqh3tvtw.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{nn as buildCss,Sl as extractClassNames,xl as fingerprintConfig,kl as generateCss,up as getCachedCSS,cp as getCssServeAsset,h as injectCss,sa as loadCssEngine,oa as loadCssEngineConfig,Kn as rebuildCss,lp as resetCssCache,wl as resolveUserCssConfig,dp as withLinkedModuleBundles};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function
|
|
2
|
+
var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function Cd(s,n={},t){let e=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return s.replace(e,(r,i,o,d)=>{let u=l(),a=p(i||"");return f(u,o.trim(),d.trim(),a)})}function p(s){let n={},t=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,e;while((e=t.exec(s))!==null){let r=e[1],i=e[2]||e[3],o=e[4];switch(r){case"id":n.id=i;break;case"timeout":n.timeout=o?parseInt(o,10):void 0;break}}return n}function f(s,n,t,e){let r=e.timeout||30000,i=e.id||s;return`
|
|
3
3
|
<div class="stx-suspense" data-suspense-id="${s}" data-custom-id="${i}" data-status="pending">
|
|
4
4
|
<div class="stx-suspense-fallback" data-suspense-fallback="${s}">
|
|
5
5
|
${t}
|
|
@@ -189,7 +189,7 @@ else {
|
|
|
189
189
|
}, 0);
|
|
190
190
|
})();
|
|
191
191
|
</script>
|
|
192
|
-
`}function
|
|
192
|
+
`}function Ed(s,n,t){return{id:s,fallback:t,content:n}}async function Td(s){let n=s.map((e)=>`
|
|
193
193
|
<div id="stx-ssr-suspense-${e.id}" class="stx-ssr-suspense">
|
|
194
194
|
${e.fallback}
|
|
195
195
|
</div>
|
|
@@ -214,7 +214,7 @@ else {
|
|
|
214
214
|
}
|
|
215
215
|
})();
|
|
216
216
|
</script>
|
|
217
|
-
`}}return{initial:n,streaming:t()}}function
|
|
217
|
+
`}}return{initial:n,streaming:t()}}function $d(){return`
|
|
218
218
|
/* STX Suspense Styles */
|
|
219
219
|
.stx-suspense {
|
|
220
220
|
position: relative;
|
|
@@ -270,7 +270,7 @@ else {
|
|
|
270
270
|
background-size: 200% 100%;
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
`}function
|
|
273
|
+
`}function Rd(){return`
|
|
274
274
|
// STX Suspense Runtime
|
|
275
275
|
(function() {
|
|
276
276
|
if (typeof window === 'undefined') return;
|
|
@@ -338,4 +338,4 @@ else {
|
|
|
338
338
|
console.log('[stx] Suspense runtime initialized');
|
|
339
339
|
})();
|
|
340
340
|
`}
|
|
341
|
-
export{
|
|
341
|
+
export{Cd,Ed,Td,$d,Rd};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],h=3;function y(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function
|
|
3
|
-
export{
|
|
2
|
+
import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],h=3;function y(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function xr(e,t,r=0,o=new Set){if(!t||r>=h)return!1;for(let s of e.matchAll(g)){let n=y(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(xr(i,n,r+1,o))return!0}return!1}var x=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],lc=["onMount","onDestroy"];function st(e="const",t=[],r){let o=t.length?x.filter((s)=>!t.includes(s)):x;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var v=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var E=x.filter((e)=>!v.includes(e));function Jo(e){if(!e)return!1;return E.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var S=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],T=/\s@[a-z][\w.:-]*\s*=/i;function uc(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(S.some((r)=>r.test(e)))return!0;if(Jo(e))return!0;return R(e,t)}function R(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(xr(r[1],t))return!0;return!1}function dc(e,t){if(!e)return!1;let r=f(e);return T.test(r)||d(r,t)}var _=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function pc(e){return _.includes(e.toLowerCase())}var Ts=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],w=["x-init","x-transition","x-effect","x-on"],fc=[...Ts,...w];function gc(){return`{${Ts.map((e)=>`'${e}':1`).join(",")}}`}var Yo=["class","style","text","html","show","model","if","ref"];function mc(){return`{${Yo.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function hc(){return`/^(${p.join("|")})(?:\\.|$)/`}function yc(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var A=65536,N=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=A;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=N){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
|
|
3
|
+
export{xr,x,lc,st,Jo,uc,dc,pc,Ts,fc,gc,Yo,mc,hc,yc};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{it,at,ct}from"./chunk-tp4eqfxq.js";import{
|
|
2
|
+
import{it,at,ct}from"./chunk-tp4eqfxq.js";import{Ft,zt,ot,pi,Ht,Vt}from"./chunk-028e9fty.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();Ft();let t=await it({mode:"build"});if(!t.config.enabled){ot("Story feature is disabled in config.");return}let n=await Ht(t);at(t,n);let l=Vt(t.config,n);ct(t,l),zt(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;pi(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">
|