@stacksjs/stx 0.2.258 → 0.2.260

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.
Files changed (57) hide show
  1. package/dist/build.js +1 -0
  2. package/dist/{chunk-npmp6a2c.js → chunk-0cpze9x0.js} +1 -1
  3. package/dist/{chunk-w9q0zj9q.js → chunk-0eeymffm.js} +1 -1
  4. package/dist/{chunk-xjywr72b.js → chunk-0jqtsexq.js} +1 -1
  5. package/dist/chunk-0tcqnfm9.js +3 -0
  6. package/dist/{chunk-keeas4pc.js → chunk-0ve08c39.js} +1 -1
  7. package/dist/{chunk-pqm9181x.js → chunk-149qmkxb.js} +1 -1
  8. package/dist/{chunk-qt0evm5e.js → chunk-2d3gm9fw.js} +8 -8
  9. package/dist/{chunk-qxw0v2wz.js → chunk-35dxrg9z.js} +1 -1
  10. package/dist/{chunk-edxh2d0d.js → chunk-47ectzew.js} +1 -1
  11. package/dist/{chunk-pb11vxep.js → chunk-4h7zdmrz.js} +1 -1
  12. package/dist/{chunk-ztkfhdf0.js → chunk-629d0529.js} +1 -1
  13. package/dist/{chunk-92v2162p.js → chunk-75ysdbke.js} +1 -1
  14. package/dist/{chunk-wwsrd40w.js → chunk-7b3gn58c.js} +1 -1
  15. package/dist/{chunk-kfs48te0.js → chunk-7xhxtep4.js} +1 -1
  16. package/dist/{chunk-90gket7c.js → chunk-8z2w0053.js} +1 -1
  17. package/dist/{chunk-35p7ts50.js → chunk-91hdna71.js} +1 -1
  18. package/dist/{chunk-16awvchc.js → chunk-akv4sa0c.js} +1 -1
  19. package/dist/{chunk-ay8wwp7x.js → chunk-b6b8rm2e.js} +1 -1
  20. package/dist/{chunk-jengmn92.js → chunk-bgd8qtdf.js} +1 -1
  21. package/dist/{chunk-zcqadg47.js → chunk-c6vnw997.js} +1 -1
  22. package/dist/{chunk-9rw3z4t7.js → chunk-dv8mbh0j.js} +92 -92
  23. package/dist/{chunk-yqknwa4r.js → chunk-en1q9d6s.js} +1 -1
  24. package/dist/{chunk-zsg2z6hb.js → chunk-fheafw7c.js} +1 -1
  25. package/dist/{chunk-yz233j7e.js → chunk-ft1wk1w4.js} +1 -1
  26. package/dist/{chunk-te87a619.js → chunk-hcw4k9cc.js} +2 -2
  27. package/dist/{chunk-b4th3fst.js → chunk-j2v0zyp6.js} +2 -2
  28. package/dist/{chunk-mxym7k6w.js → chunk-jt2z7t34.js} +1 -1
  29. package/dist/{chunk-6vgfcy8f.js → chunk-m1x3jmgv.js} +1 -1
  30. package/dist/{chunk-ngjg4xth.js → chunk-m7de5pqz.js} +1 -1
  31. package/dist/{chunk-hp2tdpq2.js → chunk-m7qbd931.js} +1 -1
  32. package/dist/chunk-mdw538d5.js +13 -0
  33. package/dist/{chunk-tbx3d1j9.js → chunk-mmew9zcf.js} +1 -1
  34. package/dist/{chunk-hgssafhg.js → chunk-p044tfvj.js} +1 -1
  35. package/dist/{chunk-385q36qn.js → chunk-pas7f178.js} +1 -1
  36. package/dist/{chunk-p7vxtybd.js → chunk-phngtpxg.js} +1 -1
  37. package/dist/{chunk-td67r5qj.js → chunk-pyp481nm.js} +1 -1
  38. package/dist/{chunk-xt5t2b88.js → chunk-qmtr6msv.js} +1 -1
  39. package/dist/{chunk-22av7jsc.js → chunk-qym9n5hg.js} +1 -1
  40. package/dist/{chunk-0wppscm7.js → chunk-r1kxctv6.js} +1 -1
  41. package/dist/{chunk-r8f2xb95.js → chunk-s3nn6sph.js} +1 -1
  42. package/dist/{chunk-w1sa237y.js → chunk-spk80ph3.js} +1 -1
  43. package/dist/{chunk-t581wxnt.js → chunk-te7510sg.js} +1 -1
  44. package/dist/{chunk-bsc8ggfh.js → chunk-xm40k29a.js} +1 -1
  45. package/dist/cli.js +7 -7
  46. package/dist/client-script-bundler.d.ts +0 -1
  47. package/dist/client-script-bundler.js +29 -1
  48. package/dist/craft-entry.js +1 -1
  49. package/dist/craft.js +1 -1
  50. package/dist/pwa.js +1 -1
  51. package/dist/runtime-injection.d.ts +2 -5
  52. package/dist/runtime-injection.js +5 -1
  53. package/dist/ssg.d.ts +10 -0
  54. package/dist/ssg.js +2 -2
  55. package/package.json +5 -5
  56. package/dist/chunk-3epp1pgx.js +0 -13
  57. package/dist/chunk-vq6h3jv1.js +0 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.258",
4
+ "version": "0.2.260",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -117,12 +117,12 @@
117
117
  "dependencies": {
118
118
  "@cwcss/crosswind": "^0.2.19",
119
119
  "@stacksjs/clapp": "^0.2.14",
120
- "@stacksjs/desktop": "0.2.258",
121
- "@stacksjs/sanitizer": "0.2.258",
120
+ "@stacksjs/desktop": "0.2.260",
121
+ "@stacksjs/sanitizer": "0.2.260",
122
122
  "@stacksjs/ts-i18n": "^0.1.11",
123
- "bun-plugin-stx": "0.2.258",
123
+ "bun-plugin-stx": "0.2.260",
124
124
  "bunfig": "^0.15.17",
125
- "stx-router": "0.2.258",
125
+ "stx-router": "0.2.260",
126
126
  "ts-broadcasting": "^0.0.9",
127
127
  "ts-images": "^0.2.11",
128
128
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,13 +0,0 @@
1
- // @bun
2
- import{il as _,jl as u}from"./chunk-0ha9e1wt.js";import{Sl as h,fs as n}from"./chunk-9rw3z4t7.js";import{mt as N}from"./chunk-dnhckx52.js";import K from"path";import M from"fs";var s=5,c=1,p=new Map;function $w(z){return p.get(z)??[]}function o(z,w){if(z)p.set(z,w)}function t(z=process.env){return z.STX_DEBUG==="true"||z.STX_DEBUG==="1"}function T(...z){if(t())console.log("[stx:bundler]",...z)}var D=[];function b(z,w,Y){D.push({filePath:z||"<inline>",message:w,details:Y})}function Qw(){return D.slice()}function Xw(){D.length=0}var F;function Hw(z){F=z}function f(){if(F)return F;try{let z=n.strict;return typeof z==="object"&&z!==null?z.bundlerFallback??"warn":"warn"}catch{return"warn"}}var g=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function qw(z){let w=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=w.exec(z))!==null){let j=Y[1];if(!g.some((G)=>G.test(j)))return T("detected user import:",j),!0}let Z=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=Z.exec(z))!==null){let j=Y[1];if(/\.css(?:\?.*)?$/.test(j))continue;if(!g.some((G)=>G.test(j)))return T("detected side-effect import:",j),!0}return!1}function a(z,w,Y,Z){let j=(Q,G)=>{let J=Q===Y?w:K.dirname(Q),W=K.resolve(J,G),X=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,K.join(W,"index.ts"),K.join(W,"index.tsx"),K.join(W,"index.js"),K.join(W,"index.mjs")];for(let S of X)try{if(M.existsSync(S)&&M.statSync(S,{throwIfNoEntry:!1})?.isFile())return S}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(M.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let J=j(G.importer,G.path);return Z.add(J),{path:J}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let J=K.resolve(z,G.path.slice(2)),W=[J,`${J}.ts`,`${J}.tsx`,`${J}.js`,`${J}.mjs`,`${J}.jsx`,K.join(J,"index.ts"),K.join(J,"index.tsx"),K.join(J,"index.js"),K.join(J,"index.mjs")];for(let X of W)if(M.existsSync(X)&&M.statSync(X,{throwIfNoEntry:!1})?.isFile())return T(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",X),Z.add(X),{path:X};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:J}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let J=K.extname(G.path).toLowerCase(),W=J===".json"?"json":J===".tsx"?"tsx":J===".jsx"?"jsx":J===".ts"||J===".mts"||J===".cts"?"ts":"js";if(G.path!==Y)Z.add(G.path);return{contents:M.readFileSync(G.path,"utf8"),loader:W}})}}}var R=new Map,m=Symbol.for("stx.client-bundle-build-queue");function e(z){let w=globalThis,Z=(w[m]??Promise.resolve()).then(z,z);return w[m]=Z.then(()=>{return},()=>{return}),Z}async function Mw(z,w,Y={}){let Z=Y.projectRoot||process.cwd(),j=Y.minify??!1,Q=Y.cacheDir||N(Z,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${s}\x00${z}\x00${w}`);let J=G.digest("hex").slice(0,12),W=K.join(Q,`${J}.js`),X=K.join(Q,`${J}.deps.json`),S=Bun.file(W);if(await S.exists()){let k=Bun.file(X),I=!0;if(await k.exists())try{let O=JSON.parse(await k.text());if(O.metadataVersion!==c||!Array.isArray(O.files))I=!1;for(let q of Array.isArray(O.files)?O.files:[])try{if(M.statSync(q.path).mtimeMs!==q.mtimeMs){I=!1;break}}catch{I=!1;break}}catch{I=!1}if(I){T("cache hit:",J);try{let O=JSON.parse(await Bun.file(X).text());o(w,(O.files??[]).map((q)=>q.path))}catch{}return await S.text()}T("cache invalidated by dep change:",J)}let y=R.get(J);if(y)return await y;let x=e(()=>ww(z,w,{projectRoot:Z,minify:j,cacheDir:Q,hash:J,cachePath:W,depsPath:X}));R.set(J,x);try{return await x}finally{R.delete(J)}}async function ww(z,w,Y){let{projectRoot:Z,minify:j,cacheDir:Q,hash:G,cachePath:J,depsPath:W}=Y,X=N(Z,"bundle-tmp"),S=K.join(X,`${G}.ts`),y=K.join(X,"out",G);M.mkdirSync(X,{recursive:!0}),M.mkdirSync(y,{recursive:!0});let x=K.dirname(w),k=[],I=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,O=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,q;while((q=I.exec(z))!==null){if(q[1])continue;if(q[2])q[2].split(",").forEach((V)=>{let H=zw(V);if(H)k.push(H)});else if(q[3])k.push(q[3])}while((q=O.exec(z))!==null){if(q[1])continue;k.push(q[2])}let E=k.length>0?`
3
- export { ${k.join(", ")} }`:"";await Bun.write(S,z+E),T("bundling:",G,"from:",K.basename(w));let B=new Set;try{let V=await Bun.build({entrypoints:[S],outdir:y,target:"browser",format:"esm",minify:j,plugins:[a(Z,x,S,B)],define:{"process.env.NODE_ENV":j?'"production"':'"development"',...h()},root:Z});if(!V.success){let U=V.logs.filter((L)=>L.level==="error").map((L)=>L.message).join(", ")||`Unable to bundle ${K.basename(w)}`,A=_(V.logs,w||void 0);if(console.warn("[stx:bundler] build failed:",U),b(w||"",U,A),f()==="error")throw Error(U);return z}let H="";for(let $ of V.outputs){H=await $.text();break}let C=[];for(let $ of H.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let U of $[1].split(",")){let A=U.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(A){C.push([A[2],A[1]]);continue}let L=U.trim();if(/^[A-Za-z_$][\w$]*$/.test(L))C.push([L,L])}let r=H.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];H=H.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let v=`__stxBundle_${G}`,d=C.map(([$,U])=>`${JSON.stringify($)}: ${U}`).join(", "),l=C.map(([$])=>`var ${$} = undefined;`).join(`
4
- `),i=C.map(([$])=>`${$} = ${v}[${JSON.stringify($)}];`).join(`
5
- `);if(H=`${r.join(`
6
- `)}
7
- ${l}
8
- var ${v} = (function() {
9
- ${H}
10
- return { ${d} };
11
- })();
12
- ${i}`.trim(),T("bundled:",G,"output:",H.length,"bytes"),k.length>0&&C.length===0)return console.warn(`[stx:bundler] dropped every binding for ${K.basename(w)} (${G}); serving the unbundled source and not caching this result`),z;M.mkdirSync(Q,{recursive:!0}),await Bun.write(J,H);let P=Array.from(B).map(($)=>{try{return{path:$,mtimeMs:M.statSync($).mtimeMs}}catch{return null}}).filter(($)=>$!==null);return await Bun.write(W,JSON.stringify({metadataVersion:c,files:P})),o(w,P.map(($)=>$.path)),H}catch(V){let H=_(V,w||void 0),C=u(V,w||void 0);if(console.warn(`[stx:bundler] error: ${C}`),b(w||"",C,H),f()==="error")throw V;return z}finally{try{M.rmSync(S,{force:!0}),M.rmSync(y,{recursive:!0,force:!0})}catch{}}}function zw(z){let w=z.trim();if(!w)return null;let Y=w.indexOf("=");if(Y!==-1)w=w.slice(0,Y).trim();let Z=w.indexOf(":");if(Z!==-1)w=w.slice(Z+1).trim();if(w.startsWith("..."))w=w.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(w)?w:null}
13
- export{$w as _k,t as $k,b as al,Qw as bl,Xw as cl,Hw as dl,f as el,qw as fl,e as gl,Mw as hl};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{es as E}from"./chunk-9rw3z4t7.js";import{Su as D}from"./chunk-0y6f4037.js";import I from"path";async function M(q={}){let G=performance.now(),J=q.root||process.cwd(),j=await E(),y=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${y.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let A,B;if(y==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");A=await z({pagesDir:I.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,...q.ssg})}else{let{buildForProduction:z}=await import("./chunk-yz233j7e.js");B=await z({outputDir:".output",debug:q.debug,...q.ssr})}let H=Math.round(performance.now()-G);return{mode:y,ssg:A,ssr:B,duration:H}}
3
- export{M as kg};