@stacksjs/stx 0.2.440 → 0.2.442
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-06qhvtsv.js +2 -0
- package/dist/{chunk-4gmdfym5.js → chunk-0ahjxtkx.js} +22 -22
- package/dist/chunk-0e6da0m4.js +2 -0
- package/dist/{chunk-zfzcedw4.js → chunk-0vbpcef6.js} +4 -4
- package/dist/{chunk-nvht5259.js → chunk-0xntpjmp.js} +3 -3
- package/dist/{chunk-fg5ve6ey.js → chunk-149r1q6c.js} +2 -2
- package/dist/{chunk-a9necy79.js → chunk-1ghj9pgz.js} +154 -154
- package/dist/chunk-1gsr2z6s.js +2 -0
- package/dist/chunk-1k55q9ff.js +2 -0
- package/dist/{chunk-489z8wry.js → chunk-1qnyn82e.js} +2 -2
- package/dist/{chunk-dc89a93n.js → chunk-1rn1g4ac.js} +11 -11
- package/dist/chunk-1s04q9hz.js +2 -0
- package/dist/chunk-224x6rsx.js +2 -0
- package/dist/chunk-2rs6n7c0.js +2 -0
- package/dist/{chunk-1yj3p63h.js → chunk-2xnwsavq.js} +2 -2
- package/dist/{chunk-xfv7evmd.js → chunk-3n8qh43z.js} +3 -3
- package/dist/chunk-3wezvz6m.js +2 -0
- package/dist/chunk-41fbr3m6.js +2 -0
- package/dist/chunk-4ct5vj9n.js +2 -0
- package/dist/chunk-4ta6131h.js +2 -0
- package/dist/chunk-5402rpwg.js +2 -0
- package/dist/{chunk-b9wpgn7b.js → chunk-56hvemdx.js} +5 -5
- package/dist/chunk-5tx1wqns.js +2 -0
- package/dist/chunk-5vgyr78g.js +2 -0
- package/dist/{chunk-t7x753ga.js → chunk-5zpt78j4.js} +4 -4
- package/dist/{chunk-7a0ffmer.js → chunk-6a1jr9pp.js} +4 -4
- package/dist/chunk-6nxzh304.js +2 -0
- package/dist/{chunk-8x47zcfa.js → chunk-73h7qjgq.js} +2 -2
- package/dist/chunk-7416mm6g.js +2 -0
- package/dist/{chunk-8wkja2z2.js → chunk-7676qzab.js} +3 -3
- package/dist/chunk-7cdrpkzz.js +2 -0
- package/dist/{chunk-yhxazetv.js → chunk-7cvc6hdw.js} +6 -6
- package/dist/{chunk-s28eh0jn.js → chunk-7mbx7dzg.js} +2 -2
- package/dist/{chunk-36kkc60p.js → chunk-7x8nd4fw.js} +3 -3
- package/dist/{chunk-74j5jbs6.js → chunk-81zfdd95.js} +3 -3
- package/dist/{chunk-5vwg3h5g.js → chunk-8nsmx2w4.js} +2 -2
- package/dist/{chunk-nq7z26y6.js → chunk-8sbm4bza.js} +5 -5
- package/dist/{chunk-acwgap78.js → chunk-9ad04ksh.js} +1 -1
- package/dist/{chunk-3rbz496d.js → chunk-9f0srtmg.js} +1 -1
- package/dist/{chunk-w040f2er.js → chunk-a3smkhem.js} +2 -2
- package/dist/chunk-a8hjvjb8.js +2 -0
- package/dist/{chunk-my3jkpv7.js → chunk-aa7w63xc.js} +7 -7
- package/dist/{chunk-tywmtk33.js → chunk-ak7eyyka.js} +2 -2
- package/dist/{chunk-pxqs3psa.js → chunk-b5emjcf1.js} +4 -4
- package/dist/{chunk-p2x7tjbt.js → chunk-bbnyq3gm.js} +2 -2
- package/dist/chunk-bcgth8qf.js +2 -0
- package/dist/{chunk-b8dbq51z.js → chunk-bh432b7n.js} +2 -2
- package/dist/chunk-by1s70jp.js +2 -0
- package/dist/{chunk-wtms9jhs.js → chunk-cm875f73.js} +2 -2
- package/dist/chunk-cpfnd8ta.js +2 -0
- package/dist/{chunk-721yq8qx.js → chunk-cs15xqf0.js} +4 -4
- package/dist/chunk-d59cjrpm.js +2 -0
- package/dist/chunk-d6npyn3x.js +2 -0
- package/dist/chunk-dftp2bp0.js +2 -0
- package/dist/{chunk-24e7qjb8.js → chunk-dn9thd0h.js} +2 -2
- package/dist/{chunk-114zdbnd.js → chunk-dqr5n49p.js} +2 -2
- package/dist/chunk-drsy8gek.js +2 -0
- package/dist/chunk-dvja1k84.js +2 -0
- package/dist/{chunk-4xemkkm8.js → chunk-dwp3knc4.js} +3 -3
- package/dist/chunk-e1n2t5tk.js +2 -0
- package/dist/{chunk-ydz7w2mt.js → chunk-f85dyf2f.js} +1 -1
- package/dist/chunk-fgedcdc1.js +2 -0
- package/dist/chunk-fm3k5v8s.js +2 -0
- package/dist/{chunk-thx147nq.js → chunk-fmj4xvqm.js} +5 -5
- package/dist/{chunk-5zahqrb4.js → chunk-fx994kkj.js} +6 -6
- package/dist/chunk-gsgkaa1g.js +2 -0
- package/dist/{chunk-6wmxrn6x.js → chunk-gvefw19e.js} +1 -1
- package/dist/{chunk-m607bd3m.js → chunk-h7ny0py8.js} +5 -5
- package/dist/{chunk-hc9242wm.js → chunk-hkx8pggg.js} +1 -1
- package/dist/{chunk-bjnvymb7.js → chunk-hqywyyez.js} +5 -5
- package/dist/{chunk-tprtjzzc.js → chunk-htwgkg91.js} +5 -5
- package/dist/{chunk-44zjqsh9.js → chunk-hwaxjfr0.js} +2 -2
- package/dist/{chunk-vzek2z1v.js → chunk-j0nyamyf.js} +1 -1
- package/dist/chunk-j3gcjbnm.js +2 -0
- package/dist/{chunk-ptjqacjd.js → chunk-jwpcck1b.js} +2 -2
- package/dist/chunk-k2k6engs.js +2 -0
- package/dist/chunk-kagy1rcd.js +2 -0
- package/dist/{chunk-5ty8h14h.js → chunk-kpz3tpx7.js} +4 -4
- package/dist/chunk-kr2phxhf.js +2 -0
- package/dist/{chunk-771hf74z.js → chunk-m0nw8he9.js} +5 -5
- package/dist/chunk-m3f50p6c.js +2 -0
- package/dist/{chunk-dtvwes4f.js → chunk-m4q2e418.js} +3 -3
- package/dist/chunk-m90a5dpn.js +2 -0
- package/dist/{chunk-9w5nse46.js → chunk-mcgpeyy8.js} +4 -4
- package/dist/{chunk-w2085fwx.js → chunk-mnz6bdp3.js} +5 -5
- package/dist/{chunk-93e1nf1y.js → chunk-mx9wp3va.js} +1 -1
- package/dist/{chunk-j1q65enz.js → chunk-n9jn3qzw.js} +2 -2
- package/dist/chunk-nqcg2bf0.js +2 -0
- package/dist/{chunk-3hmy75tw.js → chunk-nw8p8eg9.js} +5 -5
- package/dist/chunk-pe9hxhrb.js +2 -0
- package/dist/{chunk-3akpy7er.js → chunk-phafsgd9.js} +10 -10
- package/dist/{chunk-p4wvc7wx.js → chunk-qa7j3j71.js} +6 -6
- package/dist/chunk-qg5e32gx.js +2 -0
- package/dist/chunk-qqq7jr16.js +2 -0
- package/dist/chunk-qy8wb31b.js +2 -0
- package/dist/{chunk-ccq35xp7.js → chunk-r3f9jcf7.js} +3 -3
- package/dist/chunk-ra2wyhrd.js +2 -0
- package/dist/{chunk-8zf5q1m3.js → chunk-rdq113p4.js} +2 -2
- package/dist/chunk-rk3nsd1x.js +2 -0
- package/dist/chunk-rmnhy5az.js +2 -0
- package/dist/{chunk-spx27cs4.js → chunk-rvbcnahe.js} +2 -2
- package/dist/chunk-rwdkh7c0.js +2 -0
- package/dist/{chunk-4wf68rht.js → chunk-s5drjm2j.js} +6 -6
- package/dist/{chunk-zpnz1k3b.js → chunk-t5wfq4r9.js} +2 -2
- package/dist/{chunk-hnep9jbj.js → chunk-tn85vr56.js} +2 -2
- package/dist/chunk-tr1q484n.js +2 -0
- package/dist/chunk-tz32ndmq.js +2 -0
- package/dist/chunk-v404gvm0.js +2 -0
- package/dist/chunk-v4mrkvzc.js +33 -0
- package/dist/{chunk-r9vrqxma.js → chunk-v93znq7a.js} +1 -1
- package/dist/chunk-vhywbdej.js +2 -0
- package/dist/{chunk-3pxp0r0a.js → chunk-vxgtq00t.js} +3 -3
- package/dist/{chunk-r7pmpd2x.js → chunk-wbdk7bcw.js} +1 -1
- package/dist/{chunk-5ahb6arz.js → chunk-wf2gq6hc.js} +2 -2
- package/dist/chunk-wn1p05ac.js +2 -0
- package/dist/chunk-xf873x70.js +2 -0
- package/dist/{chunk-mtb5000n.js → chunk-xh420ckt.js} +2 -2
- package/dist/{chunk-7x8qwshk.js → chunk-xq4jdzje.js} +4 -4
- package/dist/chunk-y3695sgc.js +2 -0
- package/dist/chunk-ye27ept1.js +2 -0
- package/dist/chunk-ymvdbs80.js +2 -0
- package/dist/chunk-yqnkzkd3.js +2 -0
- package/dist/{chunk-tnbgy59s.js → chunk-yva29j3q.js} +3 -3
- package/dist/chunk-zntspqxt.js +2 -0
- package/dist/cli.js +19 -19
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/bridge/protocol.d.ts +1 -0
- package/dist/native/compiler/headwind-to-style.js +14 -6
- package/dist/native/compiler/html-to-ir.js +13 -5
- package/dist/native/compiler/icons.d.ts +1 -0
- package/dist/native/compiler/icons.js +1 -0
- package/dist/native/compiler/ir.d.ts +2 -0
- package/dist/native/components/primitives.d.ts +7 -3
- package/dist/native/components/primitives.js +1 -0
- package/dist/native/primitives/Icon.stx +7 -0
- package/dist/native/runtime/binding-tree.d.ts +3 -1
- package/dist/native/runtime/binding-tree.js +26 -5
- package/dist/native/runtime/craft-bridge.js +6 -1
- package/dist/native/runtime/craft.d.ts +4 -0
- package/dist/native/runtime/native-host.d.ts +3 -1
- package/dist/native/runtime/native-host.js +60 -5
- package/dist/native/runtime/shared-screen.js +10 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-053t5wrs.js +0 -2
- package/dist/chunk-0jgvwa50.js +0 -2
- package/dist/chunk-0n28xm1q.js +0 -2
- package/dist/chunk-1cq9w2qz.js +0 -2
- package/dist/chunk-1n7d9ag2.js +0 -2
- package/dist/chunk-259ecbwa.js +0 -2
- package/dist/chunk-386zrhbf.js +0 -2
- package/dist/chunk-397fy72k.js +0 -2
- package/dist/chunk-48w0qzmk.js +0 -2
- package/dist/chunk-4bpc0tsf.js +0 -2
- package/dist/chunk-535nrr6j.js +0 -2
- package/dist/chunk-60j147cj.js +0 -2
- package/dist/chunk-67r98kff.js +0 -2
- package/dist/chunk-6c7294j8.js +0 -2
- package/dist/chunk-6faqgn2f.js +0 -2
- package/dist/chunk-7pbv9mg7.js +0 -2
- package/dist/chunk-7tkwt0a9.js +0 -2
- package/dist/chunk-87c76jq3.js +0 -2
- package/dist/chunk-88ey0pdm.js +0 -2
- package/dist/chunk-8h0nbb7t.js +0 -2
- package/dist/chunk-9yy4fyq6.js +0 -2
- package/dist/chunk-a88mq2k6.js +0 -2
- package/dist/chunk-awqft00q.js +0 -2
- package/dist/chunk-cczrcjfs.js +0 -2
- package/dist/chunk-cnmz9543.js +0 -2
- package/dist/chunk-cv56m171.js +0 -2
- package/dist/chunk-ed7p2a5q.js +0 -2
- package/dist/chunk-fg8kmyz8.js +0 -2
- package/dist/chunk-gq16fxc2.js +0 -2
- package/dist/chunk-h4avjh3q.js +0 -2
- package/dist/chunk-k5tcanyq.js +0 -2
- package/dist/chunk-k6kvgdd0.js +0 -2
- package/dist/chunk-kcwz3kvn.js +0 -2
- package/dist/chunk-ksyb5bgt.js +0 -2
- package/dist/chunk-mh4qh1dk.js +0 -2
- package/dist/chunk-p3462q2p.js +0 -2
- package/dist/chunk-pey0cpyh.js +0 -2
- package/dist/chunk-q5433grh.js +0 -2
- package/dist/chunk-qke87dwv.js +0 -2
- package/dist/chunk-r089d1s4.js +0 -2
- package/dist/chunk-rnjkfhh0.js +0 -2
- package/dist/chunk-rnth7r2v.js +0 -33
- package/dist/chunk-s4ypqjhp.js +0 -2
- package/dist/chunk-st6exqqv.js +0 -2
- package/dist/chunk-tv7hxprx.js +0 -2
- package/dist/chunk-veqzjwty.js +0 -2
- package/dist/chunk-vw8a7yfw.js +0 -2
- package/dist/chunk-vwms759h.js +0 -2
- package/dist/chunk-vzey1tm1.js +0 -2
- package/dist/chunk-w7zh2avv.js +0 -2
- package/dist/chunk-w88efb66.js +0 -2
- package/dist/chunk-xeb3vyhx.js +0 -2
- package/dist/chunk-xq5hzqg5.js +0 -2
- package/dist/chunk-xx5gx241.js +0 -2
- package/dist/chunk-ynrnx1tp.js +0 -2
- package/dist/chunk-z9154ddm.js +0 -2
- package/dist/chunk-zdkspb3m.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import S from"fs";import _ from"path";function
|
|
2
|
+
import S from"fs";import _ from"path";function mr(e){let{token:t,baseUrl:i="https://api.netlify.com/api/v1"}=e;async function s(n,r,l={}){let p=`${i}${r}`,f={Authorization:`Bearer ${t}`,"User-Agent":"stx-deploy/1.0"},u;if(l.rawBody)f["Content-Type"]=l.contentType||"application/octet-stream",u=l.rawBody;else if(l.body)f["Content-Type"]="application/json",u=JSON.stringify(l.body);let o=await fetch(p,{method:n,headers:f,body:u});if(!o.ok){let g=Error(`Netlify API error: ${o.status} ${o.statusText}`);g.status=o.status;try{let b=await o.json();g.message=b.message||g.message,g.code=b.code,g.details=b}catch{}throw g}let a=await o.text();if(!a)return{};return JSON.parse(a)}return{async getSite(n){return s("GET",`/sites/${n}`)},async listSites(){return s("GET","/sites")},async createSite(n){let r={};if(n)r.name=n;return s("POST","/sites",{body:r})},async createDeploy(n,r){let l={files:r.files,draft:r.draft??!0,async:r.async??!0};if(r.title)l.title=r.title;if(r.branch)l.branch=r.branch;if(r.functions)l.functions=r.functions;return s("POST",`/sites/${n}/deploys`,{body:l})},async uploadFile(n,r,l){let p=r.startsWith("/")?r.slice(1):r;await s("PUT",`/deploys/${n}/files/${p}`,{rawBody:l,contentType:"application/octet-stream"})},async uploadFiles(n,r){let p=[...r],f=async()=>{while(p.length>0){let o=p.shift();if(o)await this.uploadFile(n,o.path,o.content)}},u=Array.from({length:Math.min(5,r.length)},()=>f());await Promise.all(u)},async getDeploy(n){return s("GET",`/deploys/${n}`)},async waitForDeploy(n,r={}){let{timeout:l=300000,pollInterval:p=2000,onProgress:f}=r,u=Date.now();while(!0){let o=await this.getDeploy(n);if(f)f(o);if(o.state==="ready")return o;if(o.state==="error"){let a=Error(`Deploy failed: ${o.error_message||"Unknown error"}`);throw a.status=500,a.details=o,a}if(Date.now()-u>l){let a=Error(`Deploy timed out after ${l}ms`);throw a.status=408,a.details=o,a}await new Promise((a)=>setTimeout(a,p))}},async lockDeploy(n){return s("POST",`/deploys/${n}/lock`)},async unlockDeploy(n){return s("POST",`/deploys/${n}/unlock`)}}}async function Xs(e){let t=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(t)).map((s)=>s.toString(16).padStart(2,"0")).join("")}async function vn(e,t={}){let{ignore:i=["node_modules",".git",".env*","*.map"]}=t,s=[],n=new Bun.Glob("**/*");for await(let r of n.scan({cwd:e,onlyFiles:!0,dot:!1})){if(i.some((a)=>{if(a.includes("*"))return new RegExp(`^${a.replace(/\*/g,".*")}$`).test(r);return r.includes(a)}))continue;let p=`${e}/${r}`,u=await Bun.file(p).arrayBuffer(),o=await Xs(u);s.push({path:r,content:new Uint8Array(u),sha1:o})}return s}function hr(e){let t={};for(let i of e)t[`/${i.path}`]=i.sha1;return t}function yr(e,t){let i=new Set(t.map((s)=>s.startsWith("/")?s.slice(1):s));return e.filter((s)=>i.has(s.path))}function Rt(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;if(e<1073741824)return`${(e/1048576).toFixed(1)} MB`;return`${(e/1073741824).toFixed(1)} GB`}function lt(e){return e.reduce((t,i)=>t+i.content.byteLength,0)}import m from"fs";import y from"path";function Gs(e){let t=[];if(t.push("[build]"),t.push(` command = "${d(e.build.command)}"`),t.push(` publish = "${d(e.build.publish)}"`),e.build.functions)t.push(` functions = "${d(e.build.functions)}"`);if(e.build.edge_functions)t.push(` edge_functions = "${d(e.build.edge_functions)}"`);if(e.build.environment&&Object.keys(e.build.environment).length>0){t.push(""),t.push("[build.environment]");for(let[i,s]of Object.entries(e.build.environment))t.push(` ${i} = "${d(s)}"`)}if(e.functions){if(t.push(""),t.push("[functions]"),e.functions.directory)t.push(` directory = "${d(e.functions.directory)}"`);if(e.functions.node_bundler)t.push(` node_bundler = "${e.functions.node_bundler}"`);if(e.functions.external_node_modules&&e.functions.external_node_modules.length>0)t.push(` external_node_modules = [${e.functions.external_node_modules.map((i)=>`"${i}"`).join(", ")}]`)}if(e.edge_functions&&e.edge_functions.length>0){t.push("");for(let i of e.edge_functions)t.push("[[edge_functions]]"),t.push(` function = "${d(i.function)}"`),t.push(` path = "${d(i.path)}"`)}if(e.redirects&&e.redirects.length>0){t.push("");for(let i of e.redirects){if(t.push("[[redirects]]"),t.push(` from = "${d(i.from)}"`),t.push(` to = "${d(i.to)}"`),i.status!==void 0)t.push(` status = ${i.status}`);if(i.force!==void 0)t.push(` force = ${i.force}`);if(i.conditions&&Object.keys(i.conditions).length>0){t.push(" [redirects.conditions]");for(let[s,n]of Object.entries(i.conditions))t.push(` ${s} = "${d(n)}"`)}}}if(e.headers&&e.headers.length>0){t.push("");for(let i of e.headers){t.push("[[headers]]"),t.push(` for = "${d(i.for)}"`),t.push(" [headers.values]");for(let[s,n]of Object.entries(i.values))t.push(` ${s} = "${d(n)}"`)}}if(e.plugins&&e.plugins.length>0){t.push("");for(let i of e.plugins)if(t.push("[[plugins]]"),t.push(` package = "${d(i.package)}"`),i.inputs&&Object.keys(i.inputs).length>0){t.push(" [plugins.inputs]");for(let[s,n]of Object.entries(i.inputs))if(typeof n==="string")t.push(` ${s} = "${d(n)}"`);else if(typeof n==="boolean"||typeof n==="number")t.push(` ${s} = ${n}`)}}if(e.context&&Object.keys(e.context).length>0)for(let[i,s]of Object.entries(e.context)){if(t.push(""),t.push(`[context.${i}]`),s.command)t.push(` command = "${d(s.command)}"`);if(s.publish)t.push(` publish = "${d(s.publish)}"`);if(s.environment&&Object.keys(s.environment).length>0){t.push(` [context.${i}.environment]`);for(let[n,r]of Object.entries(s.environment))t.push(` ${n} = "${d(r)}"`)}}return t.join(`
|
|
3
3
|
`)+`
|
|
4
|
-
`}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function xn(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function Sn(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function
|
|
4
|
+
`}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function xn(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function Sn(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function br(e,t){let i=await xn(e),s=t||Sn(i),n=Gs(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function wr(e){return m.existsSync(y.join(e,"netlify.toml"))}async function Fc(e={}){let t=Date.now(),i=[],s=e.cwd||process.cwd(),n=(c)=>{i.push(c)},r=(c)=>{if(e.onProgress)e.onProgress(c)},l=_.resolve(s,e.directory||"dist"),p=e.token||process.env.NETLIFY_AUTH_TOKEN,f=e.siteId||process.env.NETLIFY_SITE_ID;if(!p)throw new Te(`No Netlify auth token found.
|
|
5
5
|
|
|
6
6
|
To deploy to Netlify:
|
|
7
7
|
1. Create account at https://app.netlify.com
|
|
@@ -19,12 +19,12 @@ Find your site ID at: https://app.netlify.com/sites/YOUR_SITE/settings/general`,
|
|
|
19
19
|
|
|
20
20
|
Run \`stx build\` first or specify a different directory with --directory`,"NO_BUILD_DIR");if(!(S.readdirSync(l).length>0))throw new Te(`Build directory is empty: ${l}
|
|
21
21
|
|
|
22
|
-
Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await vn(l),w=lt(c);return n(`Would deploy ${c.length} files (${Rt(w)})`),n(`From: ${l}`),n(`To: Site ${f}`),n(`Mode: ${e.production?"production":"draft"}`),{success:!0,url:`https://${f}.netlify.app (dry-run)`,deployId:"dry-run",logs:i,duration:Date.now()-t,filesUploaded:c.length,totalSize:w}}let o=
|
|
22
|
+
Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await vn(l),w=lt(c);return n(`Would deploy ${c.length} files (${Rt(w)})`),n(`From: ${l}`),n(`To: Site ${f}`),n(`Mode: ${e.production?"production":"draft"}`),{success:!0,url:`https://${f}.netlify.app (dry-run)`,deployId:"dry-run",logs:i,duration:Date.now()-t,filesUploaded:c.length,totalSize:w}}let o=mr({token:p});r({stage:"collect",message:"Verifying site..."});try{let c=await o.getSite(f);n(`Deploying to: ${c.name} (${c.url})`)}catch(c){if(c.status===404)throw new Te(`Site not found: ${f}
|
|
23
23
|
|
|
24
|
-
Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await vn(l),g=lt(a);if(n(`Found ${a.length} files (${Rt(g)})`),a.length===0)throw new Te(`No files found in ${l}`,"NO_FILES");let b=
|
|
24
|
+
Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await vn(l),g=lt(a);if(n(`Found ${a.length} files (${Rt(g)})`),a.length===0)throw new Te(`No files found in ${l}`,"NO_FILES");let b=hr(a);r({stage:"upload",message:"Creating deploy...",percent:0});let D=await o.createDeploy(f,{title:e.message||"Deploy from stx CLI",draft:!e.production,files:b});n(`Created deploy: ${D.id}`);let h=yr(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=lt(h);for(let x of h){await o.uploadFile(D.id,x.path,x.content),c++;let C=Math.round(c/h.length*100);r({stage:"upload",message:`Uploading: ${x.path}`,percent:C,details:{uploaded:c,total:h.length}})}n(`Uploaded ${Rt(w)}`)}else n("All files already on CDN (no upload needed)");r({stage:"process",message:"Processing deploy..."});let N=await o.waitForDeploy(D.id,{onProgress:(c)=>{r({stage:"process",message:`Status: ${c.state}`,details:c})}}),P=Date.now()-t;if(r({stage:"done",message:"Deploy complete!"}),n(`Deploy complete in ${(P/1000).toFixed(1)}s`),n(`URL: ${N.deploy_ssl_url}`),e.production)n(`Site: ${N.ssl_url}`);if(e.open){let c=e.production?N.ssl_url:N.deploy_ssl_url;I(c)}return{success:!0,url:N.deploy_ssl_url,siteUrl:e.production?N.ssl_url:void 0,deployId:N.id,logs:i,duration:P,filesUploaded:h.length,totalSize:lt(h)}}async function zc(e={}){let t=e.directory||process.cwd(),i;if(wr(t))i=_.join(t,"netlify.toml");else{let s=await xn(t);i=await br(t,Sn(s))}if(e.siteId){let s=_.join(t,".env.local"),n="";if(await Bun.file(s).exists()){if(n=await Bun.file(s).text(),n=n.split(`
|
|
25
25
|
`).filter((r)=>!r.startsWith("NETLIFY_SITE_ID=")).join(`
|
|
26
26
|
`),n&&!n.endsWith(`
|
|
27
27
|
`))n+=`
|
|
28
28
|
`}n+=`NETLIFY_SITE_ID=${e.siteId}
|
|
29
29
|
`,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class Te extends Error{code;constructor(e,t){super(e);this.name="DeployError",this.code=t}}function I(e){let t=process.platform,i=t==="darwin"?"open":t==="win32"?"start":"xdg-open";Bun.spawn([i,e],{stdio:["ignore","ignore","ignore"]})}
|
|
30
|
-
export{
|
|
30
|
+
export{mr,Xs,vn,hr,yr,Rt,lt,Gs,xn,Sn,br,wr,Fc,zc,Te};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$o,Eo,To}from"./chunk-2xnwsavq.js";import{z,En,Wt,Or,Mr,Tn,qt,Kt,Nr,_n}from"./chunk-149r1q6c.js";function W(r,d=!0,u){if(!d||!r||typeof window>"u")return;let o=window;if(!o.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let f=JSON.parse(y?.textContent||"{}");o.__STX_DATA__=f&&typeof f==="object"&&!Array.isArray(f)?f:{}}catch{o.__STX_DATA__={}}}let i=o.__STX_DATA__;if(i&&Object.prototype.hasOwnProperty.call(i,r))try{return{data:u?u(i[r]):i[r]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function X(r){if(typeof window>"u")return;let d=window;if(r===void 0)d.__STX_DATA__={};else{if(!d.__STX_DATA__)try{let u=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");d.__STX_DATA__=u&&typeof u==="object"&&!Array.isArray(u)?u:{}}catch{d.__STX_DATA__={}}if(d.__STX_DATA__)delete d.__STX_DATA__[r]}}function Q(r){let d=null;try{d=typeof indexedDB<"u"?indexedDB:null}catch{d=null}if(!d)return null;let u=d,o=r||"stx-kept",i=null,y=()=>{if(!i)i=new Promise((h,l)=>{let a=u.open(o,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>h(a.result),a.onerror=()=>l(a.error),a.onblocked=()=>l(Error("blocked"))}),i.catch(()=>{i=null});return i},f=(h,l)=>y().then((a)=>new Promise((v,g)=>{let t=a.transaction("kv",h),s=l(t.objectStore("kv"));t.oncomplete=()=>v(s?s.result:void 0),t.onerror=()=>g(t.error),t.onabort=()=>g(t.error)}));return{get:(h)=>f("readonly",(l)=>l.get(h)),set:(h,l)=>f("readwrite",(a)=>{a.put(l,h)}),remove:(h)=>f("readwrite",(l)=>{l.delete(h)}),removePrefix:(h)=>f("readwrite",(l)=>{l.delete(IDBKeyRange.bound(h,`${h}\uFFFF`))})}}function G(r,d){let u=r||{},o=null;if(u.storage!==void 0)o=u.storage;else try{o=typeof localStorage<"u"?localStorage:null}catch{o=null}let i=null,y=u.backend!==void 0;if(y)i=u.backend||null;let f=()=>{if(y)return i;y=!0;try{i=d?d():null}catch{i=null}if(i){let e=i;e.get("__stx_probe__").catch(()=>{if(i===e)i=null})}return i},h=u.limit||32768,l=u.defer||((e)=>{let n=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(n)n(e,{timeout:200});else setTimeout(e,16)}),a=new Map,v=new Set,g=new Map,t=!1,s=Promise.resolve(),m=(e)=>{try{return JSON.parse(e)}catch{return e}},p=(e,n)=>{if(!o)return!1;try{return o.setItem(e,n),!0}catch{return!1}},T=(e)=>{try{if(o)o.removeItem(e)}catch{}},S=()=>{if(t=!1,!g.size)return s;let e=Array.from(g.entries());return g.clear(),s=s.then(()=>Promise.all(e.map(([n,c])=>{if(!i){v.delete(n);try{p(n,JSON.stringify(c===void 0?null:c))}catch{}return}let _;try{return _={v:c},i.set(n,_).catch(()=>{let w;try{w=JSON.stringify(c)}catch{return}return i?i.set(n,{j:w}).catch(()=>{p(n,w)}):void 0})}catch{return}}))).then(()=>{}),s},R=(e,n)=>{if(g.set(e,n),v.add(e),t)return;t=!0,l(()=>{S()})},O=(e)=>{if(!e||typeof e!=="object")return;let n=e;if("v"in n)return{value:n.v};if(typeof n.j==="string")return{value:m(n.j)};return},E={peek(e){if(a.has(e))return{value:a.get(e)};let n=null;try{n=o?o.getItem(e):null}catch{n=null}if(n===null||n===void 0)return;let c=m(n);return a.set(e,c),{value:c}},load(e){let n=E.peek(e),c=n?null:f();if(n||!c)return Promise.resolve(n);return c.get(e).then((_)=>{if(a.has(e))return{value:a.get(e)};let w=O(_);if(w)a.set(e,w.value),v.add(e);return w},()=>{return})},set(e,n){if(a.set(e,n),i&&v.has(e)){R(e,n);return}let c;try{c=JSON.stringify(n===void 0?null:n)}catch{return}if(c.length<=h&&p(e,c))return;if(!f()){if(c.length>h)p(e,c);return}T(e),R(e,n)},forget(e){for(let c of Array.from(a.keys()))if(c.indexOf(e)===0)a.delete(c);for(let c of Array.from(g.keys()))if(c.indexOf(e)===0)g.delete(c);for(let c of Array.from(v))if(c.indexOf(e)===0)v.delete(c);try{if(o)for(let c=o.length-1;c>=0;c--){let _=o.key(c);if(_&&_.indexOf(e)===0)o.removeItem(_)}}catch{}let n=f();if(!n)return s;return s=s.then(()=>n.removePrefix(e)).catch(()=>{}),s},flush(){return S()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")S()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{S()})}catch{}return E}function J(r,d){if(!r)return!1;if(r===d.key)return!0;if(!d.url)return!1;if(r===d.url)return!0;try{let u=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",o=new URL(r,u),i=new URL(d.url,u);if(o.origin!==i.origin||o.pathname!==i.pathname)return!1;return!o.search||o.search===i.search}catch{return!1}}function Y(r){let d=r.prefix||"stx:kept:",u=r.matches||((t,s)=>t===s.key||t===s.url),o=new Set,i=new Map,y,f=(t)=>t===void 0?y:t,h=(t,s)=>{let m=f(s);if(m===!1||m===null||m==="")return null;return`${d}${m===void 0?"":`${m}:`}query:${t}`},l=(t)=>{let s=t&&t.value;if(!s||typeof s!=="object"||!("d"in s))return;return{data:s.d,at:Number(s.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},v={setScope(t){y=t},scope:()=>y,keyFor:h,seed(t,s){let m=h(t,s);return m?l(r.kept.peek(m)):void 0},restore(t,s){let m=h(t,s);return m?r.kept.load(m).then(l):Promise.resolve(void 0)},persist(t,s,m){let p=h(t,m);if(p)r.kept.set(p,{d:s,at:Date.now()})},overlay(t,s,m){let p=a();if(!p||!p.size)return s;let T=s;return p.forEach((S)=>{try{T=S.overlay(t,T,m)}catch{}}),T},watch(t){return o.add(t),()=>{o.delete(t)}},cachedQuery(t,s){let m=i.get(t);if(m){if(s&&m.__options)m.__options(s);return m}let p=s||{},T=p.initial===void 0?null:p.initial,S=()=>typeof p.scope==="function"?p.scope():p.scope,R=()=>(typeof p.url==="function"?p.url():p.url)||null,O=()=>({key:t,url:R()}),E=S(),e=T,n=0,c=null,_=v.seed(t,E);if(_)e=_.data;let w=r.state(v.overlay(O(),e)),H=r.state(!1),V=r.state(!1),q=r.state(null),I=r.state(_?_.at:0),N=0,M=()=>{w.set(v.overlay(O(),e))},K=(b)=>{let x=N;v.restore(t,b).then((C)=>{if(!C||x!==N||n)return;e=C.data,I.set(C.at),M()})};if(!_)K(E);let ee=()=>{let b=S();if(b===E)return;E=b,N++,c=null,n=0;let x=v.seed(t,E);if(e=x?x.data:T,I.set(x?x.at:0),M(),!x)K(E)},te=(b)=>{let x=R(),C=p.timeoutMs||15000,A=typeof AbortController<"u"?new AbortController:null,k=null,ne=new Promise((D,L)=>{k=setTimeout(()=>{if(A)A.abort();L(Error("The request took too long."))},C)}),U;if(p.load)U=p.load({force:b,url:x,signal:A?A.signal:void 0});else if(x){let D=p.fetch||((P,F)=>fetch(P,F)),L={method:"GET",headers:{Accept:"application/json"}};if(b)L.cache="no-cache";if(A)L.signal=A.signal;U=D(x,L).then((P)=>{if(!P.ok)return P.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${P.status})`)});return P.json()})}else return Promise.resolve(w());return Promise.race([U,ne]).then((D)=>{if(k)clearTimeout(k);return p.transform?p.transform(D):D},(D)=>{if(k)clearTimeout(k);throw D})},B=(b)=>{if(c)return c;let x=N;if(V.set(!0),n===0&&!I())H.set(!0);let C=()=>{if(x!==N)return;c=null,V.set(!1),H.set(!1)},A=te(b).then((k)=>{if(x!==N)return w();return e=k,n=Date.now(),I.set(n),q.set(null),v.persist(t,k,E),M(),C(),w()},(k)=>{if(x===N)q.set(k&&k.message?k.message:"Could not load.");return C(),w()});return c=A,A},j={data:w,loading:H,isFetching:V,error:q,updatedAt:I,get key(){return t},load(b){if(ee(),!b&&n&&Date.now()-n<(p.staleTime||0))return Promise.resolve(w());return B(!!b)},refresh(){return j.load(!0)},set(b){e=typeof b==="function"?b(e):b,v.persist(t,e,E),M()},invalidate(){n=0},__options(b){p={...p,...b}}};if(o.add({target:O,updated:()=>{if(n||I())B(!1)},outbox:(b)=>{if(b)e=v.overlay(O(),e,b.id),n=0,B(!0);M()}}),i.set(t,j),p.immediate)j.load();return j}},g=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(r.listen!==!1&&g&&typeof g.addEventListener==="function")g.addEventListener("stx:updated",(t)=>{let s=t.detail||{};if(s.kind!=="api"||typeof s.url!=="string")return;o.forEach((m)=>{if(u(s.url,m.target()))m.updated()})}),g.addEventListener("stx:outbox",(t)=>{let s=t.detail||{},m=s.sent&&typeof s.sent.id==="string"?s.sent:null;o.forEach((p)=>{if(m){let T=Array.isArray(m.affects)?m.affects:[],S=p.target();if(!T.some((R)=>u(R,S)))return}p.outbox(m)})});return v}function Z(r,d,u,o,i){let y=!0,f=new Set,h=(a)=>o.get?o.get(a):a,l=()=>h(r());return Object.defineProperty(l,"_isSignal",{value:!0}),Object.defineProperty(l,"modifiers",{get:d}),l.set=(a)=>{if(!y)return;let v=d(),g=o.set?o.set(a,v):a;if(v.trim&&typeof g==="string")g=g.trim();if(v.number&&typeof g==="string"&&g!==""){let t=Number(g);if(!Number.isNaN(t))g=t}if(Object.is(r(),g))return;r.set(g),u(g)},l.update=(a)=>l.set(a(l())),l.input=(a)=>{if(!d().lazy)l.set(a)},l.change=(a)=>{if(d().lazy)l.set(a)},l.subscribe=(a)=>{if(!y)return()=>{};let v=r.subscribe((g,t)=>a(h(g),h(t)));return f.add(v),()=>{v(),f.delete(v)}},Object.defineProperty(l,"value",{get:l,set:l.set}),i(()=>{y=!1,f.forEach((a)=>a()),f.clear()}),l}function Pe(){let r=re(Ut());try{let u=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(r);return u=u.replace(/\}(var |let |const |function )/g,"};$1"),u}catch{return r}}function re(r){let d=[],u=0,o="console.log(";while(u<r.length){let i=r.indexOf(o,u);if(i===-1){d.push(r.slice(u));break}d.push(r.slice(u,i));let y=1,f=i+o.length;while(f<r.length&&y>0){let h=r[f];if(h==='"'||h==="'"||h==="`"){let l=h;f++;while(f<r.length&&r[f]!==l){if(r[f]==="\\")f++;f++}f++;continue}if(h==="(")y++;else if(h===")")y--;f++}d.push("0"),u=f}return d.join("")}function Ut(){return`
|
|
3
3
|
// STX Signals Runtime (Development Build)
|
|
4
4
|
console.log('[stx] signals runtime loading');
|
|
5
5
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -3132,7 +3132,7 @@ catch (e2) {
|
|
|
3132
3132
|
};
|
|
3133
3133
|
|
|
3134
3134
|
// Known directive names to exclude from generic :attr binding
|
|
3135
|
-
var DIRECTIVE_NAMES = ${
|
|
3135
|
+
var DIRECTIVE_NAMES = ${Eo()};
|
|
3136
3136
|
|
|
3137
3137
|
// A bound value cannot introduce a URL scheme the page did not ask for.
|
|
3138
3138
|
// This is the client half of url-safety.ts: the server refuses a scheme
|
|
@@ -3167,7 +3167,7 @@ catch (e2) {
|
|
|
3167
3167
|
// a dead duplicate attribute and the real viewBox never updates.
|
|
3168
3168
|
var SVG_ATTR_CASE = {attributename:'attributeName', attributetype:'attributeType', basefrequency:'baseFrequency', baseprofile:'baseProfile', calcmode:'calcMode', clippathunits:'clipPathUnits', diffuseconstant:'diffuseConstant', edgemode:'edgeMode', filterunits:'filterUnits', glyphref:'glyphRef', gradienttransform:'gradientTransform', gradientunits:'gradientUnits', kernelmatrix:'kernelMatrix', kernelunitlength:'kernelUnitLength', keypoints:'keyPoints', keysplines:'keySplines', keytimes:'keyTimes', lengthadjust:'lengthAdjust', limitingconeangle:'limitingConeAngle', markerheight:'markerHeight', markerunits:'markerUnits', markerwidth:'markerWidth', maskcontentunits:'maskContentUnits', maskunits:'maskUnits', numoctaves:'numOctaves', pathlength:'pathLength', patterncontentunits:'patternContentUnits', patterntransform:'patternTransform', patternunits:'patternUnits', pointsatx:'pointsAtX', pointsaty:'pointsAtY', pointsatz:'pointsAtZ', preservealpha:'preserveAlpha', preserveaspectratio:'preserveAspectRatio', primitiveunits:'primitiveUnits', refx:'refX', refy:'refY', repeatcount:'repeatCount', repeatdur:'repeatDur', requiredextensions:'requiredExtensions', requiredfeatures:'requiredFeatures', specularconstant:'specularConstant', specularexponent:'specularExponent', spreadmethod:'spreadMethod', startoffset:'startOffset', stddeviation:'stdDeviation', stitchtiles:'stitchTiles', surfacescale:'surfaceScale', systemlanguage:'systemLanguage', tablevalues:'tableValues', targetx:'targetX', targety:'targetY', textlength:'textLength', viewbox:'viewBox', viewtarget:'viewTarget', xchannelselector:'xChannelSelector', ychannelselector:'yChannelSelector', zoomandpan:'zoomAndPan'};
|
|
3169
3169
|
var SVG_NS = 'http://www.w3.org/2000/svg';
|
|
3170
|
-
var EVENT_RE = ${
|
|
3170
|
+
var EVENT_RE = ${To()};
|
|
3171
3171
|
var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
|
|
3172
3172
|
|
|
3173
3173
|
// Handle attributes
|
|
@@ -3203,7 +3203,7 @@ catch (e2) {
|
|
|
3203
3203
|
// :attr still works for backward compat but is reserved for structural directives.
|
|
3204
3204
|
// x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
|
|
3205
3205
|
// handled by their own code paths below \u2014 exclude them here.
|
|
3206
|
-
var X_HANDLED = ${
|
|
3206
|
+
var X_HANDLED = ${$o()};
|
|
3207
3207
|
if (name.startsWith('@bind:') || name.startsWith('x-bind:')
|
|
3208
3208
|
|| (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
|
|
3209
3209
|
|| (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
|
|
@@ -9339,5 +9339,5 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
9339
9339
|
}
|
|
9340
9340
|
}
|
|
9341
9341
|
})();
|
|
9342
|
-
`}var
|
|
9343
|
-
export{Pe,Ut,
|
|
9342
|
+
`}var ql={state:z,derived:En,effect:Wt,batch:Or,onMount:Mr,onDestroy:Tn,isSignal:qt,isDerived:Kt,untrack:Nr,peek:_n,generateSignalsRuntime:Pe,generateSignalsRuntimeDev:Ut};
|
|
9343
|
+
export{Pe,Ut,ql};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Jo,ll,Yo,Zo,ul,dl}from"./chunk-a3smkhem.js";import"./chunk-1ghj9pgz.js";import"./chunk-7676qzab.js";import"./chunk-73h7qjgq.js";import"./chunk-5zpt78j4.js";import"./chunk-wf2gq6hc.js";import"./chunk-jwpcck1b.js";import"./chunk-aa7w63xc.js";import"./chunk-cs15xqf0.js";import"./chunk-56hvemdx.js";import"./chunk-axydabse.js";import"./chunk-2xnwsavq.js";import"./chunk-b5emjcf1.js";import"./chunk-dqr5n49p.js";export{dl as applySlots,ul as extractSlotContent,ll as parseSlotElement,Jo as parseSlots,Zo as processSlots,Yo as renderSlot};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{L,j,B,Dt,G,se,Cn,
|
|
2
|
+
import{L,j,B,Dt,G,se,Cn,Go,Re,ut,Ot,Mt,Nt,F,Lt,jt,$n}from"./chunk-dn9thd0h.js";export{j as DEFAULT_FORMATS,B as DEFAULT_QUALITY,L as DEFAULT_WIDTHS,$n as ImageProcessingError,jt as formatSize,ut as generateSizes,Re as generateSrcSet,Ot as getFallbackVariant,Cn as getImageMetadata,F as getMimeType,Lt as getTotalSize,Mt as groupVariantsByFormat,G as isImageBackendAvailable,Nt as isImageFile,Dt as isSharpAvailable,se as processImage,Go as resizeAndConvert};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ie}from"./chunk-
|
|
2
|
+
import{Ie}from"./chunk-xq4jdzje.js";function Rn(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=Ie(e),i=`
|
|
3
3
|
<!-- stx PWA Meta Tags -->
|
|
4
4
|
<link rel="manifest" href="/manifest.json">
|
|
5
5
|
<meta name="theme-color" content="${a(r?.themeColor||"#000000")}">
|
|
@@ -43,9 +43,9 @@ if ('serviceWorker' in navigator) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
</script>
|
|
46
|
-
<!-- End stx PWA -->`,i}function
|
|
46
|
+
<!-- End stx PWA -->`,i}function Br(e,n){let r=n.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let o=e.lastIndexOf("</body>");if(o!==-1){let i=Rn(n);return e.slice(0,o)+i+`
|
|
47
47
|
`+e.slice(o)}return e+Rn(n)}let t=Rn(n);return e.replace("</head>",`${t}
|
|
48
|
-
</head>`)}function
|
|
48
|
+
</head>`)}function Pa(e){if(!e.pwa?.enabled)return"";return`<script>
|
|
49
49
|
if ('serviceWorker' in navigator) {
|
|
50
50
|
window.addEventListener('load', function() {
|
|
51
51
|
navigator.serviceWorker.register('/${Ie(e)}')
|
|
@@ -57,5 +57,5 @@ if ('serviceWorker' in navigator) {
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
</script>`}function
|
|
61
|
-
export{Rn,
|
|
60
|
+
</script>`}function Ia(){return'<link rel="manifest" href="/manifest.json">'}function Da(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
61
|
+
export{Rn,Br,Pa,Ia,Da};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{E,x,Bt,Ft,zt}from"./chunk-45rfv3a5.js";import{resolve as z,basename as j,extname as T,join as q}from"path";import{mkdir as k}from"fs/promises";var S={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class
|
|
2
|
+
import{E,x,Bt,Ft,zt}from"./chunk-45rfv3a5.js";import{resolve as z,basename as j,extname as T,join as q}from"path";import{mkdir as k}from"fs/promises";var S={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class kr{config;constructor(e={}){this.config={...S,...e}}async get(e,s){return Bt(e,s,"image",this.config)}async set(e,s,r){return Ft(e,s,r,"image",this.config)}async clear(){return zt("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}var w=null;function v(e){if(!w)w=new kr(e);else if(e)w.updateConfig(e);return w}async function Cr(e,s,r){let t=r?{directory:`${r.outputDir}/../.cache`}:{};return v(t).get(e,s)}async function $r(e,s,r,t){let a=t?{directory:`${t.outputDir}/../.cache`}:{};return v(a).set(e,s,r)}async function Qo(){return v().clear()}async function R(){try{return await import("ts-images")}catch{return null}}function F(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function D(e,s){let r=s?F(s):F("web"),t=e.formatQuality||{};return{jpeg:{...r.jpeg,...t.jpeg},png:{...r.png,...t.png},webp:{...r.webp,...t.webp},avif:{...r.avif,...t.avif}}}async function ea(e,s,r){let t=await R();if(!t)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let a=await Cr(e,s,r);if(a)return a;try{let c=z(e);if(!await x(c))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let n=D(r,s.preset),p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await k(p,{recursive:!0});let d=await E(c),P=j(e,T(e)),b=s.outputFormat?[s.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],o={src:e,processed:!0,variants:[],hash:d},u=null;if(s.transformations&&s.transformations.length>0)u=await ui(c,s.transformations,t);for(let i of b){let l=n[i]||{},g=`${P}-${d}.${i}`,h=q(p,g);try{let m=await t.optimizeImage({input:u||c,output:h,format:i,quality:l.quality,progressive:l.progressive});if(m){if(o.variants.push({path:h,url:`${I}/${g}`,width:m.width||0,height:m.height||0,format:i,size:m.outputSize||0}),!o.originalWidth&&m.width)o.originalWidth=m.width,o.originalHeight=m.height}}catch(m){o.errors=o.errors||[],o.errors.push(`Failed to optimize ${i}: ${m}`)}}if(s.embedThumbhash||s.placeholder==="thumbhash")try{let i=await t.generateThumbHash(c);o.placeholder=i.dataUrl}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to generate thumbhash: ${i}`)}if(s.useDominantColor)try{let i=await t.generatePlaceholder(c,{strategy:"dominant-color"});o.dominantColor=i.dominantColor}catch(i){o.errors=o.errors||[],o.errors.push(`Failed to extract dominant color: ${i}`)}return await $r(e,s,o,r),o}catch(c){return{src:e,processed:!1,errors:[`Processing failed: ${c}`]}}}async function ta(e,s,r,t){let a=await R();if(!a)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await a.optimizeImage({input:e,output:t,format:s,quality:r}))?.outputSize}}catch(c){return{success:!1,error:String(c)}}}async function ui(e,s,r){let t=r||await R();if(!t)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let a=await t.decode(e);for(let c of s){let n=c.options||{};switch(c.type){case"resize":if(n.width||n.height)a=await t.resize(a,{width:n.width,height:n.height,fit:n.fit});break;case"blur":if(n.sigma!==void 0)a=await t.blur(a,n.sigma);break;case"sharpen":if(n.amount!==void 0)a=await t.sharpen(a,n.amount);break;case"grayscale":a=await t.grayscale(a);break;case"rotate":if(n.angle!==void 0)a=await t.rotate(a,n.angle);break;case"flip":a=await t.flip(a);break;case"flop":a=await t.flop(a);break;case"brightness":if(n.value!==void 0)a=await t.brightness(a,n.value);break;case"contrast":if(n.value!==void 0)a=await t.contrast(a,n.value);break;case"saturation":if(n.value!==void 0)a=await t.saturation(a,n.value);break}}return await t.encode(a,"png")}catch(a){return console.error(`[stx-media] Transformation failed: ${a}`),null}}import{resolve as Q,basename as U,extname as V,join as L}from"path";import{mkdir as H}from"fs/promises";async function O(){try{return await import("ts-images")}catch{return null}}var A=[320,480,640,768,1024,1280,1536,1920];async function na(e,s,r){let t=await O();if(!t)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let a=Q(e);if(!await x(a))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let c=s.responsiveWidths||r.breakpoints||A,n=s.formats||r.defaultFormats||["avif","webp","jpeg"],p=r.outputDir||"dist/images",I=r.baseUrl||"/images";await H(p,{recursive:!0});let d=await E(a),P=U(e,V(e)),b=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},o={src:e,byFormat:{},srcsets:{}};for(let i of n){o.byFormat[i]=[];let l=[];for(let g of c){let h=`${P}-${g}w-${d}.${i}`,m=L(p,h),y=`${I}/${h}`;try{let C=b[i]?.quality||80;if(await x(m)){o.byFormat[i].push({path:m,url:y,width:g,height:0,format:i,size:0}),l.push(`${y} ${g}w`);continue}let f=await t.processImage({input:a,output:m,format:i,quality:C,resize:{width:g}});if(f)o.byFormat[i].push({path:m,url:y,width:g,height:f.height||Math.round(g*(f.height||1)/(f.width||1)),format:i,size:f.outputSize||0}),l.push(`${y} ${g}w`)}catch(C){console.warn(`[stx-media] Failed to generate ${i} at ${g}w: ${C}`)}}o.srcsets[i]=l.join(", ")}let u=s.placeholder||r.placeholderStrategy||"thumbhash";if(u!=="none")try{if(u==="thumbhash"){let i=await t.generateThumbHash(a);o.placeholder={dataURL:i.dataUrl,width:i.width||32,height:i.height||32,strategy:"thumbhash"}}else{let i=await t.generatePlaceholder(a,{strategy:u,width:20});o.placeholder={dataURL:i.dataURL,width:i.width,height:i.height,strategy:u}}}catch(i){console.warn(`[stx-media] Failed to generate placeholder: ${i}`)}return o.sizes=s.sizes||B(c),o}catch(c){return console.error(`[stx-media] Responsive generation failed: ${c}`),null}}function B(e){let s=[...e].sort((t,a)=>t-a),r=[];for(let t=0;t<s.length-1;t++){let a=s[t];r.push(`(max-width: ${a}px) ${a}px`)}return r.push(`${s[s.length-1]}px`),r.join(", ")}function ra(e,s="width"){if(!e||e.length===0)return"";if(s==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}export{kr,Cr,$r,Qo,ea,ta,ui,na,ra};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function
|
|
2
|
+
function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function xl(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.enter:t.duration;if(t.onBeforeEnter?.(e),e.classList.add(n.enterFrom),e.classList.add(n.enterActive),f(e),e.classList.remove(n.enterFrom),e.classList.add(n.enterTo),t.onEnter)await new Promise((a)=>{t.onEnter(e,a)});else await v(e,s);e.classList.remove(n.enterActive),e.classList.remove(n.enterTo),t.onAfterEnter?.(e)}async function Sl(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.leave:t.duration;if(t.onBeforeLeave?.(e),e.classList.add(n.leaveFrom),e.classList.add(n.leaveActive),f(e),e.classList.remove(n.leaveFrom),e.classList.add(n.leaveTo),t.onLeave)await new Promise((a)=>{t.onLeave(e,a)});else await v(e,s);e.classList.remove(n.leaveActive),e.classList.remove(n.leaveTo),t.onAfterLeave?.(e)}function kl(e,t={},o){let n=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return e.replace(n,(s,a,i)=>{let r=p(a),l=r.name||"stx",c=r.duration||300,d=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
3
3
|
<div
|
|
4
4
|
class="stx-transition-wrapper"
|
|
5
5
|
data-transition="${l}"
|
|
@@ -41,7 +41,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
|
|
|
41
41
|
});
|
|
42
42
|
})();
|
|
43
43
|
</script>
|
|
44
|
-
`})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function
|
|
44
|
+
`})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function Cl(){return`
|
|
45
45
|
/* STX Transition Presets */
|
|
46
46
|
|
|
47
47
|
/* Fade */
|
|
@@ -228,7 +228,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
|
|
|
228
228
|
opacity: 1;
|
|
229
229
|
max-height: 1000px;
|
|
230
230
|
}
|
|
231
|
-
`}function
|
|
231
|
+
`}function $l(){return`
|
|
232
232
|
// STX Transition Runtime
|
|
233
233
|
(function() {
|
|
234
234
|
if (typeof window === 'undefined') return;
|
|
@@ -317,5 +317,5 @@ else {
|
|
|
317
317
|
|
|
318
318
|
console.log('[stx] Transition runtime initialized');
|
|
319
319
|
})();
|
|
320
|
-
`}function
|
|
321
|
-
export{
|
|
320
|
+
`}function El(e){let t=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return e.replace(t,(o,n,s,a)=>{let i=s||"300",r=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${n}" data-stx-transition-duration="${i}" data-stx-transition-condition="${a}" data-stx-transition-id="${r}"`})}
|
|
321
|
+
export{xl,Sl,kl,Cl,$l,El};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{X}from"./chunk-
|
|
3
|
-
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function
|
|
4
|
-
`)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function j(s,l){let o=s.map((i)=>({route:i,...X(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=i.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function
|
|
5
|
-
`));let c=n.outputs.find((d)=>d.kind==="entry-point");if(!c||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${u.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await c.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function
|
|
6
|
-
export{yt,
|
|
2
|
+
import{X}from"./chunk-b5emjcf1.js";import{le,S}from"./chunk-jwpcck1b.js";import{mo}from"./chunk-5zpt78j4.js";import{a}from"./chunk-cm875f73.js";import v from"fs";import m from"path";import{pathToFileURL as O}from"url";var E=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],P=new Set;function yt(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let u=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=u.pop(),c=n.lastIndexOf("."),d=c>=0?n.slice(c+1):"get",g=d.toUpperCase();if(!E.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${E.map((A)=>A.toLowerCase()).join(", ")}`);if(c>=0)n=n.slice(0,c);if(n!=="index")u.push(n);let r=new Set,h=u.map((A,I)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&I!==u.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,x=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(x))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(x)} and ${e}`);f.set(x,e);let R=m.join(o,e);P.add(m.resolve(R)),P.add(v.realpathSync(R)),i.push({pattern:w,method:g,filePath:R})}return i.sort((e,p)=>{let u=e.pattern.split("/"),n=p.pattern.split("/"),c=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(u.length,n.length);d++){let g=c(n[d])-c(u[d]);if(g)return g}return e.pattern.localeCompare(p.pattern)||e.method.localeCompare(p.method)})}async function zr(s,l){let o=a(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:p}=X(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${p.map((u)=>`${JSON.stringify(u)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
|
+
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Hr(s,l,o={}){let i=yt(s,o);await zr(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
+
`)}`);let p=e.outputs.find((c)=>c.kind==="entry-point");if(!p)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await p.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),p),f.push({...t,filePath:n})}return f}function j(s,l){let o=s.map((i)=>({route:i,...X(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,p=(r)=>r.replace(/:\w+/g,":param"),u=t.filter((r)=>p(r.route.pattern)===p(e)),n=i.method,c=u.find((r)=>r.route.method===n)??(n==="HEAD"?u.find((r)=>r.route.method==="GET"):void 0);if(!c){let r=new Set(u.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=c.regex.exec(f),g=Object.create(null);try{c.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(c.route);if(typeof r!=="function")throw Error(`API endpoint ${c.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Vr(s,l){return j(l,async(o)=>(await import(O(m.resolve(s,o.filePath)).href)).default)}async function hu(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=yt(s,o);return await zr(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=yt(s,o);await zr(s,t);let{loadStxConfig:e}=await import("./chunk-tz32ndmq.js"),p=S((await e(s)).runtimeConfig);return await le(p,()=>j(t,async(u)=>{let n=await Bun.build({entrypoints:[u.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
|
+
`));let c=n.outputs.find((d)=>d.kind==="entry-point");if(!c||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${u.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await c.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Ur(s,l,o){if(mo(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(P.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(p)=>{try{return v.realpathSync(p)}catch{return m.resolve(p)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((p)=>{let u=t(p);return e===u||e.startsWith(`${u}${m.sep}`)})}
|
|
6
|
+
export{yt,zr,Hr,Vr,hu,Ur};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{V,ae}from"./chunk-
|
|
3
|
-
export{At,
|
|
2
|
+
import{V,ae}from"./chunk-1ghj9pgz.js";import{le,S,Ke}from"./chunk-jwpcck1b.js";import{Ze,X,xe}from"./chunk-b5emjcf1.js";import{_e,ne,C,re,ai,xr,ci,Pt}from"./chunk-6a1jr9pp.js";import{Vr}from"./chunk-htwgkg91.js";import{It}from"./chunk-rdq113p4.js";import H from"zlib";import{promisify as Y}from"util";var Q=Y(H.brotliCompress),Z=Y(H.gzip),K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((i)=>e.startsWith(i)))return!1;return K.some((i)=>e.startsWith(i))}function oe(t){let e=new Map;for(let i of t.split(",")){let[s,...c]=i.trim().split(";"),l=s.trim().toLowerCase();if(!l)continue;let m=1;for(let f of c){let x=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(f);if(!x)continue;let g=Number.parseFloat(x[1]);if(Number.isFinite(g))m=g}e.set(l,m)}return e}function ie(t){if(!t)return null;let e=oe(t),i=e.get("*"),s=(c)=>e.get(c)??i??0;if(s("br")>0)return"br";if(s("gzip")>0)return"gzip";return null}async function At(t,e,i={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let s=ie(t.headers.get("accept-encoding"));if(!s)return e;let c;try{c=new Uint8Array(await e.arrayBuffer())}catch{return e}let l=()=>new Response(c,{status:e.status,statusText:e.statusText,headers:q(e.headers)});if(c.length<(i.threshold??te))return l();try{let m=s==="br"?await Q(c,{params:{[H.constants.BROTLI_PARAM_QUALITY]:i.quality??5,[H.constants.BROTLI_PARAM_SIZE_HINT]:c.length}}):await Z(c);if(m.length>=c.length)return l();let f=q(e.headers);return f.set("Content-Encoding",s),f.set("Content-Length",String(m.length)),new Response(m,{status:e.status,statusText:e.statusText,headers:f})}catch{return l()}}function q(t){let e=new Headers(t),i=e.get("Vary");if(!i)return e.set("Vary","Accept-Encoding"),e;if(!i.split(",").some((c)=>c.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${i}, Accept-Encoding`);return e}import J from"fs";import M from"path";var{serve:ce}=globalThis.Bun;class G{now;entries=new V(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,i){let s,c=async()=>{let r=s??await i();return r.headers.set("Cache-Control","private, no-store"),r.headers.set("Vary",C(r.headers.get("Vary")).Vary),r};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return c();let l=new URL(t.url),m=`${l.origin}${l.pathname}${l.search}|${ne(t)?"fragment":"document"}`,f=this.entries.get(m),x=(r)=>{let T=new Headers(r.headers);return T.set("Cache-Control","private, no-store"),T.set("Age",String(Math.max(0,Math.floor((this.now()-r.created)/1000)))),new Response(r.body.slice(0),{headers:T})},g=f?(this.now()-f.created)/1000:1/0;if(f&&g<e.maxAge)return x(f);let b=this.generation,O=async()=>{let r=await i();s=r;let T=(r.headers.get("Vary")??"").toLowerCase().split(",").map((R)=>R.trim()).filter(Boolean);if(r.status!==200||r.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(r.headers.get("Cache-Control")??"")||T.some((R)=>R!=="x-stx-router"&&R!=="accept-encoding"))return null;let L=await r.clone().arrayBuffer();if(L.byteLength>1048576)return null;r.headers.set("Vary",C(r.headers.get("Vary")).Vary);let n={body:L,headers:Array.from(r.headers.entries()),created:this.now(),path:l.pathname};if(this.generation===b)this.entries.set(m,n);return n},v=this.pending.get(m);if(!v){if(this.pending.size>=1000)return c();v=O().finally(()=>{if(this.pending.get(m)===v)this.pending.delete(m)}),this.pending.set(m,v)}if(f&&g<e.maxAge+(e.swr??0))return v.catch(()=>{}),x(f);let E=await v;return E?x(E):c()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function al(t={}){let e=M.resolve(t.outputDir||".output"),i=t.port??3000,s=ai(e);if(!s)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${s.routes.length} routes...`);let c=It(s.routeRules),l=new G,m=Vr(e,s.apiRoutes??[]),f=Bun.file(M.join(e,"server/runtime-config.json")),x=t.runtimeConfig??(await f.exists()?await f.json():void 0),g=x?S(x):void 0,b=new Map,O=new Map,v=new Map,E=new Map;for(let n of s.routes)try{let R=M.join(e,n.compiledPath),o=JSON.parse(await Bun.file(R).text());if(g)o.html=Ke(o.html,g);b.set(n.pattern,o),v.set(n.pattern,xe(o.html)),E.set(n.pattern,ae(o.html));let _=M.join(e,n.fragmentPath);if(await Bun.file(_).exists()){let A=await Bun.file(_).text();O.set(n.pattern,g?Ke(A,g):A)}}catch(R){console.warn(`[stx] Failed to load route ${n.pattern}:`,R)}let r=new Map,T=[];for(let n of s.routes)if(n.hasParams){let{regex:R,params:o}=X(n.pattern,{page:!0});T.push({regex:R,route:n,paramNames:o})}else r.set(n.pattern,n);let L=ce({port:i,async fetch(n){return At(n,await le(g??S(),async()=>{let o=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[o])return t.apiRoutes[o](n);let _=await m(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&o!=="/"){let p=M.resolve(e,"public"),d;try{d=decodeURIComponent(o)}catch{d=o}if(!d.includes("\x00")){let u=M.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${M.sep}`))try{if(J.existsSync(u)&&J.statSync(u).isFile()){let h=M.extname(u).toLowerCase(),j=pe[h]||"application/octet-stream",B=o.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(o);return new Response(Bun.file(u),{headers:{"Content-Type":j,"Cache-Control":B?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=ne(n),y=null,U={};if(y=r.get(o)||null,!y)for(let{regex:p,route:d,paramNames:u}of T){let a=o.match(p);if(a){y=d,u.forEach((h,j)=>{U[h]=a[j+1]});break}}if(!y){let p=Ze(o)?null:r.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=c(o),W=Object.keys(k).length>0;return l.respond(n,k.cache,async()=>{let p=b.get(y.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let a=O.get(y.pattern);if(a){let h=v.get(y.pattern);return new Response(a,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(y.pattern)?{"X-STX-Runtime":E.get(y.pattern)?"true":"false"}:{},...h?{"X-STX-Layout":h.layout,"X-STX-Layout-Group":h.group}:{},...C(),...k.cache?{}:{"Cache-Control":_e}}})}}let d=xr(n.method),u=b.get(y.pattern);if(!u){let a=r.get("/500")||null;if(a){let h=b.get(a.pattern);if(h)return new Response(h.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(y.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...C(),"Cache-Control":"public, max-age=60"}});try{let{html:a,boundaries:h,redirect:j,cookies:B,status:I,headers:z}=await Pt(u,{params:U,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:g});if(j)return ci(j,B,z);if(h&&h.length>0){let{renderStreamingPage:P,streamToResponse:D}=await import("./chunk-7416mm6g.js"),N=new Headers({...C(),...z,"Cache-Control":"private, no-store"});for(let F of B??[])N.append("Set-Cookie",F);if(A&&!d){let F=xe(a);N.set("X-STX-Fragment","true"),N.set("X-STX-Runtime",ae(a)?"true":"false"),N.set("X-STX-Layout",F.layout),N.set("X-STX-Layout-Group",F.group)}return D(P(A&&!d?re(a,s.routerContainer||"main"):a,h,{timeoutMs:30000}),{status:I??u.status??200,headers:N})}let w=new Headers({"Content-Type":"text/html",...C(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let P of B??[])w.append("Set-Cookie",P);for(let[P,D]of Object.entries(z??{}))w.set(P,D);if(w.set("Vary",C(w.get("Vary")).Vary),A&&!d){let P=xe(a);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",ae(a)?"true":"false"),w.set("X-STX-Layout",P.layout),w.set("X-STX-Layout-Group",P.group),new Response(re(a,s.routerContainer||"main"),{status:I??u.status??200,headers:w})}return new Response(a,{status:I??u.status??200,headers:w})}catch(a){if(console.error(`[stx] Hydration error for ${o}:`,a),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${L.port}`),console.log(`[stx] Serving ${s.routes.length} routes (${b.size} pre-loaded)`),{port:L.port,stop:()=>{l.invalidate(),L.stop()},invalidate:(n)=>l.invalidate(n)}}
|
|
3
|
+
export{At,al};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ce,$e,Ee}from"./chunk-qxre7vw6.js";import{it,ot,ke,
|
|
2
|
+
import{Ce,$e,Ee}from"./chunk-qxre7vw6.js";import{it,ot,ke,Bs,at,ct}from"./chunk-ak7eyyka.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();it();let t=await Ce({mode:"build"});if(!t.config.enabled){ke("Story feature is disabled in config.");return}let n=await at(t);$e(t,n);let l=ct(t.config,n);Ee(t,l),ot(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;Bs(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function le(n,f){return m.run(n,f)}function $t(){return m.getStore()}function
|
|
3
|
-
export{le,$t,
|
|
2
|
+
import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function le(n,f){return m.run(n,f)}function $t(){return m.getStore()}function Gn(){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 xs(){return Gn().public}function S(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 Ke(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{le,$t,Gn,xs,S,Ke};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Mo,Js,No,Lo,Ys,jo,Bo,Fo,zo,Zs,Ho,Hc}from"./chunk-mcgpeyy8.js";import{ei,Xo}from"./chunk-bh432b7n.js";import{L,j,B,Dt,G,se,Cn,Re,ut,Ot,Mt,Nt,F,Lt,jt,$n}from"./chunk-dn9thd0h.js";import{$a}from"./chunk-7mbx7dzg.js";export{j as DEFAULT_FORMATS,B as DEFAULT_QUALITY,L as DEFAULT_WIDTHS,$n as ImageProcessingError,Lo as clearImageCache,Ys as createImageDirective,Xo as createImageHandler,Bo as createImagePlugin,Hc as defaultImageConfig,jt as formatSize,Zs as generateImageManifest,ut as generateSizes,Re as generateSrcSet,Ot as getFallbackVariant,Cn as getImageMetadata,F as getMimeType,Lt as getTotalSize,Mt as groupVariantsByFormat,ei as handleImageRequest,jo as imageDirective,G as isImageBackendAvailable,Nt as isImageFile,Dt as isSharpAvailable,zo as optimizeDirectory,Fo as optimizeImage,Js as parseImageComponent,se as processImage,No as processImageComponents,Mo as renderImageComponent,$a as rewriteImagesWithSiblings,Ho as writeImageManifest};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Au,zi,Pu,Hi,Ya,Za,vt,en,Iu,Qa,ec,tc,f}from"./chunk-1ghj9pgz.js";import"./chunk-7676qzab.js";import"./chunk-73h7qjgq.js";import"./chunk-5zpt78j4.js";import"./chunk-wf2gq6hc.js";import"./chunk-jwpcck1b.js";import"./chunk-aa7w63xc.js";import"./chunk-cs15xqf0.js";import"./chunk-56hvemdx.js";import"./chunk-axydabse.js";import"./chunk-2xnwsavq.js";import"./chunk-b5emjcf1.js";import"./chunk-dqr5n49p.js";export{vt as buildCss,Qa as extractClassNames,Za as fingerprintConfig,ec as generateCss,Iu as getCachedCSS,Au as getCssServeAsset,f as injectCss,zi as loadCssEngine,Hi as loadCssEngineConfig,en as rebuildCss,Pu as resetCssCache,Ya as resolveUserCssConfig,tc as withLinkedModuleBundles};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Pn,Oe,Ne,me,
|
|
2
|
+
import{Pn,Oe,Ne,me,Vi,Nn,Z,q,nn,d,n,A}from"./chunk-1ghj9pgz.js";import{dirname as C,resolve as R}from"path";function h(o){return o.endsWith(".md")||o.endsWith(".markdown")}function _(o){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(s,p){let u;while((u=s.exec(o))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((s,p)=>s.start-p.start);let a="",c=0;for(let s of e){if(s.start<c)continue;a+=o.slice(c,s.start),a+=`@raw${o.slice(s.start,s.end)}@endraw`,c=s.end}return a+=o.slice(c),a}async function b(o,e={}){let{data:r,content:m}=Pn(o),c=await(e.renderer??((s)=>Oe(s)))(m);return{html:_(c),frontmatter:r??{}}}function k(o){let e=o,r=Z(o);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],s=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(o))!==null){let i=u[1],l=u[2],f=u[0],g=i.includes("server");if(p(l))s.push(f);else if(g)c.push(l);else a.push(f)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,f=[];while((l=i.exec(t))!==null){let g=l.index+l[0].length,x=t.indexOf("</script>",g);if(x===-1)continue;f.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let g=f.length-1;g>=0;g--)t=t.substring(0,f[g].start)+t.substring(f[g].end)}for(let i of a)t=t.replace(i,"");return{templateContent:t,serverScripts:c,clientScripts:a,signalsScripts:s}}function v(o,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -9,10 +9,10 @@ import{Pn,Oe,Ne,me,Hi,Mn,Z,q,nn,d,n,A}from"./chunk-a9necy79.js";import{dirname a
|
|
|
9
9
|
<body>
|
|
10
10
|
${o}
|
|
11
11
|
</body>
|
|
12
|
-
</html>`}async function
|
|
12
|
+
</html>`}async function $i(o,e={}){let r=R(o),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let a=await m.text(),c=null;if(h(r)){let s=await b(a,{renderer:e.markdownRenderer});a=s.html,c=s.frontmatter}if(c)e={...e,context:{...c,...e.context||{}}};if(e.layout){let s=R(e.layout),p=Bun.file(s);if(!await p.exists())throw Error(`Layout template not found: ${s}`);let{layout:u,injectCSS:t,...i}=e,l={...e.context||{}};nn(l);let f=await S(a,r,{...i,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),g=await p.text(),x={...l,content:f},w={...i,context:x,injectCSS:t};return S(g,s,w)}return S(a,r,e)}async function S(o,e,r={}){let{templateContent:m,serverScripts:a,clientScripts:c}=k(o),s={...A,...r.options},p={__filename:e,__dirname:C(e),__stx:{},__stx_options:s,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...Nn(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let i of a)await d(i,p,e);let u=new Set,t=m;if(t=await n(t,p,e,s,u),Vi(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),c.length>0)t+=`
|
|
13
13
|
${c.join(`
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=Ne(p),g=(await Promise.all(c.map(async(w)=>{let y=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!y)return w;return await me(y[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})}))).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${g}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${g}`}t=await q(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=v(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-
|
|
18
|
-
export{
|
|
17
|
+
${g}`}t=await q(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=v(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-kagy1rcd.js");t=await i(t)}catch{}return t}
|
|
18
|
+
export{$i};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{y,Me,I,Yt,i,T}from"./chunk-
|
|
2
|
+
import{y,Me,I,Yt,i,T}from"./chunk-1ghj9pgz.js";import{Ur}from"./chunk-htwgkg91.js";import{s,be}from"./chunk-vxgtq00t.js";import{a}from"./chunk-cm875f73.js";import m from"path";import j from"fs";function pe(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.message==="string"&&(t.name==="BuildMessage"||t.name==="ResolveMessage"||("position"in t))}function fe(e){if(e&&typeof e==="object"&&Array.isArray(e.errors))return e.errors;return[e]}function J(e,t){let r=[];for(let l of fe(e)){if(pe(l)){let u=l.position||void 0;r.push({file:t||u?.file,line:u?.line,column:u?.column,message:l.message??"",lineText:u?.lineText});continue}r.push({file:t,message:l instanceof Error?l.message:String(l)})}return r}function De(e,t){return J(e,t).map((r)=>{let l=r.file?`${r.file}${r.line?`:${r.line}${r.column?`:${r.column}`:""}`:""}`:"",u=r.lineText?`
|
|
3
3
|
${r.lineText.trim()}`:"";return l?`${l}: ${r.message}${u}`:`${r.message}${u}`}).join(`
|
|
4
|
-
`)}var me=10;function P(e,t,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(m.basename(e))||
|
|
5
|
-
export { ${[...S].join(", ")} }`:"";await Bun.write(f,e+le),A("bundling:",d,"from:",m.basename(t));let Q=new Set,K=new Map;try{let w=await Bun.build({entrypoints:[f],outdir:E,target:"browser",format:"esm",minify:u,plugins:[$e(l,N,f,Q,c,K,r.serverApi)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...y()},root:l});if(!w.success){let R=w.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ")||`Unable to bundle ${m.basename(t)}`,O=J(w.logs,t||void 0);if(console.warn("[stx:bundler] build failed:",R),
|
|
4
|
+
`)}var me=10;function P(e,t,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(m.basename(e))||Ur(e,t,r)}var re=1,se=new Map,W=600,ge=100,G=new Map;async function he(e){let t=G.get(e)??0;if(t>0&&t<ge){G.set(e,t+1);return}G.set(e,1);try{let r=(await j.promises.readdir(e)).filter((p)=>p.endsWith(".js"));if(r.length<=W)return;let u=(await Promise.all(r.map(async(p)=>{try{return{name:p,at:(await j.promises.stat(m.join(e,p))).mtimeMs}}catch{return null}}))).filter((p)=>p!==null);u.sort((p,d)=>d.at-p.at);for(let p of u.slice(W)){let d=p.name.slice(0,-3);await j.promises.rm(m.join(e,`${d}.js`),{force:!0}),await j.promises.rm(m.join(e,`${d}.deps.json`),{force:!0})}A("pruned bundle cache to",W,"entries")}catch{}}function oe(e){return se.get(e)??[]}function q(e,t){if(e)se.set(e,t)}function Ma(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function A(...e){if(Ma())console.log("[stx:bundler]",...e)}var Y=[];function Di(e,t,r){Y.push({filePath:e||"<inline>",message:t,details:r})}function ft(){return Y.slice()}function gt(){Y.length=0}var H;function mu(e){H=e}function Oi(){if(H)return H;try{let e=T.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Z=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function mt(e){let t=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,r;while((r=t.exec(e))!==null){let u=r[1];if(!Z.some((d)=>d.test(u)))return A("detected user import:",u),!0}let l=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((r=l.exec(e))!==null){let u=r[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Z.some((d)=>d.test(u)))return A("detected side-effect import:",u),!0}return!1}var Jt="stx-module:",xe=/\.(?:[cm]?[jt]sx?|json)$/i;function Na(e,t){return m.relative(e,t).split(m.sep).join("/")}function La(e,t){if(t.size===0)return e;return e.replace(/^([ \t]*import\s+(?:[^;"']*?\s+from\s+)?)(["'])([^"']+)\2/gm,(r,l,u,p)=>{let d=t.get(p);return d&&!p.startsWith(Jt)?`${l}${u}${d}${u}`:r})}function ja(e,t){let r=0,l=(p)=>{let d=`__stxMod${r++}`,b=JSON.stringify(p);return t.push(`var ${d} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${d} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),d},u=(p,d)=>{for(let b of p.split(",")){let M=b.trim();if(!M)continue;let c=M.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!c)continue;let n=c[1].startsWith('"')?JSON.parse(c[1]):c[1],o=c[2]??n;t.push(`var ${o} = ${d}[${JSON.stringify(n)}];`)}};return e=e.replace(/^[ \t]*import\s+([^;"']*?)\s+from\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d,b)=>{let M=b.slice(Jt.length),c=l(M),n=d.trim(),o=n.match(/^([\w$]+)\s*(?:,\s*|$)/);if(o&&!n.startsWith("{")&&!n.startsWith("*"))t.push(`var ${o[1]} = ${c}.default;`),n=n.slice(o[0].length).trim();let f=n.match(/^\*\s*as\s+([\w$]+)$/);if(f)t.push(`var ${f[1]} = ${c};`);else if(n.startsWith("{"))u(n.replace(/^\{|\}$/g,""),c);return""}),e=e.replace(/^[ \t]*import\s+["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,d)=>(l(d.slice(Jt.length)),"")),e}function te(e){let t=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,m.join(e,"index.ts"),m.join(e,"index.tsx"),m.join(e,"index.js"),m.join(e,"index.mjs")];for(let r of t)try{if(j.existsSync(r)&&j.statSync(r,{throwIfNoEntry:!1})?.isFile())return r}catch{}return}function $e(e,t,r,l,u,p=new Map,d){let b=(c,n,o)=>{if(P(n,e,d))return null;if(!u||c!==r||!xe.test(n))return null;try{if(!j.statSync(n,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(n);let f=`${Jt}${Na(process.cwd(),n)}`;return p.set(o,f),{path:f,external:!0}},M=(c,n)=>{let o=c===r?t:m.dirname(c),f=m.resolve(o,n);return te(f)??f};return{name:"stx-client-bundle",setup(c){if(c.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(n)=>({path:n.path,external:!0})),c.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(n)=>({path:n.path,external:!0})),c.onResolve({filter:/^\//},(n)=>{let o=te(n.path);if(o){let f=b(n.importer,o,n.path);if(f)return f;if(o!==r)l.add(o);return{path:o}}return{path:n.path,external:!0}}),c.onResolve({filter:/^\.\.?\//},(n)=>{let o=M(n.importer,n.path),f=b(n.importer,o,n.path);if(f)return f;return l.add(o),{path:o}}),c.onResolve({filter:/^[@~]\//},(n)=>{let o=m.resolve(e,n.path.slice(2)),f=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,m.join(o,"index.ts"),m.join(o,"index.tsx"),m.join(o,"index.js"),m.join(o,"index.mjs")];for(let E of f)if(j.existsSync(E)&&j.statSync(E,{throwIfNoEntry:!1})?.isFile()){let N=b(n.importer,E,n.path);if(N)return N;return A(`resolved ${n.path[0]}/ import:`,n.path,"\u2192",E),l.add(E),{path:E}}return console.warn(`[stx:bundler] could not resolve ${n.path[0]}/ import:`,n.path),{path:o}}),u)c.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(n)=>{if(n.importer!==r)return;let o=`${Jt}npm:${n.path}`;return p.set(n.path,o),{path:o,external:!0}});c.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(n)=>{if(P(n.path,e,d))throw Error(`Server-only API source cannot be imported by a client script: ${n.path}`);let o=m.extname(n.path).toLowerCase(),f=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(n.path!==r)l.add(n.path);return{contents:j.readFileSync(n.path,"utf8"),loader:f}})}}}var X=new Map,U=I(64),ne=Symbol.for("stx.client-bundle-build-queue");function Ba(e){let t=globalThis,l=(t[ne]??Promise.resolve()).then(e,e);return t[ne]=l.then(()=>{return},()=>{return}),l}async function ht(e,t,r={}){let l=r.projectRoot||process.cwd(),u=(await i(l)).serverApi,p=r.minify??!1,d=r.externalizeUserModules??!0,b=r.cacheDir||a(l,"bundle-cache"),M=new Bun.CryptoHasher("md5");M.update(`${me}\x00${Me()}\x00${JSON.stringify(u??!1)}\x00${d?"registry":"inline"}\x00${e}\x00${t}`);let c=M.digest("hex").slice(0,12),n=m.join(b,`${c}.js`),o=U.get(n);if(o){if(Yt(o.files)&&o.files.every((F)=>!P(F.path,l,u))){A("memo hit:",c);let F=o.files.map((_)=>_.path);return q(t,F),r.collectInputs?.push(...F),o.code}U.delete(n),A("memo invalidated by dep change:",c)}let f=m.join(b,`${c}.deps.json`),E=Bun.file(n);if(await E.exists()){let F=Bun.file(f),_=!1,v=null;if(await F.exists())try{let D=JSON.parse(await F.text());if(D.metadataVersion!==re||!Array.isArray(D.files))_=!1;else v=D.files,_=!0;if(v&&(!Yt(v)||v.some((k)=>P(k.path,l,u))))_=!1}catch{_=!1}if(_){if(A("cache hit:",c),v)q(t,v.map((k)=>k.path)),r.collectInputs?.push(...v.map((k)=>k.path));let D=await E.text();if(v)U.set(n,{code:D,files:v});return D}A("cache invalidated by dep change:",c)}let N=X.get(c);if(N){let F=await N;if(r.collectInputs)r.collectInputs.push(...(U.get(n)?.files??[]).map((_)=>_.path));return F}let S=Ba(()=>ye(e,t,{projectRoot:l,minify:p,cacheDir:b,hash:c,cachePath:n,depsPath:f,collectInputs:r.collectInputs,externalizeUserModules:d,serverApi:u}));X.set(c,S);try{return await S}finally{X.delete(c)}}var we=0;function Fa(e){return`${e}-${process.pid}-${++we}`}async function ye(e,t,r){let{projectRoot:l,minify:u,cacheDir:p,hash:d,cachePath:b,depsPath:M,externalizeUserModules:c}=r,n=a(l,"bundle-tmp"),o=Fa(d),f=m.join(n,`${o}.ts`),E=m.join(n,"out",o);j.mkdirSync(n,{recursive:!0}),j.mkdirSync(E,{recursive:!0});let N=m.dirname(t),S=new Set,F=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,v=s(e),{depths:D,balanced:k}=be(v),V=(w)=>!k||D[w]===0,h;while((h=F.exec(v))!==null){if(h[1])continue;if(!V(h.index))continue;if(h[2])h[2].split(",").forEach((w)=>{let g=Be(w);if(g)S.add(g)});else if(h[3])S.add(h[3])}while((h=_.exec(v))!==null){if(h[1])continue;if(!V(h.index))continue;S.add(h[2])}let ie=/^[ \t]*import\s+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((h=ie.exec(v))!==null){if(!V(h.index))continue;let w=/^\s*['"]([^'"]+)['"]/.exec(e.slice(h.index+h[0].length))?.[1];if(w&&Z.some((g)=>g.test(w)))continue;if(h[1])S.add(h[1]);if(h[2])S.add(h[2]);for(let g of(h[3]??"").split(",")){let B=g.trim();if(!B||/^type\s/.test(B))continue;let L=/\bas\s+(\w+)\s*$/.exec(B)?.[1]??/^\w+$/.exec(B)?.[0];if(L)S.add(L)}}for(let w of v.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let g of w[1].split(",")){let B=/\bas\s+(\w+)\s*$/.exec(g)?.[1]??/^\s*(\w+)\s*$/.exec(g)?.[1];if(B)S.delete(B)}let le=S.size>0?`
|
|
5
|
+
export { ${[...S].join(", ")} }`:"";await Bun.write(f,e+le),A("bundling:",d,"from:",m.basename(t));let Q=new Set,K=new Map;try{let w=await Bun.build({entrypoints:[f],outdir:E,target:"browser",format:"esm",minify:u,plugins:[$e(l,N,f,Q,c,K,r.serverApi)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...y()},root:l});if(!w.success){let R=w.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ")||`Unable to bundle ${m.basename(t)}`,O=J(w.logs,t||void 0);if(console.warn("[stx:bundler] build failed:",R),Di(t||"",R,O),Oi()==="error")throw Error(R);return e}let g="";for(let x of w.outputs){g=await x.text();break}let B=[];for(let x of g.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let R of x[1].split(",")){let O=R.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(O){B.push([O[2],O[1]]);continue}let C=R.trim();if(/^[A-Za-z_$][\w$]*$/.test(C))B.push([C,C])}let L=[];g=ja(La(g,K),L);let ae=g.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];g=g.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let ee=`__stxBundle_${d}`,ce=B.map(([x,R])=>`${JSON.stringify(x)}: ${R}`).join(", "),ue=B.map(([x])=>`var ${x} = undefined;`).join(`
|
|
6
6
|
`),de=B.map(([x])=>`${x} = ${ee}[${JSON.stringify(x)}];`).join(`
|
|
7
7
|
`);if(g=`${ae.join(`
|
|
8
8
|
`)}
|
|
@@ -13,5 +13,5 @@ ${L.join(`
|
|
|
13
13
|
${g}
|
|
14
14
|
return { ${ce} };
|
|
15
15
|
})();
|
|
16
|
-
${de}`.trim(),A("bundled:",d,"output:",g.length,"bytes"),S.size>0&&B.length===0)return console.warn(`[stx:bundler] dropped every binding for ${m.basename(t)} (${d}); serving the unbundled source and not caching this result`),e;j.mkdirSync(p,{recursive:!0}),await Bun.write(b,g);let z=Array.from(Q).map((x)=>{try{return{path:x,mtimeMs:j.statSync(x).mtimeMs}}catch{return null}}).filter((x)=>x!==null);return await Bun.write(M,JSON.stringify({metadataVersion:re,files:z})),q(t,z.map((x)=>x.path)),r.collectInputs?.push(...z.map((x)=>x.path)),U.set(b,{code:g,files:z}),await he(p),g}catch(w){let g=J(w,t||void 0),B=De(w,t||void 0);if(console.warn(`[stx:bundler] error: ${B}`),
|
|
17
|
-
export{De,oe,
|
|
16
|
+
${de}`.trim(),A("bundled:",d,"output:",g.length,"bytes"),S.size>0&&B.length===0)return console.warn(`[stx:bundler] dropped every binding for ${m.basename(t)} (${d}); serving the unbundled source and not caching this result`),e;j.mkdirSync(p,{recursive:!0}),await Bun.write(b,g);let z=Array.from(Q).map((x)=>{try{return{path:x,mtimeMs:j.statSync(x).mtimeMs}}catch{return null}}).filter((x)=>x!==null);return await Bun.write(M,JSON.stringify({metadataVersion:re,files:z})),q(t,z.map((x)=>x.path)),r.collectInputs?.push(...z.map((x)=>x.path)),U.set(b,{code:g,files:z}),await he(p),g}catch(w){let g=J(w,t||void 0),B=De(w,t||void 0);if(console.warn(`[stx:bundler] error: ${B}`),Di(t||"",B,g),Oi()==="error")throw w;return e}finally{try{j.rmSync(f,{force:!0}),j.rmSync(E,{recursive:!0,force:!0})}catch{}}}function Be(e){let t=e.trim();if(!t)return null;let r=t.indexOf("=");if(r!==-1)t=t.slice(0,r).trim();let l=t.indexOf(":");if(l!==-1)t=t.slice(l+1).trim();if(t.startsWith("..."))t=t.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(t)?t:null}
|
|
17
|
+
export{De,oe,Ma,Di,ft,gt,mu,Oi,mt,Jt,Na,La,ja,Ba,ht,Fa};
|