@stacksjs/stx 0.2.883 → 0.2.884

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 (81) hide show
  1. package/dist/{chunk-7psdag9t.js → chunk-0c913abf.js} +1 -1
  2. package/dist/{chunk-90zpw7zw.js → chunk-0q117rw8.js} +1 -1
  3. package/dist/chunk-188st53m.js +2 -0
  4. package/dist/{chunk-yc9bpftb.js → chunk-19q3j7cd.js} +1 -1
  5. package/dist/{chunk-av1acvah.js → chunk-2bvms1pz.js} +2 -2
  6. package/dist/{chunk-e5kygw75.js → chunk-2nt2wjb2.js} +1 -1
  7. package/dist/chunk-3t0pf47w.js +2 -0
  8. package/dist/{chunk-gw6v6n8y.js → chunk-4qzytgtg.js} +2 -2
  9. package/dist/{chunk-w2p9mhef.js → chunk-5a73eghg.js} +1 -1
  10. package/dist/{chunk-gc65patn.js → chunk-5fn9s4e7.js} +1 -1
  11. package/dist/{chunk-rxm46f9z.js → chunk-5kh07k1p.js} +2 -2
  12. package/dist/{chunk-an4vtgem.js → chunk-6ha9vbjv.js} +2 -2
  13. package/dist/{chunk-fk45k15v.js → chunk-7vggqc7d.js} +1 -1
  14. package/dist/{chunk-29btwpda.js → chunk-7xc81f1w.js} +2 -2
  15. package/dist/{chunk-cb2gzs3m.js → chunk-8t8yzdzq.js} +1 -1
  16. package/dist/{chunk-26yzqev3.js → chunk-be201zh7.js} +5 -5
  17. package/dist/{chunk-tzmqvsmf.js → chunk-bnawaxh5.js} +1 -1
  18. package/dist/chunk-bx301nnn.js +2 -0
  19. package/dist/{chunk-6dq3qdg2.js → chunk-ccv21bj8.js} +1 -1
  20. package/dist/{chunk-yaenczev.js → chunk-d80re6y8.js} +4 -4
  21. package/dist/{chunk-7hf1xyrb.js → chunk-egmkawq6.js} +1 -1
  22. package/dist/chunk-fa3syk1m.js +3 -0
  23. package/dist/chunk-fzxynhyc.js +2 -0
  24. package/dist/chunk-gg4vcn6m.js +2 -0
  25. package/dist/{chunk-x3py9q5v.js → chunk-gksn30x7.js} +6 -6
  26. package/dist/{chunk-vz6dtfe9.js → chunk-gn2x58yq.js} +1 -1
  27. package/dist/{chunk-0rc5tg89.js → chunk-h573cegy.js} +1 -1
  28. package/dist/{chunk-w9zs57z0.js → chunk-hd6hc981.js} +1 -1
  29. package/dist/{chunk-3mepf96h.js → chunk-j5gcwg3k.js} +1 -1
  30. package/dist/{chunk-sqjv4kxc.js → chunk-jyyyzazb.js} +1 -1
  31. package/dist/{chunk-x2a5phpm.js → chunk-k06xctna.js} +1 -1
  32. package/dist/{chunk-vsraamv3.js → chunk-kg7w5xwh.js} +1 -1
  33. package/dist/chunk-mcc01ts7.js +2 -0
  34. package/dist/{chunk-r04j085h.js → chunk-mdb4pvv9.js} +1 -1
  35. package/dist/{chunk-ptg2karz.js → chunk-n2nxpgzc.js} +4 -4
  36. package/dist/{chunk-21tx0mbz.js → chunk-n4d7qk9w.js} +1 -1
  37. package/dist/{chunk-wxa1w308.js → chunk-nsa675xs.js} +1 -1
  38. package/dist/{chunk-dzpm2n8g.js → chunk-ntk07yeh.js} +1 -1
  39. package/dist/{chunk-ytbed3rp.js → chunk-pw2bfb6k.js} +1 -1
  40. package/dist/{chunk-se53e743.js → chunk-pxt57028.js} +1 -1
  41. package/dist/chunk-pzm31te2.js +2 -0
  42. package/dist/{chunk-ykzwrxpn.js → chunk-q8dkdnvg.js} +1 -1
  43. package/dist/{chunk-1r1kfskk.js → chunk-q910pjr4.js} +1 -1
  44. package/dist/{chunk-kyb5nyt8.js → chunk-rcjkms52.js} +2 -2
  45. package/dist/{chunk-0f6k5r31.js → chunk-rptq6d7b.js} +3 -3
  46. package/dist/{chunk-xynq9fcr.js → chunk-rqbqxs01.js} +1 -1
  47. package/dist/{chunk-24f59184.js → chunk-rx94z3d5.js} +1 -1
  48. package/dist/{chunk-tct0jrp1.js → chunk-rzq0s8k3.js} +1 -1
  49. package/dist/chunk-s7c1f3h4.js +2 -0
  50. package/dist/{chunk-htrptrn9.js → chunk-sb1e0rd8.js} +1 -1
  51. package/dist/{chunk-ckb8yk6a.js → chunk-se4xbbh5.js} +1 -1
  52. package/dist/{chunk-w7476ea6.js → chunk-swwn1pa7.js} +1 -1
  53. package/dist/{chunk-hnnargm3.js → chunk-szwde015.js} +1 -1
  54. package/dist/{chunk-99956f90.js → chunk-t25pwp2a.js} +10 -10
  55. package/dist/{chunk-32z3g0y1.js → chunk-tvhm8t45.js} +1 -1
  56. package/dist/{chunk-x8s9487t.js → chunk-twhahqbd.js} +1 -1
  57. package/dist/{chunk-myfsnf67.js → chunk-v5zm24gy.js} +1 -1
  58. package/dist/{chunk-jr61mjwn.js → chunk-vc3sz26f.js} +1 -1
  59. package/dist/{chunk-9y2n8wm6.js → chunk-vh1sewja.js} +1 -1
  60. package/dist/{chunk-8hc7mec0.js → chunk-we9k6vtw.js} +1 -1
  61. package/dist/{chunk-8cnavhtr.js → chunk-wkgzyjyv.js} +1 -1
  62. package/dist/{chunk-rk98082b.js → chunk-xs8fccfq.js} +1 -1
  63. package/dist/{chunk-8a09r8xy.js → chunk-yv1w9dqr.js} +4 -4
  64. package/dist/{chunk-3ahqdb2n.js → chunk-z9cz0vxm.js} +1 -1
  65. package/dist/cli.js +7 -7
  66. package/dist/craft-entry.js +1 -1
  67. package/dist/craft.js +1 -1
  68. package/dist/native/compiler/html-to-ir.d.ts +16 -0
  69. package/dist/native/compiler/html-to-ir.js +23 -1
  70. package/dist/pwa.js +1 -1
  71. package/dist/ssg.js +2 -2
  72. package/package.json +5 -5
  73. package/dist/chunk-0fmrrsbp.js +0 -2
  74. package/dist/chunk-2d170z61.js +0 -2
  75. package/dist/chunk-a6cwm61q.js +0 -2
  76. package/dist/chunk-a6mjqetx.js +0 -2
  77. package/dist/chunk-awywwbc5.js +0 -3
  78. package/dist/chunk-fb5vv2q5.js +0 -2
  79. package/dist/chunk-pnw1n18p.js +0 -2
  80. package/dist/chunk-rf5tatrc.js +0 -2
  81. package/dist/chunk-xncrk7dz.js +0 -2
@@ -262,7 +262,10 @@ function settle(frame, diagnostics) {
262
262
  }
263
263
  export async function translateHtmlToIR(html, options = {}) {
264
264
  html = await excludeNativeSubtrees(html);
265
- const diagnostics = [], stylesheetTheme = await extractStylesheetTheme(html, (name) => diagnostics.push({ kind: "unsupported-theme-rule", tag: "style", name })), stylesheetVariables = createStyleVariables(stylesheetTheme.light).computed(), usedClasses = new Set([...html.matchAll(/\sclass(?:name)?\s*=\s*"([^"]*)"/gi)].flatMap((match) => match[1].split(/\s+/))), stylesheetRules = await extractStylesheetRules(html, (name, classes) => {
265
+ const diagnostics = [];
266
+ for (const tag of strayEndTags(html))
267
+ diagnostics.push({ kind: "stray-end-tag", tag });
268
+ const stylesheetTheme = await extractStylesheetTheme(html, (name) => diagnostics.push({ kind: "unsupported-theme-rule", tag: "style", name })), stylesheetVariables = createStyleVariables(stylesheetTheme.light).computed(), usedClasses = new Set([...html.matchAll(/\sclass(?:name)?\s*=\s*"([^"]*)"/gi)].flatMap((match) => match[1].split(/\s+/))), stylesheetRules = await extractStylesheetRules(html, (name, classes) => {
266
269
  if (!classes.length || classes.some((name) => usedClasses.has(name)))
267
270
  diagnostics.push({ kind: "unsupported-style-rule", tag: "style", name });
268
271
  }), roots = [], stack = [], seenUnmapped = new Set;
@@ -658,6 +661,25 @@ export async function translateHtmlToDocument(html, options = {}) {
658
661
  diagnostics
659
662
  };
660
663
  }
664
+ const VOID_TAGS = new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
665
+ export function strayEndTags(html) {
666
+ const blank = (text) => text.replace(/[^\n]/g, " "), markup = html.replace(/<!--[\s\S]*?-->/g, blank).replace(/<(script|style|textarea|title)\b[^>]*>[\s\S]*?<\/\1\s*>/gi, blank).replace(/"[^"]*"|'[^']*'/g, (value) => value[0] + blank(value.slice(1, -1)) + value[0]), open = [], stray = [];
667
+ for (const match of markup.matchAll(/<(\/?)([a-z][\w:.-]*)[^<>]*?(\/?)>/gi)) {
668
+ const tag = match[2].toLowerCase();
669
+ if (VOID_TAGS.has(tag) || match[3])
670
+ continue;
671
+ if (!match[1]) {
672
+ open.push(tag);
673
+ continue;
674
+ }
675
+ const at = open.lastIndexOf(tag);
676
+ if (at === -1)
677
+ stray.push(tag);
678
+ else
679
+ open.length = at;
680
+ }
681
+ return stray;
682
+ }
661
683
  function removeSelfClosedExcludedTags(html) {
662
684
  let out = "", last = 0;
663
685
  for (let start = html.indexOf("<");start !== -1; start = html.indexOf("<", start + 1)) {
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  import{bo,en,Xl,tm}from"./chunk-69ezjc8k.js";import{yo,ta,Zg,Qg,em}from"./chunk-50cnypys.js";import{ql,Kl,Gl,Jg,Yg}from"./chunk-e41pgmgk.js";import{tt,Fn,na}from"./chunk-02qmvcmv.js";import{nm,rm,sm,om,wo,Vy}from"./chunk-dwyhpbpx.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
- Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-rf5tatrc.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
3
+ Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-3t0pf47w.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
package/dist/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-s29hp1qw.js";import"./chunk-a60ztvnp.js";import"./chunk-9f31gs4m.js";import{k,Tl}from"./chunk-295bykzd.js";import"./chunk-00tq7ghn.js";import"./chunk-hxhmhw23.js";import{zt,w}from"./chunk-x3py9q5v.js";import"./chunk-6t04tqvh.js";import"./chunk-xynq9fcr.js";import"./chunk-h63ma36g.js";import{Mt,Dt,Lt,jt,Bt,Ft}from"./chunk-agd2b928.js";import{a}from"./chunk-av1acvah.js";import{Fs}from"./chunk-0rdh8bw3.js";import"./chunk-ssg6ne5b.js";import"./chunk-vsraamv3.js";import{Ce,gn,mn}from"./chunk-dzpm2n8g.js";import"./chunk-9y2n8wm6.js";import{x}from"./chunk-kyb5nyt8.js";import{Rt,i}from"./chunk-ptg2karz.js";import"./chunk-cb2gzs3m.js";import"./chunk-8a09r8xy.js";import{Ts}from"./chunk-an4vtgem.js";import"./chunk-rk98082b.js";import"./chunk-c0g30cjs.js";import{vc,xc,Sc}from"./chunk-59er0fc7.js";import{pn,ur,dr}from"./chunk-p6hcrg3r.js";import{fn}from"./chunk-yc9bpftb.js";import"./chunk-awywwbc5.js";import"./chunk-d2pexm3z.js";import{ne,$e}from"./chunk-yaenczev.js";import"./chunk-cb0c6959.js";import"./chunk-nb6erf75.js";import"./chunk-htrptrn9.js";import{l}from"./chunk-s7xywsqd.js";import{et}from"./chunk-ws2h92mm.js";import{t,C}from"./chunk-yh2hnt3m.js";import{f}from"./chunk-xpbakn6t.js";import R from"fs";import m from"path";import{createHash as Pt}from"crypto";function $t(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}var kt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Et(e){return Bun.hash(e).toString(16)}function lt(e,n={}){if(!e.includes('type="stx/island"'))return{html:e,chunks:[]};let s=new Map,o=e.replace(kt,(r,u,g,v)=>{let S=v.trim();if(!S)return r;if(/\bdata-stx-src=/.test(g))return r;if(n.minify)S=$t(S);let p=Et(S);if(!s.has(p))s.set(p,S);let P=n.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(S).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),c=Array.from(s,([r,u])=>({hash:r,code:u}));return{html:o,chunks:c}}var Ct=new Set(["visible","idle"]);function ut(e){if(!e.includes("data-stx-src="))return e;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(e))!==null)n.set(o[1],o[2]);let c=new Set,r=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=r.exec(e))!==null)if(Ct.has(n.get(u[1])||""))c.add(u[2]);let g=/<\/head\s*>/iy,v=w(e,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return e;let S=Array.from(c).filter((p)=>!e.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!S)return e;return e.slice(0,v)+S+e.slice(v)}var It=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function Y(e){let n=e.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Tt(e){for(let n of It){let s=e[n];if(!s)continue;let o=Y(s);if(o)return{url:o,source:"env",via:n}}return null}function dt(e){if(!e||typeof e!=="object")return null;let n=e,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?Y(s):null}async function At(e){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(e,o);if(!n(c))continue;try{let r=await import(c),u=dt(r.default??r);if(u)return u}catch{}}return null}async function gt(e={}){let n=e.cwd??process.cwd(),s=e.env??process.env;if(e.explicit){let u=Y(e.explicit);if(u)return{url:u,source:"option"}}let o=dt(e.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let c=await At(n);if(c)return{url:c,source:"site.config",via:"url"};let r=Tt(s);if(r)return r;return{url:"http://localhost",source:"fallback"}}function pt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
2
+ import"./chunk-s29hp1qw.js";import"./chunk-a60ztvnp.js";import"./chunk-9f31gs4m.js";import{k,Tl}from"./chunk-295bykzd.js";import"./chunk-00tq7ghn.js";import"./chunk-hxhmhw23.js";import{zt,w}from"./chunk-gksn30x7.js";import"./chunk-6t04tqvh.js";import"./chunk-rqbqxs01.js";import"./chunk-h63ma36g.js";import{Mt,Dt,Lt,jt,Bt,Ft}from"./chunk-agd2b928.js";import{a}from"./chunk-2bvms1pz.js";import{Fs}from"./chunk-0rdh8bw3.js";import"./chunk-ssg6ne5b.js";import"./chunk-kg7w5xwh.js";import{Ce,gn,mn}from"./chunk-ntk07yeh.js";import"./chunk-vh1sewja.js";import{x}from"./chunk-rcjkms52.js";import{Rt,i}from"./chunk-n2nxpgzc.js";import"./chunk-8t8yzdzq.js";import"./chunk-yv1w9dqr.js";import{Ts}from"./chunk-6ha9vbjv.js";import"./chunk-xs8fccfq.js";import"./chunk-c0g30cjs.js";import{vc,xc,Sc}from"./chunk-59er0fc7.js";import{pn,ur,dr}from"./chunk-p6hcrg3r.js";import{fn}from"./chunk-19q3j7cd.js";import"./chunk-fa3syk1m.js";import"./chunk-d2pexm3z.js";import{ne,$e}from"./chunk-d80re6y8.js";import"./chunk-cb0c6959.js";import"./chunk-nb6erf75.js";import"./chunk-sb1e0rd8.js";import{l}from"./chunk-s7xywsqd.js";import{et}from"./chunk-ws2h92mm.js";import{t,C}from"./chunk-yh2hnt3m.js";import{f}from"./chunk-xpbakn6t.js";import R from"fs";import m from"path";import{createHash as Pt}from"crypto";function $t(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}var kt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Et(e){return Bun.hash(e).toString(16)}function lt(e,n={}){if(!e.includes('type="stx/island"'))return{html:e,chunks:[]};let s=new Map,o=e.replace(kt,(r,u,g,v)=>{let S=v.trim();if(!S)return r;if(/\bdata-stx-src=/.test(g))return r;if(n.minify)S=$t(S);let p=Et(S);if(!s.has(p))s.set(p,S);let P=n.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(S).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),c=Array.from(s,([r,u])=>({hash:r,code:u}));return{html:o,chunks:c}}var Ct=new Set(["visible","idle"]);function ut(e){if(!e.includes("data-stx-src="))return e;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(e))!==null)n.set(o[1],o[2]);let c=new Set,r=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=r.exec(e))!==null)if(Ct.has(n.get(u[1])||""))c.add(u[2]);let g=/<\/head\s*>/iy,v=w(e,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return e;let S=Array.from(c).filter((p)=>!e.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!S)return e;return e.slice(0,v)+S+e.slice(v)}var It=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function Y(e){let n=e.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Tt(e){for(let n of It){let s=e[n];if(!s)continue;let o=Y(s);if(o)return{url:o,source:"env",via:n}}return null}function dt(e){if(!e||typeof e!=="object")return null;let n=e,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?Y(s):null}async function At(e){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(e,o);if(!n(c))continue;try{let r=await import(c),u=dt(r.default??r);if(u)return u}catch{}}return null}async function gt(e={}){let n=e.cwd??process.cwd(),s=e.env??process.env;if(e.explicit){let u=Y(e.explicit);if(u)return{url:u,source:"option"}}let o=dt(e.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let c=await At(n);if(c)return{url:c,source:"site.config",via:"url"};let r=Tt(s);if(r)return r;return{url:"http://localhost",source:"fallback"}}function pt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
3
  `)}function V(e){return async()=>({paths:await e(),fallback:!1})}var Ot;function Ut(e){let n=t(e),{depths:s}=C(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=o.exec(n))!==null){if(s[c.index]!==0)continue;let u=k(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=k(n,"{","}",g);if(u<0||g<0||v<0)break;return e.slice(c.index,v+1)}let r=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=r.exec(n))!==null){if(s[c.index]!==0)continue;let u=Tl(n,r.lastIndex).endPos;return e.slice(r.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function ft(e){let n="read";try{let s=await Bun.file(e).text();n="parse";let o=fn(s),c=[...o.server,...o.client,...o.signals].filter((r)=>/(?:^|\s)server(?:\s|=|$)/i.test(t(r.attrs))).sort((r,u)=>s.indexOf(r.fullTag)-s.indexOf(u.fullTag));for(let r of c){if(!/\bgetStaticPaths\b/.test(t(r.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(r.content);if(!/\bgetStaticPaths\b/.test(t(u)))continue;let g=Ut(u);if(/\bdefineStaticPaths\b/.test(t(g))&&zt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(V);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let S=await v();n="result";let p=Array.isArray(S)?{paths:S}:S;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class ht{cacheDir;cache=new Map;loaded=!1;salt;constructor(e,n=""){this.cacheDir=e,this.salt=n}async load(){if(this.loaded)return;let e=m.join(this.cacheDir,"build-cache.json");if(await Bun.file(e).exists())try{let n=JSON.parse(await Bun.file(e).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await R.promises.mkdir(this.cacheDir,{recursive:!0});let e=m.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(e,JSON.stringify(n))}getHash(e,n){let s=R.statSync(e),o=`${this.salt}|${e}:${s.mtimeMs}`;for(let r of n)if(R.existsSync(r)){let u=R.statSync(r);o+=`:${r}:${u.mtimeMs}`}let c=0;for(let r=0;r<o.length;r++){let u=o.charCodeAt(r);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(e,n){let s=this.cache.get(e);if(!s)return null;let o=wt(n).some((u)=>R.existsSync(u)),c=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&R.existsSync(u)&&Ts(R.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||c)return this.cache.delete(e),null;let r=this.getHash(n,s.dependencies??[]);if(s.hash!==r)return this.cache.delete(e),null;return s.html}set(e,n,s,o){let c=this.getHash(n,s);this.cache.set(e,{hash:c,html:o,generatedAt:Date.now(),dependencies:s})}}class mt{cacheDir;constructor(e){this.cacheDir=e}getFilePath(e){let n=e.replace(/[^a-zA-Z0-9]/g,"_")+".json";return m.join(this.cacheDir,"isr",n)}async get(e){let n=this.getFilePath(e);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(e,n){let s=this.getFilePath(e);await R.promises.mkdir(m.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(e){let n=this.getFilePath(e);if(await Bun.file(n).exists())await R.promises.unlink(n)}async invalidatePattern(e){let n=m.join(this.cacheDir,"isr");if(!R.existsSync(n))return;let s=await R.promises.readdir(n);for(let o of s){let c=o.replace(/_/g,"/").replace(".json","");if(e.test(c))await R.promises.unlink(m.join(n,o))}}async needsRevalidation(e){let n=await this.get(e);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function _t(e){let n=[];if(!e.isDynamic)n.push({url:e.pattern,params:{}});else{let s=await ft(e.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${e.pattern} (${e.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${e.pattern} (${e.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${e.pattern} (${e.filePath})`),n;for(let c of o.paths){let r=e.pattern;for(let[u,g]of Object.entries(c.params))r=r.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:r,params:c.params,props:c.props,revalidate:c.revalidate})}}return n}function wt(e){return[e.replace(/\.stx$/,".data.ts"),e.replace(/\.stx$/,".data.js"),e+".data.ts",e+".data.js"]}async function Gt(e){for(let n of wt(e))if(await Bun.file(n).exists())try{let s=await import(n);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...c}=s;return c}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Ht(e,n,s){let o=e.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let c=o[1];if(!c.includes("getStaticProps"))return null;try{let r=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!r)return null;return await Function("params",`
4
4
  return (async function getStaticProps() {
5
5
  ${r[1]}
@@ -36,7 +36,7 @@ ${e.map((o)=>{let c=new URL(o.loc,n).href,r=` <url>
36
36
  ${s.join(`
37
37
  `)}
38
38
  </channel>
39
- </rss>`}async function Xt(e={}){let n=Date.now();mn();let s=await a(process.cwd()),o=s.build||{},c=await gt({explicit:e.domain||o.domain,stxConfig:s});if(c.source==="fallback"&&(e.sitemap??o.sitemap??!0))console.warn(pt());let r={router:e.router??s?.router??{},pagesDir:e.pagesDir||o.pagesDir||"pages",outputDir:e.outputDir||o.outputDir||"dist",baseUrl:e.baseUrl||o.baseUrl||"/",domain:c.url,revalidate:e.revalidate??o.revalidate??!1,sitemap:e.sitemap??o.sitemap??!0,sitemapExclude:e.sitemapExclude||o.sitemapExclude||[],robots:e.robots??o.robots??!0,rss:e.rss??o.rss??!1,concurrency:e.concurrency||o.concurrency||10,cache:e.cache??o.cache??!0,cacheDir:e.cacheDir||o.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:e.contentLoaders||[],hooks:e.hooks||{},minify:e.minify??o.minify??!0,generate404:e.generate404??o.generate404??!0,publicDir:e.publicDir||o.publicDir||"public",trailingSlash:e.trailingSlash??o.trailingSlash??!1,cleanOutput:e.cleanOutput??o.cleanOutput??!0,cacheSalt:e.cacheSalt??"",partialsDir:e.partialsDir||s?.partialsDir||"",componentsDir:e.componentsDir||s?.componentsDir||"",failOnIncludeError:e.failOnIncludeError??!0,failOnServerScriptError:e.failOnServerScriptError??!0,chunkIslands:e.chunkIslands===!0,prefetchIslands:e.prefetchIslands===!0,integrityIslands:e.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,S={},p={};await r.hooks.onBuildStart?.();try{if(r.cleanOutput&&R.existsSync(r.outputDir))await R.promises.rm(r.outputDir,{recursive:!0});await R.promises.mkdir(r.outputDir,{recursive:!0});let I=r.cacheSalt;if(!I){let{resolveUserCssConfig:d,fingerprintConfig:y}=await import("./chunk-7hf1xyrb.js");try{I=y(await d(process.cwd()))}catch{}}let{prepareImageDelivery:b}=await import("./chunk-se53e743.js"),E=await b(r.publicDir,r.outputDir);if(E.count>0)console.log(`Optimized ${E.count} image(s) for responsive delivery`),I=[I,E.fingerprint].filter(Boolean).join(":");let L=new ht(r.cacheDir,I);if(r.cache)await L.load();try{let{generateCss:d}=await import("./chunk-7hf1xyrb.js");await d('<div class="bg-black"></div>')}catch{}Mt();let St=s?.routeMiddleware?.dir||"middleware";await Lt(process.cwd(),St);let K=Dt();if(K.length>0)console.log(`Loaded ${K.length} middleware: ${K.join(", ")}`);let xt=s?.routeMiddleware?.global||[];Sc(s?.layoutsDir,l(process.cwd()));let Q=ne(".",{pagesDir:r.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Q.length} routes`);let _=[];for(let d of Q)try{let y=await _t(d);for(let D of y)_.push({route:d,url:D.url,params:D.params,props:D.props,revalidate:D.revalidate??r.revalidate})}catch(y){let D=y instanceof Error?y:Error(String(y));u.failedCount++,u.errors.push({route:d.pattern,error:D}),await r.hooks.onError?.(D,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,D)}u.totalPages=_.length+u.failedCount,console.log(`Generating ${_.length} pages...`);let M=[],tt=[];for(let d=0;d<_.length;d+=r.concurrency)tt.push(_.slice(d,d+r.concurrency));for(let d of tt)await Promise.all(d.map(async(y)=>{let{route:D,url:h,params:G,props:bt,revalidate:it}=y;try{await r.hooks.onPageStart?.(h);let H=await Bun.file(D.filePath).text(),O=Qt(H),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],st=[...xt,...vt];if(st.length>0){let F=jt(h,G,O||{}),z=Bt(F,null,void 0,{isServer:!0}),T=await Ft(st,z);if(T.redirect){let B=typeof T.redirect==="string"?T.redirect:T.redirect.path||T.redirect,W=te(String(B),h),U=ee(h,r);await R.promises.mkdir(m.dirname(U),{recursive:!0}),await Bun.write(U,W),u.successCount++,u.pages.push({route:h,outputPath:U,size:Buffer.byteLength(W),cached:!1}),M.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${B}`);return}if(T.abort){let B=typeof T.abort==="string"?T.abort:T.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${B}`);return}}let at=O?.validate;if(typeof at==="function")try{if(!await at({params:G})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let j=null,ot=!1;if(r.cache){if(j=L.get(h,D.filePath),j)ot=!0,u.cachedCount++}if(!j){let F=await yt(D,G,bt,r,s);if(j=F.html,r.failOnIncludeError&&F.includeFailures.length>0)throw Error(`${F.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
39
+ </rss>`}async function Xt(e={}){let n=Date.now();mn();let s=await a(process.cwd()),o=s.build||{},c=await gt({explicit:e.domain||o.domain,stxConfig:s});if(c.source==="fallback"&&(e.sitemap??o.sitemap??!0))console.warn(pt());let r={router:e.router??s?.router??{},pagesDir:e.pagesDir||o.pagesDir||"pages",outputDir:e.outputDir||o.outputDir||"dist",baseUrl:e.baseUrl||o.baseUrl||"/",domain:c.url,revalidate:e.revalidate??o.revalidate??!1,sitemap:e.sitemap??o.sitemap??!0,sitemapExclude:e.sitemapExclude||o.sitemapExclude||[],robots:e.robots??o.robots??!0,rss:e.rss??o.rss??!1,concurrency:e.concurrency||o.concurrency||10,cache:e.cache??o.cache??!0,cacheDir:e.cacheDir||o.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:e.contentLoaders||[],hooks:e.hooks||{},minify:e.minify??o.minify??!0,generate404:e.generate404??o.generate404??!0,publicDir:e.publicDir||o.publicDir||"public",trailingSlash:e.trailingSlash??o.trailingSlash??!1,cleanOutput:e.cleanOutput??o.cleanOutput??!0,cacheSalt:e.cacheSalt??"",partialsDir:e.partialsDir||s?.partialsDir||"",componentsDir:e.componentsDir||s?.componentsDir||"",failOnIncludeError:e.failOnIncludeError??!0,failOnServerScriptError:e.failOnServerScriptError??!0,chunkIslands:e.chunkIslands===!0,prefetchIslands:e.prefetchIslands===!0,integrityIslands:e.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,S={},p={};await r.hooks.onBuildStart?.();try{if(r.cleanOutput&&R.existsSync(r.outputDir))await R.promises.rm(r.outputDir,{recursive:!0});await R.promises.mkdir(r.outputDir,{recursive:!0});let I=r.cacheSalt;if(!I){let{resolveUserCssConfig:d,fingerprintConfig:y}=await import("./chunk-egmkawq6.js");try{I=y(await d(process.cwd()))}catch{}}let{prepareImageDelivery:b}=await import("./chunk-pxt57028.js"),E=await b(r.publicDir,r.outputDir);if(E.count>0)console.log(`Optimized ${E.count} image(s) for responsive delivery`),I=[I,E.fingerprint].filter(Boolean).join(":");let L=new ht(r.cacheDir,I);if(r.cache)await L.load();try{let{generateCss:d}=await import("./chunk-egmkawq6.js");await d('<div class="bg-black"></div>')}catch{}Mt();let St=s?.routeMiddleware?.dir||"middleware";await Lt(process.cwd(),St);let K=Dt();if(K.length>0)console.log(`Loaded ${K.length} middleware: ${K.join(", ")}`);let xt=s?.routeMiddleware?.global||[];Sc(s?.layoutsDir,l(process.cwd()));let Q=ne(".",{pagesDir:r.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Q.length} routes`);let _=[];for(let d of Q)try{let y=await _t(d);for(let D of y)_.push({route:d,url:D.url,params:D.params,props:D.props,revalidate:D.revalidate??r.revalidate})}catch(y){let D=y instanceof Error?y:Error(String(y));u.failedCount++,u.errors.push({route:d.pattern,error:D}),await r.hooks.onError?.(D,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,D)}u.totalPages=_.length+u.failedCount,console.log(`Generating ${_.length} pages...`);let M=[],tt=[];for(let d=0;d<_.length;d+=r.concurrency)tt.push(_.slice(d,d+r.concurrency));for(let d of tt)await Promise.all(d.map(async(y)=>{let{route:D,url:h,params:G,props:bt,revalidate:it}=y;try{await r.hooks.onPageStart?.(h);let H=await Bun.file(D.filePath).text(),O=Qt(H),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],st=[...xt,...vt];if(st.length>0){let F=jt(h,G,O||{}),z=Bt(F,null,void 0,{isServer:!0}),T=await Ft(st,z);if(T.redirect){let B=typeof T.redirect==="string"?T.redirect:T.redirect.path||T.redirect,W=te(String(B),h),U=ee(h,r);await R.promises.mkdir(m.dirname(U),{recursive:!0}),await Bun.write(U,W),u.successCount++,u.pages.push({route:h,outputPath:U,size:Buffer.byteLength(W),cached:!1}),M.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${B}`);return}if(T.abort){let B=typeof T.abort==="string"?T.abort:T.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${B}`);return}}let at=O?.validate;if(typeof at==="function")try{if(!await at({params:G})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let j=null,ot=!1;if(r.cache){if(j=L.get(h,D.filePath),j)ot=!0,u.cachedCount++}if(!j){let F=await yt(D,G,bt,r,s);if(j=F.html,r.failOnIncludeError&&F.includeFailures.length>0)throw Error(`${F.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
40
40
  ${F.includeFailures.join(`
41
41
  `)}
42
42
  Set ssg.failOnIncludeError to false to build anyway.`);if(r.failOnServerScriptError&&F.serverScriptFailures.length>0)throw Error(`${F.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.883",
4
+ "version": "0.2.884",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -127,14 +127,14 @@
127
127
  },
128
128
  "dependencies": {
129
129
  "@stacksjs/clapp": "^0.2.17",
130
- "@stacksjs/desktop": "0.2.883",
131
- "@stacksjs/sanitizer": "0.2.883",
130
+ "@stacksjs/desktop": "0.2.884",
131
+ "@stacksjs/sanitizer": "0.2.884",
132
132
  "@stacksjs/ts-css": "^0.3.21",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
134
  "@types/dom-speech-recognition": "^0.0.12",
135
- "bun-plugin-stx": "0.2.883",
135
+ "bun-plugin-stx": "0.2.884",
136
136
  "bunfig": "^0.15.21",
137
- "stx-router": "0.2.883",
137
+ "stx-router": "0.2.884",
138
138
  "ts-broadcasting": "^0.0.13",
139
139
  "ts-images": "^0.2.22",
140
140
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Pm}from"./chunk-w7476ea6.js";import"./chunk-0f6k5r31.js";import"./chunk-4fkcn6z5.js";import"./chunk-yc9bpftb.js";import"./chunk-vsraamv3.js";import"./chunk-ptg2karz.js";import"./chunk-kyb5nyt8.js";import"./chunk-8a09r8xy.js";import"./chunk-c0g30cjs.js";import"./chunk-cb2gzs3m.js";import"./chunk-awywwbc5.js";import"./chunk-rk98082b.js";import"./chunk-d2pexm3z.js";import"./chunk-an4vtgem.js";import"./chunk-yaenczev.js";import"./chunk-cb0c6959.js";import"./chunk-9y2n8wm6.js";import"./chunk-nb6erf75.js";import"./chunk-av1acvah.js";import"./chunk-htrptrn9.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-x3py9q5v.js";import"./chunk-xynq9fcr.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Pm as buildForProduction};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{lh,za,Lu,uh,dh,ph,fh,gh,ju,Bu,mh,hh,yh,bh}from"./chunk-sqjv4kxc.js";import"./chunk-ptg2karz.js";import"./chunk-kyb5nyt8.js";import"./chunk-8a09r8xy.js";import"./chunk-c0g30cjs.js";import"./chunk-cb2gzs3m.js";import"./chunk-awywwbc5.js";import"./chunk-rk98082b.js";import"./chunk-d2pexm3z.js";import"./chunk-an4vtgem.js";import"./chunk-yaenczev.js";import"./chunk-cb0c6959.js";import"./chunk-9y2n8wm6.js";import"./chunk-nb6erf75.js";import"./chunk-av1acvah.js";import"./chunk-htrptrn9.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-x3py9q5v.js";import"./chunk-xynq9fcr.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Lu as SUSPENSE_RESOLVER_RUNTIME,za as buildSuspenseResolveScript,gh as createStreamRenderer,ph as extractStreamBoundaries,bh as generateHydrationRuntime,Bu as islandDirective,hh as processSectionDirectives,dh as processStreamDirectives,mh as registerStreamingDirectives,uh as renderStreamingPage,lh as streamTemplate,fh as streamTemplateSimple,yh as streamToResponse,ju as streamingSuspenseDirective};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{xm}from"./chunk-vz6dtfe9.js";import"./chunk-ptg2karz.js";import"./chunk-kyb5nyt8.js";import"./chunk-8a09r8xy.js";import"./chunk-c0g30cjs.js";import"./chunk-cb2gzs3m.js";import"./chunk-awywwbc5.js";import"./chunk-rk98082b.js";import"./chunk-d2pexm3z.js";import"./chunk-an4vtgem.js";import"./chunk-yaenczev.js";import"./chunk-cb0c6959.js";import"./chunk-9y2n8wm6.js";import"./chunk-nb6erf75.js";import"./chunk-av1acvah.js";import"./chunk-htrptrn9.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-x3py9q5v.js";import"./chunk-xynq9fcr.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{xm as startInteractive};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Lo,jh,Bh}from"./chunk-fk45k15v.js";import"./chunk-dzpm2n8g.js";import"./chunk-vsraamv3.js";import"./chunk-9f31gs4m.js";import"./chunk-an4vtgem.js";import"./chunk-yaenczev.js";import"./chunk-cb0c6959.js";import"./chunk-nb6erf75.js";import"./chunk-av1acvah.js";import"./chunk-htrptrn9.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-x3py9q5v.js";import"./chunk-xynq9fcr.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Bh as clearComposableCache,jh as getComposableScript,Lo as listComposableModules};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{Y}from"./chunk-x3py9q5v.js";function r(t){return Y(t)}
3
- export{r};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ql,eu}from"./chunk-26yzqev3.js";import"./chunk-94ctmp0j.js";import"./chunk-vz6dtfe9.js";import"./chunk-myfsnf67.js";import"./chunk-1r1kfskk.js";import"./chunk-4n45qa0b.js";import"./chunk-czcx3nbx.js";import"./chunk-x8s9487t.js";import"./chunk-w7476ea6.js";import"./chunk-0f6k5r31.js";import"./chunk-2r0nrvqe.js";import"./chunk-q1mb0fbt.js";import"./chunk-pdprhg5k.js";import"./chunk-r04j085h.js";import"./chunk-q74affc4.js";import"./chunk-gbncp2gp.js";import"./chunk-yp4tn4zn.js";import"./chunk-8va3fs07.js";import"./chunk-sv7fdqmc.js";import"./chunk-a7ryj8z8.js";import"./chunk-w9zs57z0.js";import"./chunk-sqjv4kxc.js";import"./chunk-aaea157p.js";import"./chunk-8e1cv1hh.js";import"./chunk-ybjgnnyf.js";import"./chunk-a0q0kb0s.js";import"./chunk-ytbed3rp.js";import"./chunk-fk45k15v.js";import"./chunk-4fkcn6z5.js";import"./chunk-29btwpda.js";import"./chunk-kee5a3ce.js";import"./chunk-59er0fc7.js";import{fn}from"./chunk-yc9bpftb.js";import{Qf}from"./chunk-dzpm2n8g.js";import"./chunk-vsraamv3.js";import"./chunk-9f31gs4m.js";import{ze,i}from"./chunk-ptg2karz.js";import"./chunk-kyb5nyt8.js";import"./chunk-8a09r8xy.js";import"./chunk-c0g30cjs.js";import"./chunk-cb2gzs3m.js";import"./chunk-awywwbc5.js";import"./chunk-rk98082b.js";import"./chunk-d2pexm3z.js";import"./chunk-an4vtgem.js";import{$e}from"./chunk-yaenczev.js";import"./chunk-cb0c6959.js";import{Sr,kr}from"./chunk-9y2n8wm6.js";import"./chunk-nb6erf75.js";import{Ms,W,a}from"./chunk-av1acvah.js";import"./chunk-htrptrn9.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import{j,h,Ke}from"./chunk-x3py9q5v.js";import"./chunk-xynq9fcr.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";import{ra}from"./chunk-xpbakn6t.js";import"./chunk-463weehv.js";import"./chunk-shcnt6aa.js";export{Ms as buildWebComponents,kr as cacheTemplate,Sr as checkCache,fn as classifyAllScripts,Ql as createMiddleware,eu as createRoute,W as defaultConfig,h as extractVariables,j as findSfcTemplateBlock,$e as injectRouterScript,ra as insertBeforeBodyClose,a as loadStxConfig,Ke as processClientScript,i as processDirectives,ze as readMarkdownFile,Qf as withinBundlerCallback};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{km}from"./chunk-1r1kfskk.js";import"./chunk-0f6k5r31.js";import"./chunk-yc9bpftb.js";import"./chunk-vsraamv3.js";import"./chunk-awywwbc5.js";import"./chunk-yaenczev.js";import"./chunk-av1acvah.js";import"./chunk-htrptrn9.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-x3py9q5v.js";import"./chunk-xynq9fcr.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{km as startProductionServer};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{gr,i}from"./chunk-ptg2karz.js";import"./chunk-kyb5nyt8.js";import"./chunk-8a09r8xy.js";import"./chunk-c0g30cjs.js";import"./chunk-cb2gzs3m.js";import"./chunk-awywwbc5.js";import"./chunk-rk98082b.js";import"./chunk-d2pexm3z.js";import"./chunk-an4vtgem.js";import{$e}from"./chunk-yaenczev.js";import"./chunk-cb0c6959.js";import"./chunk-9y2n8wm6.js";import"./chunk-nb6erf75.js";import"./chunk-av1acvah.js";import"./chunk-htrptrn9.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import{Ue,ro,so}from"./chunk-x3py9q5v.js";import"./chunk-xynq9fcr.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{gr as buildModulesTag,$e as injectRouterScript,i as processDirectives,ro as processJsonDirective,so as processOnceDirective,Ue as validateClientScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ga,Xa,Ja,Ya,Yh}from"./chunk-32z3g0y1.js";import"./chunk-e362e615.js";import"./chunk-29btwpda.js";import"./chunk-kee5a3ce.js";import"./chunk-ptg2karz.js";import"./chunk-kyb5nyt8.js";import"./chunk-8a09r8xy.js";import"./chunk-c0g30cjs.js";import"./chunk-cb2gzs3m.js";import"./chunk-awywwbc5.js";import"./chunk-rk98082b.js";import"./chunk-d2pexm3z.js";import"./chunk-an4vtgem.js";import"./chunk-yaenczev.js";import"./chunk-cb0c6959.js";import"./chunk-9y2n8wm6.js";import"./chunk-nb6erf75.js";import"./chunk-av1acvah.js";import"./chunk-htrptrn9.js";import"./chunk-h63ma36g.js";import"./chunk-ssg6ne5b.js";import"./chunk-0rdh8bw3.js";import"./chunk-agd2b928.js";import"./chunk-x3py9q5v.js";import"./chunk-xynq9fcr.js";import"./chunk-6t04tqvh.js";import"./chunk-295bykzd.js";import"./chunk-hxhmhw23.js";import"./chunk-a60ztvnp.js";import"./chunk-s29hp1qw.js";import"./chunk-00tq7ghn.js";export{Ga as buildNative,Yh as default,Xa as findCraftBinary,Ya as getAvailableFormats,Ja as getAvailableTargets};