@stacksjs/stx 0.2.915 → 0.2.919
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/app-shell.js +3 -2
- package/dist/{chunk-frpsrv1e.js → chunk-09xqy448.js} +2 -2
- package/dist/chunk-0ebaf0pr.js +2 -0
- package/dist/chunk-0jjq552g.js +2 -0
- package/dist/chunk-0wctbtad.js +7 -0
- package/dist/{chunk-r7y1196g.js → chunk-0xyfs691.js} +4 -4
- package/dist/{chunk-w98yt4d4.js → chunk-14df2jzs.js} +2 -2
- package/dist/chunk-15rc8t28.js +2 -0
- package/dist/chunk-1a2c4pv8.js +54 -0
- package/dist/{chunk-1jakr6f2.js → chunk-1baxccfq.js} +18 -18
- package/dist/{chunk-0vyytd9v.js → chunk-1bf0grbf.js} +3 -3
- package/dist/chunk-1jrhjn2b.js +2 -0
- package/dist/chunk-1svffhzq.js +2 -0
- package/dist/{chunk-1hx6dyy9.js → chunk-1ts1pg90.js} +2 -2
- package/dist/{chunk-88fx8xc1.js → chunk-1vsjmwr1.js} +2 -2
- package/dist/{chunk-cxsc37fg.js → chunk-2f46pcg0.js} +2 -2
- package/dist/{chunk-pcwq66w3.js → chunk-2jm7map2.js} +2 -2
- package/dist/chunk-2m4ydym0.js +33 -0
- package/dist/chunk-2mv29s6w.js +9 -0
- package/dist/{chunk-d1ka4dvr.js → chunk-2szhk8mh.js} +5 -5
- package/dist/{chunk-gg715pj6.js → chunk-2zb642qr.js} +6 -6
- package/dist/chunk-3aayrnbh.js +21 -0
- package/dist/chunk-3br07y64.js +20 -0
- package/dist/{chunk-2f5jjxcj.js → chunk-3efpqm1f.js} +2 -2
- package/dist/chunk-3ftrv1f7.js +182 -0
- package/dist/{chunk-barb4gka.js → chunk-3hfv217t.js} +6 -6
- package/dist/{chunk-eptzpvn0.js → chunk-3kpxkjgm.js} +3 -3
- package/dist/{chunk-4w8t0a9e.js → chunk-3tcy9r6r.js} +27 -27
- package/dist/{chunk-zv3rn0ch.js → chunk-40j2pmnb.js} +6 -6
- package/dist/chunk-426gq0g5.js +2 -0
- package/dist/chunk-4ge80k8j.js +2 -0
- package/dist/chunk-4vdfqr64.js +2 -0
- package/dist/chunk-4yz33vzb.js +2 -0
- package/dist/chunk-4zcswx6x.js +2 -0
- package/dist/{chunk-smnt37jq.js → chunk-50zzar2c.js} +3 -3
- package/dist/{chunk-vayzmvf5.js → chunk-514yg4dr.js} +6 -6
- package/dist/{chunk-vnk582z7.js → chunk-5fdc8pej.js} +102 -36
- package/dist/chunk-5ht628zp.js +2 -0
- package/dist/chunk-67zy5p7x.js +2 -0
- package/dist/chunk-6bm7t0hm.js +3 -0
- package/dist/{chunk-7qzanp9y.js → chunk-6n6kndk0.js} +1 -1
- package/dist/chunk-6x5a2w5a.js +3 -0
- package/dist/{chunk-xc5esqcb.js → chunk-6ybq9pfh.js} +2 -2
- package/dist/{chunk-23x3k751.js → chunk-7axtwg1f.js} +2 -2
- package/dist/chunk-8153bfpx.js +2 -0
- package/dist/{chunk-16sfjkc4.js → chunk-858p3hkz.js} +2 -2
- package/dist/chunk-86p0m920.js +2 -0
- package/dist/chunk-88texeh4.js +2 -0
- package/dist/chunk-8mye65n9.js +2 -0
- package/dist/chunk-8ycgk8w6.js +2 -0
- package/dist/{chunk-npj20tj9.js → chunk-9707zz6v.js} +2 -2
- package/dist/{chunk-pyyda92j.js → chunk-9gr7m3tb.js} +1 -1
- package/dist/{chunk-952dfmcb.js → chunk-9mack1g8.js} +3 -3
- package/dist/chunk-9xcsn4pb.js +2 -0
- package/dist/{chunk-3jc6yb02.js → chunk-9zwmfkfg.js} +9 -9
- package/dist/chunk-a5tg553d.js +2 -0
- package/dist/chunk-agxxqjjt.js +2 -0
- package/dist/{chunk-phzhmnnm.js → chunk-ayrd026n.js} +3 -3
- package/dist/chunk-b44pvac7.js +2 -0
- package/dist/chunk-b4yp16a2.js +2 -0
- package/dist/{chunk-95j8660f.js → chunk-cbqe84g3.js} +2 -2
- package/dist/{chunk-qsexsrw2.js → chunk-d4xjwebv.js} +5 -5
- package/dist/{chunk-pmn9kynz.js → chunk-d69k67bn.js} +11 -11
- package/dist/chunk-ex6dne7e.js +3 -0
- package/dist/chunk-fb63xppz.js +2 -0
- package/dist/chunk-ffqqkeye.js +2 -0
- package/dist/chunk-fjpt8arw.js +3 -0
- package/dist/{chunk-mgj074y2.js → chunk-fn0y9z1t.js} +5 -5
- package/dist/{chunk-ar6jeqmm.js → chunk-ft34x0h1.js} +4 -4
- package/dist/{chunk-7x3tt27s.js → chunk-fwxgzktt.js} +2 -2
- package/dist/chunk-g1v12bjm.js +2 -0
- package/dist/chunk-gg0kkn2e.js +2 -0
- package/dist/chunk-ggg8b8n1.js +2 -0
- package/dist/chunk-ggrcg7k7.js +2 -0
- package/dist/{chunk-11c7xg1z.js → chunk-gjyz5ma7.js} +1 -1
- package/dist/chunk-gmn9ba8f.js +3 -0
- package/dist/chunk-gqe574d9.js +2 -0
- package/dist/chunk-h4nqjks2.js +2 -0
- package/dist/chunk-hajamm16.js +2 -0
- package/dist/chunk-hg2n2264.js +2 -0
- package/dist/{chunk-6t8ce21j.js → chunk-hht7n4zd.js} +2 -2
- package/dist/chunk-hxabvt31.js +2 -0
- package/dist/chunk-j3sat6vn.js +2 -0
- package/dist/chunk-j9gbnqxq.js +2 -0
- package/dist/{chunk-1hbf5e1h.js → chunk-jgtn9t5n.js} +2 -2
- package/dist/chunk-jj2z4nxa.js +2 -0
- package/dist/{chunk-0jdz31q1.js → chunk-jjq7c8s2.js} +3 -3
- package/dist/chunk-k289127j.js +2 -0
- package/dist/{chunk-p3fepzt9.js → chunk-kk9h53xg.js} +3 -3
- package/dist/{chunk-xnp031ba.js → chunk-ktv65e3n.js} +7 -7
- package/dist/chunk-m1hfh2t4.js +2 -0
- package/dist/{chunk-9b2wdkbq.js → chunk-m390z8w8.js} +11 -11
- package/dist/chunk-m3qwqhxp.js +2 -0
- package/dist/{chunk-t85zac4y.js → chunk-m6hrb7rm.js} +58 -58
- package/dist/{chunk-7gwysmrs.js → chunk-m86sjbx7.js} +3 -3
- package/dist/chunk-m9smh7fs.js +2 -0
- package/dist/{chunk-1jvt9t3r.js → chunk-m9ta0640.js} +2 -2
- package/dist/chunk-mhnjtc42.js +2 -0
- package/dist/{chunk-hhspwfva.js → chunk-mn9t5fnv.js} +2 -2
- package/dist/{chunk-36cz2v8k.js → chunk-mnpfvxpa.js} +31 -31
- package/dist/{chunk-2vx2ben8.js → chunk-mr9pp5cf.js} +2 -2
- package/dist/{chunk-1jxkc6d0.js → chunk-mztjpp7m.js} +2 -2
- package/dist/chunk-n4bxb2hx.js +2 -0
- package/dist/chunk-n958bxm6.js +2 -0
- package/dist/{chunk-8wqhzzkn.js → chunk-neymp1bb.js} +3 -3
- package/dist/chunk-nkbnsbb0.js +3 -0
- package/dist/chunk-nkr1aa5z.js +2 -0
- package/dist/{chunk-nhyv3w4r.js → chunk-p0xqm2ne.js} +1 -1
- package/dist/chunk-p3vswt0f.js +2 -0
- package/dist/{chunk-z110bf2c.js → chunk-p3x7kwb5.js} +7 -7
- package/dist/chunk-p4twxjfs.js +6 -0
- package/dist/chunk-p8wnp4p1.js +2 -0
- package/dist/{chunk-bvqgq18r.js → chunk-p97h91zx.js} +2 -2
- package/dist/chunk-pjv4dskp.js +2 -0
- package/dist/{chunk-5jc9hmwg.js → chunk-pwg544dw.js} +2 -2
- package/dist/chunk-pxvp0cc9.js +3 -0
- package/dist/chunk-q3z252d9.js +2 -0
- package/dist/{chunk-q9gbdzw0.js → chunk-qda8tmk9.js} +2 -2
- package/dist/chunk-qfkak3jb.js +2 -0
- package/dist/chunk-qnytvyy0.js +2 -0
- package/dist/{chunk-fznjm7qt.js → chunk-qsnw0qyp.js} +2 -2
- package/dist/{chunk-ftvpz1j4.js → chunk-qtzfbv7e.js} +5 -5
- package/dist/{chunk-9xmx8hc7.js → chunk-qzqqzraq.js} +8 -8
- package/dist/{chunk-47z0m17p.js → chunk-rk16391e.js} +3 -3
- package/dist/chunk-rt7xy537.js +2 -0
- package/dist/chunk-rwjye578.js +2 -0
- package/dist/{chunk-cwcmmgvz.js → chunk-s1x2pc9b.js} +2 -2
- package/dist/{chunk-zbpvmgjn.js → chunk-sbr3wg75.js} +65 -65
- package/dist/chunk-sftznswb.js +2 -0
- package/dist/{chunk-cq4cwfqf.js → chunk-sxrcac01.js} +2 -2
- package/dist/{chunk-fzcqw147.js → chunk-tb4be5ct.js} +3 -3
- package/dist/{chunk-m8n14s3z.js → chunk-tnbzg7fd.js} +2 -2
- package/dist/{chunk-jr2r2nh5.js → chunk-txk2z7v0.js} +4 -4
- package/dist/chunk-tz5ktd6d.js +2 -0
- package/dist/{chunk-302nw40c.js → chunk-v060015m.js} +1 -1
- package/dist/chunk-v1a5h1tc.js +38 -0
- package/dist/{chunk-7anbc757.js → chunk-v1x96kjr.js} +8 -8
- package/dist/chunk-vb609vbj.js +1323 -0
- package/dist/chunk-vf7tpgqz.js +70 -0
- package/dist/chunk-vtcyber4.js +2 -0
- package/dist/chunk-vtj3dwhh.js +4 -0
- package/dist/{chunk-p9fyn5k4.js → chunk-whnzf9hn.js} +5 -5
- package/dist/chunk-wq2bpt0w.js +2 -0
- package/dist/{chunk-sdmq09jw.js → chunk-wv0wsavj.js} +2 -2
- package/dist/chunk-wv8zt78c.js +2 -0
- package/dist/{chunk-whc4jptx.js → chunk-wxqay5c2.js} +1 -1
- package/dist/{chunk-gfp39bzr.js → chunk-x40j67z1.js} +2 -2
- package/dist/chunk-xakqpa4z.js +3 -0
- package/dist/{chunk-dgt9kfkp.js → chunk-xap1f1bw.js} +2 -2
- package/dist/{chunk-zk5g49p5.js → chunk-xk7hdpq5.js} +3 -3
- package/dist/{chunk-zkwkhesc.js → chunk-xmy75h5v.js} +2 -2
- package/dist/{chunk-dp6r6gtb.js → chunk-xpsg91dh.js} +5 -5
- package/dist/{chunk-va4xam1q.js → chunk-xq5s4vc1.js} +1 -1
- package/dist/chunk-xy3ex6ht.js +2 -0
- package/dist/chunk-y899wtm8.js +2 -0
- package/dist/chunk-ye45znz5.js +2 -0
- package/dist/chunk-yegp50jb.js +2 -0
- package/dist/chunk-yq9aqpk8.js +2 -0
- package/dist/{chunk-5xbx0r3k.js → chunk-yvaqgdv1.js} +2 -2
- package/dist/{chunk-etmq1qny.js → chunk-yye2pec5.js} +14 -14
- package/dist/{chunk-47nzpbvm.js → chunk-yzqb7y45.js} +6 -6
- package/dist/{chunk-n0nf8n0h.js → chunk-z6nyyt3n.js} +6 -6
- package/dist/{chunk-fs43342z.js → chunk-zaj3nnvv.js} +2 -2
- package/dist/{chunk-2qk2ppgm.js → chunk-zb6my502.js} +1 -1
- package/dist/{chunk-ra2tzsvz.js → chunk-zrxvj3zf.js} +5 -5
- package/dist/chunk-zt45dqfx.js +2 -0
- package/dist/cli.js +38 -38
- package/dist/color-mode-boot.d.ts +1 -8
- package/dist/color-mode-boot.js +46 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/ts-css.d.ts +1 -1
- package/dist/dev-server/ts-css.js +2 -2
- package/dist/document-shell.d.ts +2 -0
- package/dist/document-shell.js +15 -3
- package/dist/document-tags.d.ts +2 -0
- package/dist/document-tags.js +9 -0
- package/dist/head-injection.d.ts +2 -0
- package/dist/head-injection.js +1 -0
- package/dist/head.d.ts +2 -0
- package/dist/head.js +2 -2
- package/dist/native/compiler/html-to-ir.d.ts +3 -1
- package/dist/native/compiler/html-to-ir.js +31 -0
- package/dist/native/compiler/ir.d.ts +1 -0
- package/dist/native/components/primitives.d.ts +1 -0
- package/dist/native/event-names.js +2 -0
- package/dist/native/runtime/browser-renderer.d.ts +1 -0
- package/dist/native/runtime/browser-renderer.js +23 -6
- package/dist/native/testing.d.ts +1 -0
- package/dist/native/testing.js +33 -0
- package/dist/page-head.js +1 -9
- package/dist/process.js +1 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +13 -13
- package/dist/types/config-types.d.ts +2 -1
- package/dist/variable-extractor.js +6 -1
- package/package.json +5 -5
- package/dist/chunk-0adc8x2h.js +0 -9
- package/dist/chunk-1gj46s0g.js +0 -2
- package/dist/chunk-1mx3j280.js +0 -2
- package/dist/chunk-1p6gaaf3.js +0 -3
- package/dist/chunk-1rfzs48h.js +0 -2
- package/dist/chunk-20hy5p3p.js +0 -2
- package/dist/chunk-29v3b5ks.js +0 -2
- package/dist/chunk-2cay3heb.js +0 -2
- package/dist/chunk-33fnbw33.js +0 -2
- package/dist/chunk-357qjcj1.js +0 -3
- package/dist/chunk-38y11q8x.js +0 -2
- package/dist/chunk-3q80f7mt.js +0 -2
- package/dist/chunk-43kz6rx9.js +0 -2
- package/dist/chunk-490rrkrp.js +0 -2
- package/dist/chunk-49980am3.js +0 -2
- package/dist/chunk-4a9bqc8f.js +0 -33
- package/dist/chunk-4e18r89n.js +0 -3
- package/dist/chunk-4r0028av.js +0 -1323
- package/dist/chunk-4vz17ytv.js +0 -68
- package/dist/chunk-4w9pvpfd.js +0 -2
- package/dist/chunk-5afnyvw5.js +0 -2
- package/dist/chunk-5pb1x7x6.js +0 -2
- package/dist/chunk-6n50b07t.js +0 -2
- package/dist/chunk-76mn123c.js +0 -2
- package/dist/chunk-8egbh6z1.js +0 -2
- package/dist/chunk-8n9jd8cz.js +0 -2
- package/dist/chunk-8tfpv6zf.js +0 -6
- package/dist/chunk-94qc4zwb.js +0 -2
- package/dist/chunk-9928zdej.js +0 -3
- package/dist/chunk-9ay18k46.js +0 -2
- package/dist/chunk-9tv0tw7f.js +0 -3
- package/dist/chunk-a5h9bwrc.js +0 -2
- package/dist/chunk-am7xmh9p.js +0 -2
- package/dist/chunk-bdkst2wp.js +0 -2
- package/dist/chunk-bej9kz05.js +0 -2
- package/dist/chunk-ccgabq3a.js +0 -2
- package/dist/chunk-cv6d4zr5.js +0 -2
- package/dist/chunk-e5rag6rh.js +0 -3
- package/dist/chunk-eqdg72re.js +0 -2
- package/dist/chunk-fvr3h2fr.js +0 -7
- package/dist/chunk-g0hkknzm.js +0 -2
- package/dist/chunk-g44932zc.js +0 -2
- package/dist/chunk-g4w3wms2.js +0 -2
- package/dist/chunk-gmmqz698.js +0 -2
- package/dist/chunk-hxftzw0x.js +0 -2
- package/dist/chunk-j3d3q3g7.js +0 -2
- package/dist/chunk-jmggm1ep.js +0 -3
- package/dist/chunk-jz37h2z0.js +0 -4
- package/dist/chunk-k8s3hyh2.js +0 -2
- package/dist/chunk-m8mmasgc.js +0 -2
- package/dist/chunk-man5ap64.js +0 -54
- package/dist/chunk-mdgcjzcn.js +0 -38
- package/dist/chunk-mjny8x91.js +0 -2
- package/dist/chunk-mjr5fkc2.js +0 -2
- package/dist/chunk-n1y82svg.js +0 -2
- package/dist/chunk-na0e3s88.js +0 -2
- package/dist/chunk-new89wh2.js +0 -2
- package/dist/chunk-nrap20qt.js +0 -2
- package/dist/chunk-q85wy43m.js +0 -2
- package/dist/chunk-q9yahsww.js +0 -2
- package/dist/chunk-qdwtemy1.js +0 -2
- package/dist/chunk-qp0ndbk6.js +0 -2
- package/dist/chunk-r1fhahnn.js +0 -2
- package/dist/chunk-r4e17p2x.js +0 -2
- package/dist/chunk-rnsa5zz5.js +0 -2
- package/dist/chunk-rzsvxjse.js +0 -2
- package/dist/chunk-senrtnx2.js +0 -2
- package/dist/chunk-sw5g5mbd.js +0 -2
- package/dist/chunk-t63y6qd5.js +0 -2
- package/dist/chunk-v1wr2vdx.js +0 -2
- package/dist/chunk-v6gkjg5f.js +0 -3
- package/dist/chunk-vq7m7xcz.js +0 -182
- package/dist/chunk-wsfqb5jk.js +0 -2
- package/dist/chunk-wvc6eayq.js +0 -2
- package/dist/chunk-wz44vmgn.js +0 -21
- package/dist/chunk-x1kzqxj5.js +0 -2
- package/dist/chunk-xa98a901.js +0 -2
- package/dist/chunk-xj95sk0y.js +0 -2
- package/dist/chunk-xtf3sab5.js +0 -2
- package/dist/chunk-yga49yw3.js +0 -2
- package/dist/chunk-yn02d599.js +0 -2
- package/dist/chunk-z5nx021e.js +0 -20
- package/dist/chunk-z9wwa50p.js +0 -2
package/dist/app-shell.js
CHANGED
|
@@ -5,6 +5,7 @@ import { classifyAllScripts } from "./script-classifier.js";
|
|
|
5
5
|
import { startsDocument } from "./document-shell.js";
|
|
6
6
|
import { findContainerRegion } from "./fragment-container.js";
|
|
7
7
|
import { matchScriptElement, scanAtElementPosition } from "./html-masking.js";
|
|
8
|
+
import { BEFORE_RUNTIME_SCRIPT_MARKER } from "./head-injection.js";
|
|
8
9
|
import { isDevelopment } from "./env.js";
|
|
9
10
|
import { isSpaNavRequest } from "./spa-nav.js";
|
|
10
11
|
import { pageCssFragment, pageHeadFragment } from "./page-head.js";
|
|
@@ -198,7 +199,7 @@ export function externalScriptsOutsideContainer(html, container) {
|
|
|
198
199
|
const src = attrs.get("src")?.trim(), type = attrs.get("type")?.trim().toLowerCase();
|
|
199
200
|
if (!src || attrs.has("server") || type && !["module", "text/javascript", "application/javascript"].includes(type))
|
|
200
201
|
continue;
|
|
201
|
-
if (attrs.has("data-stx-runtime") || attrs.has("data-stx-router") || /^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(src))
|
|
202
|
+
if (attrs.has(BEFORE_RUNTIME_SCRIPT_MARKER) || attrs.has("data-stx-runtime") || attrs.has("data-stx-router") || /^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(src))
|
|
202
203
|
continue;
|
|
203
204
|
if (isChromeInstanceScript(html, element.token, container.start, container.end) || seen.has(element.token))
|
|
204
205
|
continue;
|
|
@@ -219,7 +220,7 @@ export function extractContainerContent(html, containerSelector = "main", includ
|
|
|
219
220
|
headStyles.push(m[0]);
|
|
220
221
|
const routeParamsRegex = /<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;
|
|
221
222
|
while ((m = routeParamsRegex.exec(headContent)) !== null) {
|
|
222
|
-
if (COMPONENT_INSTANCE_SCRIPT.test(m[0]) || m[0].includes("__stx_early_mounts") || /^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(m[0]))
|
|
223
|
+
if (COMPONENT_INSTANCE_SCRIPT.test(m[0]) || m[0].includes("__stx_early_mounts") || /^<script\b[^>]*\bdata-stx-before-runtime(?=[\s=>])/i.test(m[0]) || /^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(m[0]))
|
|
223
224
|
continue;
|
|
224
225
|
headScripts.push(m[0]);
|
|
225
226
|
}
|
|
@@ -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 Ru(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{Ru};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Nm}from"./chunk-nkbnsbb0.js";import"./chunk-2m4ydym0.js";import"./chunk-yvaqgdv1.js";import"./chunk-xpsg91dh.js";import"./chunk-xakqpa4z.js";import"./chunk-v1x96kjr.js";import"./chunk-3tcy9r6r.js";import"./chunk-50zzar2c.js";import"./chunk-mr9pp5cf.js";import"./chunk-txk2z7v0.js";import"./chunk-ktv65e3n.js";import"./chunk-5fdc8pej.js";import"./chunk-vb609vbj.js";import"./chunk-qda8tmk9.js";import"./chunk-14df2jzs.js";import"./chunk-vf7tpgqz.js";import"./chunk-ayrd026n.js";import"./chunk-ex6dne7e.js";import"./chunk-jjq7c8s2.js";import"./chunk-858p3hkz.js";export{Nm as startProductionServer};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
function E(e,s){let i=e[s],n=s+1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]===i)return n+1;n++}return e.length}function k(e,s){let i=s+1;while(i<e.length){if(e[i]==="\\"){i+=2;continue}if(e[i]==="`")return i+1;if(e[i]==="$"&&e[i+1]==="{"){if(i=Kl(e,i+2),i<e.length)i++;continue}i++}return e.length}function Kl(e,s){let i=1,n=s,f="{",r="";while(n<e.length){let l=e[n];if(l==="\\"){n+=2;continue}if(l==='"'||l==="'"){n=E(e,n),f=o,r="";continue}if(l==="`"){n=k(e,n),f=o,r="";continue}if(l==="/"&&e[n+1]==="/"){while(n<e.length&&e[n]!==`
|
|
3
|
+
`)n++;continue}if(l==="/"&&e[n+1]==="*"){n+=2;while(n<e.length&&e.slice(n,n+2)!=="*/")n++;n+=2;continue}if(l==="/"&&b(f,r)){let h=m(e,n);if(h!==-1){n=h,f=o,r="";continue}}if(l==="{")i++;else if(l==="}"){if(i--,i===0)return n}if(/[\w$]/.test(l))r=/[\w$]/.test(f)?r+l:l,f=l;else if(!/\s/.test(l))f=l,r="";n++}return e.length}var L=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]);function b(e,s){if(s)return L.has(s);return!(e===")"||e==="]"||e===o)}var o="\x00";function m(e,s){let i=s+1,n=!1;while(i<e.length){let f=e[i];if(f===`
|
|
4
|
+
`)return-1;if(f==="\\"){i+=2;continue}if(f==="[")n=!0;else if(f==="]")n=!1;else if(f==="/"&&!n){i++;while(i<e.length&&/[a-z]/i.test(e[i]))i++;return i}i++}return-1}function t(e){return p(e,!1)}function Kn(e){return p(e,!0)}function p(e,s){let i="",n=0,f=/[\w$]+|\s+|[^\w$\s]/g,r="",l="";while(n<e.length){f.lastIndex=n;let h=f.exec(e)[0];if(h.length>1||/[\w$\s]/.test(h)){if(i+=h,n+=h.length,!/\s/.test(h[0]))l=/[\w$]/.test(r)?l+h:h,r=h[h.length-1];continue}let a=h;if(a==="/"&&e[n+1]==="/"){let u=e.indexOf(`
|
|
5
|
+
`,n),g=u===-1?e.length:u;i+=" ".repeat(g-n),n=g;continue}if(a==="/"&&e[n+1]==="*"){let u=e.indexOf("*/",n),g=u===-1?e.length:u;i+=x(e.slice(n,g)),n=g,i+=" ",n+=2;continue}if(a==='"'||a==="'"){let u=a;i+=" ",n++;let g=u==='"'?/["\\]/g:/['\\]/g;while(n<e.length&&e[n]!==u){if(e[n]==="\\"){i+=" ",n+=2;continue}g.lastIndex=n;let c=g.exec(e)?.index??e.length;i+=x(e.slice(n,c)),n=c}i+=s?"$":" ",n++,r=o,l="";continue}if(a==="/"&&b(r,l)){let u=m(e,n);if(u!==-1){i+=`/${" ".repeat(u-n-2)}/`,n=u,r=o,l="";continue}}if(a==="`"){i+=s?"(":" ",n++;let u=/[\\`$]/g;while(n<e.length&&e[n]!=="`"){if(e[n]==="\\"){i+=" ",n+=2;continue}if(e[n]==="$"&&e[n+1]==="{"){let c=n+2,w=Kl(e,c);if(i+=s?" {":" ",i+=p(e.slice(c,w),s),w<e.length)i+=s?"}":" ";n=w+1;continue}let g=n;n++,u.lastIndex=n,n=u.exec(e)?.index??e.length,i+=x(e.slice(g,n))}i+=s?")":" ",n++,r=o,l="";continue}i+=a,n++,r=a,l=""}return i}function x(e){return e.includes(`
|
|
6
|
+
`)?e.replace(/[^\n]/g," "):" ".repeat(e.length)}function y(e){let s=new Uint16Array(e.length),i=0,n=!0;for(let f=0;f<e.length;f++){let r=e[f];if(r===")"||r==="]"||r==="}")if(i===0)n=!1;else i--;if(s[f]=i,r==="("||r==="["||r==="{")i++}return{depths:s,balanced:n&&i===0}}
|
|
7
|
+
export{Kl,t,Kn,y};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ot,Xn,ua}from"./chunk-3kpxkjgm.js";function Eo(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?ot(a,e):null,h=u?Xn(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{st,Vn,ca}from"./chunk-eptzpvn0.js";function _o(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?`${ua(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 sn(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function iu(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function pm(e,a){if(!e.pwa?.enabled)return"";if(iu(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-mn9t5fnv.js");return t(e,a)}return Eo(e,a)}
|
|
829
|
+
export{Eo,sn,iu,pm};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function
|
|
3
|
-
export{
|
|
2
|
+
import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function Qe(n,f){return m.run(n,f)}function Bn(){return m.getStore()}function mo(){let n=m.getStore();if(!n)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:n.public},"private",{value:n.private}))}function Qi(){return mo().public}function z(n={},f=process.env){let s=new Set;function o(e,i){if(i===null)return e===null;if(Array.isArray(i))return Array.isArray(e)&&(!i.length||e.every((r)=>i.some((u)=>o(r,u))));if(typeof i==="object")return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.entries(i).every(([r,u])=>Object.hasOwn(e,r)&&o(e[r],u));return typeof e===typeof i}function g(e,i){if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`);let t=Object.create(null);for(let[c,l]of Object.entries(e)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(c)||["constructor","prototype","__proto__"].includes(c))throw TypeError(`Invalid runtime config key: ${c}`);t[c]=g(l,[...i,c])}return Object.freeze(t)}let r=`STX_RUNTIME_${i.map((t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(s.has(r))throw TypeError(`Ambiguous runtime config environment key: ${r}`);s.add(r);let u=f[r],a=e;if(u!==void 0){try{a=typeof e==="string"?u:JSON.parse(u)}catch{throw TypeError(`Invalid runtime config override: ${r}`)}if(!o(a,e))throw TypeError(`Wrong runtime config override type: ${r}`)}function p(t){if(t===null||typeof t==="string"||typeof t==="boolean")return t;if(typeof t==="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(p));if(t&&typeof t==="object"&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null))return Object.freeze(Object.fromEntries(Object.entries(t).map(([c,l])=>[c,p(l)])));throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`)}return p(a)}return Object.freeze({public:g(n.public??{},["public"]),private:g(n.private??{},["private"])})}function C(n){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(n.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function Jt(n,f){let s=n.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),o=/<head\b[^>]*>/i.exec(s),g=o?o.index+o[0].length:0;return s.slice(0,g)+C(f)+s.slice(g)}
|
|
3
|
+
export{Qe,Bn,mo,Qi,z,Jt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{b,Wi,Cl,El,Kg,Xg,Gg,Jg,Yg,fo,Zg,Je,ie,Ye,Qg,Wr,em,Rl,Al,Xi,Ze,s,Mn,Pl,w,Ce,Ly}from"./chunk-vb609vbj.js";import"./chunk-qda8tmk9.js";import"./chunk-14df2jzs.js";import"./chunk-vf7tpgqz.js";import"./chunk-ayrd026n.js";import"./chunk-ex6dne7e.js";import"./chunk-jjq7c8s2.js";import"./chunk-858p3hkz.js";export{Al as SIGNAL_COMPOSABLE_CALL,Ce as clearComponentCache,Xi as componentClientSignalNames,Wi as convertToCommonJS,w as createDetailedErrorMessage,Yg as extractDirectiveNames,Cl as extractScriptFromTemplate,b as extractVariables,s as fileExists,Ly as getComponentCacheStats,Xg as getPositionInfo,ie as getSharedTranspiler,Pl as getSourceLineInfo,Jg as hasDirectives,El as hasVariables,em as isHydrateTrigger,Zg as isJavaScriptScript,Ze as renderComponentWithSlot,Mn as resolveTemplatePath,Qg as scopeOnRootElement,fo as scopeSequenceKey,Je as shouldTranspileTypeScript,Rl as slotContentHasExpressions,Ye as transpileTypeScript,Wr as userComponentFileExists,Gg as validateDirective,Kg as validateTemplate};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{d,h,D,p,te,vt}from"./chunk-vf7tpgqz.js";import{T}from"./chunk-jjq7c8s2.js";import{J,Ys,Ke,B,Ur,Je,Ye,s,w,Ne,P}from"./chunk-vb609vbj.js";import{St}from"./chunk-858p3hkz.js";import{L}from"./chunk-ayrd026n.js";import{ge}from"./chunk-fjpt8arw.js";import{W,dt}from"./chunk-mztjpp7m.js";import{I,Vn}from"./chunk-gmn9ba8f.js";import M from"path";import{existsSync as ye}from"fs";function ae(c,e){let a=0;for(let r=e;r<c.length;r++){let S=c[r];if(S==="("||S==="["||S==="{")a++;else if(S===")"||S==="]"||S==="}")a--;else if(S===","&&a===0)return r}return-1}function $e(c,e,a){let r=c,S=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=S.exec(r);while(n){let u=n.index,t=u+n[0].length-1,A=1,z=t+1;while(z<r.length&&A>0){if(r[z]==="(")A++;else if(r[z]===")")A--;z++}if(A!==0)break;let ie=r.substring(t+1,z-1),j=`${a}(${ie})`;r=r.substring(0,u)+j+r.substring(z),S.lastIndex=u+j.length,n=S.exec(r)}return r}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function he(c){let e=c,a=[],r=new Set,S=0,n=0,u=e.length,t=(j)=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]===j){n++;return}n++}},A=()=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;return}if(e[n]==="$"&&e[n+1]==="{"){n+=2;let j=1;while(n<u&&j>0)if(e[n]==="{")j++,n++;else if(e[n]==="}")j--,n++;else if(e[n]==="'"||e[n]==='"')t(e[n]);else if(e[n]==="`")A();else n++;continue}n++}},z=()=>{if(e[n]==="/"&&e[n+1]==="/"){while(n<u&&e[n]!==`
|
|
3
|
+
`)n++;return!0}if(e[n]==="/"&&e[n+1]==="*"){n+=2;while(n<u-1&&!(e[n]==="*"&&e[n+1]==="/"))n++;return n+=2,!0}return!1},ie=()=>{if(S!==0)return;let j=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let H=j[2];if(!r.has(H))a.push(H),r.add(H);return}let se=e.slice(n).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(se){let H=se[1];if(!r.has(H))a.push(H),r.add(H);return}let Y=e.slice(n).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let H=Y[1];if(!r.has(H))a.push(H),r.add(H)}};while(n<u){if(z())continue;if(e[n]==="'"||e[n]==='"'){t(e[n]);continue}if(e[n]==="`"){A();continue}if(e[n]==="{"){S++,n++;continue}if(e[n]==="}"){S--,n++;continue}if(S===0&&/[a-z]/i.test(e[n])&&(n===0||/\s|[;{}()]/.test(e[n-1])))ie();n++}return a.join(", ")}function ve(c,e=""){let a=he(c).split(",").map((r)=>r.trim()).filter(Boolean);return`
|
|
4
|
+
(function() {
|
|
5
|
+
${St("var",a)}
|
|
6
|
+
var __destroyHooks = [];
|
|
7
|
+
var __origOnDestroy = onDestroy;
|
|
8
|
+
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
9
|
+
|
|
10
|
+
${c}
|
|
11
|
+
${e}})();
|
|
12
|
+
`}function Re(c,e){let r=he(c).split(",").map((u)=>u.trim()).filter(Boolean),S=new Set(J(c,!0).split(",").map((u)=>u.trim())),n=r.map((u)=>S.has(u)?` try { ${u}; Object.defineProperty(__scopeRegistration, ${JSON.stringify(u)}, ${Ys(u)}); } catch (e) { /* not actually top-level */ }`:` try { __scopeRegistration[${JSON.stringify(u)}] = ${u}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
13
|
+
`);return`
|
|
14
|
+
// Register scope variables for STX runtime
|
|
15
|
+
if (!window.stx._scopes) window.stx._scopes = {};
|
|
16
|
+
var __scopeRegistration = window.stx._scopes['${e}'] || { __destroyCallbacks: __destroyHooks };
|
|
17
|
+
${n}
|
|
18
|
+
// #1767: when the bundler renamed a component const that collided with an
|
|
19
|
+
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
20
|
+
// renamed declaration so it resolves to the component's value, not the
|
|
21
|
+
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
22
|
+
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
23
|
+
if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeRegistration, Object.getOwnPropertyDescriptors(__stxLiveBindings));
|
|
24
|
+
window.stx._scopes['${e}'] = __scopeRegistration;
|
|
25
|
+
`}function ke(c,e){return c.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(a,r)=>r===e?a:'<script data-stx-scoped data-stx-run="always"')}function ue(c,e){let a=Re(c,e);return Ie(ve(c,a),e)}function Ie(c,e){let a=`
|
|
26
|
+
(function() {
|
|
27
|
+
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${e}"]') : null;
|
|
28
|
+
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
29
|
+
if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
|
|
30
|
+
if (__stxScopeEl && typeof window !== 'undefined' && window.stx) {
|
|
31
|
+
if (!window.stx._scopes) window.stx._scopes = {};
|
|
32
|
+
window.stx._scopes['${e}'] = {};
|
|
33
|
+
}
|
|
34
|
+
var __stxEndEffects = (typeof window !== 'undefined' && window.stx && window.stx._beginEffects) ? window.stx._beginEffects() : null;
|
|
35
|
+
try {`,r=`
|
|
36
|
+
} finally {
|
|
37
|
+
// The body's effects end where its onDestroy callbacks run: with the scope
|
|
38
|
+
// when the partial has a root, with the page when it has none.
|
|
39
|
+
if (__stxEndEffects) {
|
|
40
|
+
var __stxDisposeEffects = __stxEndEffects();
|
|
41
|
+
var __stxRegistered = __stxScopeEl && window.stx._scopes && window.stx._scopes['${e}'];
|
|
42
|
+
if (__stxRegistered) __stxRegistered.__disposeEffects = __stxDisposeEffects;
|
|
43
|
+
else if (window.stx._destroyCallbacks) window.stx._destroyCallbacks.push(__stxDisposeEffects);
|
|
44
|
+
}
|
|
45
|
+
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
46
|
+
}
|
|
47
|
+
})();`;return a+c+r}function Me(c,e){if(W(c)){let n=W(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[1],stamped:!0,root:"body"};return{html:dt(c,(u,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=vt(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let S=r[1]+r[2],n=r[1].slice(1),u=S.match(/data-stx-scope="([^"]*)"/);if(u)return{html:c,mergedIntoExisting:u[1],stamped:!0,root:n};let t=c.slice(0,a),A=r[1],z=r[2];return{html:`${t}${A} data-stx-scope="${e}"${z}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Te=0;function fe(c,e){let a=M.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Te}`}var le=new Set,pe=new Set;function my(){le.clear(),pe.clear()}var Ae=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function bg(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),r=[],S=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,u;while((u=n.exec(a))!==null){let t=u[1]==="/",A=u[2],z=u[3]==="/"||Ae.has(A.toLowerCase());if(t){S=Math.max(0,S-1);continue}if(S===0)r.push(A);if(!z)S++}return r}function me(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var ut=new T(500),Fc=new Set;function hy(){Fc.clear()}function Ce(c){if(c.__onceStore instanceof Set)return c.__onceStore;return Fc}async function $s(c,e,a,r,S,n=new Set){let u=r.partialsDir||M.join(M.dirname(a),"partials");if(u&&!M.isAbsolute(u))u=M.resolve(process.cwd(),u);let t=$e(c,"@partial","@include"),A=Ce(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(f,v,m)=>{let g=v.trim(),i=`${a}:${g}`;if(A.has(i))return"";return A.add(i),v});{let f=/@includeIf\s*\(/g,v;while((v=f.exec(t))!==null){let m=v.index,g=m+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")")i--;x++}if(i!==0)break;let l=t.substring(g+1,x-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){f.lastIndex=x;continue}let C=o[1],F=z(C,u,a),E="";if(F&&await Bun.file(F).exists())S.add(F),E=`@include(${l})`;t=t.substring(0,m)+E+t.substring(x),f.lastIndex=0}}for(let[f,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let m=new RegExp(`${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),g;while((g=m.exec(t))!==null){let i=g.index,x=i+g[0].length-1,l=1,o=x+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let C=t.substring(x+1,o-1),F=ae(C,0);if(F===-1){m.lastIndex=o;continue}let E=C.substring(0,F).trim(),V=C.substring(F+1).trim(),U=V.match(/^\s*['"]([^'"]+)['"]/);if(!U){m.lastIndex=o;continue}let _=U[1],q=V.substring(U[0].length),O,R=ae(q,0);if(R!==-1)O=q.substring(R+1).trim();try{let k=`Boolean(${E})`,N;if(h(k)){let oe=p(k,Object.keys(e));N=Boolean(oe(...Object.values(e)))}else N=Boolean(d(k,e));let ee=v?!N:N,re="";if(ee){let oe=z(_,u,a);if(oe&&await Bun.file(oe).exists())S.add(oe);re=`@include('${_}'${O?`, ${O}`:""})`}t=t.substring(0,i)+re+t.substring(o),m.lastIndex=0}catch(k){let N=k instanceof Error?k.message:String(k),ee=w("Include",`Error evaluating ${f} condition: ${N}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),m.lastIndex=0}}}{let f=/@each\s*\(/g,v;while((v=f.exec(t))!==null){let m=v.index,g=m+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(m,x+1),C=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!C){f.lastIndex=0,t=t.replace(o,"");continue}let[,F,E,V,U]=C;try{let _,q=E.trim();if(h(q))_=p(q,Object.keys(e))(...Object.values(e));else _=d(q,e);let O="";if(Array.isArray(_)&&_.length>0)for(let R of _){let k={...e,[V]:R},N=await se(F,k,c,m);O+=N}else if(U)O=await se(U,{},c,m);t=t.substring(0,m)+O+t.substring(x+1),f.lastIndex=0}catch(_){let q=_ instanceof Error?_.message:String(_);t=t.substring(0,m)+w("Each",`Error in @each: ${q}`,a,c,m)+t.substring(x+1),f.lastIndex=0}}}{let f=/@includeFirst\s*\(/g,v;while((v=f.exec(t))!==null){let m=v.index,g=m+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(m,x+1),C=l.match(/^\s*(\[[^\]]+\])/);if(!C){f.lastIndex=0,t=t.replace(o,"");continue}let F=C[1],E=l.slice(C[0].length),V,U=E.match(/^\s*,\s*\{/);if(U){E=E.slice(U[0].length-1);let O=1,R=1;while(R<E.length&&O>0){if(E[R]==="{")O++;else if(E[R]==="}"){if(O--,O===0)break}R++}V=E.substring(0,R+1),E=E.slice(R+1)}let _,q=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(q)_=q[1];try{let O=JSON.parse(F.replace(/'/g,'"')),R={};if(V)try{R=D(V,e)}catch(N){let ee=N instanceof Error?N.message:String(N);if(r.debug){let re=w("Include",`Error parsing includeFirst variables: ${ee}`,a,c,m,o);t=t.replace(o,()=>re)}else t=t.replace(o,()=>_||"");continue}let k=!1;for(let N of O){let ee=z(N,u,a);if(!ee)continue;if(await s(ee)){let re=await se(N,R,c,m);t=t.replace(o,()=>re),k=!0;break}}if(!k)if(_!==void 0)t=t.replace(o,()=>_);else if(r.debug){let N=w("Include",`None of the includeFirst paths exist: ${F}`,a,c,m,o);t=t.replace(o,()=>N)}else t=t.replace(o,"")}catch(O){let R=O instanceof Error?O.message:String(O),k=w("Include",`Error processing @includeFirst: ${R}`,a,c,m,o);t=t.replace(o,()=>k)}f.lastIndex=0}}function z(f,v,m){try{let g=f;if(!f.endsWith(".stx"))g=`${f}.stx`;let i=M.resolve(v),x=M.resolve(M.dirname(m)),l;if(!g.startsWith("./")&&!g.startsWith("../")){for(let U of r._layerPartialDirs??[]){let _=M.resolve(U,g);if(_.startsWith(`${M.resolve(U)}${M.sep}`)&&ye(_))return _}l=M.resolve(v,g)}else l=M.resolve(x,g);let o=M.normalize(l),C=o.startsWith(i+M.sep)||o===i,F=o.startsWith(x+M.sep)||o===x,E=!1,V=M.dirname(x);if(o.startsWith(V+M.sep)){if(!M.relative(V,o).split(M.sep).some((O)=>O.startsWith(".")&&O!=="."&&O!==".."))E=!0}if(!C&&!F&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${f}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${x}`),null;return o}catch(g){return console.error(`Error resolving path ${f}: ${g}`),null}}let ie=M.resolve(a);n.add(ie);function j(f,v,m,g){return r.onIncludeError?.({includePath:f,templatePath:a,message:v,partialsDir:u}),w("Include",v,a,m,g)}async function se(f,v={},m,g){let i=z(f,u,a);if(!i)return j(f,`Could not resolve path for include: ${f}`,m,g);let x=M.resolve(i);if(n.has(x)){let l=[...n,x].map((o)=>M.basename(o)).join(" -> ");return j(f,`Circular include detected: ${l}`,m,g)}try{S.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(y){let K=y instanceof Error?y.message:String(y);return j(f,`Error loading include file ${f}: ${K}`,m,g)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-m1hfh2t4.js");l=y(l,e)}if(l&&(r.debug||!I()&&!Vn()))try{let{warnUnbalancedTags:y}=await import("./chunk-rt7xy537.js");y(l,i)}catch{}try{let{processESImports:y}=await import("./chunk-gg0kkn2e.js");l=await y(l,e,i,r,S)}catch(y){if(r.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,y instanceof Error?y.message:y)}let o=l,C=B(o);if(C)o=C.content.trim();let E=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(E)V=`<style${E[1]}>${E[2]}</style>`;let U=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,K,b)=>{if(!me(K))return"";return U.push({attrs:K,body:b}),`__STX_DATA_BLOCK_${U.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _={...e};_.__stx_signals_gate=Ne(l,i);for(let[y,K]of Object.entries(v))_[y]=K;let q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,O=[...l.matchAll(q)].sort((y,K)=>{let b=(y[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(b)}),R="",k=null,N=!1,ee=!1;for(let y of O){let K=y[1]||"",b=y[2]||"";if(me(K))continue;let X=K.includes("server"),be=Je(K);if(!X&&!/\bsrc\s*=/i.test(K))Ke(b,i,r.strict);if(!X&&b.trim()){let{interpolateScriptExpressions:Z}=await import("./chunk-p8wnp4p1.js");b=Z(b,_,f)}let ce="";try{let{extractAndStripCssImports:Z,renderVendorStyleTags:Q}=await import("./chunk-a5tg553d.js"),ne=Z(b,{filePath:i,projectRoot:process.cwd()});b=ne.code,ce=Q(ne.styles)}catch(Z){if(r.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,Z instanceof Error?Z.message:Z)}if(be&&b.trim())b=Ye(b);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-a5tg553d.js");b=Q(b).code;let{hasUserImports:ne,bundleClientScript:Se}=await import("./chunk-xy3ex6ht.js");if(ne(b))b=await Se(b,i,{projectRoot:process.cwd()})}catch(Q){if(r.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:Z}=await import("./chunk-67zy5p7x.js");b=Z(b)}let de=Ee(b);if(!X){let{extractBridgeData:Z,generateServerDataBridge:Q}=await import("./chunk-a5tg553d.js"),ne=Q(b,Z(_));if(ne)b=`${ne}
|
|
48
|
+
${b}`}if(de&&!X){N=!0,k=fe(i,e);let Z=L(b),Q=ue(Z,k);R+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${k}">${Q}</script>
|
|
49
|
+
`;continue}if(X)try{let{extractVariables:Z}=await import("./chunk-ggrcg7k7.js");await Z(b,_,i)}catch(Z){if(r.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,Z)}if(!X&&!de){let Z=K.replace(/\bclient\b/i,"").trim();k=fe(i,e);let Q=L(b),ne=ue(Q,k);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(ne))ee=!0;R+=`${ce}<script data-stx-scoped data-stx-run="always" data-stx-owner="${k}"${Z?` ${Z}`:""}>${ne}</script>
|
|
50
|
+
`}}if(U.length>0){let{interpolateScriptExpressions:y}=await import("./chunk-p8wnp4p1.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,b)=>{let X=U[Number(b)];return`<script${X.attrs}>${y(X.body,_,f)}</script>`})}if(k){let y=Me(o,k);if(o=y.html,y.mergedIntoExisting){let b=k,X=y.mergedIntoExisting;R=R.split(`'${b}'`).join(`'${X}'`).split(`"${b}"`).join(`"${X}"`),k=X}else if(!y.stamped&&N&&!le.has(i))le.add(i),console.warn(`[stx] ${M.relative(process.cwd(),i)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(y.stamped&&y.root!=="body"&&(N||ee)&&!pe.has(i)){let b=bg(o);if(b.length>1)pe.add(i),console.warn(`[stx] ${M.relative(process.cwd(),i)} declares ${N?"signals":"bindings"} and has ${b.length} top-level elements (${b.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=y.stamped&&y.root!==null&&Ur(y.root);R=ke(R,K?k:null)}if(o.includes("@include")||o.includes("@partial"))o=await $s(o,_,i,r,S,n);let{processLoops:re,reportDeferredLoopWarnings:oe}=await import("./chunk-m9smh7fs.js"),G=re(o,_,i,void 0,!0);G=ge(G,_,i),G=oe(G);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-8ycgk8w6.js");if(G=xe(G,_,i,r),G=we(G,_,i),G=_e(G,_,i,r),G=P(G,_,i),V)G+=`
|
|
51
|
+
`+V;if(R)G+=`
|
|
52
|
+
`+R;return G}catch(l){if(l instanceof te)throw l;let o=l instanceof Error?l.message:String(l);return j(f,`Error processing include ${f}: ${o}`,m,g)}}let Y=/@include\s*\(/g,H;while((H=Y.exec(t))!==null){let f=H.index,v=f+H[0].length-1,m=1,g=v+1;while(g<t.length&&m>0){if(t[g]==="(")m++;else if(t[g]===")")m--;g++}if(m!==0)break;let i=t.substring(f,g),x=t.substring(v+1,g-1),l=x.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=g;continue}let o=l[1],C,F=x.substring(l[0].length),E=ae(F,0);if(E!==-1)C=F.substring(E+1).trim();let V={};if(C)try{V=D(C,e)}catch(_){let q=_ instanceof Error?_.message:String(_);t=t.replace(i,w("Include",`Error parsing include variables for ${o}: ${q}`,a,c,f)),Y.lastIndex=0;continue}let U=await se(o,V,c,f);t=t.substring(0,f)+U+t.substring(g),Y.lastIndex=0}return t}function Rs(c,e){let a=c;function r(S,n,u,t){let A=S,z=!0;while(z){z=!1;let ie=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),j=A.match(ie);if(!j||j.index===void 0)break;let se=j.index,Y=j[1],H=se+j[0].length,f=new RegExp(`@${n}\\(`),v=new RegExp(`@${u}(?![a-z])`),m=1,g=H,i=-1;while(m>0&&g<A.length){let l=A.slice(g),o=l.match(f),C=l.match(v),F=o?g+o.index:1/0,E=C?g+C.index:1/0;if(F<E)m++,g=F+(o[0].length||1);else if(E<1/0){if(m--,m===0){i=E;break}g=E+u.length+1}else break}if(i===-1)break;let x=A.slice(H,i);if(!e[Y])e[Y]=[];if(t)e[Y].unshift(x);else e[Y].push(x);A=A.substring(0,se)+A.substring(i+`@${u}`.length),z=!0}return A}return a=r(a,"push","endpush",!1),a=r(a,"prepend","endprepend",!0),a}function As(c,e){return c.replace(/@stack\(['"]([^'"]+)['"]\)/g,(a,r)=>{if(!e[r]||e[r].length===0)return"";return e[r].join(`
|
|
53
|
+
`)})}
|
|
54
|
+
export{my,bg,ut,Fc,hy,$s,Rs,As};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{xs,Ss}from"./chunk-mnpfvxpa.js";import{g}from"./chunk-vf7tpgqz.js";import{a}from"./chunk-3tcy9r6r.js";import{at,fe}from"./chunk-1bf0grbf.js";import{Ec}from"./chunk-2szhk8mh.js";import{W}from"./chunk-mztjpp7m.js";import{x}from"./chunk-6bm7t0hm.js";import{f}from"./chunk-p4twxjfs.js";import{existsSync as z,mkdirSync as C,copyFileSync as I,chmodSync as B,rmSync as xe}from"fs";import{join as c,basename as ye,resolve as K}from"path";import{spawn as _}from"child_process";import{platform as Se}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=g(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var Yu=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -468,9 +468,9 @@ else if (data.type === 'event' && data.method) {
|
|
|
468
468
|
}
|
|
469
469
|
})();
|
|
470
470
|
</script>
|
|
471
|
-
`;function
|
|
471
|
+
`;function Za(e={}){let{debug:r=!1,timeout:i=30000}=e;return Yu.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function sy(){return!1}function oy(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(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 Za(t)})}function Qa(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=Za(r),n=O(e,"head",`${i}
|
|
472
472
|
`);if(n!==null)return n;let s=W(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
|
|
473
|
-
${i}`+e.slice(t)}return i+e}var
|
|
473
|
+
${i}`+e.slice(t)}return i+e}var Go={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 i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
474
474
|
<input type="checkbox" class="craft-checkbox" ${i} ${n}>
|
|
475
475
|
<span class="craft-checkbox-label">${r||e.label||""}</span>
|
|
476
476
|
</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 i=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="${i}" 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 i=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:${i}px;height:${i}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${i}px;height:${i}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 i=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,i/n*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let i=e.size||24;return`<div class="craft-spinner" style="width:${i}px;height:${i}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 i=e.open?"open":"",n=e.title||"";return`<dialog class="craft-modal" ${i}>
|
|
@@ -484,7 +484,7 @@ ${i}`+e.slice(t)}return i+e}var Ko={button:{nativeType:"craft-button",fallbackTa
|
|
|
484
484
|
</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 i=e.variant||"info",n=e.title||"";return`<div class="craft-alert craft-alert-${i}" role="alert">
|
|
485
485
|
${n?`<div class="craft-alert-title">${n}</div>`:""}
|
|
486
486
|
<div class="craft-alert-content">${r}</div>
|
|
487
|
-
</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 i=e.content||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${i}" 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:re},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:ae},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:ie},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:ne},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 i=e.value||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${i}" 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||""}">`}},
|
|
487
|
+
</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 i=e.content||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${i}" 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:re},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:ae},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:ie},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:ne},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 i=e.value||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${i}" 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||""}">`}},vs=`
|
|
488
488
|
<style id="craft-component-styles">
|
|
489
489
|
/* Craft Component Base Styles */
|
|
490
490
|
.craft-button {
|
|
@@ -902,7 +902,7 @@ ${i}`+e.slice(t)}return i+e}var Ko={button:{nativeType:"craft-button",fallbackTa
|
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
904
|
</style>
|
|
905
|
-
`,
|
|
905
|
+
`,ec=`
|
|
906
906
|
<script id="craft-component-runtime">
|
|
907
907
|
(function() {
|
|
908
908
|
if (window.__stxCraftComponentRuntime) return;
|
|
@@ -1006,11 +1006,11 @@ ${i}`+e.slice(t)}return i+e}var Ko={button:{nativeType:"craft-button",fallbackTa
|
|
|
1006
1006
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
1007
1007
|
})();
|
|
1008
1008
|
</script>
|
|
1009
|
-
`;function
|
|
1010
|
-
`)??
|
|
1011
|
-
`)??e+
|
|
1012
|
-
${g}
|
|
1009
|
+
`;function tc(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=O(e,"head",`${vs}
|
|
1010
|
+
`)??vs+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${ec}
|
|
1011
|
+
`)??e+ec;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>N("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>N("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>N(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>N(s,t,o.trim(),r,i)),e}function N(e,r,i,n,s){let t=n.components?.[e]||Go[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=F(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,i);let p=be(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${p}>`;return`<${t.fallbackTag} ${p}>${i}</${t.fallbackTag}>`}function F(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,p=o??d;if(s.startsWith(":"))r[t]=p;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=p;else if(p===void 0)r[t]=!0;else r[t]=p}return r}function re(e,r){let i=R(String(e.id||`craft-sidebar-${pe(r||JSON.stringify(e))}`)),n=ce(e.spaces)||oe(r),s=n.length?[]:le(e.sections)||j(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((y)=>y.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),p={id:i,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"),l=Number(e.width||e.sidebarWidth||286),b=e.native===!1||e.native==="false"?"false":"true",m=p.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${P(p.searchPlaceholder)}"></div>`:"",w;if(n.length)w=de(n,t,d);else if(s.length)w=s.map((y)=>L(y,d)).join("");else w=r;return`<aside class="${S(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${S(i)}" data-native="${b}" style="--craft-sidebar-width:${l}px">
|
|
1013
1012
|
${m}
|
|
1013
|
+
${w}
|
|
1014
1014
|
</aside>
|
|
1015
1015
|
<script type="application/json" data-craft-sidebar-config="${S(i)}">${ue(p)}</script>`}function ae(e,r){let i=R(String(e.id||e.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${S(i)}">
|
|
1016
1016
|
${e.label?`<div class="craft-sidebar-space-title">${P(String(e.label))}</div>`:""}
|
|
@@ -1029,7 +1029,7 @@ ${i}`+e.slice(t)}return i+e}var Ko={button:{nativeType:"craft-button",fallbackTa
|
|
|
1029
1029
|
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${S(e.icon)}"${i}></span>`:""}
|
|
1030
1030
|
<span class="craft-sidebar-item-label">${P(e.label)}</span>
|
|
1031
1031
|
${e.badge?`<span class="craft-sidebar-item-badge">${P(e.badge)}</span>`:""}
|
|
1032
|
-
</button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function pe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function P(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function S(e){return P(e).replace(/`/g,"`")}function ue(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function be(e,r,i){let n=[];n.push(`class="${i.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
|
|
1032
|
+
</button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function pe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function P(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function S(e){return P(e).replace(/`/g,"`")}function ue(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function be(e,r,i){let n=[];n.push(`class="${i.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 iy(e,r){Go[e]=r}function ay(){return{...Go}}import{chmodSync as ge,copyFileSync as me,mkdtempSync as V,rmSync as we,writeFileSync as J}from"fs";import{tmpdir as Q}from"os";import{join as D}from"path";function he(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 i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function ve(e,r){let i=D(r,"Contents","embedded.provisionprofile");me(e,i),ge(i,420)}async function Y(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let u=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(u.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=he(u.stdout),b={};if(i.entitlements){let m=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(m.exitCode!==0)throw Error("Could not read the app entitlements plist.");b=JSON.parse(m.stdout.toString())}for(let m of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[m])b[m]=l[m];if(s=V(D(Q(),"stx-entitlements-")),n=D(s,"entitlements.plist"),J(n,JSON.stringify(b)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");ve(i.provisioningProfile,e)}let t;if(r.length){let u=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");u=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(D(Q(),"stx-entitlements-")),t=D(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...u?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let u of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(u===e&&n)l.push("--entitlements",n);if(u!==e&&t)l.push("--entitlements",t);let b=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",m=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",b,...l,u],{stdout:"pipe",stderr:"pipe"}),[w,y]=await Promise.all([new Response(m.stderr).text(),m.exited]);if(y!==0)throw Error(`Could not sign native bundle ${u}: ${w.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,p]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(p!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)we(s,{recursive:!0,force:!0})}}var G=(e)=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function X(e){let r=new Set,i=(n,s,t)=>{if(typeof n==="string")return`${s}<string>${G(n)}</string>`;if(typeof n==="boolean")return`${s}<${n}/>`;if(typeof n==="number"){if(!Number.isFinite(n))throw TypeError(`Non-finite Info.plist number at ${t}`);let o=Number.isSafeInteger(n)?"integer":"real";return`${s}<${o}>${n}</${o}>`}if(n!==null&&typeof n==="object"){let o=Array.isArray(n);if(!o&&Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Unsupported Info.plist value at ${t}`);if(r.has(n))throw TypeError(`Cyclic Info.plist value at ${t}`);r.add(n);try{let d=o?"array":"dict",p=`${s} `,u=o?Array.from(n,(l,b)=>i(l,p,`${t}[${b}]`)):Object.entries(n).map(([l,b])=>`${p}<key>${G(l)}</key>
|
|
1033
1033
|
${i(b,p,`${t}.${l}`)}`);return u.length?`${s}<${d}>
|
|
1034
1034
|
${u.join(`
|
|
1035
1035
|
`)}
|
|
@@ -1038,7 +1038,7 @@ ${s}</${d}>`:`${s}<${d}/>`}finally{r.delete(n)}}throw TypeError(`Unsupported Inf
|
|
|
1038
1038
|
<plist version="1.0">
|
|
1039
1039
|
${i(e,"","infoPlist")}
|
|
1040
1040
|
</plist>
|
|
1041
|
-
`}async function
|
|
1041
|
+
`}async function nc(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||q(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||q(),n=e.format||Re(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!z(K(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!z(s))C(s,{recursive:!0});let t=await a(process.cwd()),o=await Ec(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=Qa(o,{debug:e.verbose}),o=tc(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=f(o,vs)}let d=e.name||ye(e.input,".stx"),p=e.version||"1.0.0",u=e.craftPath||rc(e.runtimeProfile);if(!u)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let b=Bun.spawnSync([u,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(b.exitCode!==0||b.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(u=xs(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${u}`);let l;switch(i){case"macos":l=await Ce(o,d,p,s,n,e,u);break;case"windows":l=await Te(o,d,p,s,n,e,u);break;case"linux":l=await Pe(o,d,p,s,n,e,u);break;case"ios":l=await Ie(o,d,p,s,e,u);break;case"android":l=await Be(o,d,p,s,e,u);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||q(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Ce(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,p=c(n,`${r}.app`),u=c(p,"Contents"),l=c(u,"MacOS"),b=c(u,"Resources");xe(p,{recursive:!0,force:!0}),C(l,{recursive:!0}),C(b,{recursive:!0});let m=c(b,"index.html");await Bun.write(m,e);let w="";if(t.sidebar?.enabled&&t.sidebar?.config)w=c(b,"sidebar-config.json"),await Bun.write(w,JSON.stringify(t.sidebar.config));let y=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",T=t.menubarOnly??t.systemTray,v=t.bundleStyle||(await $e(o)?"executable":"launcher");if(t.backend){if(!await ke(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");I(o,c(l,r)),B(c(l,r),493);let k=at("native-backend");try{let h=c(k,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(h,`import { runNativeBackend } from ${JSON.stringify(M)}
|
|
1042
1042
|
import * as backend from ${JSON.stringify(K(t.backend.entry))}
|
|
1043
1043
|
await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: backend.default, shutdown: Reflect.get(backend, "shutdown"),
|
|
1044
1044
|
maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
|
|
@@ -1069,14 +1069,14 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
|
|
|
1069
1069
|
--height ${t.window?.height||800} \\
|
|
1070
1070
|
${t.systemTray?"--system-tray":""} \\
|
|
1071
1071
|
${t.devTools?"":"--no-devtools"}
|
|
1072
|
-
`,b=c(d,r.toLowerCase());await Bun.write(b,l),B(b,493);let
|
|
1072
|
+
`,b=c(d,r.toLowerCase());await Bun.write(b,l),B(b,493);let m=`[Desktop Entry]
|
|
1073
1073
|
Type=Application
|
|
1074
1074
|
Name=${r}
|
|
1075
1075
|
Exec=${b}
|
|
1076
1076
|
Terminal=false
|
|
1077
1077
|
Categories=Utility;
|
|
1078
|
-
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),
|
|
1079
|
-
exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;
|
|
1078
|
+
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),m),s==="deb"){let w=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),y=await De(d,w,r,i,t);if(!y.success)return{success:!1,target:"linux",format:"deb",error:y.error};return{success:!0,target:"linux",format:"deb",outputPath:w}}if(s==="appimage"){let w=c(n,`${r}-${i}-x86_64.AppImage`),y=await qe(d,w,r,t);if(!y.success)return{success:!1,target:"linux",format:"appimage",error:y.error};return{success:!0,target:"linux",format:"appimage",outputPath:w}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Ie(e,r,i,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 Be(e,r,i,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 rc(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!z(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function q(){switch(Se()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Re(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 Ee(e,r,i){return Ss({appBundlePath:e,outputPath:r,volumeName:i})}async function Oe(e,r){return new Promise((i)=>{let n=_("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function De(e,r,i,n,s){return new Promise((t)=>{let o=at("deb");try{let d=c(o,"pkg"),p=c(d,"DEBIAN"),u=c(d,"usr","bin"),l=c(d,"usr","share","applications"),b=c(d,"usr","share",i.toLowerCase());C(p,{recursive:!0}),C(u,{recursive:!0}),C(l,{recursive:!0}),C(b,{recursive:!0});let m=x("fs").readdirSync(e);for(let v of m)I(c(e,v),c(b,v));let w=`#!/bin/bash
|
|
1079
|
+
exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;x("fs").writeFileSync(c(u,i.toLowerCase()),w),B(c(u,i.toLowerCase()),493);let y=`Package: ${i.toLowerCase()}
|
|
1080
1080
|
Version: ${n}
|
|
1081
1081
|
Section: utils
|
|
1082
1082
|
Priority: optional
|
|
@@ -1084,17 +1084,17 @@ Architecture: amd64
|
|
|
1084
1084
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
1085
1085
|
Maintainer: ${s.author||"Unknown"}
|
|
1086
1086
|
Description: ${s.description||i}
|
|
1087
|
-
`;
|
|
1087
|
+
`;x("fs").writeFileSync(c(p,"control"),y);let T=_("dpkg-deb",["--build",d,r]);T.on("close",(v)=>{if(fe(o),v===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${v}`})}),T.on("error",(v)=>{fe(o),t({success:!1,error:v.message})})}catch(d){fe(o),t({success:!1,error:d.message})}})}async function qe(e,r,i,n){return new Promise((s)=>{let t=at("appimage");try{let o=c(t,`${i}.AppDir`),d=c(o,"usr"),p=c(d,"bin"),u=c(d,"share");C(p,{recursive:!0}),C(u,{recursive:!0});let l=c(u,i.toLowerCase());C(l,{recursive:!0});let b=x("fs").readdirSync(e);for(let v of b)I(c(e,v),c(l,v));let m=`#!/bin/bash
|
|
1088
1088
|
SELF=$(readlink -f "$0")
|
|
1089
1089
|
HERE=\${SELF%/*}
|
|
1090
1090
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
1091
1091
|
exec "\${HERE}/usr/share/${i.toLowerCase()}/${i.toLowerCase()}" "$@"
|
|
1092
|
-
`;
|
|
1092
|
+
`;x("fs").writeFileSync(c(o,"AppRun"),m),B(c(o,"AppRun"),493);let w=`[Desktop Entry]
|
|
1093
1093
|
Type=Application
|
|
1094
1094
|
Name=${i}
|
|
1095
1095
|
Exec=${i.toLowerCase()}
|
|
1096
1096
|
Terminal=false
|
|
1097
1097
|
Categories=Utility;
|
|
1098
1098
|
Icon=${i.toLowerCase()}
|
|
1099
|
-
`;
|
|
1100
|
-
export{
|
|
1099
|
+
`;x("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),w);let y=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(x("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),y),n.icon&&z(n.icon))I(n.icon,c(o,`${i.toLowerCase()}.png`));let T=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});T.on("close",(v)=>{if(fe(t),v===0)B(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${v}. Install from https://appimage.github.io/appimagetool/`})}),T.on("error",(v)=>{fe(t),s({success:!1,error:`appimagetool not found: ${v.message}`})})}catch(o){fe(t),s({success:!1,error:o.message})}})}function sc(){return[q()]}function oc(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 Ae={buildNative:nc,getAvailableTargets:sc,getAvailableFormats:oc,detectPlatform:q},cy=Ae;
|
|
1100
|
+
export{Yu,Za,sy,oy,Qa,Go,vs,ec,tc,iy,ay,nc,rc,sc,oc,cy};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as A,mkdtempSync as D,readdirSync as M,realpathSync as b,rmSync as k,statSync as g,writeFileSync as P}from"fs";import{constants as _,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var I=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",N=60000,R=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{k(e,{recursive:!0,force:!0})}catch{}}function C(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function G(e){if(C(),t.listenerCount(e)===0)t.exit(128+(_.signals[e]??1))}var h=new Map(R.map((e)=>[e,()=>G(e)]));function K(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function O(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function L(e={}){let n=e.root??x(),r=e.isAlive??O,w=e.minAgeMs??N,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let l of u){let d=I.exec(l);if(!d)continue;let m=Number(d[1]);if(m===t.pid||r(m))continue;let o=s(n,l);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function z(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function H(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function
|
|
3
|
-
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function
|
|
4
|
-
export{
|
|
2
|
+
import{existsSync as A,mkdtempSync as D,readdirSync as M,realpathSync as b,rmSync as k,statSync as g,writeFileSync as P}from"fs";import{constants as _,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var I=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",N=60000,R=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{k(e,{recursive:!0,force:!0})}catch{}}function C(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function G(e){if(C(),t.listenerCount(e)===0)t.exit(128+(_.signals[e]??1))}var h=new Map(R.map((e)=>[e,()=>G(e)]));function K(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function O(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function L(e={}){let n=e.root??x(),r=e.isAlive??O,w=e.minAgeMs??N,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let l of u){let d=I.exec(l);if(!d)continue;let m=Number(d[1]);if(m===t.pid||r(m))continue;let o=s(n,l);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function z(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function H(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function at(e="stx",n=x()){if(!S.has(n))S.add(n),L({root:n});let r=b(D(s(n,z(e))));if(H())return W(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return K(),i.add(r),r}function fe(e){if(y.has(e))return;if(p(e),i.delete(e),i.size===0)f()}function W(e){try{P(s(e,v),`kept by pid ${t.pid}
|
|
3
|
+
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function Tc(e,n){let r=at(e);try{return await n(r)}finally{fe(r)}}
|
|
4
|
+
export{at,fe,Tc};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Im}from"./chunk-rk16391e.js";import"./chunk-sbr3wg75.js";import"./chunk-m390z8w8.js";import"./chunk-1a2c4pv8.js";import"./chunk-zaj3nnvv.js";import"./chunk-d69k67bn.js";import"./chunk-xakqpa4z.js";import"./chunk-whnzf9hn.js";import"./chunk-fjpt8arw.js";import"./chunk-3aayrnbh.js";import"./chunk-v1x96kjr.js";import"./chunk-p0xqm2ne.js";import"./chunk-fwxgzktt.js";import"./chunk-2mv29s6w.js";import"./chunk-3tcy9r6r.js";import"./chunk-50zzar2c.js";import"./chunk-mr9pp5cf.js";import"./chunk-txk2z7v0.js";import"./chunk-ktv65e3n.js";import"./chunk-5fdc8pej.js";import"./chunk-vb609vbj.js";import"./chunk-qda8tmk9.js";import"./chunk-14df2jzs.js";import"./chunk-vf7tpgqz.js";import"./chunk-ayrd026n.js";import"./chunk-ex6dne7e.js";import"./chunk-jjq7c8s2.js";import"./chunk-858p3hkz.js";export{Im as startInteractive};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import i from"os";import{join as s}from"path";function
|
|
3
|
-
export{
|
|
2
|
+
import i from"os";import{join as s}from"path";function Er(t,r=process.cwd()){try{let n=typeof Bun<"u"?Bun.resolveSync(t,r):void 0;return n&&o(n)?n:void 0}catch{return}}function o(t,r=process.env){let n=t.replace(/\\/g,"/");if(n.split("/").some((e)=>/@\d[^/]*@@@\d+$/.test(e)))return!1;return![r.BUN_INSTALL_CACHE_DIR,s(r.BUN_INSTALL||s(i.homedir(),".bun"),"install","cache")].filter((e)=>!!e).map((e)=>`${e.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((e)=>n.startsWith(e))}
|
|
3
|
+
export{Er};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{le,ue,de,
|
|
2
|
+
import{at,fe,Tc}from"./chunk-1bf0grbf.js";import v from"fs";import g from"path";import V from"crypto";var le=[320,640,768,1024,1280,1536,1920],ue=["webp","jpeg"],de=80,T=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function tr(){return await d()!==null}async function Te(){return!0}async function ze(t,e={}){let{widths:a=le,formats:n=ue,quality:r=de,fit:m="cover",placeholder:l="none",outputDir:o=".stx/images",baseUrl:c="/images"}=e,i,h;if(typeof t==="string"){if(h=t,!await Bun.file(t).exists())throw new hs(`Image not found: ${t}`,"NOT_FOUND");i=await Bun.file(t).arrayBuffer().then((s)=>Buffer.from(s))}else h="buffer-input",i=t;let b=V.createHash("sha256").update(i).digest("hex").slice(0,12),j=await ms(i),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(o,{recursive:!0});let B=[],A=g.basename(h,g.extname(h)),f=a.filter((s)=>s<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((s,p)=>s-p);for(let s of f){let p=Math.round(s/F);for(let w of n){let S=`${A}-${s}w-${b}.${w}`,P=g.join(o,S),q=`${c}/${S}`,E=await $u(i,{width:s,height:p,format:w,quality:r,fit:m});await Bun.write(P,E),B.push({path:P,url:q,width:s,height:p,format:w,size:E.length})}}let y;if(l!=="none")y=await D(i,l);return{src:h,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function ms(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let r=await a(e).metadata();return{width:r.width||0,height:r.height||0,format:r.format||"unknown",hasAlpha:r.hasAlpha}}return L(e)}function L(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let r=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:r,format:"jpeg",hasAlpha:!1}}let n=t.readUInt16BE(e+2);e+=2+n}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,n=t.readUInt16LE(28)&16383;return{width:a,height:n,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),n=(a&16383)+1,r=(a>>14&16383)+1;return{width:n,height:r,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new hs("Unable to parse image dimensions","PARSE_ERROR")}async function $u(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}let{processImage:n}=await import("ts-images");return await Tc("img",async(r)=>{let m=g.join(r,`out.${e.format}`);return await n({input:t,output:m,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(m).arrayBuffer())})}async function D(t,e){let a=await d();if(e==="blur"&&a){let c=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),i=await ms(t);return`data:${U[i.format]||"image/jpeg"};base64,${c}`}if(e==="dominant-color"&&a){let{dominant:o}=await a(t).resize(1,1).toBuffer().then(async(c)=>{let i=await a(c).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${o.r}, ${o.g}, ${o.b})`}let{generatePlaceholder:n}=await import("ts-images"),r=await ms(t),m=at("ph"),l=g.join(m,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(l,t);let o=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",i=await n(l,{strategy:o,width:o==="thumbhash"?void 0:32});if(e==="dominant-color"&&i.dominantColor)return i.dominantColor;if(i.dataURL)return i.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{fe(m)}}function Rt(t,e){return(e?t.filter((n)=>n.format===e):t).sort((n,r)=>n.width-r.width).map((n)=>`${n.url} ${n.width}w`).join(", ")}function pn(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,n)=>{let r=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(n[0].replace(/\D/g,""))||0)-r}).map(([a,n])=>`(max-width: ${a}) ${n}`).join(", ")+", 100vw"}function nr(t){let e=t.filter((n)=>n.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((n,r)=>n.width-r.width);return a[Math.floor(a.length/2)]}function rr(t){let e=new Map;for(let a of t){let n=e.get(a.format)||[];n.push(a),e.set(a.format,n)}return e}function sr(t){let e=g.extname(t).toLowerCase();return T.includes(e)}function pe(t){return U[t]||"application/octet-stream"}function or(t){return t.reduce((e,a)=>e+a.size,0)}function ir(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class hs extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
|
|
3
|
+
export{le,ue,de,tr,Te,ze,ms,$u,Rt,pn,nr,rr,sr,pe,or,ir,hs};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{gt}from"./chunk-5fdc8pej.js";import{Pt,lr}from"./chunk-p3x7kwb5.js";import{Xr,Gr,Jr,Zr,je}from"./chunk-vf7tpgqz.js";import{ye,In,Il,Ol}from"./chunk-vb609vbj.js";import{z}from"./chunk-14df2jzs.js";import{Zi}from"./chunk-qda8tmk9.js";import{S}from"./chunk-m390z8w8.js";import{i}from"./chunk-sbr3wg75.js";import{q,a}from"./chunk-3tcy9r6r.js";import{rl}from"./chunk-txk2z7v0.js";import{Yn,Zn,it,Fe,Fa,za,Qn}from"./chunk-2m4ydym0.js";import{kn,ri}from"./chunk-xpsg91dh.js";import{er}from"./chunk-qsnw0qyp.js";import{hn,br,wr}from"./chunk-pxvp0cc9.js";import{se}from"./chunk-v1x96kjr.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?lr():Pt(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=gt(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import U from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{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 V(n,l,o={}){let r=U.resolve(n),e=await Bun.file(r).text(),x=Q("sha256").update(e).digest("hex").slice(0,16);Il();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ye(R))),{context:D}=ee({__filename:r,__dirname:U.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...q,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Yn(f)+Zn(f)+it(f),j=Ol();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:x,status:In(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(x,_){let y=m.readdirSync(x,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(x,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Hm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),x=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=je(e.app?.head,{known:Zr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=er(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)kn(o,w);if(e.runtimeConfig)z(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=se(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await V(s.filePath,s.pattern,{configDir:o,componentsDir:x,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=Jr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Xr(t.html,u);if(g.htmlAttrs)t.html=Gr(t.html,g.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 G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await S(t.html),M){let p=await Qn(t,{params:{},request:new Request(`http://stx.build${s.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 ${s.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=Fe(t.html,D,!0);let N=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),K=c.join("server","pages",`${N}.compiled.json`),L=c.join("server","fragments",`${N}.html`);await Bun.write(c.join(r,K),JSON.stringify(t,null,2)),await Bun.write(c.join(r,L),t.fragment),O.push({pattern:s.pattern,compiledPath:K,fragmentPath:L,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=wr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",br));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${hn}/`)}let E={runtime:v.filename,router:b.filename},C=Fa(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await ri(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Zi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(rl(e._layerGraph),null,2));za(C,r);let F=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${F}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:E,outputDir:r,duration:F}}
|
|
4
|
-
export{
|
|
4
|
+
export{Hm};
|