@stacksjs/stx 0.2.619 → 0.2.621
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-08jyyegp.js +2 -0
- package/dist/{chunk-83h5ydvw.js → chunk-0c7ss25y.js} +3 -3
- package/dist/chunk-0r2g00m7.js +2 -0
- package/dist/{chunk-2bagpncj.js → chunk-0s1hpqas.js} +2 -2
- package/dist/{chunk-93whjefr.js → chunk-0z189871.js} +1 -1
- package/dist/{chunk-99rfdydy.js → chunk-10s16tad.js} +2 -2
- package/dist/chunk-18104nfg.js +2 -0
- package/dist/{chunk-t1cbac58.js → chunk-19bhnbyn.js} +4 -4
- package/dist/{chunk-47csgccw.js → chunk-1gtrs8va.js} +5 -5
- package/dist/chunk-2340emvg.js +2 -0
- package/dist/{chunk-1a59snwg.js → chunk-29cbmfrc.js} +5 -5
- package/dist/chunk-2aj6bjyd.js +2 -0
- package/dist/chunk-39qcn4gt.js +2 -0
- package/dist/chunk-3dd57j7e.js +2 -0
- package/dist/{chunk-3a60b9an.js → chunk-3dth76ce.js} +3 -3
- package/dist/{chunk-1g257jhn.js → chunk-3h2rpaps.js} +11 -11
- package/dist/{chunk-3x88c989.js → chunk-3rmby39r.js} +1 -1
- package/dist/{chunk-06pc67a6.js → chunk-3tp481j5.js} +4 -4
- package/dist/chunk-40fepd2t.js +2 -0
- package/dist/chunk-4eb02a0z.js +2 -0
- package/dist/{chunk-8jqdb1qr.js → chunk-4hmdcmw1.js} +6 -6
- package/dist/{chunk-1bqtsjry.js → chunk-5m0r0j79.js} +3 -3
- package/dist/{chunk-35qyy4fx.js → chunk-5wa3ydkf.js} +3 -3
- package/dist/{chunk-y039e06c.js → chunk-5wrmcbch.js} +2 -2
- package/dist/{chunk-r4n2fve8.js → chunk-5zzrth32.js} +5 -5
- package/dist/{chunk-1q3e1w2y.js → chunk-604hzs2x.js} +3 -3
- package/dist/chunk-6jjrvb9v.js +2 -0
- package/dist/{chunk-6rd762vj.js → chunk-6qvskcwp.js} +3 -3
- package/dist/{chunk-d16jgsyv.js → chunk-773vgw1k.js} +3 -3
- package/dist/chunk-7h4mxhkh.js +2 -0
- package/dist/{chunk-azj2cj8h.js → chunk-7mehf3h5.js} +2 -2
- package/dist/chunk-7zdefvrn.js +2 -0
- package/dist/{chunk-ehq5j4tb.js → chunk-7zwsgjy4.js} +2 -2
- package/dist/chunk-81h6xyna.js +2 -0
- package/dist/chunk-8898f767.js +2 -0
- package/dist/chunk-8xns82s5.js +2 -0
- package/dist/chunk-8yycg9pb.js +2 -0
- package/dist/chunk-9e1vjey6.js +2 -0
- package/dist/{chunk-samsjcqt.js → chunk-9eejvpqc.js} +4 -4
- package/dist/{chunk-tyhw0ndz.js → chunk-9g5sv1p6.js} +5 -5
- package/dist/{chunk-cv2t12cc.js → chunk-9pz3jh7w.js} +10 -10
- package/dist/chunk-9wbraw07.js +2 -0
- package/dist/{chunk-qxr7e0y2.js → chunk-9z9f3d6b.js} +2 -2
- package/dist/{chunk-dz3wh7x0.js → chunk-a39kvc2p.js} +3 -3
- package/dist/{chunk-mkss8wbh.js → chunk-a669q9b8.js} +5 -5
- package/dist/{chunk-vxa0h3yy.js → chunk-b9kn62k3.js} +4 -4
- package/dist/chunk-c0yb755y.js +2 -0
- package/dist/chunk-chaee0vj.js +2 -0
- package/dist/{chunk-8xwgz6jf.js → chunk-dayjd2sj.js} +4 -4
- package/dist/{chunk-2bcp699b.js → chunk-dvbgbd06.js} +2 -2
- package/dist/{chunk-7f0gh0kg.js → chunk-e030grrq.js} +200 -200
- package/dist/{chunk-45gz1yff.js → chunk-e6ccfmx9.js} +5 -5
- package/dist/chunk-e876sg0j.js +2 -0
- package/dist/{chunk-34a1jdhq.js → chunk-ebkjpj5m.js} +2 -2
- package/dist/{chunk-epbhzaca.js → chunk-erk7afjv.js} +5 -5
- package/dist/chunk-f53x5d7h.js +2 -0
- package/dist/chunk-fmdezmt4.js +2 -0
- package/dist/chunk-fnzv245x.js +2 -0
- package/dist/chunk-fqwyfx6c.js +15 -0
- package/dist/{chunk-bbbdfd8q.js → chunk-fvk33v69.js} +1 -1
- package/dist/chunk-g6mv9vkp.js +2 -0
- package/dist/chunk-g8f1dqx1.js +2 -0
- package/dist/{chunk-ctf9gd40.js → chunk-g8gzxhp8.js} +2 -2
- package/dist/{chunk-nmh4pn44.js → chunk-gc1dzxee.js} +2 -2
- package/dist/{chunk-safstptd.js → chunk-gd7vq083.js} +1 -1
- package/dist/{chunk-8vdsewsa.js → chunk-h431swg6.js} +4 -4
- package/dist/chunk-hjkm6k8c.js +2 -0
- package/dist/{chunk-etyjfmza.js → chunk-hmpzdq4p.js} +3 -3
- package/dist/chunk-hpvkkke2.js +2 -0
- package/dist/{chunk-8jcrtb7k.js → chunk-j8vd52sg.js} +2 -2
- package/dist/chunk-jh2kve7q.js +2 -0
- package/dist/{chunk-mm8jdb4p.js → chunk-jp6yn9mj.js} +2 -2
- package/dist/{chunk-dcs87qta.js → chunk-jsw5yby0.js} +2 -2
- package/dist/chunk-jwqz8w58.js +2 -0
- package/dist/{chunk-tk1bkmdq.js → chunk-k1k2t4ez.js} +1 -1
- package/dist/chunk-k1vjhhd4.js +2 -0
- package/dist/chunk-kaz5smvw.js +2 -0
- package/dist/{chunk-6tsenq5p.js → chunk-kep8q407.js} +2 -2
- package/dist/chunk-khzdk7q9.js +2 -0
- package/dist/{chunk-sy2nm0z7.js → chunk-khzyc41k.js} +7 -7
- package/dist/chunk-kp4j8vja.js +2 -0
- package/dist/chunk-m0zmexz1.js +2 -0
- package/dist/{chunk-5md6ejrq.js → chunk-m64w624a.js} +2 -2
- package/dist/{chunk-n1zyt21h.js → chunk-m735gtc4.js} +2 -2
- package/dist/chunk-mb8c650x.js +2 -0
- package/dist/{chunk-b3v077t7.js → chunk-n5xbv1a9.js} +3 -3
- package/dist/{chunk-8w9w1vv4.js → chunk-n8595zaf.js} +1 -1
- package/dist/{chunk-6rjm087c.js → chunk-pwsg9w5g.js} +2 -2
- package/dist/chunk-pz5zh3tg.js +2 -0
- package/dist/chunk-q068mc46.js +2 -0
- package/dist/{chunk-a0xkvdjr.js → chunk-q1983d5e.js} +2 -2
- package/dist/{chunk-effx3f2n.js → chunk-q35z0cyg.js} +1 -1
- package/dist/{chunk-6ta850w8.js → chunk-q4a2j4qr.js} +2 -2
- package/dist/{chunk-r9z467kx.js → chunk-q7t2mtn4.js} +5 -5
- package/dist/{chunk-5vs12p6m.js → chunk-q7wj2ypd.js} +6 -6
- package/dist/{chunk-s2n7exsm.js → chunk-qb7a4am2.js} +2 -2
- package/dist/{chunk-vqwszvzt.js → chunk-qbh3jk5z.js} +6 -6
- package/dist/chunk-qk4zkvzh.js +2 -0
- package/dist/chunk-rg4zqdbj.js +2 -0
- package/dist/chunk-rj0nyb2t.js +2 -0
- package/dist/chunk-rj8fsjx9.js +2 -0
- package/dist/chunk-rmc8cg2n.js +2 -0
- package/dist/chunk-smpyb21z.js +2 -0
- package/dist/{chunk-5hqkfqne.js → chunk-sxpnpvt5.js} +4 -4
- package/dist/{chunk-3jdfzq61.js → chunk-szjgbjw1.js} +2 -2
- package/dist/chunk-tc62pvzg.js +2 -0
- package/dist/chunk-tftnx4vj.js +2 -0
- package/dist/chunk-th9wcse5.js +2 -0
- package/dist/chunk-v1ck0wd3.js +2 -0
- package/dist/{chunk-34tbh570.js → chunk-v3anfm9d.js} +2 -2
- package/dist/chunk-vddfv082.js +2 -0
- package/dist/chunk-w21444rc.js +2 -0
- package/dist/chunk-w24zd7sj.js +2 -0
- package/dist/chunk-w28sn5g5.js +2 -0
- package/dist/{chunk-xz7h73ra.js → chunk-wbhzt74k.js} +1 -1
- package/dist/chunk-wfettff6.js +2 -0
- package/dist/{chunk-2t49cfd3.js → chunk-wk95x5ym.js} +33 -33
- package/dist/{chunk-x7jmchd5.js → chunk-wsbccxwy.js} +5 -5
- package/dist/chunk-x5cscz50.js +2 -0
- package/dist/{chunk-7fg1hzad.js → chunk-x6pz1h3x.js} +8 -8
- package/dist/chunk-x7v3m9nk.js +2 -0
- package/dist/{chunk-ejqt0kh2.js → chunk-xfvbm4pn.js} +1 -1
- package/dist/{chunk-a3j5sb7g.js → chunk-y3n2cgev.js} +2 -2
- package/dist/{chunk-5pa5bbzv.js → chunk-ygkwp4sf.js} +2 -2
- package/dist/{chunk-0zx1400y.js → chunk-z4te6223.js} +4 -4
- package/dist/chunk-zvg2h3wd.js +2 -0
- package/dist/cli.js +19 -19
- package/dist/client-script-bundler.d.ts +6 -0
- package/dist/client-script-bundler.js +50 -19
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +3 -3
- package/dist/utils.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-0v4zcm3s.js +0 -2
- package/dist/chunk-0vfqp662.js +0 -2
- package/dist/chunk-1v40w4qr.js +0 -2
- package/dist/chunk-1zq9pht7.js +0 -2
- package/dist/chunk-2a0wr0dm.js +0 -2
- package/dist/chunk-2pvt0edy.js +0 -2
- package/dist/chunk-37n8rf75.js +0 -2
- package/dist/chunk-3njhzgqa.js +0 -2
- package/dist/chunk-42er5gwc.js +0 -2
- package/dist/chunk-5ek9k7hh.js +0 -2
- package/dist/chunk-5mw7qawr.js +0 -2
- package/dist/chunk-65b3f0e9.js +0 -2
- package/dist/chunk-6jjbmfy0.js +0 -2
- package/dist/chunk-6kqmr5z1.js +0 -2
- package/dist/chunk-6pg74bkj.js +0 -2
- package/dist/chunk-70gchk6z.js +0 -2
- package/dist/chunk-78jnrn1f.js +0 -2
- package/dist/chunk-7y4ff3se.js +0 -2
- package/dist/chunk-86xx6pre.js +0 -2
- package/dist/chunk-8gy3vz25.js +0 -2
- package/dist/chunk-8xp2r8s0.js +0 -2
- package/dist/chunk-9985eshw.js +0 -2
- package/dist/chunk-9k34a7bd.js +0 -2
- package/dist/chunk-9r4m465q.js +0 -2
- package/dist/chunk-at430s7q.js +0 -2
- package/dist/chunk-axt96apz.js +0 -2
- package/dist/chunk-b2shw48x.js +0 -2
- package/dist/chunk-bah51zv3.js +0 -2
- package/dist/chunk-bemx44n4.js +0 -2
- package/dist/chunk-c091xff6.js +0 -2
- package/dist/chunk-ckts3t2h.js +0 -2
- package/dist/chunk-d8v0amcr.js +0 -2
- package/dist/chunk-ddx52kk5.js +0 -2
- package/dist/chunk-evqpzzns.js +0 -2
- package/dist/chunk-ey6rjjec.js +0 -2
- package/dist/chunk-fdkr055a.js +0 -2
- package/dist/chunk-gg38as5t.js +0 -2
- package/dist/chunk-hmdettqm.js +0 -2
- package/dist/chunk-j2gvr4n6.js +0 -2
- package/dist/chunk-j7vjfzjx.js +0 -2
- package/dist/chunk-jahkmmhh.js +0 -2
- package/dist/chunk-k1j2aw54.js +0 -2
- package/dist/chunk-m2c4rx9x.js +0 -15
- package/dist/chunk-mg9931y0.js +0 -2
- package/dist/chunk-mheh85ph.js +0 -2
- package/dist/chunk-mzvggfjn.js +0 -2
- package/dist/chunk-nk0cn3yq.js +0 -2
- package/dist/chunk-ptgn563n.js +0 -2
- package/dist/chunk-rbwhdwa9.js +0 -2
- package/dist/chunk-rgg6kr7r.js +0 -2
- package/dist/chunk-sgnez07y.js +0 -2
- package/dist/chunk-tx1mq72q.js +0 -2
- package/dist/chunk-x6bh13w3.js +0 -2
- package/dist/chunk-xs01xryj.js +0 -2
- package/dist/chunk-xvt6vvg4.js +0 -2
- package/dist/chunk-yzpr0fh3.js +0 -2
- package/dist/chunk-zxvqjzr2.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 Br(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 xo(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 qn(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 xo(u);s.push({path:r,content:new Uint8Array(u),sha1:o})}return s}function Fr(e){let t={};for(let i of e)t[`/${i.path}`]=i.sha1;return t}function zr(e,t){let i=new Set(t.map((s)=>s.startsWith("/")?s.slice(1):s));return e.filter((s)=>i.has(s.path))}function Gt(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 xt(e){return e.reduce((t,i)=>t+i.content.byteLength,0)}import m from"fs";import y from"path";function So(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 Gn(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 Kn(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 Gn(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 Kn(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 Hr(e,t){let i=await Gn(e),s=t||Kn(i),n=So(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function Vr(e){return m.existsSync(y.join(e,"netlify.toml"))}async function xl(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 je(`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 je(`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 qn(l),w=xt(c);return n(`Would deploy ${c.length} files (${Gt(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 qn(l),w=xt(c);return n(`Would deploy ${c.length} files (${Gt(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=Br({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 je(`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 qn(l),g=xt(a);if(n(`Found ${a.length} files (${Gt(g)})`),a.length===0)throw new je(`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 qn(l),g=xt(a);if(n(`Found ${a.length} files (${Gt(g)})`),a.length===0)throw new je(`No files found in ${l}`,"NO_FILES");let b=Fr(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=zr(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=xt(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 ${Gt(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:xt(h)}}async function Sl(e={}){let t=e.directory||process.cwd(),i;if(Vr(t))i=_.join(t,"netlify.toml");else{let s=await Gn(t);i=await Hr(t,Kn(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 je 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{Br,xo,qn,Fr,zr,Gt,xt,So,Gn,Kn,Hr,Vr,xl,Sl,je};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pa,fa}from"./chunk-wk95x5ym.js";import"./chunk-5wa3ydkf.js";import"./chunk-pwsg9w5g.js";import"./chunk-wsbccxwy.js";import"./chunk-h431swg6.js";import"./chunk-9pz3jh7w.js";import"./chunk-9z9f3d6b.js";import"./chunk-kep8q407.js";import{To}from"./chunk-9eejvpqc.js";import"./chunk-q1983d5e.js";import"./chunk-5wrmcbch.js";import"./chunk-m64w624a.js";import"./chunk-n8595zaf.js";import"./chunk-ebkjpj5m.js";import"./chunk-y3n2cgev.js";import"./chunk-q35z0cyg.js";import"./chunk-0c7ss25y.js";import"./chunk-e6ccfmx9.js";import"./chunk-4hmdcmw1.js";import"./chunk-q7wj2ypd.js";import"./chunk-5m0r0j79.js";import"./chunk-7mehf3h5.js";import"./chunk-a39kvc2p.js";import"./chunk-7zwsgjy4.js";import"./chunk-604hzs2x.js";import"./chunk-q7t2mtn4.js";import"./chunk-a669q9b8.js";import"./chunk-b9kn62k3.js";import"./chunk-hmpzdq4p.js";import"./chunk-19bhnbyn.js";import"./chunk-qbh3jk5z.js";import"./chunk-3tp481j5.js";import"./chunk-jsw5yby0.js";import"./chunk-773vgw1k.js";import"./chunk-fqwyfx6c.js";import"./chunk-erk7afjv.js";import"./chunk-5rtatjwq.js";import{ke,vn,wn,Z,u,n,mr,A,o,he}from"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{mr as buildWebComponents,wn as cacheTemplate,vn as checkCache,To as classifyAllScripts,pa as createMiddleware,fa as createRoute,A as defaultConfig,u as extractVariables,Z as injectRouterScript,o as loadStxConfig,ke as processClientScript,n as processDirectives,he as readMarkdownFile};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,i,Mn,
|
|
3
|
-
`:l==="t"?"\t":l;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[a+1]==="{")return null;s+=o}return s}var ue=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function ct(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let s=Mn(r);if(s)return{ok:!1,message:`the expression is not allowed (${s})`,code:t.UNSAFE_EXPRESSION};let a=
|
|
2
|
+
import{t,i,Mn,Er,Pe,c}from"./chunk-1gtrs8va.js";import U from"path";function S(e,n,r,s=0){let a=0,o=s,l=null,u=0,p=!1;while(o<e.length){let d=e[o];if(l&&p){p=!1,o++;continue}if(l&&d==="\\"){p=!0,o++;continue}if(p=!1,(d==='"'||d==="'"||d==="`")&&!l){l=d,o++;continue}if(d===l&&l!=="`"){l=null,o++;continue}if(l==="`"&&d==="$"&&e[o+1]==="{"){u++,o+=2;continue}if(u>0&&d==="}"){u--,o++;continue}if(d==="`"&&l==="`"&&u===0){l=null,o++;continue}if(l){o++;continue}if(d===n)a++;else if(d===r){if(a--,a===0)return o}o++}return-1}function Js(e,n){let r=[];n.lastIndex=0;let s;while((s=n.exec(e))!==null){let a=s.index,o=a+s[0].length-1,l=S(e,"(",")",o);if(l===-1){r.push({start:a,end:-1,args:"",call:e.slice(a,Math.min(e.length,a+80))}),n.lastIndex=o+1;continue}r.push({start:a,end:l+1,args:e.slice(o+1,l),call:e.slice(a,l+1)}),n.lastIndex=l+1}return r}function it(e,n,r,s){let a="",o=0;for(let l of Js(e,n)){if(a+=e.slice(o,l.start),l.end===-1){a+=s(l.call),o=l.start;continue}a+=r(l.args,l.call),o=l.end}return a+e.slice(o)}function at(e){let n=[],r=0,s=null,a="";for(let o=0;o<e.length;o++){let l=e[o];if(s){if(a+=l,l==="\\"&&o+1<e.length){a+=e[++o];continue}if(l===s)s=null;continue}if(l==="'"||l==='"'||l==="`")s=l;else if(l==="("||l==="["||l==="{")r++;else if(l===")"||l==="]"||l==="}")r--;else if(l===","&&r===0){n.push(a.trim()),a="";continue}a+=l}if(a.trim())n.push(a.trim());return n}function O(e){let n=e.trim(),r=n[0];if(r!=="'"&&r!=='"'&&r!=="`"||n.length<2||n.at(-1)!==r)return null;let s="";for(let a=1;a<n.length-1;a++){let o=n[a];if(o==="\\"&&a+1<n.length-1){let l=n[++a];s+=l==="n"?`
|
|
3
|
+
`:l==="t"?"\t":l;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[a+1]==="{")return null;s+=o}return s}var ue=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function ct(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let s=Mn(r);if(s)return{ok:!1,message:`the expression is not allowed (${s})`,code:t.UNSAFE_EXPRESSION};let a=Er(n),o;try{o=c(r,Object.keys(a))(...Object.values(a))}catch(u){return{ok:!1,message:`the expression could not be evaluated: ${u instanceof Error?u.message:String(u)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let l=[...new Set(Pe(r))].filter((u)=>!ue.has(u)&&!(u in a)&&!(u in globalThis));if(l.length>0)return{ok:!1,message:`${l.map((p)=>`"${p}"`).join(", ")} ${l.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:o}}function be(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function Re(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function V(e){if(!e)return"";return U.isAbsolute(e)?U.relative(process.cwd(),e)||e:e}function M(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function _(e,n,r,s,a=t.EVALUATION_ERROR){let o=s?` in ${V(s)}`:"";return console.warn(`[stx] ${M(n)}${o}: ${r}`),i(e,`${M(n)}: ${r}`,a)}function Sr(e,n,r){let s=r?` in ${V(r)}`:"";console.warn(`[stx] ${M(e)}${s}: ${n}`)}function Ys(){return{afterOpen:[],beforeClose:[]}}function pe(e){return e.afterOpen.length>0||e.beforeClose.length>0}function qi(e,n){if(!pe(n))return e;let r=n.afterOpen.join(""),s=n.beforeClose.join(""),a=e.lastIndexOf("</head>"),o=r?Rn(e):null,l=s&&a!==-1?a:null;if(o===null&&l===null)return e;if(o!==null&&l!==null)return`${e.slice(0,o)}${r}${e.slice(o,l)}${s}${e.slice(l)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,l)}${s}${e.slice(l)}`}var K=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Rn(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;K.lastIndex=r;let s=K.exec(e);return s?r+s[0].length:r}var L="data-stx-color-mode-boot",F="__STX_COLOR_MODE__",de=new Set(["light","dark","auto","system"]),ge=new Set(["auto","system"]),fe=/^[a-z][\w:-]*$/i,he=/^[\w-]+$/;function me(e){let n=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",s=e.darkClass===void 0?"dark":e.darkClass,a=e.attribute??null,o=e.autoValue??null,l=e.respectExisting===!0;if(typeof n!=="string"||n.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!de.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(s!==null&&(typeof s!=="string"||!he.test(s)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(s)}`);if(a!==null&&(typeof a!=="string"||!fe.test(a)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(a)}`);if(o!==null&&!ge.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(s===null&&a===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(l&&a===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:n,initialMode:r==="system"?"auto":r,darkClass:s,attribute:a,autoValue:o,respectExisting:l}}function ye(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function D(e={}){let n=me(e),r=ye(n),s=`(function(){"use strict";var o=window.${F};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${F}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${L}>${s}</script>`}function An(e,n={}){if(e.includes(L))return e;let r=N(e);if(r===null)return e;let s=D(n);return`${e.slice(0,r)}
|
|
4
4
|
${s}${e.slice(r)}`}var N=Rn,ke=new RegExp(`<script\\b[^>]*\\b${L}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),W=/<meta\b[^>]*\bcharset\b[^>]*>/gi,q=/<\/head>/gi;function Te(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;q.lastIndex=r;let s=q.exec(e),a=s?s.index:e.length;W.lastIndex=r;let o=W.exec(e);if(!o||o.index>=a)return e;if(e.slice(r,o.index).trim()==="")return e;let l=o.index+o[0].length;return`${e.slice(0,r)}
|
|
5
|
-
${o[0]}${e.slice(r,o.index)}${e.slice(l,a)}${e.slice(a)}`}function
|
|
6
|
-
${n[0]}${s.slice(a)}`}var Y="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",w="data-stx-html-attrs",C="data-stx-html-class",G=/^[A-Za-z_:][\w:.-]*$/;function y(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function xe(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Ae(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function Ce(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let s of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[s[1].toLowerCase()]=s[2]??s[3]??s[4]??"";return r}function k(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,s])=>`${r}="${y(String(s))}"`).join(" ")}function R(e){let n=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?n.replace(/<\//g,"<\\/"):n}function J(e){let n=k(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${R(e)}</script>`}function $e(e={},n="en"){let r=[],s=[],a="",o=n;for(let[u,p]of Object.entries(e||{})){if(p==null)continue;let d=u.trim();if(!G.test(d))continue;let f=d.toLowerCase();if(f==="lang"){o=String(p);continue}if(f==="class"){a=String(p).trim();continue}r.push(` ${d}="${y(String(p))}"`),s.push(d)}let l=` lang="${y(o)}"`;if(a)l+=` class="${y(a)}"`;if(l+=r.join(""),a)l+=` ${C}="${y(a)}"`;if(s.length)l+=` ${w}="${y(s.join(" "))}"`;return l}function
|
|
5
|
+
${o[0]}${e.slice(r,o.index)}${e.slice(l,a)}${e.slice(a)}`}function Gi(e){return Ee(Te(e))}function Ee(e){let n=ke.exec(e);if(!n)return e;let r=N(e);if(r===null)return e;if(n.index<=r||e.slice(r,n.index).trim()==="")return e;let s=e.slice(0,n.index)+e.slice(n.index+n[0].length),a=N(s);if(a===null)return e;return`${s.slice(0,a)}
|
|
6
|
+
${n[0]}${s.slice(a)}`}var Y="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",w="data-stx-html-attrs",C="data-stx-html-class",G=/^[A-Za-z_:][\w:.-]*$/;function y(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function xe(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Ae(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function Ce(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let s of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[s[1].toLowerCase()]=s[2]??s[3]??s[4]??"";return r}function k(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,s])=>`${r}="${y(String(s))}"`).join(" ")}function R(e){let n=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?n.replace(/<\//g,"<\\/"):n}function J(e){let n=k(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${R(e)}</script>`}function $e(e={},n="en"){let r=[],s=[],a="",o=n;for(let[u,p]of Object.entries(e||{})){if(p==null)continue;let d=u.trim();if(!G.test(d))continue;let f=d.toLowerCase();if(f==="lang"){o=String(p);continue}if(f==="class"){a=String(p).trim();continue}r.push(` ${d}="${y(String(p))}"`),s.push(d)}let l=` lang="${y(o)}"`;if(a)l+=` class="${y(a)}"`;if(l+=r.join(""),a)l+=` ${C}="${y(a)}"`;if(s.length)l+=` ${w}="${y(s.join(" "))}"`;return l}function Ki(e={},n={}){let r={...e,...n};if(e.class&&n.class){let s=e.class.split(/\s+/).filter(Boolean);for(let a of n.class.split(/\s+/).filter(Boolean))if(!s.includes(a))s.push(a);r.class=s.join(" ")}return r}function Pn(e,n={}){if(!n||Object.keys(n).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let s={},a=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,l;while((l=o.exec(r[1]))!==null){let f=l[1];if(!(f in s))a.push(f);s[f]=l[2]??l[3]??l[4]??""}let u=[],p=[];for(let[f,h]of Object.entries(n)){if(h==null)continue;let m=f.trim();if(!G.test(m))continue;let A=m.toLowerCase();if(A==="class"){let E=(s.class||"").split(/\s+/).filter(Boolean);for(let x of String(h).split(/\s+/).filter(Boolean))if(!E.includes(x))E.push(x),u.push(x);if(!("class"in s))a.push("class");s.class=E.join(" ");continue}if(!(m in s))a.push(m);if(s[m]=String(h),A!=="lang")p.push(m)}if(u.length){if(!(C in s))a.push(C);s[C]=u.join(" ")}if(p.length){if(!(w in s))a.push(w);s[w]=p.join(" ")}let d=a.map((f)=>` ${f}="${y(s[f])}"`).join("");return e.replace(r[0],()=>`<html${d}>`)}function Xi(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${Y}
|
|
7
7
|
`}function Se(e){let n=[],r=0;while(r<e.length){let o=e.slice(r),l=o.match(/^\s+/);if(l){r+=l[0].length;continue}if(o.startsWith("<!--")){let h=e.indexOf("-->",r);if(h===-1)break;r=h+3;continue}let u=o.match(/^<script\b[^>]*>/i);if(u){let h=e.toLowerCase().indexOf("</script>",r+u[0].length);if(h===-1)break;r=h+9;continue}let p=o.match(/^<link\b[^>]*>/i);if(p){n.push(p[0]),r+=p[0].length;continue}let d=o.match(/^<meta\b[^>]*>/i);if(d){n.push(d[0]),r+=d[0].length;continue}let f=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(f){n.push(f[0]),r+=f[0].length;continue}break}if(n.length===0)return{body:e,hoisted:n};let s="",a=0;while(a<e.length&&a<r){let o=e.slice(a),l=o.match(/^<link\b[^>]*>/i);if(l&&n.includes(l[0])){a+=l[0].length;continue}let u=o.match(/^<meta\b[^>]*>/i);if(u&&n.includes(u[0])){a+=u[0].length;continue}let p=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(p&&n.includes(p[0])){a+=p[0].length;continue}s+=e[a],a++}return s+=e.slice(r),{body:s,hoisted:n}}function Ie(e,n={},r={}){let{title:s="stx App",lang:a="en",meta:o=[],link:l=[],script:u=[],headRaw:p="",htmlAttrs:d={},bodyClass:f="",bodyAttrs:h={}}=n,m=r.title||s,A=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],E=new Set(o.map(Ae).filter(Boolean)),{body:x,hoisted:B}=Se(e),te=new Set(B.flatMap((g)=>{let v=Ce(g);return v?[Ae(v)].filter(Boolean):[]})),ne=[...A.filter((g)=>!E.has(Ae(g))),...o].filter((g)=>!te.has(Ae(g))).map((g)=>` <meta ${k(g)}>`).join(`
|
|
8
8
|
`),re=l.map((g)=>` <link ${k(g)}>`).join(`
|
|
9
9
|
`),ie=u.map((g)=>{if(g.src)return` <script ${k(g,(v)=>v==="content")}></script>`;if(g.content)return` ${J(g)}`;return""}).filter(Boolean).join(`
|
|
@@ -17,8 +17,8 @@ ${le.join(`
|
|
|
17
17
|
${ce.join(`
|
|
18
18
|
`)}
|
|
19
19
|
</body>
|
|
20
|
-
</html>`}var H=/\s+/y,j=/<(script|style)\b[^>]*>/iy,_e=/<\/script>/gi,Me=/<\/style>/gi,z=/<!DOCTYPE\b/iy,X=/<html[\s>]/iy;function Ht(e){let n=0;while(n<e.length){if(H.lastIndex=n,H.exec(e)){n=H.lastIndex;continue}if(e.startsWith("<!--",n)){let a=e.indexOf("-->",n);if(a===-1)return!1;n=a+3;continue}j.lastIndex=n;let s=j.exec(e);if(s){let a=s[1].toLowerCase()==="script"?_e:Me;a.lastIndex=j.lastIndex;let o=a.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(z.lastIndex=n,z.test(e))return!0;return X.lastIndex=n,X.test(e)}return!1}function
|
|
20
|
+
</html>`}var H=/\s+/y,j=/<(script|style)\b[^>]*>/iy,_e=/<\/script>/gi,Me=/<\/style>/gi,z=/<!DOCTYPE\b/iy,X=/<html[\s>]/iy;function Ht(e){let n=0;while(n<e.length){if(H.lastIndex=n,H.exec(e)){n=H.lastIndex;continue}if(e.startsWith("<!--",n)){let a=e.indexOf("-->",n);if(a===-1)return!1;n=a+3;continue}j.lastIndex=n;let s=j.exec(e);if(s){let a=s[1].toLowerCase()==="script"?_e:Me;a.lastIndex=j.lastIndex;let o=a.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(z.lastIndex=n,z.test(e))return!0;return X.lastIndex=n,X.test(e)}return!1}function Zs(e){return Ht(e)}function Ji(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:s=[],link:a=[],script:o=[],headRaw:l=""}=n,u=e.slice(0,r),p=[];for(let d of s){let f=Ae(d);if(f&&u.includes(f))continue;p.push(` <meta ${k(d)}>`)}for(let d of a){if(d.href&&u.includes(`href="${d.href}"`))continue;p.push(` <link ${k(d)}>`)}for(let d of o)if(d.src){if(u.includes(`src="${d.src}"`))continue;p.push(` <script ${k(d,(f)=>f==="content")}></script>`)}else if(d.content){if(u.includes(R(d)))continue;p.push(` ${J(d)}`)}if(l&&!u.includes(l))p.push(` ${l}`);if(p.length===0)return e;return`${e.slice(0,r)}${p.join(`
|
|
21
21
|
`)}
|
|
22
|
-
${e.slice(r)}`}function In(e,n={},r={},s){if(s??
|
|
23
|
-
`)}function
|
|
24
|
-
`,"")),headContent:n.trim()}}function
|
|
22
|
+
${e.slice(r)}`}function In(e,n={},r={},s){if(s??Zs(e))return e;return Ie(e,n,r)}var Oe=["og:","article:","book:","profile:","fb:","music:","video:"],Ne=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function On(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=Le(e[0],n);if(typeof r!=="string")return r;let s;if(e.length===2){let o=De(e[1],n);if(typeof o!=="string")return o;s=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,l=n.openGraph,u=n[o]??(Re(l)?l[o]:void 0);s=u===void 0||u===null||typeof u==="object"?"":String(u)}if(!s)return{kind:"empty"};return{kind:"tag",tag:Oe.some((o)=>r.startsWith(o))?{property:r,content:s}:{name:r,content:s}}}function Le(e,n){let r=O(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(Ne.test(e.trim()))return e.trim();let s=ct(e,n);if(!s.ok)return{kind:"error",message:`meta name: ${s.message}`,code:s.code};if(typeof s.value!=="string"||!s.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${be(s.value)}`,code:t.TYPE_ERROR};return s.value}function De(e,n){let r=O(e);if(r!==null)return r;let s=ct(e,n);if(!s.ok)return{kind:"error",message:s.message,code:s.code};let a=s.value;if(a===void 0||a===null||a===!1)return"";if(Array.isArray(a))return a.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof a==="object"&&!(a instanceof Date))return{kind:"error",message:`the content must be text, got ${be(a)}`,code:t.TYPE_ERROR};return String(a)}var Nn=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],kr=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],ee={links:"link",metas:"meta",scripts:"script",styles:"style"},Z=new Set,Q=new WeakMap;function P(e){if(Z.has(e))return;Z.add(e),console.warn(e)}function He(e,n){let r=Array.from({length:n.length+1},(s,a)=>a);for(let s=1;s<=e.length;s++){let a=r[0];r[0]=s;for(let o=1;o<=n.length;o++){let l=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,a+(e[s-1]===n[o-1]?0:1)),a=l}}return r[n.length]}function je(e,n){let r=e.toLowerCase(),s=n.find((p)=>p.toLowerCase()===r);if(s)return s;let a=ee[r];if(a&&n.includes(a))return a;let o,l=1/0;for(let p of n){let d=He(r,p.toLowerCase());if(d<l)o=p,l=d}let u=Math.min(e.length,o?.length??0)<=4?1:2;return l<=u?o:void 0}function ve(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Q.get(e);if(r)return r;let{known:s,source:a}=n,o=e;for(let l of Object.keys(e)){if(s.includes(l))continue;let u=ee[l];if(u&&s.includes(u)&&Array.isArray(e[l])){if(o===e)o={...e};let d=Array.isArray(o[u])?o[u]:[];o[u]=[...d,...e[l]],delete o[l],P(`[stx] ${a}.${l} is not a head key; reading it as ${a}.${u}. Rename it to \`${u}\`.`);continue}if(/^styles?$/.test(l)&&!s.includes("style")){P(`[stx] ${a}.${l} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let p=je(l,s);P(p?`[stx] ${a}.${l} is not a head key and is ignored. Did you mean \`${p}\`?`:`[stx] ${a}.${l} is not a head key and is ignored. Known keys: ${s.join(", ")}.`)}return Q.set(e,o),o}var b={},Be=[],I={};function Qs(){return b}function Td(){return I}function $d(){b={},Be.length=0,I={}}function Yi(e){b=we(b,ve(e,{known:kr,source:"useHead()"}))}function we(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:[...e.meta||[],...n.meta||[]],link:[...e.link||[],...n.link||[]],script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function ol(e){Yi(Cr(e))}function Cr(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let p=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:p})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,s=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(s)n.push({property:"og:description",content:s});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let a=e.twitterTitle??e.title,o=e.twitterDescription??e.description,l=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(a)n.push({name:"twitter:title",content:a});if(o)n.push({name:"twitter:description",content:o});if(l){n.push({name:"twitter:image",content:l});let p=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(p)n.push({name:"twitter:image:alt",content:p})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let p of e.articleTags)n.push({property:"article:tag",content:p});let u=[];if(e.canonical)u.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:u}}function Rd(e){if(I={...I,...e},e.title||e.description)ol({title:e.title,description:e.description})}function Ad(e){let n=typeof e==="function"?e():e;Yi({title:n})}function Pd(e=b){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${T(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([s,a])=>`${s}="${T(a)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let s=Object.entries(r).filter(([a,o])=>o!==void 0).map(([a,o])=>`${a==="httpEquiv"?"http-equiv":a}="${T(String(o))}"`).join(" ");n.push(`<meta ${s}>`)}for(let r of e.link||[]){let s=Object.entries(r).filter(([a,o])=>o!==void 0).map(([a,o])=>`${a}="${T(String(o))}"`).join(" ");n.push(`<link ${s}>`)}for(let r of e.script||[]){let{content:s,...a}=r,o=Object.entries(a).filter(([l,u])=>u!==void 0).map(([l,u])=>{if(typeof u==="boolean")return u?l:"";return`${l}="${T(String(u))}"`}).filter(Boolean).join(" ");if(s)n.push(`<script ${o}>${R(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let s=r.type?` type="${r.type}"`:"";n.push(`<style${s}>${r.content}</style>`)}return n.join(`
|
|
23
|
+
`)}function Id(e=b){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${T(r)}"`).join(" ")}function Od(e=b){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${T(r)}"`).join(" ")}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Nd(e=b){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let s=document.querySelector(r);if(!s){if(s=document.createElement("meta"),n.name)s.setAttribute("name",n.name);if(n.property)s.setAttribute("property",n.property);document.head.appendChild(s)}s.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,s=document.querySelector(r);if(!s)s=document.createElement("link"),document.head.appendChild(s);for(let[a,o]of Object.entries(n))if(o!==void 0)s.setAttribute(a,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let s of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(s);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function Dd(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(s,a)=>(n+=a.trim()+`
|
|
24
|
+
`,"")),headContent:n.trim()}}function Md(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,s,a,o)=>{let l=s?a:n[(o||"").trim()]??o,u=n.__stx_runtime_head??{};return n.__stx_runtime_head=we(u,{title:l}),""})}function Ld(e,n,r=""){if(!e.includes("@meta"))return e;return it(e,/(?<![\w$@])@meta\s*\(/g,(s,a)=>{let o=On(at(s),n);if(o.kind==="error")return _("Meta",a,o.message,r,o.code);if(o.kind==="tag"){let l=n.__stx_runtime_head??{};n.__stx_runtime_head=we(l,{meta:[o.tag]})}return""},(s)=>_("Meta",s,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{S,Js,it,at,ct,be,Re,_,Sr,Ys,qi,Rn,An,Gi,Ae,Ki,Pn,Xi,Ht,Zs,Ji,In,On,Nn,kr,ve,Qs,Td,$d,Yi,we,ol,Cr,Rd,Ad,Pd,Id,Od,Nd,Dd,Md,Ld};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$l}from"./chunk-kep8q407.js";import"./chunk-9eejvpqc.js";import"./chunk-19bhnbyn.js";import"./chunk-erk7afjv.js";import"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{$l as buildForProduction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{B,F,z,Jt,ee,le,Jn,
|
|
2
|
+
import{B,F,z,Jt,ee,le,Jn,$a,Fe,St,Yt,Zt,Qt,H,en,tn,Yn}from"./chunk-ebkjpj5m.js";import"./chunk-jsw5yby0.js";export{F as DEFAULT_FORMATS,z as DEFAULT_QUALITY,B as DEFAULT_WIDTHS,Yn as ImageProcessingError,tn as formatSize,St as generateSizes,Fe as generateSrcSet,Yt as getFallbackVariant,Jn as getImageMetadata,H as getMimeType,en as getTotalSize,Zt as groupVariantsByFormat,ee as isImageBackendAvailable,Qt as isImageFile,Jt as isSharpAvailable,le as processImage,$a as resizeAndConvert};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{p,c}from"./chunk-
|
|
3
|
-
export{
|
|
2
|
+
import{p,c}from"./chunk-1gtrs8va.js";import{ne,b}from"./chunk-e030grrq.js";function A(t,o){let i=1,r=o,n="<template",e="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(n,r)&&(r+n.length>=t.length||/[\s>\/]/.test(t[r+n.length]))){i++,r+=n.length;continue}if(t.startsWith(e,r)){let a=t.indexOf(">",r+e.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let n=t[r];if(i){if(n==="\\"){r++;continue}if(n===i)i=null;continue}if(n==='"'||n==="'"){i=n;continue}if(n===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),n=1,e=i;while(e<t.length){let s=t.indexOf("<",e);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);e=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(n--,n===0)return a}else if(!/\/\s*>$/.test(f))n++}e=a}return-1}function R(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=x(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(u);if(l!==-1)i.splice(l);n=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],d=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:e,end:s,slotName:l,element:d}),n=s;else o.push({start:e,end:h,slotName:l,element:d+t.slice(s,h)}),n=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let l=t.toLowerCase().indexOf(`</${u}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,n=0;while(n<t.length){let e=t.indexOf("<",n);if(e===-1)break;if(t.startsWith("<!--",e)){let l=t.indexOf("-->",e+4);n=l===-1?t.length:l+3;continue}let s=x(t,e+1);if(s===-1)break;let a=t.slice(e,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){n=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);n=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let d=A(t,s);if(d!==-1){let h=l[1]||l[2]||l[3];o.push({start:e,end:d,slotName:h,content:t.slice(s,d-11).trim(),propsBinding:l[4]||void 0}),n=d;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){n=l;continue}}}n=s}return o}function Ra(t){let o={default:"",named:new Map},i=t,r=O(t);for(let e of r)o.named.set(e.slotName,{name:e.slotName,content:e.content,propsBinding:e.propsBinding});r.sort((e,s)=>s.start-e.start);for(let e of r)i=i.slice(0,e.start)+i.slice(e.end);let n=R(i);for(let e of n){let s=o.named.get(e.slotName);if(s)s.content+=e.element;else o.named.set(e.slotName,{name:e.slotName,content:e.element})}for(let e=n.length-1;e>=0;e--){let s=n[e];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Hl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},n=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,e;while((e=n.exec(t))!==null)r[e[1]]=e[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Aa(t,o,i,r){if(!t)return i;let n=t.content;if(t.propsBinding&&Object.keys(o).length>0){let e=t.propsBinding.trim(),s={...r},a=new Set,f=new Set;if(e.startsWith("{")&&e.endsWith("}")){let u=e.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of u){let[m,l]=g.split(":").map((h)=>h.trim()),d=l||m;if(s[d]=o[m],o[m]!==void 0)f.add(d);else a.add(d)}}else if(s[e]=o,Object.values(o).some((u)=>u===void 0))a.add(e);else f.add(e);n=C(n,s,a,f)}return n}function C(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(n,e)=>{try{let s=e.trim();if(ne(s,i))return n;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!ne(s,r))return n;let a=k(s,o);if(a===void 0)return n;return b(String(a??""))}catch{return`{{ ${e} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),n=o;for(let e of r)if(n&&typeof n==="object"&&e in n)n=n[e];else return;return n}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,n,e]=i,s=o[r],a=parseInt(e,10);if(typeof s==="number")switch(n){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return c(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Pa(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),m=u?.trim()||"",l=f||"",d={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(l))!==null){let y=S[1],E=S[2];d[y]=k(E,i)}return await Aa(g,d,m,i)});let e=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(e,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],n=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return n.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let e=await Promise.all(r),s=t;for(let a=n.length-1;a>=0;a--){let{match:f,index:u}=n[a];s=s.slice(0,u)+e[a]+s.slice(u+f.length)}return s}function Vl(t){let o=Ra(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Ul(t,o,i,r){return await Pa(t,{default:o,named:i},r)}
|
|
3
|
+
export{Ra,Hl,Aa,Pa,Vl,Ul};
|
|
@@ -298,5 +298,5 @@ catch (error) {
|
|
|
298
298
|
init();
|
|
299
299
|
}
|
|
300
300
|
})();
|
|
301
|
-
</script>`}var
|
|
302
|
-
export{
|
|
301
|
+
</script>`}var ml={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},hl={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},yl={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},bl={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},Or=[ml,hl,yl,bl];function jd(t){return[...t,...Or]}
|
|
302
|
+
export{ml,hl,yl,bl,Or,jd};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function
|
|
3
|
-
`)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function
|
|
4
|
-
`)}function
|
|
5
|
-
export{
|
|
2
|
+
import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function Hi(e){try{return w.has(c.realpathSync(e))}catch{return w.has(i.resolve(e))}}var _=new Set(["extends","root",...j.map((e)=>`${e}Dir`),"publicDir","stateDir","cachePath"]),x=(e)=>e!==null&&typeof e==="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null);function b(e,n,r=""){if(Array.isArray(n))return["middleware","plugins"].includes(r)?[...Array.isArray(e)?e:[],...n]:[...n];if(!x(n))return n;let o={...x(e)?e:{}};for(let[s,a]of Object.entries(n)){if(["__proto__","constructor","prototype"].includes(s))throw Error(`Invalid layer config key: ${s}`);o[s]=b(o[s],a,s)}return o}function v(e){for(let n of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let r=i.join(e,n);if(c.existsSync(r))return c.realpathSync(r)}throw Error(`Application layer has no stx.config.ts: ${e}`)}function E(e,n,r){if(typeof e!=="string"||!e||/^(?:https?:|git[+:])/.test(e))throw Error(`Invalid application layer ${JSON.stringify(e)} in ${n}; use a local path or installed package`);if(e.startsWith(".")||i.isAbsolute(e)){let s=i.resolve(n,e);return c.statSync(s).isDirectory()?v(s):c.realpathSync(s)}let o=n;while(!0){let s=i.join(o,"node_modules",e),a=i.join(s,"package.json");if(c.existsSync(a)){r.add(c.realpathSync(a));let g=JSON.parse(c.readFileSync(a,"utf8"));return g.stx?.layer?c.realpathSync(i.resolve(s,g.stx.layer)):v(s)}let p=i.dirname(o);if(p===o)break;o=p}throw Error(`Cannot resolve application layer ${JSON.stringify(e)} from ${n}`)}async function C(e,n){let r=await Bun.build({entrypoints:[e],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(a){a.onResolve({filter:/^[^./]/},(p)=>{if(p.path.startsWith("node:"))return{path:p.path,external:!0};return{path:Bun.resolveSync(p.path,p.resolveDir),external:!0}}),a.onLoad({filter:/./},(p)=>{let g=c.realpathSync(p.path);n.add(g),w.add(g);return})}}]});if(!r.success)throw Error(`Cannot load layer ${e}: ${r.logs.join(`
|
|
3
|
+
`)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function Vi(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await Vs(m,e),{config:f,graph:m}}async function Vs(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function hr(e){return O(A(e))}function yr(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
|
|
4
|
+
`)}function Ui(e){return e.layers.map((n)=>({config:i.relative(n.root,n.configFile),files:A({layers:[n],configDependencies:e.configDependencies.filter((r)=>r.startsWith(`${n.root}${i.sep}`))}).filter((r)=>c.statSync(r).isFile()).map((r)=>({path:i.relative(n.root,r).replaceAll(i.sep,"/"),sha256:k("sha256").update(c.readFileSync(r)).digest("hex")}))}))}
|
|
5
|
+
export{Hi,Vi,Vs,hr,yr,Ui};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hd,Lc,$s,Rs,_i,Ei,As,Ps,dr,jc,Ti,$i,Bc,et}from"./chunk-e030grrq.js";import"./chunk-n5xbv1a9.js";import"./chunk-10s16tad.js";import"./chunk-z4te6223.js";import"./chunk-j8vd52sg.js";import"./chunk-gc1dzxee.js";import"./chunk-khzyc41k.js";import"./chunk-x6pz1h3x.js";import"./chunk-1gtrs8va.js";import"./chunk-66e4ga0z.js";import"./chunk-dvbgbd06.js";import"./chunk-sxpnpvt5.js";import"./chunk-jp6yn9mj.js";export{hd as clearScriptScanCache,As as convertServerLoopAttributesToDirectives,_i as convertSignalDirectivesToAttributes,Ps as convertSignalLoopsToAttributes,jc as extractExports,$i as findMarkupIndexOutsideScripts,Rs as hasSignalsSyntax,$s as parseLoopExpression,Ei as preEvalLiteralReactiveIfs,dr as processScriptSetup,Ti as processSignals,Bc as rewriteStxImportSpecifiers,Lc as scanScriptTags,et as stripStxRuntimeImports};
|