@stacksjs/stx 0.2.833 → 0.2.834
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/builtins/image-worker.js +6 -1
- package/dist/{chunk-vb4xzz5c.js → chunk-0a36jnq4.js} +1 -1
- package/dist/chunk-0c8fqfan.js +3 -0
- package/dist/{chunk-3sqay5jm.js → chunk-0mb3jch4.js} +3 -3
- package/dist/{chunk-qym44qqd.js → chunk-0mrzdsh5.js} +4 -4
- package/dist/chunk-0rnfywsx.js +2 -0
- package/dist/chunk-0z7w8e0s.js +2 -0
- package/dist/{chunk-y34ayg61.js → chunk-1qgzexkc.js} +42 -40
- package/dist/{chunk-mxvevxb8.js → chunk-29f6vmyz.js} +4 -4
- package/dist/{chunk-jp6sbk05.js → chunk-2nxxhcyy.js} +1 -1
- package/dist/{chunk-xdwnbr9b.js → chunk-33czswpt.js} +2 -2
- package/dist/{chunk-ekh3mxyp.js → chunk-3bjnrmha.js} +2 -2
- package/dist/chunk-3f1ks1ah.js +2 -0
- package/dist/{chunk-6qbatp72.js → chunk-3tn9tb9w.js} +5 -5
- package/dist/{chunk-g0vz0ch5.js → chunk-3w8kt53x.js} +7 -7
- package/dist/chunk-4f2zy3y6.js +2 -0
- package/dist/{chunk-fby81k5g.js → chunk-4g6v5qsp.js} +2 -2
- package/dist/{chunk-04z1xyrb.js → chunk-4ntm3dtk.js} +2 -2
- package/dist/chunk-523s4p08.js +2 -0
- package/dist/{chunk-mypygxdm.js → chunk-52g026sc.js} +2 -2
- package/dist/{chunk-716jrdcg.js → chunk-52t0qpx6.js} +1 -1
- package/dist/{chunk-z58dr234.js → chunk-5379q74v.js} +1 -1
- package/dist/{chunk-4a3r1kh1.js → chunk-55e46spy.js} +2 -2
- package/dist/{chunk-gy59sm92.js → chunk-55k7m9cp.js} +2 -2
- package/dist/chunk-5gqjhq31.js +2 -0
- package/dist/chunk-6j2aea05.js +2 -0
- package/dist/{chunk-yrw5ensv.js → chunk-7bvvv74e.js} +2 -2
- package/dist/chunk-7efkc3gk.js +2 -0
- package/dist/{chunk-m6q2vedz.js → chunk-7h5rt22w.js} +4 -4
- package/dist/{chunk-5201w0f1.js → chunk-84nw3921.js} +3 -3
- package/dist/chunk-913grzaj.js +2 -0
- package/dist/chunk-99ddfv0b.js +2 -0
- package/dist/{chunk-7nnep25t.js → chunk-9n14m2gn.js} +5 -5
- package/dist/chunk-9w3r1ch2.js +3 -0
- package/dist/chunk-a1hxz8q4.js +2 -0
- package/dist/{chunk-wt7qhv5b.js → chunk-a579jdwb.js} +1 -1
- package/dist/{chunk-7p8m82pj.js → chunk-amg6kr1p.js} +2 -2
- package/dist/{chunk-cfqz4bd6.js → chunk-b0z85f8h.js} +1 -1
- package/dist/chunk-b3s8tb18.js +2 -0
- package/dist/{chunk-67nq6csk.js → chunk-bc4x45vx.js} +1 -1
- package/dist/{chunk-3p7r3ajd.js → chunk-bky02g7k.js} +2 -2
- package/dist/chunk-brk1pk8w.js +2 -0
- package/dist/{chunk-hd378dgy.js → chunk-c3dg8qdn.js} +2 -2
- package/dist/{chunk-cca18z35.js → chunk-c9vxm8yq.js} +8 -8
- package/dist/{chunk-g00nhj1d.js → chunk-cddzcckm.js} +7 -7
- package/dist/chunk-cy3c4yxg.js +2 -0
- package/dist/chunk-db7p6bc4.js +2 -0
- package/dist/{chunk-1b1crd5a.js → chunk-ddtk57fy.js} +4 -4
- package/dist/{chunk-95d5qy7d.js → chunk-dgqp0pjn.js} +2 -2
- package/dist/{chunk-gcf97wgx.js → chunk-dv11h4f0.js} +1 -1
- package/dist/{chunk-yd1j88kp.js → chunk-dvyysszs.js} +6 -6
- package/dist/chunk-e7ssdryq.js +2 -0
- package/dist/{chunk-a395a3dt.js → chunk-ecmvq302.js} +8 -8
- package/dist/chunk-ee147ezb.js +2 -0
- package/dist/chunk-f6vzn90z.js +2 -0
- package/dist/chunk-fc5zj6qg.js +2 -0
- package/dist/{chunk-wr7bmkne.js → chunk-fvgk1w9s.js} +2 -2
- package/dist/{chunk-hfktzsat.js → chunk-g3xbwz51.js} +1 -1
- package/dist/chunk-g5jfb1ms.js +2 -0
- package/dist/{chunk-6b1g5a6a.js → chunk-ga2k1rga.js} +11 -11
- package/dist/{chunk-cv1zc9dg.js → chunk-gh62p9mx.js} +2 -2
- package/dist/{chunk-4xw22xqd.js → chunk-gnt1v0kc.js} +6 -6
- package/dist/chunk-gtj8wy95.js +2 -0
- package/dist/{chunk-wb6w807m.js → chunk-h4tbpr7p.js} +1 -1
- package/dist/chunk-j0w048sj.js +2 -0
- package/dist/chunk-jmk1ze6r.js +2 -0
- package/dist/{chunk-t59bc7na.js → chunk-jr0r5pzw.js} +2 -2
- package/dist/{chunk-r2fwxtke.js → chunk-k46pfdmn.js} +1 -1
- package/dist/chunk-k4hjqfx1.js +2 -0
- package/dist/chunk-k761q7s7.js +2 -0
- package/dist/{chunk-1vzncfka.js → chunk-kw5gra2z.js} +2 -2
- package/dist/chunk-kzvt88tk.js +2 -0
- package/dist/chunk-mdtysd2d.js +2 -0
- package/dist/{chunk-rkdsgfhd.js → chunk-ms3v5nat.js} +6 -6
- package/dist/{chunk-ba499a3p.js → chunk-mya2g8sn.js} +1 -1
- package/dist/{chunk-f6b7av6b.js → chunk-n4qznmkm.js} +5 -5
- package/dist/{chunk-m9bbhg46.js → chunk-nmtya57z.js} +2 -2
- package/dist/chunk-npn692c4.js +42 -0
- package/dist/{chunk-02zvytqx.js → chunk-nxfyjw59.js} +1 -1
- package/dist/{chunk-xn9jg1q5.js → chunk-nyg0nbjj.js} +1 -1
- package/dist/chunk-pt8nft3k.js +2 -0
- package/dist/chunk-pwv77cyb.js +2 -0
- package/dist/chunk-q1cfc2fp.js +2 -0
- package/dist/{chunk-qy6dtm1a.js → chunk-q46ay7aq.js} +4 -4
- package/dist/{chunk-38wq4ttd.js → chunk-qbvy23qa.js} +95 -95
- package/dist/{chunk-xdqv5yq4.js → chunk-qdagsy5b.js} +2 -2
- package/dist/{chunk-s67pnfvz.js → chunk-qfcabz87.js} +4 -4
- package/dist/{chunk-qws72sn9.js → chunk-rfdwn0k3.js} +32 -32
- package/dist/{chunk-wvds0s9m.js → chunk-rnm8ejpz.js} +2 -2
- package/dist/{chunk-a9d14beh.js → chunk-rtj900pa.js} +1 -1
- package/dist/{chunk-c84pxd2k.js → chunk-s33andzg.js} +2 -2
- package/dist/{chunk-4z0jpzdq.js → chunk-s3j5vxy9.js} +2 -2
- package/dist/{chunk-8y8kgw9s.js → chunk-s6r54dyf.js} +2 -2
- package/dist/{chunk-c6gr71fg.js → chunk-srb0qmgx.js} +1 -1
- package/dist/{chunk-a7j451hn.js → chunk-srqk1nxc.js} +2 -2
- package/dist/{chunk-vhehb6eh.js → chunk-t33fttx9.js} +1 -1
- package/dist/chunk-t612xpa4.js +2 -0
- package/dist/{chunk-g4qzy5hv.js → chunk-tesbhpbp.js} +1 -1
- package/dist/{chunk-m9dj8pgb.js → chunk-tvw571ab.js} +1 -1
- package/dist/{chunk-6k26n0sj.js → chunk-tx8wk6h7.js} +2 -2
- package/dist/{chunk-c9mdvpf5.js → chunk-txd2js5v.js} +10 -10
- package/dist/chunk-v1wgp7ep.js +2 -0
- package/dist/{chunk-qnrgfm9v.js → chunk-v3xyb3ws.js} +2 -2
- package/dist/{chunk-w7m9pecb.js → chunk-v4kenb7z.js} +5 -5
- package/dist/chunk-v53kdjz6.js +2 -0
- package/dist/{chunk-2qngyyaz.js → chunk-vfj9wp11.js} +2 -2
- package/dist/{chunk-nfpsaaqm.js → chunk-vfxkn1pe.js} +3 -3
- package/dist/{chunk-tchz2m2v.js → chunk-vnk6gt0t.js} +1 -1
- package/dist/chunk-vqpypnys.js +2 -0
- package/dist/{chunk-1c62mrad.js → chunk-x57x0yq7.js} +5 -5
- package/dist/{chunk-3grrmmrg.js → chunk-xd9t20sx.js} +1 -1
- package/dist/{chunk-dzm9g76x.js → chunk-xqy8y5dc.js} +1 -1
- package/dist/{chunk-6tjm38e4.js → chunk-xtqapjz3.js} +1 -1
- package/dist/{chunk-6kk8p766.js → chunk-xvmn976f.js} +1 -1
- package/dist/chunk-xxyhzsqx.js +2 -0
- package/dist/{chunk-bgqbvf1w.js → chunk-y47n1j5x.js} +6 -6
- package/dist/{chunk-qadce16v.js → chunk-ya6bp08c.js} +1 -1
- package/dist/{chunk-zvvv6x8c.js → chunk-yw1s8kyj.js} +3 -3
- package/dist/{chunk-rmygv0n0.js → chunk-z0ynyz62.js} +4 -4
- package/dist/chunk-z2e06633.js +2 -0
- package/dist/{chunk-kn3pknzt.js → chunk-zb7kfwac.js} +3 -3
- package/dist/chunk-zsdqsky6.js +2 -0
- package/dist/cli.js +13 -13
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/document-styles.d.ts +7 -0
- package/dist/document-styles.js +40 -0
- package/dist/html-masking.js +6 -3
- package/dist/process.js +3 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-09fbj9b4.js +0 -2
- package/dist/chunk-17h13201.js +0 -2
- package/dist/chunk-17zrprh0.js +0 -2
- package/dist/chunk-28z6pq6w.js +0 -42
- package/dist/chunk-293fnyc2.js +0 -2
- package/dist/chunk-42c92rp3.js +0 -2
- package/dist/chunk-437wgphe.js +0 -2
- package/dist/chunk-46yyc2sf.js +0 -2
- package/dist/chunk-503ppv77.js +0 -2
- package/dist/chunk-5e7abvtz.js +0 -2
- package/dist/chunk-6r4teng3.js +0 -2
- package/dist/chunk-7b105hww.js +0 -2
- package/dist/chunk-83hwrh5n.js +0 -2
- package/dist/chunk-8n8vj099.js +0 -2
- package/dist/chunk-9jvpyq5h.js +0 -2
- package/dist/chunk-abh791bh.js +0 -2
- package/dist/chunk-aqjcqnex.js +0 -2
- package/dist/chunk-awd0dvjb.js +0 -2
- package/dist/chunk-b39g02k9.js +0 -2
- package/dist/chunk-e7yejx6x.js +0 -2
- package/dist/chunk-f8g0sgs0.js +0 -2
- package/dist/chunk-fb90n0by.js +0 -2
- package/dist/chunk-ggnzezrn.js +0 -2
- package/dist/chunk-jny0vbmt.js +0 -2
- package/dist/chunk-k6ye0159.js +0 -3
- package/dist/chunk-kgn911k7.js +0 -2
- package/dist/chunk-kr6x19z0.js +0 -2
- package/dist/chunk-kshem79d.js +0 -2
- package/dist/chunk-ns23fv15.js +0 -3
- package/dist/chunk-pc4xah5j.js +0 -2
- package/dist/chunk-q2tbbtqn.js +0 -2
- package/dist/chunk-qg2tpvdw.js +0 -2
- package/dist/chunk-shzkz2az.js +0 -2
- package/dist/chunk-v1mwhvf8.js +0 -2
- package/dist/chunk-vce1js6z.js +0 -2
- package/dist/chunk-vhmzkhy4.js +0 -2
- package/dist/chunk-wpyhavjy.js +0 -2
- package/dist/chunk-zt74q4c8.js +0 -2
- package/dist/chunk-zty254tw.js +0 -2
- package/dist/chunk-zy41xhc4.js +0 -2
|
@@ -2,7 +2,6 @@ import fs from "node:fs";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { Worker as ThreadWorker } from "node:worker_threads";
|
|
6
5
|
export const WORKER_UNAVAILABLE = Symbol("stx.image-worker.unavailable");
|
|
7
6
|
export function imageWorkerSlots(cores = typeof os.availableParallelism === "function" ? os.availableParallelism() : os.cpus().length) {
|
|
8
7
|
return Math.max(1, Math.min(2, cores - 1));
|
|
@@ -60,6 +59,12 @@ function messageOf(error) {
|
|
|
60
59
|
return error instanceof Error ? error.message : String(error);
|
|
61
60
|
}
|
|
62
61
|
export async function runImageTask(task, args) {
|
|
62
|
+
let ThreadWorker;
|
|
63
|
+
try {
|
|
64
|
+
ThreadWorker = (await import("node:worker_threads")).Worker;
|
|
65
|
+
} catch (error) {
|
|
66
|
+
return unavailable(`could not load node:worker_threads: ${messageOf(error)}`);
|
|
67
|
+
}
|
|
63
68
|
if (typeof ThreadWorker !== "function")
|
|
64
69
|
return unavailable("node:worker_threads has no Worker in this runtime");
|
|
65
70
|
const entry = imageWorkerEntry();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mi,Di,Li,Ng,Mg,Dg,Cl,Lg,jg}from"./chunk-
|
|
2
|
+
import{Mi,Di,Li,Ng,Mg,Dg,Cl,Lg,jg}from"./chunk-dv11h4f0.js";export{Mi as ImageProcessorCache,Cl as applyTransformations,Ng as clearImageCache,Lg as generateResponsiveVariants,jg as generateSrcset,Di as getCachedImageResult,Dg as optimizeImage,Mg as processImage,Li as setCachedImageResult};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Oe,w,S,C,Z}from"./chunk-
|
|
2
|
+
import{Oe,w,S,C,Z}from"./chunk-qbvy23qa.js";import{k}from"./chunk-4ntm3dtk.js";import{I,$n}from"./chunk-s6r54dyf.js";import{a}from"./chunk-ecmvq302.js";import{ye,rn,sn,on}from"./chunk-ddtk57fy.js";import{vt}from"./chunk-3w8kt53x.js";import{ht,Vn,Jt,le}from"./chunk-33czswpt.js";import{E,Tn}from"./chunk-jr0r5pzw.js";import h from"path";var v=new Map,A=new Map,F=w(64),R=new Map,Y=["composables","functions"];function H(e){let s=h.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function ee(e){if(e)return h.resolve(e);let s=`<default>:${process.cwd()}`,r=R.get(s);if(r!==void 0)return r;let t=await te();if(t!==null)R.set(s,t);return t}async function te(){let e=await a(),s=e.root||process.cwd(),r=e.composablesDir;if(r)return h.resolve(s,r);for(let t of Y){let n=h.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let i of c.scan({cwd:n,absolute:!0}))if(!H(i))return n}catch{}}return null}async function W(e){let s=Array.isArray(e)?e:e?[h.resolve(e)]:(await a())._layerComposableDirs??[await ee()].filter((t)=>!!t),r=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let i=h.relative(t,c);if(!H(c)&&!r.has(i))r.set(i,c)}}catch{}}return{key:s.join("\x00"),files:[...r.values()].sort()}}async function vo(e){let{files:s}=await W(e),r=Z({loader:"ts",target:"browser",define:C()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),i=r.scan(c).exports.filter((u)=>u!=="default");if(i.length>0)t.push({file:n,names:i})}catch{}return t}function ne(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function P(e,s){let r=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?r.has(n):ne(e,n))t.add(n);return t}var J=w(64);function X(e,s){let r=S(e,s.size),t=J.get(r);if(t)return t;let n;try{n=Oe(e,s)}catch{n=P(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let i of c)for(let u of i[1].split(",")){let f=u.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return J.set(r,n),n}function se(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var L=w(256);function oe(e,s){let r=new Set(s),t="",n=0,c=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)){t+=e.slice(n,i.index),n=i.index+i[0].length;let u=i[1]??"",f=i[2]??"",d=/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(u),m=d?(d[1]??d[2]??d[3]??"").trim():void 0;if(!se(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let y=P(f,r);if(y.size===0)continue;let _=S(f,[...y].sort().join(",")),b=L.get(_);if(!b)b=X(f,y),L.set(_,b);for(let B of b)c.add(B)}t+=e.slice(n);for(let i of P(t,r))c.add(i);return c}function ie(e,s,r){let t=new Map;for(let{file:f,names:d}of e)for(let m of d)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let d=[];for(let m of X(f,n))d.push(t.get(m));return d},i=new Set,u=r.flatMap((f,d)=>d===0?[...oe(f,t.keys())].map((m)=>t.get(m)):c(f));while(u.length>0){let f=[];for(let d of u){if(i.has(d))continue;i.add(d);for(let m of c(s.get(d)??""))if(!i.has(m))f.push(m)}u=f}return i}async function ph(e,s,r,t){let{key:n,files:c}=await W(e);if(!n)return null;let i=()=>[...new Set([...c,...c.flatMap((o)=>ye(o))])],u=ht(i());if(c.length===0)return le(v,n,u,""),null;c.sort();let f=Z({loader:"ts",target:"browser",define:C()}),d=Jt(A,n,u);if(!d){let o=new Map,l=[];for(let p of c)try{let x=await Bun.file(p).text();o.set(p,x);let g=f.scan(x).exports.filter((V)=>V!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}d=le(A,n,u,{codeByFile:o,modules:l})}let{codeByFile:m,modules:y}=d,_;if(s===void 0)_=new Set(c);else{let o=r?[s,...r]:[s],l=S(o.join("\x00"),n,o.length,u),p=F.get(l);if(_=p??ie(y,m,o),!p)F.set(l,_)}if(_.size===0)return null;let b=c.filter((o)=>_.has(o)),B=()=>{if(!t)return;for(let o of b)t.push(o,...ye(o))},N=`${n}\x00${b.join("\x00")}\x00${sn()}`,U=Jt(v,N,u);if(U!==void 0)return B(),U||null;let D=[],M=new Set,T=new Set;for(let o of b)try{let l=m.get(o)??await Bun.file(o).text(),p=h.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])T.add(g[1]);let x=[];try{for(let g of f.scan(l).exports)if(g!=="default")M.add(g),x.push(g)}catch{}if(l=I(l),rn(l))l=await on(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:x}),l=vt(l);l=$n(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),D.push(`// Composable: ${p}
|
|
3
3
|
${l.trim()}`)}catch(l){console.warn(`[stx] Failed to load composable ${o}:`,l)}if(D.length===0||M.size===0)return le(v,N,u,""),null;let q=[...M].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
|
|
4
4
|
`),z=JSON.stringify([...M]),j=D.join(`
|
|
5
5
|
|
|
@@ -29,5 +29,5 @@ ${q}
|
|
|
29
29
|
window[__n] = __c[__n];
|
|
30
30
|
__published[__n] = true;
|
|
31
31
|
}
|
|
32
|
-
})();`,G=E()?
|
|
33
|
-
export{
|
|
32
|
+
})();`,G=E()?Tn(O):O;return u=ht(i()),le(v,N,u,G),B(),G}function fh(){v.clear(),Vn(),A.clear(),F.clear(),R.clear()}
|
|
33
|
+
export{vo,ph,fh};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Se,It,ui,
|
|
2
|
+
import{Se,It,ui,js,Oc,Nc,Mc,Dc,Bs,pi,Lc,jc,fi,bn}from"./chunk-qbvy23qa.js";import{k}from"./chunk-4ntm3dtk.js";import{a}from"./chunk-ecmvq302.js";import{vo}from"./chunk-0mb3jch4.js";import{c}from"./chunk-9w3r1ch2.js";import{existsSync as B,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=bn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),he=[...new Set([...ee,...te])].sort(),be=new Set(ee),xe=new Set(te),ye=new Set(he),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function ke(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let f of t){if(f.offset===void 0)continue;let i=f.kind==="server"?be:xe;Y.lastIndex=0;for(let p of f.code.matchAll(Y)){let g=p.index+p[0].indexOf("{")+1;for(let d of p[1].matchAll(/[^,]+/g)){let y=d[0];if(/^\s*type\s/.test(y))continue;let b=/^\s*([A-Za-z_$][\w$]*)/.exec(y);if(!b)continue;let r=b[1];if(!ye.has(r)||i.has(r))continue;let o=f.offset+g+d.index+b[0].length-r.length,u=e.slice(0,o),S=u.split(`
|
|
3
3
|
`).length;s.push({line:S,column:o-(u.lastIndexOf(`
|
|
4
4
|
`)+1)+1,offset:o,length:r.length,name:r,kind:f.kind,message:ke(r,f.kind)})}}}return s}import E from"path";var we="@stacksjs/stx-typescript-plugin";function $e(e,t){let s=E.resolve(e);for(;;){let f=E.join(s,"tsconfig.json");if(t(f))return f;let i=E.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let f=$e(e,s);if(!f)return;let i=new Set,p=(g)=>{if(i.has(g))return;i.add(g);let d=t(g);if(!d)return;let y=d.compilerOptions?.plugins;if(Array.isArray(y)){let r=y.find((u)=>u?.name===we),o=Array.isArray(r?.libs)?r.libs.filter((u)=>typeof u==="string"):[];return r?{configPath:g,libs:o.map((u)=>E.resolve(E.dirname(g),u))}:null}let b=typeof d.extends==="string"?[d.extends]:Array.isArray(d.extends)?d.extends:[];for(let r of[...b].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let o=E.resolve(E.dirname(g),r.endsWith(".json")?r:`${r}.json`),u=p(o);if(u!==void 0)return u}return};return p(f)??void 0}function aa(e,t="",s=""){let f=e.startLine>1?`
|
|
5
|
-
`.repeat(e.startLine-1):"",i=ui(pi(e)+e.code,t),p=
|
|
5
|
+
`.repeat(e.startLine-1):"",i=ui(pi(e)+e.code,t),p=js(i.code),g=e.kind==="client"||e.kind==="plain"?Mc(t,e.code):"",d=(f+p).split(`
|
|
6
6
|
`),y=d.length,b=new Map;for(let o of i.declarations)for(let[u,S]of o.text.split(`
|
|
7
|
-
`).entries())if(d.push(S),o.origin)b.set(d.length,{...o.origin,line:e.startLine+o.origin.line-1+u,column:u===0?o.origin.column:1});d.push(g,"export {}","");let r=
|
|
7
|
+
`).entries())if(d.push(S),o.origin)b.set(d.length,{...o.origin,line:e.startLine+o.origin.line-1+u,column:u===0?o.origin.column:1});d.push(g,"export {}","");let r=Bs(d.join(`
|
|
8
8
|
`),s);return{text:r.code,sourceLineCount:y,lineMap:b,scriptColumns:new Map([...i.columns].map(([o,u])=>[o+e.startLine-1,u])),importColumns:r.columns}}function tm(e,t="",s=""){return aa(e,t,s).text}var ve=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function Te(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],s=new Set(k),f=[];for(let{file:i,names:p}of e){let g=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));f.push(` export * from ${g}`);for(let d of p){if(s.has(d)||ve.has(d))continue;s.add(d),t.push(`declare const ${d}: typeof import(${g})[${JSON.stringify(d)}]`)}}return t.push("declare module '@composables' {",...f,"}"),t.join(`
|
|
9
9
|
`)}function ca(e,t,s){return`${e}.__stx_${t}${s}.ts`}function nm(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function Bl(){return se("stx.d.ts")}function Fl(){return se("stx-module.d.ts")}function se(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(B(t))return t;return null}var De=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function re(e){return e>=1000&&e<2000}function oe(e){let t="",s=!1,f=!1;for(let i=0;i<e.length;i++){let p=e[i];if(s){if(t+=p,f)f=!1;else if(p==="\\")f=!0;else if(p==='"')s=!1;continue}if(p==='"'){s=!0,t+=p;continue}if(p==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
|
|
10
10
|
`)i++;t+=`
|
|
11
11
|
`;continue}if(p==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=p}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(oe(K(e,"utf8")))}catch{return}}function Ne(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(B(r)){s=r;break}let o=h.dirname(t);if(o===t)break;t=o}if(!s)return{};let f=new Set,i=s,p,g,d=s;while(i&&!f.has(i)){f.add(i);let r;try{r=JSON.parse(oe(K(i,"utf8")))}catch{break}let o=r?.compilerOptions??{};if(!p&&o.paths&&typeof o.paths==="object")p=o.paths,d=i;if(!g&&typeof o.baseUrl==="string")g=h.resolve(h.dirname(i),o.baseUrl);if(p&&g)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!p)return{};let y=g??h.dirname(d),b={};for(let[r,o]of Object.entries(p)){if(!Array.isArray(o))continue;b[r]=o.map((u)=>typeof u==="string"&&!h.isAbsolute(u)?h.resolve(y,u):u)}return{paths:b}}async function rm(e,t={}){let s=t.client!==!1,f=t.server!==!1,i=t.templates!==!1,p=t.componentsDir??(i?(await a()).componentsDir:void 0),g=new Map,d=new Map,y=[],b=[],r=0,o=0,u=Bl();for(let n of e){let l=await Bun.file(n).text(),x=It(l).filter((m)=>{if(m.kind==="server")return f;return s}),w=It(l).filter((m)=>m.kind==="server").map((m)=>m.code).join(`
|
|
12
12
|
`);for(let m of ne(l,x))y.push({file:n,line:m.line,column:m.column,code:0,message:m.message,category:"error",blockKind:m.kind});if(s&&w){let m=x.filter((v)=>v.kind!=="server"),O=[...new Set(m.flatMap((v)=>Dc(w,v.code)))];if(O.length>0)d.set(n,{names:O,line:m[0].startLine,kind:m[0].kind})}let N=h.dirname(h.resolve(n)),D=i?Lc(l,{runtimeGlobals:!u,originDir:N,filePath:h.resolve(n),componentsDir:p}):null,R=D?[...D.lineMap.values()].filter((m)=>m.expression).length:0;if(x.length===0&&R===0)continue;if(b.push(n),r+=x.length,o+=R,x.forEach((m,O)=>{let v=aa(m,w,N);g.set(ca(n,m.kind,O),{virtual:v,source:v.text,origin:n,kind:m.kind})}),D&&R>0)g.set(ca(n,"template",0),{source:D.text,origin:n,kind:"template",virtual:D})}if(g.size===0)return{diagnostics:y,checkedFiles:b,blockCount:0,expressionCount:0};let S=(t.extraLibs??[]).map((n)=>h.resolve(n)),ce=ie(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Ee,B);for(let n of ce?.libs??[])if(!S.includes(n)&&B(n))S.push(n);if(u)S.push(u);let F=u?Fl():null;if(F)S.push(F);let G=`${c()}/typecheck/__stx_globals.d.ts`,ae=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",Oc(u?Nc(K(u,"utf8")):void 0),...u?[]:["declare const window: any",...k.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...Se.map((n)=>`declare const ${n}: any`)].join(`
|
|
13
|
-
`),Te(await
|
|
13
|
+
`),Te(await vo())].filter(Boolean).join(`
|
|
14
14
|
`),C=`${c()}/typecheck`;await Bun.$`rm -rf ${C}`.quiet().nothrow(),await Bun.$`mkdir -p ${C}`.quiet().nothrow(),await Bun.write(G,ae);let M=new Map,le=0;for(let[n,l]of g){let x=`${le++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${C}/${x}`,l.source),M.set(x,l)}let ue={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...Ne(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},V=async(n,l)=>{let x=`${C}/tsconfig${l===1?"":`.${l}`}.json`;await Bun.write(x,JSON.stringify({compilerOptions:ue,files:n.map((N)=>`${C}/${N}`).concat(G,...S)},null,2));let w=Bun.spawnSync(["bun","x","tsc","-p",x,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(w.stdout)+new TextDecoder().decode(w.stderr),exitCode:w.exitCode??0}},X=await V([...M.keys()],1),J=X.output,P=[],U=X.exitCode,W=0,pe=new Set(S.map((n)=>n.split("/").pop())),z=0,j=new Set,q=(n)=>{for(let l of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
|
|
15
15
|
`)){let x=l.match(De);if(!x)continue;if(W++,pe.has(x[1].split("/").pop()))z++;let[,w,N,D,R,m,O]=x,v=w.split("/").pop(),T=M.get(v);if(!T)continue;if(re(Number(m)))j.add(v);let L=Number(N),A=Number(D),Q;if(T.virtual){let _=fi(T.virtual,L,A)??(T.kind!=="template"&&re(Number(m))?fi(T.virtual,T.virtual.sourceLineCount,1):null);if(!_||T.kind==="template"&&!_.expression)continue;if(jc(_,Number(m)))continue;L=_.line,A=_.column,Q=_.expression?.code.trim()}P.push({file:T.origin,line:L,column:A,code:Number(m),message:O,category:R==="error"?"error":"warning",blockKind:T.kind,expression:Q})}};q(J);let de=W,fe=z;if(j.size>0&&j.size<M.size){let n=[...M.keys()].filter((l)=>!j.has(l));q((await V(n,2)).output)}if(s)for(let[n,l]of d){if(l.names.length===0)continue;P.push({file:n,line:l.line,column:1,code:0,message:`${l.names.length===1?"1 value reaches":`${l.names.length} values reach`} this block on the implicit bridge and ${l.names.length===1?"is":"are"} untyped: ${l.names.join(", ")}. Declare them with defineClientPayload({ ${l.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:l.kind})}P.push(...y);let H=new Set,I=P.filter((n)=>{let l=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(H.has(l))return!1;return H.add(l),!0});I.sort((n,l)=>n.file.localeCompare(l.file)||n.line-l.line||n.column-l.column);let Z=fe>0&&I.length===0,me=Z||U!==0&&de===0?`${Z?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${U} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
|
|
16
16
|
${J.trim().split(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Jg}from"./chunk-t33fttx9.js";import"./chunk-ecmvq302.js";import"./chunk-srqk1nxc.js";import"./chunk-gh62p9mx.js";import"./chunk-amg6kr1p.js";import"./chunk-ms3v5nat.js";import"./chunk-29f6vmyz.js";import"./chunk-qbvy23qa.js";import"./chunk-qdagsy5b.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{Jg as buildApp};
|