@stacksjs/stx 0.2.713 → 0.2.715

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 (216) hide show
  1. package/dist/{chunk-vstvadc2.js → chunk-05qf3e2p.js} +3 -3
  2. package/dist/chunk-0ea32p9a.js +2 -0
  3. package/dist/{chunk-cpyc6t0d.js → chunk-0es09zhs.js} +1 -1
  4. package/dist/chunk-0g9a1kks.js +2 -0
  5. package/dist/chunk-0hbr71zw.js +2 -0
  6. package/dist/chunk-0jg61rty.js +2 -0
  7. package/dist/chunk-0raaa32s.js +2 -0
  8. package/dist/{chunk-39073rh9.js → chunk-0v7w578w.js} +39 -39
  9. package/dist/{chunk-hcve898s.js → chunk-203w5096.js} +4 -4
  10. package/dist/{chunk-3ps07041.js → chunk-2mqzpzy7.js} +4 -4
  11. package/dist/{chunk-wbfg7p3k.js → chunk-2t00wxz0.js} +1 -1
  12. package/dist/{chunk-46bd866e.js → chunk-2yhy3b9h.js} +3 -3
  13. package/dist/chunk-336t7zzz.js +2 -0
  14. package/dist/chunk-362sjw8c.js +2 -0
  15. package/dist/{chunk-dxqvv686.js → chunk-39nkd53v.js} +2 -2
  16. package/dist/{chunk-yw66yks2.js → chunk-3e40sm05.js} +4 -4
  17. package/dist/{chunk-zjw6j2x0.js → chunk-3fwdxxh1.js} +4 -4
  18. package/dist/{chunk-vcpynqvy.js → chunk-3g12ehgs.js} +3 -3
  19. package/dist/chunk-3j8x8mhx.js +2 -0
  20. package/dist/chunk-3nbvr34s.js +2 -0
  21. package/dist/{chunk-cc2ss77r.js → chunk-3pc7vgbz.js} +6 -6
  22. package/dist/chunk-3ssdfr6t.js +2 -0
  23. package/dist/{chunk-zav8yrtp.js → chunk-3xyvc3g1.js} +5 -5
  24. package/dist/{chunk-0sg7zzmr.js → chunk-44hfa3g1.js} +5 -5
  25. package/dist/{chunk-stvw8y3c.js → chunk-4c86wr9a.js} +2 -2
  26. package/dist/chunk-4ee5msma.js +2 -0
  27. package/dist/{chunk-tnmz1t1p.js → chunk-4gsxgxxy.js} +5 -5
  28. package/dist/chunk-5d1c504j.js +2 -0
  29. package/dist/chunk-5gd4dvnf.js +2 -0
  30. package/dist/chunk-5wpgbwap.js +2 -0
  31. package/dist/{chunk-qa9t9k6z.js → chunk-62awa752.js} +1 -1
  32. package/dist/{chunk-mr3r8crk.js → chunk-630yrhzv.js} +2 -2
  33. package/dist/{chunk-kxf8z7vp.js → chunk-6fx89gvg.js} +2 -2
  34. package/dist/chunk-6h1qa3hw.js +2 -0
  35. package/dist/chunk-6jn0p1a9.js +2 -0
  36. package/dist/{chunk-ckrmrdjp.js → chunk-72hfqwvk.js} +5 -5
  37. package/dist/{chunk-cwhzk2n3.js → chunk-74fepz6h.js} +2 -2
  38. package/dist/{chunk-42w6snem.js → chunk-78x8qfvt.js} +4 -4
  39. package/dist/chunk-79sjdpfy.js +2 -0
  40. package/dist/chunk-8428g1wb.js +2 -0
  41. package/dist/{chunk-zecgd1wz.js → chunk-88rftjjk.js} +4 -4
  42. package/dist/chunk-8dfq934n.js +2 -0
  43. package/dist/{chunk-t6ayy0t5.js → chunk-8fazd6fr.js} +2 -2
  44. package/dist/chunk-8w1ep4w3.js +2 -0
  45. package/dist/chunk-918xy0ra.js +2 -0
  46. package/dist/chunk-991f1a9r.js +2 -0
  47. package/dist/{chunk-h54w4fg6.js → chunk-9cak38bg.js} +5 -5
  48. package/dist/{chunk-tvcr9sct.js → chunk-9chqvq23.js} +3 -3
  49. package/dist/{chunk-gecdjyb5.js → chunk-9gxgef2a.js} +8 -8
  50. package/dist/{chunk-067sgh2j.js → chunk-9nev9akt.js} +76 -76
  51. package/dist/{chunk-vapj4s7f.js → chunk-9s9ckhp9.js} +6 -6
  52. package/dist/chunk-9tzn44nx.js +2 -0
  53. package/dist/{chunk-5ctdwyq1.js → chunk-9x3tvgjq.js} +6 -6
  54. package/dist/chunk-a49at1ah.js +2 -0
  55. package/dist/{chunk-qd6s902s.js → chunk-a6ntnyea.js} +5 -5
  56. package/dist/{chunk-xjge15am.js → chunk-aaw2466e.js} +6 -6
  57. package/dist/chunk-agjysd2b.js +2 -0
  58. package/dist/chunk-ak04tgvw.js +2 -0
  59. package/dist/{chunk-w246aa0j.js → chunk-aw7ypr6k.js} +4 -4
  60. package/dist/chunk-azatpcm0.js +2 -0
  61. package/dist/chunk-c1481efw.js +2 -0
  62. package/dist/chunk-c8yrvpr7.js +2 -0
  63. package/dist/chunk-cbbjepfk.js +2 -0
  64. package/dist/{chunk-6cz1sbb1.js → chunk-d9hw6n2d.js} +3 -3
  65. package/dist/{chunk-zjaw79zp.js → chunk-dhy6n39n.js} +2 -2
  66. package/dist/{chunk-edka95zp.js → chunk-dmnncw90.js} +3 -3
  67. package/dist/{chunk-b7j48bq9.js → chunk-dnqzrktd.js} +2 -2
  68. package/dist/{chunk-13z9b912.js → chunk-dr32we87.js} +18 -18
  69. package/dist/{chunk-e6ky15dr.js → chunk-ez35607j.js} +2 -2
  70. package/dist/{chunk-768evhvm.js → chunk-f2c3t1ky.js} +2 -2
  71. package/dist/{chunk-x2gxx8eg.js → chunk-f4gqzg1y.js} +2 -2
  72. package/dist/{chunk-t413xatv.js → chunk-fqfbsr8n.js} +10 -10
  73. package/dist/{chunk-029qng4p.js → chunk-fsz9k5k0.js} +5 -5
  74. package/dist/{chunk-0tay8xjs.js → chunk-ftvh9y2v.js} +1 -1
  75. package/dist/{chunk-42rw3f1h.js → chunk-gmqr249g.js} +2 -2
  76. package/dist/chunk-gv2e2dw6.js +2 -0
  77. package/dist/{chunk-an387127.js → chunk-h16qbyjd.js} +2 -2
  78. package/dist/{chunk-t63f15yh.js → chunk-hez09ssh.js} +2 -2
  79. package/dist/{chunk-c1fjdp7s.js → chunk-hfneeen7.js} +1 -1
  80. package/dist/{chunk-2aarvd3a.js → chunk-hnqpqtk2.js} +6 -6
  81. package/dist/chunk-hrb9fmq0.js +2 -0
  82. package/dist/chunk-j1wkfq9k.js +2 -0
  83. package/dist/{chunk-fcbd7kwj.js → chunk-j28r2d0q.js} +2 -2
  84. package/dist/chunk-j7he9ya7.js +2 -0
  85. package/dist/chunk-jbah8afv.js +2 -0
  86. package/dist/chunk-jjnqj9b8.js +2 -0
  87. package/dist/chunk-jresy8fn.js +2 -0
  88. package/dist/{chunk-s3ms09rt.js → chunk-jtpq7f7m.js} +5 -5
  89. package/dist/{chunk-x45dv67k.js → chunk-jwjv4r9b.js} +4 -4
  90. package/dist/chunk-k4mkhmrf.js +2 -0
  91. package/dist/{chunk-mj8c8949.js → chunk-k93mp66m.js} +4 -4
  92. package/dist/chunk-ke7qeztn.js +2 -0
  93. package/dist/{chunk-aa6fa3x4.js → chunk-krea4v7q.js} +4 -4
  94. package/dist/chunk-m340wbwd.js +2 -0
  95. package/dist/{chunk-8v2vbc4y.js → chunk-m5nzpjej.js} +1 -1
  96. package/dist/chunk-m6d2bq3y.js +2 -0
  97. package/dist/chunk-mjkmjx2r.js +2 -0
  98. package/dist/{chunk-mzfbpcy0.js → chunk-mvkmfg9c.js} +2 -2
  99. package/dist/{chunk-s9b6abkb.js → chunk-mwxbdpb1.js} +2 -2
  100. package/dist/{chunk-y083wv0f.js → chunk-my2szvtn.js} +13 -13
  101. package/dist/{chunk-83p5k4eb.js → chunk-narz7105.js} +2 -2
  102. package/dist/chunk-nnwtgp6d.js +2 -0
  103. package/dist/{chunk-khrckvwn.js → chunk-nqfpvejh.js} +1 -1
  104. package/dist/chunk-nvtp22qp.js +2 -0
  105. package/dist/{chunk-rt7q8dfs.js → chunk-p5gnb4kg.js} +9 -9
  106. package/dist/{chunk-4ckxs446.js → chunk-pd89jnqk.js} +3 -3
  107. package/dist/chunk-pqn771t1.js +3 -0
  108. package/dist/{chunk-3t3p2c1t.js → chunk-q7fh1xka.js} +6 -6
  109. package/dist/chunk-qagygnn5.js +2 -0
  110. package/dist/{chunk-5n4qg8za.js → chunk-qc93ce5h.js} +2 -2
  111. package/dist/{chunk-3457kk19.js → chunk-qf2aa8qe.js} +6 -6
  112. package/dist/{chunk-jb5sftzz.js → chunk-r3hden6p.js} +2 -2
  113. package/dist/{chunk-7dc3n69c.js → chunk-r3j4m04w.js} +2 -2
  114. package/dist/chunk-r5re2zj0.js +2 -0
  115. package/dist/{chunk-wp6q0geg.js → chunk-rbmt5w9v.js} +2 -2
  116. package/dist/chunk-rgv7rjrs.js +2 -0
  117. package/dist/{chunk-67abad76.js → chunk-rj4j7qcj.js} +1 -1
  118. package/dist/{chunk-ak09a5v6.js → chunk-rz7ykdee.js} +2 -2
  119. package/dist/{chunk-f8fekg2d.js → chunk-s8zf6n06.js} +22 -22
  120. package/dist/{chunk-g1tq4xdb.js → chunk-serrx31a.js} +2 -2
  121. package/dist/chunk-sx1aer4p.js +2 -0
  122. package/dist/chunk-t9h236ee.js +2 -0
  123. package/dist/{chunk-p3dkhz9v.js → chunk-tdrcn1mn.js} +30 -30
  124. package/dist/chunk-tdvmf3ge.js +2 -0
  125. package/dist/chunk-tgaan6d3.js +2 -0
  126. package/dist/{chunk-9dg5ja4w.js → chunk-v402swbm.js} +1 -1
  127. package/dist/chunk-v5emywex.js +2 -0
  128. package/dist/{chunk-max3smha.js → chunk-vhf72t9f.js} +2 -2
  129. package/dist/chunk-wb4kgm9x.js +2 -0
  130. package/dist/{chunk-b6318vv3.js → chunk-wk50m71x.js} +1 -1
  131. package/dist/chunk-wygve6ph.js +2 -0
  132. package/dist/chunk-x453pvrb.js +1101 -0
  133. package/dist/{chunk-rb2a1qxb.js → chunk-x5dc06p5.js} +6 -6
  134. package/dist/{chunk-ap30qs8p.js → chunk-x9wwd2ee.js} +2 -2
  135. package/dist/{chunk-ncs2j5kc.js → chunk-xaddgvkx.js} +2 -2
  136. package/dist/chunk-xva90gg3.js +2 -0
  137. package/dist/{chunk-af7av42v.js → chunk-y123wnsy.js} +3 -3
  138. package/dist/{chunk-6n11z33h.js → chunk-y3w2rc1y.js} +5 -5
  139. package/dist/chunk-yg5swp1n.js +2 -0
  140. package/dist/{chunk-bjejmqk4.js → chunk-yyj7mtfg.js} +2 -2
  141. package/dist/chunk-zdg9mx9v.js +2 -0
  142. package/dist/{chunk-vh879axx.js → chunk-zem7j2p1.js} +7 -7
  143. package/dist/{chunk-xyyt8v1r.js → chunk-zkx2m308.js} +12 -12
  144. package/dist/cli.js +19 -19
  145. package/dist/craft-bridge.d.ts +0 -18
  146. package/dist/craft-bridge.js +12 -7
  147. package/dist/craft-components.d.ts +0 -20
  148. package/dist/craft-components.js +5 -13
  149. package/dist/craft-entry.js +2 -2
  150. package/dist/craft.js +2 -2
  151. package/dist/document-injection.d.ts +2 -0
  152. package/dist/document-injection.js +8 -0
  153. package/dist/native-build.js +2 -1
  154. package/dist/native-signing.js +20 -0
  155. package/dist/pwa.js +3 -3
  156. package/dist/ssg.js +15 -15
  157. package/package.json +5 -5
  158. package/dist/chunk-07sc6jtz.js +0 -2
  159. package/dist/chunk-0kjac48x.js +0 -2
  160. package/dist/chunk-0wtqxs6s.js +0 -2
  161. package/dist/chunk-12vjp2gr.js +0 -2
  162. package/dist/chunk-18fr730w.js +0 -2
  163. package/dist/chunk-1hzf9rcy.js +0 -2
  164. package/dist/chunk-29sapda2.js +0 -2
  165. package/dist/chunk-2qf6kd9r.js +0 -2
  166. package/dist/chunk-2snfd93r.js +0 -2
  167. package/dist/chunk-4c1fbthr.js +0 -2
  168. package/dist/chunk-4fxg20je.js +0 -2
  169. package/dist/chunk-58v34kba.js +0 -2
  170. package/dist/chunk-5fjc7402.js +0 -2
  171. package/dist/chunk-5wrgzs4c.js +0 -2
  172. package/dist/chunk-5x6y26y1.js +0 -2
  173. package/dist/chunk-6q2647s6.js +0 -2
  174. package/dist/chunk-77msvbad.js +0 -3033
  175. package/dist/chunk-8s4rxgs8.js +0 -2
  176. package/dist/chunk-9736003n.js +0 -2
  177. package/dist/chunk-97r557ws.js +0 -2
  178. package/dist/chunk-bcr8sq50.js +0 -2
  179. package/dist/chunk-ccv7dw6h.js +0 -2
  180. package/dist/chunk-cx1xn3j3.js +0 -2
  181. package/dist/chunk-d9ryb159.js +0 -2
  182. package/dist/chunk-dhdt7e54.js +0 -2
  183. package/dist/chunk-et83qyc2.js +0 -2
  184. package/dist/chunk-faa56mhz.js +0 -2
  185. package/dist/chunk-fphxtr18.js +0 -2
  186. package/dist/chunk-fvk1xr5a.js +0 -2
  187. package/dist/chunk-g6wd49b5.js +0 -2
  188. package/dist/chunk-gk0nq2ky.js +0 -2
  189. package/dist/chunk-h8kbcz9t.js +0 -2
  190. package/dist/chunk-hava1caf.js +0 -3
  191. package/dist/chunk-hsthpqed.js +0 -2
  192. package/dist/chunk-jyz9frny.js +0 -2
  193. package/dist/chunk-kyymkayr.js +0 -2
  194. package/dist/chunk-mzwa2478.js +0 -2
  195. package/dist/chunk-n3z0cek6.js +0 -2
  196. package/dist/chunk-nbew0ttz.js +0 -2
  197. package/dist/chunk-nefv911a.js +0 -2
  198. package/dist/chunk-p41knx6v.js +0 -2
  199. package/dist/chunk-qcx9yp5x.js +0 -2
  200. package/dist/chunk-r6bc2q44.js +0 -2
  201. package/dist/chunk-rdj74dqc.js +0 -2
  202. package/dist/chunk-rtbkjq0y.js +0 -2
  203. package/dist/chunk-rwjgpmrw.js +0 -2
  204. package/dist/chunk-s4ks8rjm.js +0 -2
  205. package/dist/chunk-s9vfypaf.js +0 -2
  206. package/dist/chunk-sy1btryy.js +0 -2
  207. package/dist/chunk-t7mbaf69.js +0 -2
  208. package/dist/chunk-w2h6nn70.js +0 -2
  209. package/dist/chunk-wrv0tf80.js +0 -2
  210. package/dist/chunk-x5h95nnq.js +0 -2
  211. package/dist/chunk-xferp2q8.js +0 -2
  212. package/dist/chunk-xge355wc.js +0 -2
  213. package/dist/chunk-xn1hv092.js +0 -2
  214. package/dist/chunk-yd199exa.js +0 -2
  215. package/dist/chunk-ykmcnk3x.js +0 -2
  216. package/dist/chunk-z05dbey1.js +0 -2
@@ -0,0 +1,8 @@
1
+ import { scanAtElementPosition } from "./html-masking.js";
2
+ export function insertBeforeDocumentClose(html, tag, content) {
3
+ const close = new RegExp(`</${tag}\\s*>`, "iy"), match = scanAtElementPosition(html, (source, index) => {
4
+ close.lastIndex = index;
5
+ return close.exec(source) ? close.lastIndex : -1;
6
+ })[0];
7
+ return match ? html.slice(0, match.start) + content + html.slice(match.start) : null;
8
+ }
@@ -30,7 +30,8 @@ export async function buildNative(config) {
30
30
  const projectConfig = await loadStxConfig(process.cwd());
31
31
  let html = await renderTemplate(config.input, {
32
32
  context: config.context,
33
- options: { ...projectConfig, isDev: !1 }
33
+ options: { ...projectConfig, isDev: !1 },
34
+ injectCSS: !0
34
35
  });
35
36
  html = injectCraftBridge(html, { debug: config.verbose });
36
37
  html = processCraftComponents(html);
@@ -42,10 +42,30 @@ export async function signMacOSBundle(bundle, nestedExecutables = [], options =
42
42
  throw Error("Could not generate the provisioned app entitlements.");
43
43
  copyFileSync(options.provisioningProfile, join(bundle, "Contents", "embedded.provisionprofile"));
44
44
  }
45
+ let helperEntitlements;
46
+ if (nestedExecutables.length) {
47
+ let sandboxed = !1;
48
+ if (signingEntitlements) {
49
+ const parent = Bun.spawnSync(["/usr/bin/plutil", "-convert", "json", "-o", "-", signingEntitlements]);
50
+ if (parent.exitCode !== 0)
51
+ throw Error("Could not read native parent entitlements.");
52
+ sandboxed = JSON.parse(parent.stdout.toString())["com.apple.security.app-sandbox"] === !0;
53
+ }
54
+ temporary ??= mkdtempSync(join(tmpdir(), "stx-entitlements-"));
55
+ helperEntitlements = join(temporary, "helper.entitlements.plist");
56
+ writeFileSync(helperEntitlements, JSON.stringify({
57
+ "com.apple.security.cs.allow-jit": !0,
58
+ ...sandboxed ? { "com.apple.security.app-sandbox": !0, "com.apple.security.inherit": !0 } : {}
59
+ }));
60
+ if (Bun.spawnSync(["/usr/bin/plutil", "-convert", "xml1", helperEntitlements]).exitCode !== 0)
61
+ throw Error("Could not generate native helper entitlements.");
62
+ }
45
63
  for (const target of [...nestedExecutables, bundle]) {
46
64
  const flags = options.hardenedRuntime ? ["--options", "runtime"] : [];
47
65
  if (target === bundle && signingEntitlements)
48
66
  flags.push("--entitlements", signingEntitlements);
67
+ if (target !== bundle && helperEntitlements)
68
+ flags.push("--entitlements", helperEntitlements);
49
69
  const timestamp = options.identity && options.identity !== "-" ? "--timestamp" : "--timestamp=none", proc = Bun.spawn(["/usr/bin/codesign", "--force", "--sign", options.identity || "-", timestamp, ...flags, target], { stdout: "pipe", stderr: "pipe" }), [stderr, code] = await Promise.all([new Response(proc.stderr).text(), proc.exited]);
50
70
  if (code !== 0)
51
71
  throw Error(`Could not sign native bundle ${target}: ${stderr.trim()}`);
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Hs,Ft,sl,og}from"./chunk-zecgd1wz.js";import{zs,yi,ng,rg,sg}from"./chunk-3457kk19.js";import{tl,nl,rl,eg,tg}from"./chunk-83p5k4eb.js";import{Ve,_n,bi}from"./chunk-fcbd7kwj.js";import{ig,ag,cg,lg,Vs,Lh}from"./chunk-zjaw79zp.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-xferp2q8.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>
2
+ import{Vs,Ft,ol,ag}from"./chunk-88rftjjk.js";import{Hs,bi,sg,og,ig}from"./chunk-qf2aa8qe.js";import{nl,rl,sl,ng,rg}from"./chunk-narz7105.js";import{Ve,_n,vi}from"./chunk-j28r2d0q.js";import{cg,lg,ug,dg,Us,Lh}from"./chunk-dhy6n39n.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-m340wbwd.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">
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
233
233
  }, 5000);
234
234
  </script>
235
235
  </body>
236
- </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=Ve(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Hs(n,t);if(a){let s=Ft(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return yi(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,nl as auditBuildOutput,tl as auditConfig,re as buildPwaAssets,rl as calculateAuditResult,tg as formatAuditResult,bi as formatSize,j as generateManifest,_ as generateManifestJson,rg as generateManifestLink,F as generateOfflinePage,Ve as generatePrecacheManifest,_n as generatePrecacheManifestJs,M as generatePwaIcons,zs as generatePwaTags,Hs as generateServiceWorker,og as generateServiceWorkerAuto,ng as generateSwRegistrationScript,sg as generateThemeColorMeta,N as getExpectedIconPaths,Ft as getServiceWorkerFileName,yi as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,sl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,Vs as pwaDirectives,ig as pwaInstallDirective,cg as pwaOfflineDirective,lg as pwaPushDirective,ag as pwaUpdateDirective,Lh as registerPwaDirectives,eg as runPwaAudit,D as validateManifest};
236
+ </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=Ve(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Vs(n,t);if(a){let s=Ft(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return bi(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,rl as auditBuildOutput,nl as auditConfig,re as buildPwaAssets,sl as calculateAuditResult,rg as formatAuditResult,vi as formatSize,j as generateManifest,_ as generateManifestJson,og as generateManifestLink,F as generateOfflinePage,Ve as generatePrecacheManifest,_n as generatePrecacheManifestJs,M as generatePwaIcons,Hs as generatePwaTags,Vs as generateServiceWorker,ag as generateServiceWorkerAuto,sg as generateSwRegistrationScript,ig as generateThemeColorMeta,N as getExpectedIconPaths,Ft as getServiceWorkerFileName,bi as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,ol as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,Us as pwaDirectives,cg as pwaInstallDirective,ug as pwaOfflineDirective,dg as pwaPushDirective,lg as pwaUpdateDirective,Lh as registerPwaDirectives,ng as runPwaAudit,D as validateManifest};
package/dist/ssg.js CHANGED
@@ -1,13 +1,13 @@
1
1
  // @bun
2
- import"./chunk-1xjv71dw.js";import{b,Bc}from"./chunk-xyyt8v1r.js";import"./chunk-e6ky15dr.js";import"./chunk-zn3c0ew5.js";import{Tt,C}from"./chunk-067sgh2j.js";import"./chunk-wp6q0geg.js";import"./chunk-bjejmqk4.js";import"./chunk-stvw8y3c.js";import{xt,St,kt,_t,Ct,Et}from"./chunk-3ps07041.js";import{a}from"./chunk-f8fekg2d.js";import{gs}from"./chunk-3t3p2c1t.js";import"./chunk-zjw6j2x0.js";import"./chunk-qd6s902s.js";import{Te,Yt,Zt}from"./chunk-tnmz1t1p.js";import"./chunk-ak09a5v6.js";import{y}from"./chunk-vapj4s7f.js";import{mt,i}from"./chunk-39073rh9.js";import"./chunk-cc2ss77r.js";import"./chunk-t413xatv.js";import"./chunk-rt7q8dfs.js";import"./chunk-aa6fa3x4.js";import"./chunk-ap30qs8p.js";import{Da,Ma,La}from"./chunk-edka95zp.js";import{Xt,Gn,Xn}from"./chunk-9adx6f4k.js";import{Jt}from"./chunk-c1fjdp7s.js";import"./chunk-hava1caf.js";import"./chunk-7dc3n69c.js";import{K,be}from"./chunk-5ctdwyq1.js";import"./chunk-8v2vbc4y.js";import"./chunk-af7av42v.js";import{l}from"./chunk-5n4qg8za.js";import{s,ge}from"./chunk-vstvadc2.js";import k from"fs";import h from"path";import{createHash as Pt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(t){return Bun.hash(t).toString(16)}function ot(t,r={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,n=t.replace(Dt,(e,u,f,x)=>{let w=x.trim();if(!w)return e;if(/\bdata-stx-src=/.test(f))return e;if(r.minify)w=$t(w);let g=Rt(w);if(!o.has(g))o.set(g,w);let v=r.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${g}.js"${v}${f}></script>`}),c=Array.from(o,([e,u])=>({hash:e,code:u}));return{html:n,chunks:c}}var It=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let r=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=o.exec(t))!==null)r.set(n[1],n[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(r.get(u[1])||""))c.add(u[2]);let f=/<\/head\s*>/iy,x=C(t,(g,v)=>(f.lastIndex=v,f.exec(g)?f.lastIndex:-1))[0]?.start??-1;if(c.size===0||x===-1)return t;let w=Array.from(c).filter((g)=>!t.includes(`rel="prefetch" href="${g}"`)).map((g)=>`<link rel="prefetch" href="${g}" as="script">`).join("");if(!w)return t;return t.slice(0,x)+w+t.slice(x)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let r=t.trim();if(!r)return null;let o=/^https?:\/\//i.test(r)?r:`https://${r}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let r of Bt){let o=t[r];if(!o)continue;let n=X(o);if(n)return{url:n,source:"env",via:r}}return null}function lt(t){if(!t||typeof t!=="object")return null;let r=t,o=r.site?.url??r.url??r.app?.url;return typeof o==="string"?X(o):null}async function Ft(t){let{existsSync:r}=await import("fs"),o=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,n);if(!r(c))continue;try{let e=await import(c),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let r=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let n=lt(t.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let c=await Ft(r);if(c)return{url:c,source:"site.config",via:"url"};let e=jt(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){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
- `)}function q(t){return async()=>({paths:await t(),fallback:!1})}var At;function Ot(t){let r=s(t),{depths:o}=ge(r),n=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=n.exec(r))!==null){if(o[c.index]!==0)continue;let u=b(r,"(",")",n.lastIndex-1),f=r.indexOf("{",u+1),x=b(r,"{","}",f);if(u<0||f<0||x<0)break;return t.slice(c.index,x+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=e.exec(r))!==null){if(o[c.index]!==0)continue;let u=Bc(r,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let r="read";try{let o=await Bun.file(t).text();r="parse";let n=Jt(o),c=[...n.server,...n.client,...n.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(s(e.attrs))).sort((e,u)=>o.indexOf(e.fullTag)-o.indexOf(u.fullTag));for(let e of c){if(!/\bgetStaticPaths\b/.test(s(e.content)))continue;let u=(At??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(s(u)))continue;let f=Ot(u);if(/\bdefineStaticPaths\b/.test(s(f))&&Tt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");r="execute";let x=Function("defineStaticPaths",`return (${f})`)(q);if(typeof x!=="function")throw TypeError("getStaticPaths must be a function");let w=await x();r="result";let g=Array.isArray(w)?{paths:w}:w;if(!g||typeof g!=="object"||!("paths"in g)||!Array.isArray(g.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let v of g.paths)if(!v||typeof v!=="object"||!v.params||typeof v.params!=="object"||Array.isArray(v.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:g}}return{kind:"absent"}}catch(o){return{kind:"error",phase:r,error:o instanceof Error?o:Error(String(o))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,r=""){this.cacheDir=t,this.salt=r}async load(){if(this.loaded)return;let t=h.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let r=JSON.parse(await Bun.file(t).text());for(let[o,n]of Object.entries(r))this.cache.set(o,n)}catch{}this.loaded=!0}async save(){await k.promises.mkdir(this.cacheDir,{recursive:!0});let t=h.join(this.cacheDir,"build-cache.json"),r={};for(let[o,n]of this.cache)r[o]=n;await Bun.write(t,JSON.stringify(r))}getHash(t,r){let o=k.statSync(t),n=`${this.salt}|${t}:${o.mtimeMs}`;for(let e of r)if(k.existsSync(e)){let u=k.statSync(e);n+=`:${e}:${u.mtimeMs}`}let c=0;for(let e=0;e<n.length;e++){let u=n.charCodeAt(e);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(t,r){let o=this.cache.get(t);if(!o)return null;let n=this.getHash(r,o.dependencies??[]);if(o.hash!==n)return this.cache.delete(t),null;return o.html}set(t,r,o,n){let c=this.getHash(r,o);this.cache.set(t,{hash:c,html:n,generatedAt:Date.now(),dependencies:o})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let r=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return h.join(this.cacheDir,"isr",r)}async get(t){let r=this.getFilePath(t);if(!await Bun.file(r).exists())return null;try{return JSON.parse(await Bun.file(r).text())}catch{return null}}async set(t,r){let o=this.getFilePath(t);await k.promises.mkdir(h.dirname(o),{recursive:!0}),await Bun.write(o,JSON.stringify(r))}async invalidate(t){let r=this.getFilePath(t);if(await Bun.file(r).exists())await k.promises.unlink(r)}async invalidatePattern(t){let r=h.join(this.cacheDir,"isr");if(!k.existsSync(r))return;let o=await k.promises.readdir(r);for(let n of o){let c=n.replace(/_/g,"/").replace(".json","");if(t.test(c))await k.promises.unlink(h.join(r,n))}}async needsRevalidation(t){let r=await this.get(t);if(!r)return!0;return Date.now()>r.revalidateAfter}}async function Lt(t){let r=[];if(!t.isDynamic)r.push({url:t.pattern,params:{}});else{let o=await gt(t.filePath);if(o.kind==="error")throw Error(`getStaticPaths ${o.phase} failed for ${t.pattern} (${t.filePath}): ${o.error.message}`,{cause:o.error});if(o.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),r;let n=o.value;if(n.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),r;for(let c of n.paths){let e=t.pattern;for(let[u,f]of Object.entries(c.params))e=e.replace(`:${u}`,f).replace(`:${u}*`,f);r.push({url:e,params:c.params,props:c.props,revalidate:c.revalidate})}}return r}async function Ut(t){let r=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let o of r)if(await Bun.file(o).exists())try{let n=await import(o);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:c,...e}=n;return e}}catch(n){console.error(`Error loading data file ${o}:`,n)}return null}async function Mt(t,r,o){let n=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let c=n[1];if(!c.includes("getStaticProps"))return null;try{let e=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
2
+ import"./chunk-1xjv71dw.js";import{b,Fc}from"./chunk-zkx2m308.js";import"./chunk-ez35607j.js";import"./chunk-zn3c0ew5.js";import{Tt,S}from"./chunk-9nev9akt.js";import"./chunk-rbmt5w9v.js";import"./chunk-yyj7mtfg.js";import"./chunk-4c86wr9a.js";import{xt,St,kt,_t,Ct,Et}from"./chunk-2mqzpzy7.js";import{a}from"./chunk-s8zf6n06.js";import{ms}from"./chunk-q7fh1xka.js";import"./chunk-3fwdxxh1.js";import"./chunk-a6ntnyea.js";import{Te,Yt,Zt}from"./chunk-4gsxgxxy.js";import"./chunk-rz7ykdee.js";import{y}from"./chunk-9s9ckhp9.js";import{mt,i}from"./chunk-0v7w578w.js";import"./chunk-3pc7vgbz.js";import"./chunk-fqfbsr8n.js";import"./chunk-p5gnb4kg.js";import"./chunk-krea4v7q.js";import"./chunk-x9wwd2ee.js";import{Ma,La,ja}from"./chunk-dmnncw90.js";import{Xt,Gn,Xn}from"./chunk-9adx6f4k.js";import{Jt}from"./chunk-hfneeen7.js";import"./chunk-pqn771t1.js";import"./chunk-r3j4m04w.js";import{G,be}from"./chunk-9x3tvgjq.js";import"./chunk-m5nzpjej.js";import"./chunk-y123wnsy.js";import{l}from"./chunk-qc93ce5h.js";import{s,ge}from"./chunk-05qf3e2p.js";import D from"fs";import h from"path";import{createHash as Pt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(t){return Bun.hash(t).toString(16)}function ot(t,r={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,n=t.replace(Dt,(e,u,f,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(f))return e;if(r.minify)w=$t(w);let g=Rt(w);if(!o.has(g))o.set(g,w);let P=r.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${g}.js"${P}${f}></script>`}),c=Array.from(o,([e,u])=>({hash:e,code:u}));return{html:n,chunks:c}}var It=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let r=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=o.exec(t))!==null)r.set(n[1],n[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(r.get(u[1])||""))c.add(u[2]);let f=/<\/head\s*>/iy,v=S(t,(g,P)=>(f.lastIndex=P,f.exec(g)?f.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return t;let w=Array.from(c).filter((g)=>!t.includes(`rel="prefetch" href="${g}"`)).map((g)=>`<link rel="prefetch" href="${g}" as="script">`).join("");if(!w)return t;return t.slice(0,v)+w+t.slice(v)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let r=t.trim();if(!r)return null;let o=/^https?:\/\//i.test(r)?r:`https://${r}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let r of Bt){let o=t[r];if(!o)continue;let n=X(o);if(n)return{url:n,source:"env",via:r}}return null}function lt(t){if(!t||typeof t!=="object")return null;let r=t,o=r.site?.url??r.url??r.app?.url;return typeof o==="string"?X(o):null}async function Ft(t){let{existsSync:r}=await import("fs"),o=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,n);if(!r(c))continue;try{let e=await import(c),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let r=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let n=lt(t.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let c=await Ft(r);if(c)return{url:c,source:"site.config",via:"url"};let e=jt(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){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
+ `)}function J(t){return async()=>({paths:await t(),fallback:!1})}var At;function Ot(t){let r=s(t),{depths:o}=ge(r),n=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=n.exec(r))!==null){if(o[c.index]!==0)continue;let u=b(r,"(",")",n.lastIndex-1),f=r.indexOf("{",u+1),v=b(r,"{","}",f);if(u<0||f<0||v<0)break;return t.slice(c.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=e.exec(r))!==null){if(o[c.index]!==0)continue;let u=Fc(r,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let r="read";try{let o=await Bun.file(t).text();r="parse";let n=Jt(o),c=[...n.server,...n.client,...n.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(s(e.attrs))).sort((e,u)=>o.indexOf(e.fullTag)-o.indexOf(u.fullTag));for(let e of c){if(!/\bgetStaticPaths\b/.test(s(e.content)))continue;let u=(At??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(s(u)))continue;let f=Ot(u);if(/\bdefineStaticPaths\b/.test(s(f))&&Tt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");r="execute";let v=Function("defineStaticPaths",`return (${f})`)(J);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();r="result";let g=Array.isArray(w)?{paths:w}:w;if(!g||typeof g!=="object"||!("paths"in g)||!Array.isArray(g.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of g.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:g}}return{kind:"absent"}}catch(o){return{kind:"error",phase:r,error:o instanceof Error?o:Error(String(o))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,r=""){this.cacheDir=t,this.salt=r}async load(){if(this.loaded)return;let t=h.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let r=JSON.parse(await Bun.file(t).text());for(let[o,n]of Object.entries(r))this.cache.set(o,n)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=h.join(this.cacheDir,"build-cache.json"),r={};for(let[o,n]of this.cache)r[o]=n;await Bun.write(t,JSON.stringify(r))}getHash(t,r){let o=D.statSync(t),n=`${this.salt}|${t}:${o.mtimeMs}`;for(let e of r)if(D.existsSync(e)){let u=D.statSync(e);n+=`:${e}:${u.mtimeMs}`}let c=0;for(let e=0;e<n.length;e++){let u=n.charCodeAt(e);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(t,r){let o=this.cache.get(t);if(!o)return null;let n=this.getHash(r,o.dependencies??[]);if(o.hash!==n)return this.cache.delete(t),null;return o.html}set(t,r,o,n){let c=this.getHash(r,o);this.cache.set(t,{hash:c,html:n,generatedAt:Date.now(),dependencies:o})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let r=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return h.join(this.cacheDir,"isr",r)}async get(t){let r=this.getFilePath(t);if(!await Bun.file(r).exists())return null;try{return JSON.parse(await Bun.file(r).text())}catch{return null}}async set(t,r){let o=this.getFilePath(t);await D.promises.mkdir(h.dirname(o),{recursive:!0}),await Bun.write(o,JSON.stringify(r))}async invalidate(t){let r=this.getFilePath(t);if(await Bun.file(r).exists())await D.promises.unlink(r)}async invalidatePattern(t){let r=h.join(this.cacheDir,"isr");if(!D.existsSync(r))return;let o=await D.promises.readdir(r);for(let n of o){let c=n.replace(/_/g,"/").replace(".json","");if(t.test(c))await D.promises.unlink(h.join(r,n))}}async needsRevalidation(t){let r=await this.get(t);if(!r)return!0;return Date.now()>r.revalidateAfter}}async function Lt(t){let r=[];if(!t.isDynamic)r.push({url:t.pattern,params:{}});else{let o=await gt(t.filePath);if(o.kind==="error")throw Error(`getStaticPaths ${o.phase} failed for ${t.pattern} (${t.filePath}): ${o.error.message}`,{cause:o.error});if(o.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),r;let n=o.value;if(n.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),r;for(let c of n.paths){let e=t.pattern;for(let[u,f]of Object.entries(c.params))e=e.replace(`:${u}`,f).replace(`:${u}*`,f);r.push({url:e,params:c.params,props:c.props,revalidate:c.revalidate})}}return r}async function Ut(t){let r=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let o of r)if(await Bun.file(o).exists())try{let n=await import(o);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:c,...e}=n;return e}}catch(n){console.error(`Error loading data file ${o}:`,n)}return null}async function Mt(t,r,o){let n=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let c=n[1];if(!c.includes("getStaticProps"))return null;try{let e=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
4
4
  return (async function getStaticProps() {
5
5
  ${e[1]}
6
6
  })()
7
- `)(r)}catch(e){return console.error(`Error executing getStaticProps in ${o}:`,e),null}}function Gt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function ft(t,r,o={},n,c){let e=await Bun.file(t.filePath).text(),u=await Ut(t.filePath),f=await Mt(e,r,t.filePath),x={...u||{},...f||{},...o,params:r,$route:{path:t.pattern,params:r}},w=new Set,g=[],v=[],R={...c,minifyClient:!0,...n.partialsDir?{partialsDir:n.partialsDir}:{},...n.componentsDir?{componentsDir:n.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(D)=>{g.push(`${h.relative(process.cwd(),D.templatePath)}: ${D.message}
8
- resolved against partialsDir: ${D.partialsDir}`)},onServerScriptError:(D)=>{v.push(`${h.relative(process.cwd(),D.sourcePath)} (${D.kind}): ${D.message}`)}};if(Gt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let S=await i(e,x,t.filePath,R,w);for(let D of[t.filePath,...w])for(let T of Te(D))w.add(T);if(Object.keys(r).length>0){let D=`<script>if(window.stx)window.stx._rp=${JSON.stringify(r)};else window.__stx_rp=${JSON.stringify(r)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${D}
9
- </head>`);else S=`${D}
10
- ${S}`}if(S=await be(S,{router:n.router}),S=await y(S),n.minify!==!1)return{html:Nt(S),dependencies:Array.from(w),includeFailures:g,serverScriptFailures:v};return{html:S,dependencies:Array.from(w),includeFailures:g,serverScriptFailures:v}}function Nt(t){let r=[],o=0,n=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=n.exec(t))!==null){let u=t.slice(o,c.index);r.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let f=c[1],x=c[2],w=c[3];x=x.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),r.push(f+x+w),o=c.index+c[0].length}let e=t.slice(o);return r.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),r.join("").trim()}function Ht(t){let r=0;for(let o=0;o<t.length;o++){let n=t.charCodeAt(o);r=(r<<5)-r+n,r=r&r}return`"${Math.abs(r).toString(36)}"`}function zt(t,r,o,n){if(o?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(r))return!0;return n.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function Wt(t,r){return`<?xml version="1.0" encoding="UTF-8"?>
7
+ `)(r)}catch(e){return console.error(`Error executing getStaticProps in ${o}:`,e),null}}function Gt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function ft(t,r,o={},n,c){let e=await Bun.file(t.filePath).text(),u=await Ut(t.filePath),f=await Mt(e,r,t.filePath),v={...u||{},...f||{},...o,params:r,$route:{path:t.pattern,params:r}},w=new Set,g=[],P=[],E={...c,minifyClient:!0,...n.partialsDir?{partialsDir:n.partialsDir}:{},...n.componentsDir?{componentsDir:n.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{g.push(`${h.relative(process.cwd(),R.templatePath)}: ${R.message}
8
+ resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${h.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Gt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let x=await i(e,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let T of Te(R))w.add(T);if(Object.keys(r).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(r)};else window.__stx_rp=${JSON.stringify(r)};</script>`;if(x.includes("</head>"))x=x.replace("</head>",`${R}
9
+ </head>`);else x=`${R}
10
+ ${x}`}if(x=await be(x,{router:n.router}),x=await y(x),n.minify!==!1)return{html:Nt(x),dependencies:Array.from(w),includeFailures:g,serverScriptFailures:P};return{html:x,dependencies:Array.from(w),includeFailures:g,serverScriptFailures:P}}function Nt(t){let r=[],o=0,n=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=n.exec(t))!==null){let u=t.slice(o,c.index);r.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let f=c[1],v=c[2],w=c[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),r.push(f+v+w),o=c.index+c[0].length}let e=t.slice(o);return r.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),r.join("").trim()}function Ht(t){let r=0;for(let o=0;o<t.length;o++){let n=t.charCodeAt(o);r=(r<<5)-r+n,r=r&r}return`"${Math.abs(r).toString(36)}"`}function zt(t,r,o,n){if(o?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(r))return!0;return n.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function Wt(t,r){return`<?xml version="1.0" encoding="UTF-8"?>
11
11
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
12
12
  ${t.map((n)=>{let c=new URL(n.loc,r).href,e=` <url>
13
13
  <loc>${F(c)}</loc>`;if(n.lastmod)e+=`
@@ -37,18 +37,18 @@ ${t.map((n)=>{let c=new URL(n.loc,r).href,e=` <url>
37
37
  ${o.join(`
38
38
  `)}
39
39
  </channel>
40
- </rss>`}async function Vt(t={}){let r=Date.now();Zt();let o=await a(process.cwd()),n=o.build||{},c=await ut({explicit:t.domain||n.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(dt());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},f=new Set,x=0,w={},g={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&k.existsSync(e.outputDir))await k.promises.rm(e.outputDir,{recursive:!0});await k.promises.mkdir(e.outputDir,{recursive:!0});let R=e.cacheSalt;if(!R){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-5x6y26y1.js");try{R=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-d9ryb159.js"),D=await S(e.publicDir,e.outputDir);if(D.count>0)console.log(`Optimized ${D.count} image(s) for responsive delivery`),R=[R,D.fingerprint].filter(Boolean).join(":");let T=new pt(e.cacheDir,R);if(e.cache)await T.load();try{let{generateCss:d}=await import("./chunk-5x6y26y1.js");await d('<div class="bg-black"></div>')}catch{}xt();let wt=o?.routeMiddleware?.dir||"middleware";await kt(process.cwd(),wt);let J=St();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let yt=o?.routeMiddleware?.global||[];La(o?.layoutsDir,l(process.cwd()));let Z=K(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Lt(d);for(let P of m)M.push({route:d,url:P.url,params:P.params,props:P.props,revalidate:P.revalidate??e.revalidate})}catch(m){let P=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:P}),await e.hooks.onError?.(P,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,P)}u.totalPages=M.length+u.failedCount,console.log(`Generating ${M.length} pages...`);let _=[],Q=[];for(let d=0;d<M.length;d+=e.concurrency)Q.push(M.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:P,url:p,params:G,props:bt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(p);let A=await Bun.file(P.filePath).text(),O=te(A),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...yt,...vt];if(nt.length>0){let B=_t(p,G,O||{}),L=Ct(B,null,void 0,{isServer:!0}),j=await Et(nt,L);if(j.redirect){let E=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,H=ee(String(E),p),U=re(p,e);await k.promises.mkdir(h.dirname(U),{recursive:!0}),await Bun.write(U,H),u.successCount++,u.pages.push({route:p,outputPath:U,size:Buffer.byteLength(H),cached:!1}),_.push({loc:p,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${p} \u2192 redirect to ${E}`);return}if(j.abort){let E=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${p} \u2014 middleware aborted: ${E}`);return}}let it=A.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
40
+ </rss>`}async function Vt(t={}){let r=Date.now();Zt();let o=await a(process.cwd()),n=o.build||{},c=await ut({explicit:t.domain||n.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(dt());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},f=new Set,v=0,w={},g={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-wb4kgm9x.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:x}=await import("./chunk-xva90gg3.js"),R=await x(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let T=new pt(e.cacheDir,E);if(e.cache)await T.load();try{let{generateCss:d}=await import("./chunk-wb4kgm9x.js");await d('<div class="bg-black"></div>')}catch{}xt();let wt=o?.routeMiddleware?.dir||"middleware";await kt(process.cwd(),wt);let V=St();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let yt=o?.routeMiddleware?.global||[];ja(o?.layoutsDir,l(process.cwd()));let Z=G(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Lt(d);for(let k of m)M.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=M.length+u.failedCount,console.log(`Generating ${M.length} pages...`);let _=[],Q=[];for(let d=0;d<M.length;d+=e.concurrency)Q.push(M.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:p,params:N,props:bt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(p);let A=await Bun.file(k.filePath).text(),O=te(A),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...yt,...vt];if(nt.length>0){let B=_t(p,N,O||{}),L=Ct(B,null,void 0,{isServer:!0}),j=await Et(nt,L);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,z=ee(String(C),p),U=re(p,e);await D.promises.mkdir(h.dirname(U),{recursive:!0}),await Bun.write(U,z),u.successCount++,u.pages.push({route:p,outputPath:U,size:Buffer.byteLength(z),cached:!1}),_.push({loc:p,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${p} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${p} \u2014 middleware aborted: ${C}`);return}}let it=A.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
41
41
  const validate = ${it[1]};
42
42
  return validate(route);
43
- `)({params:G})){console.warn(`Validation failed for ${p}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(p,P.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await ft(P,G,bt,e,o);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
43
+ `)({params:N})){console.warn(`Validation failed for ${p}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(p,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await ft(k,N,bt,e,o);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
44
44
  ${B.includeFailures.join(`
45
45
  `)}
46
46
  Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&B.serverScriptFailures.length>0)throw Error(`${B.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
47
47
  ${B.serverScriptFailures.join(`
48
48
  `)}
49
- Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)T.set(p,P.filePath,B.dependencies,I)}let N;if(e.trailingSlash)N=h.join(e.outputDir,p,"index.html");else N=p==="/"?h.join(e.outputDir,"index.html"):h.join(e.outputDir,`${p}.html`);if(e.chunkIslands){let{html:B,chunks:L}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(L.length>0){let j=h.join(e.outputDir,"_stx","islands");await k.promises.mkdir(j,{recursive:!0});for(let E of L){let H=h.join(j,`${E.hash}.js`);if(!await Bun.file(H).exists())await Bun.write(H,E.code);if(!f.has(E.hash)){f.add(E.hash);let U=Buffer.byteLength(E.code,"utf8");x+=U,w[E.hash]={bytes:U,file:`/_stx/islands/${E.hash}.js`}}}if(g[p]=L.map((E)=>E.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await k.promises.mkdir(h.dirname(N),{recursive:!0}),await Bun.write(N,I),!zt(p,I,O,e.sitemapExclude))_.push({loc:p,lastmod:new Date().toISOString().split("T")[0],priority:p==="/"?1:0.8});let at={route:p,outputPath:N,size:Buffer.byteLength(I,"utf8"),cached:st};if(rt!==!1)at.revalidateAt=Date.now()+rt*1000;u.pages.push(at),u.successCount++,await e.hooks.onPageEnd?.(p,I)}catch(A){u.failedCount++,u.errors.push({route:p,error:A}),await e.hooks.onError?.(A,p),console.error(`Error generating ${p}:`,A)}}));let tt=Yt();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
49
+ Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)T.set(p,k.filePath,B.dependencies,I)}let H;if(e.trailingSlash)H=h.join(e.outputDir,p,"index.html");else H=p==="/"?h.join(e.outputDir,"index.html"):h.join(e.outputDir,`${p}.html`);if(e.chunkIslands){let{html:B,chunks:L}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(L.length>0){let j=h.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of L){let z=h.join(j,`${C.hash}.js`);if(!await Bun.file(z).exists())await Bun.write(z,C.code);if(!f.has(C.hash)){f.add(C.hash);let U=Buffer.byteLength(C.code,"utf8");v+=U,w[C.hash]={bytes:U,file:`/_stx/islands/${C.hash}.js`}}}if(g[p]=L.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(h.dirname(H),{recursive:!0}),await Bun.write(H,I),!zt(p,I,O,e.sitemapExclude))_.push({loc:p,lastmod:new Date().toISOString().split("T")[0],priority:p==="/"?1:0.8});let at={route:p,outputPath:H,size:Buffer.byteLength(I,"utf8"),cached:st};if(rt!==!1)at.revalidateAt=Date.now()+rt*1000;u.pages.push(at),u.successCount++,await e.hooks.onPageEnd?.(p,I)}catch(A){u.failedCount++,u.errors.push({route:p,error:A}),await e.hooks.onError?.(A,p),console.error(`Error generating ${p}:`,A)}}));let tt=Yt();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
50
50
  `);throw Error(`Client script bundling failed:
51
- ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=h.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,P={...o,minifyClient:!0,debug:!1,cache:!1},p=await i(await Bun.file(d).text(),{},d,P,m);await Bun.write(h.join(e.outputDir,"404.html"),p)}else await Bun.write(h.join(e.outputDir,"404.html"),`<!DOCTYPE html>
51
+ ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=h.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,k={...o,minifyClient:!0,debug:!1,cache:!1},p=await i(await Bun.file(d).text(),{},d,k,m);await Bun.write(h.join(e.outputDir,"404.html"),p)}else await Bun.write(h.join(e.outputDir,"404.html"),`<!DOCTYPE html>
52
52
  <html lang="en">
53
53
  <head>
54
54
  <meta charset="UTF-8">
@@ -69,16 +69,16 @@ ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=h.join(e.pagesDir,"404.
69
69
  <a href="/">Go home</a>
70
70
  </div>
71
71
  </body>
72
- </html>`)}for(let d of[500]){let m=h.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let P=new Set,p={...o,minifyClient:!0,debug:!1,cache:!1},G=await i(await Bun.file(m).text(),{},m,p,P);await Bun.write(h.join(e.outputDir,`${d}.html`),G)}}let V=h.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,m={...o,minifyClient:!0,debug:!1,cache:!1},P=await i(await Bun.file(V).text(),{},V,m,d);await Bun.write(h.join(e.outputDir,"error.html"),P)}if(e.sitemap&&_.length>0){let d=Wt(_,e.domain),m=h.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${_.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((p)=>typeof p==="string"),...d.disallow||[]],P=gs({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(h.join(e.outputDir,"robots.txt"),P),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let P=qt(d,m),p=h.join(e.outputDir,"rss.xml");await Bun.write(p,P),u.rssPath=p,console.log(`Generated rss.xml with ${m.length} items`)}let z=Da(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let W=Ma(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} repeated asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&k.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=Xn();if(et)await Y(et,h.join(e.outputDir,Gn)),console.log(`Copied assets from ${Xt}`)}catch(R){throw await e.hooks.onError?.(R),R}if(u.buildTime=Date.now()-r,f.size>0){u.islandChunks={count:f.size,totalBytes:x};let R={generatedChunks:f.size,totalBytes:x,chunks:w,pages:g};await Bun.write(h.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(R,null,2))}await e.hooks.onBuildEnd?.(u);let v=u.islandChunks?`
72
+ </html>`)}for(let d of[500]){let m=h.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,p={...o,minifyClient:!0,debug:!1,cache:!1},N=await i(await Bun.file(m).text(),{},m,p,k);await Bun.write(h.join(e.outputDir,`${d}.html`),N)}}let K=h.join(e.pagesDir,"error.stx");if(await Bun.file(K).exists()){let d=new Set,m={...o,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(K).text(),{},K,m,d);await Bun.write(h.join(e.outputDir,"error.html"),k)}if(e.sitemap&&_.length>0){let d=Wt(_,e.domain),m=h.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${_.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((p)=>typeof p==="string"),...d.disallow||[]],k=ms({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(h.join(e.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let k=qt(d,m),p=h.join(e.outputDir,"rss.xml");await Bun.write(p,k),u.rssPath=p,console.log(`Generated rss.xml with ${m.length} items`)}let W=Ma(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let q=La(e.outputDir);if(q.assets>0)console.log(`Externalized ${q.assets} repeated asset(s) from ${q.pages} page(s) (${(q.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=Xn();if(et)await Y(et,h.join(e.outputDir,Gn)),console.log(`Copied assets from ${Xt}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-r,f.size>0){u.islandChunks={count:f.size,totalBytes:v};let E={generatedChunks:f.size,totalBytes:v,chunks:w,pages:g};await Bun.write(h.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
73
73
  Island chunks: ${u.islandChunks.count} (${(u.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
74
74
  Build complete!
75
75
  Total: ${u.totalPages} pages
76
76
  Success: ${u.successCount}
77
77
  Cached: ${u.cachedCount}
78
78
  Failed: ${u.failedCount}
79
- Time: ${u.buildTime}ms${v}
80
- `),u}async function Y(t,r){await k.promises.mkdir(r,{recursive:!0});let o=await k.promises.readdir(t,{withFileTypes:!0});for(let n of o){let c=h.join(t,n.name),e=h.join(r,n.name);if(n.isDirectory())await k.promises.mkdir(e,{recursive:!0}),await Y(c,e);else await k.promises.copyFile(c,e)}}function Kt(t={}){let r=t.cacheDir||l(process.cwd(),"ssg-cache"),o=new ht(r),n=t.revalidate||3600;return{async get(c){let e=await o.get(c);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(c).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${n}, stale-while-revalidate=${n*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let u=K(".",{pagesDir:t.pagesDir||"pages"}).find((v)=>c.match(v.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${c}`);return}let f=c.match(u.regex),x={};if(f)u.params.forEach((v,R)=>{x[v]=f[R+1]});let w=await a(),{html:g}=await ft(u,x,{},t,w);await o.set(c,{html:g,generatedAt:Date.now(),revalidateAfter:Date.now()+n*1000,etag:Ht(g)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await o.invalidate(c);else await o.invalidatePattern(c)}}}function Qt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let r=await Bun.file(t).text(),o=r.match(/^---\n([\s\S]*?)\n---/),n={},c=r;if(o){let w=o[1];c=r.slice(o[0].length).trim();for(let g of w.split(`
81
- `)){let v=g.indexOf(":");if(v>0){let R=g.slice(0,v).trim(),S=g.slice(v+1).trim();if(S==="true")S=!0;else if(S==="false")S=!1;else if(/^\d+$/.test(S))S=parseInt(S,10);else if(/^\d+\.\d+$/.test(S))S=parseFloat(S);else if(S.startsWith("[")&&S.endsWith("]"))S=S.slice(1,-1).split(",").map((D)=>D.trim().replace(/^['"]|['"]$/g,""));n[R]=S}}}let e=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),u=[],f=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,x;while((x=f.exec(e))!==null){let w=parseInt(x[1],10),g=x[2],v=g.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:v,text:g,level:w})}return{content:e,data:n,toc:u}}}}function te(t){return mt(t)}function ee(t,r){return`<!DOCTYPE html>
79
+ Time: ${u.buildTime}ms${P}
80
+ `),u}async function Y(t,r){await D.promises.mkdir(r,{recursive:!0});let o=await D.promises.readdir(t,{withFileTypes:!0});for(let n of o){let c=h.join(t,n.name),e=h.join(r,n.name);if(n.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(c,e);else await D.promises.copyFile(c,e)}}function Kt(t={}){let r=t.cacheDir||l(process.cwd(),"ssg-cache"),o=new ht(r),n=t.revalidate||3600;return{async get(c){let e=await o.get(c);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(c).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${n}, stale-while-revalidate=${n*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let u=G(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>c.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${c}`);return}let f=c.match(u.regex),v={};if(f)u.params.forEach((P,E)=>{v[P]=f[E+1]});let w=await a(),{html:g}=await ft(u,v,{},t,w);await o.set(c,{html:g,generatedAt:Date.now(),revalidateAfter:Date.now()+n*1000,etag:Ht(g)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await o.invalidate(c);else await o.invalidatePattern(c)}}}function Qt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let r=await Bun.file(t).text(),o=r.match(/^---\n([\s\S]*?)\n---/),n={},c=r;if(o){let w=o[1];c=r.slice(o[0].length).trim();for(let g of w.split(`
81
+ `)){let P=g.indexOf(":");if(P>0){let E=g.slice(0,P).trim(),x=g.slice(P+1).trim();if(x==="true")x=!0;else if(x==="false")x=!1;else if(/^\d+$/.test(x))x=parseInt(x,10);else if(/^\d+\.\d+$/.test(x))x=parseFloat(x);else if(x.startsWith("[")&&x.endsWith("]"))x=x.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));n[E]=x}}}let e=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),u=[],f=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=f.exec(e))!==null){let w=parseInt(v[1],10),g=v[2],P=g.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:g,level:w})}return{content:e,data:n,toc:u}}}}function te(t){return mt(t)}function ee(t,r){return`<!DOCTYPE html>
82
82
  <html>
83
83
  <head>
84
84
  <meta charset="utf-8">
@@ -90,4 +90,4 @@ Build complete!
90
90
  <p>Redirecting to <a href="${t}">${t}</a>...</p>
91
91
  <script>window.location.replace('${t}')</script>
92
92
  </body>
93
- </html>`}function re(t,r){if(t==="/"||t==="")return h.join(r.outputDir,"index.html");let o=t.replace(/^\/|\/$/g,"");if(r.trailingSlash)return h.join(r.outputDir,o,"index.html");return h.join(r.outputDir,`${o}.html`)}var Fe={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:q,createMarkdownLoader:Qt};export{Kt as createISRHandler,Qt as createMarkdownLoader,Gt as declaresPageAction,Fe as default,q as defineStaticPaths,Vt as generateStaticSite,zt as isExcludedFromSitemap};
93
+ </html>`}function re(t,r){if(t==="/"||t==="")return h.join(r.outputDir,"index.html");let o=t.replace(/^\/|\/$/g,"");if(r.trailingSlash)return h.join(r.outputDir,o,"index.html");return h.join(r.outputDir,`${o}.html`)}var Fe={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:J,createMarkdownLoader:Qt};export{Kt as createISRHandler,Qt as createMarkdownLoader,Gt as declaresPageAction,Fe as default,J as defineStaticPaths,Vt as generateStaticSite,zt as isExcludedFromSitemap};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.713",
4
+ "version": "0.2.715",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -128,12 +128,12 @@
128
128
  "dependencies": {
129
129
  "@stacksjs/ts-css": "^0.3.11",
130
130
  "@stacksjs/clapp": "^0.2.16",
131
- "@stacksjs/desktop": "0.2.713",
132
- "@stacksjs/sanitizer": "0.2.713",
131
+ "@stacksjs/desktop": "0.2.715",
132
+ "@stacksjs/sanitizer": "0.2.715",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.713",
134
+ "bun-plugin-stx": "0.2.715",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.713",
136
+ "stx-router": "0.2.715",
137
137
  "ts-broadcasting": "^0.0.11",
138
138
  "ts-images": "^0.2.22",
139
139
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ve,Is,Gf,xh,Xf,Sh,Nt,p,H,Z,yn,xe,Jf,oi,Yf,kh,S,Zf,_h,E,Ch}from"./chunk-067sgh2j.js";import"./chunk-bjejmqk4.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-e6ky15dr.js";export{Zf as applyFilters,Sh as clearCustomFilters,Jf as clientLoopScopes,Is as defaultFilters,yn as escapeAttributeValue,p as escapeHtml,H as escapeHtmlValue,Z as escapeInterpolatedHtmlValue,E as evaluateExpression,ve as findMustacheEnd,Xf as getAllFilters,Yf as interpolateScriptAttributes,oi as interpolateScriptExpressions,kh as interpolateScriptsInTemplate,S as processExpressions,Gf as registerFilter,xh as registerFilters,Nt as replaceInterpolations,_h as resetRejectedExpressionWarnings,Ch as unescapeHtml,xe as usesSignalsInScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{nn,mo,ho,yo,Xm,bo}from"./chunk-qd6s902s.js";import"./chunk-zjw6j2x0.js";import"./chunk-3ps07041.js";import"./chunk-wp6q0geg.js";export{ho as buildServerApi,Xm as createServerApi,nn as discoverServerApi,mo as generateApiTypes,bo as isServerApiSource,yo as productionApiDispatcher};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{eh,ff,Ge,Va,th,Yr,Zr,Qr}from"./chunk-t413xatv.js";import"./chunk-cc2ss77r.js";import"./chunk-hava1caf.js";import"./chunk-7dc3n69c.js";import"./chunk-8v2vbc4y.js";import"./chunk-067sgh2j.js";import"./chunk-bjejmqk4.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-e6ky15dr.js";export{th as clearOnceStore,Va as onceStore,Ge as partialsCache,Yr as processIncludes,Zr as processStackPushDirectives,Qr as processStackReplacements,eh as resetUnscopedSignalWarnings,ff as topLevelElements};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Lo,jo,Bo,Fo,ds,ps,gh,mh,hh,yh,gs,bh}from"./chunk-3t3p2c1t.js";import"./chunk-xyyt8v1r.js";export{bh as generateDefaultRobotsTxt,gs as generateRobotsTxt,mh as generateSitemap,hh as generateSitemapIndex,Fo as injectSeoTags,ds as metaDirective,Lo as processMetaDirectives,Bo as processSeoDirective,jo as processStructuredData,gh as registerSeoDirectives,yh as scanForSitemapEntries,ps as structuredDataDirective};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{xo}from"./chunk-ap30qs8p.js";export{xo as warnUnbalancedTags};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Tg}from"./chunk-46bd866e.js";import"./chunk-vh879axx.js";import"./chunk-mj8c8949.js";import"./chunk-c1fjdp7s.js";import"./chunk-qd6s902s.js";import"./chunk-39073rh9.js";import"./chunk-vapj4s7f.js";import"./chunk-ap30qs8p.js";import"./chunk-aa6fa3x4.js";import"./chunk-t413xatv.js";import"./chunk-cc2ss77r.js";import"./chunk-hava1caf.js";import"./chunk-7dc3n69c.js";import"./chunk-rt7q8dfs.js";import"./chunk-5ctdwyq1.js";import"./chunk-8v2vbc4y.js";import"./chunk-ak09a5v6.js";import"./chunk-f8fekg2d.js";import"./chunk-af7av42v.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import"./chunk-067sgh2j.js";import"./chunk-bjejmqk4.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-e6ky15dr.js";export{Tg as buildForProduction};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Hs,Ft,sl,og}from"./chunk-zecgd1wz.js";export{Hs as generateServiceWorker,og as generateServiceWorkerAuto,Ft as getServiceWorkerFileName,sl as isWorkboxEnabled};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Xs,Fi,Mr,Js,Ys,En,Wt,zi,Lr,jr,Zs,Qs,wg,xg,ut}from"./chunk-zav8yrtp.js";export{ut as DeployError,Fi as calculateSha1,Mr as collectDeployFiles,jr as createDefaultNetlifyConfig,Js as createFileManifest,Xs as createNetlifyClient,wg as deploy,Lr as detectProjectConfig,Ys as filterRequiredFiles,En as formatSize,zi as generateNetlifyToml,Wt as getTotalSize,Qs as hasNetlifyConfig,xg as initNetlify,Zs as writeNetlifyConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Fe,vn,Os,ai,O,Dt}from"./chunk-wp6q0geg.js";export{vn as currentRuntimeConfig,Dt as injectRuntimeConfig,O as resolveRuntimeConfig,ai as useRuntimeConfig,Os as useServerRuntimeConfig,Fe as withRuntimeConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{zs,yi,ng,rg,sg}from"./chunk-3457kk19.js";import"./chunk-zecgd1wz.js";export{rg as generateManifestLink,zs as generatePwaTags,ng as generateSwRegistrationScript,sg as generateThemeColorMeta,yi as injectPwaTags};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ea,ta,Tl,$l,Rl,Al,Ug}from"./chunk-2aarvd3a.js";export{ea as createVirtualList,Ug as default,Tl as generateVirtualListCSS,Rl as processInfiniteListDirectives,Al as processVirtualGridDirectives,ta as processVirtualListDirectives,$l as useVirtualList};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{wl,Eg}from"./chunk-768evhvm.js";export{wl as captureScreenshot,Eg as captureScreenshots};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{vg}from"./chunk-mzfbpcy0.js";import"./chunk-vh879axx.js";import"./chunk-c1fjdp7s.js";import"./chunk-qd6s902s.js";import"./chunk-hava1caf.js";import"./chunk-5ctdwyq1.js";import"./chunk-f8fekg2d.js";import"./chunk-af7av42v.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import"./chunk-067sgh2j.js";import"./chunk-bjejmqk4.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-e6ky15dr.js";export{vg as startProductionServer};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{m,Qo,$c,Rc,Ff,zf,Hf,Vf,Uf,Ps,Wf,Le,Y,je,qf,wr,Kf,Ic,ri,Be,r,hn,Oc,h,fe,wh}from"./chunk-067sgh2j.js";import"./chunk-bjejmqk4.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-e6ky15dr.js";export{fe as clearComponentCache,ri as componentClientSignalNames,Qo as convertToCommonJS,h as createDetailedErrorMessage,Uf as extractDirectiveNames,$c as extractScriptFromTemplate,m as extractVariables,r as fileExists,wh as getComponentCacheStats,zf as getPositionInfo,Y as getSharedTranspiler,Oc as getSourceLineInfo,Vf as hasDirectives,Rc as hasVariables,Kf as isHydrateTrigger,Wf as isJavaScriptScript,Be as renderComponentWithSlot,hn as resolveTemplatePath,qf as scopeOnRootElement,Ps as scopeSequenceKey,Le as shouldTranspileTypeScript,Ic as slotContentHasExpressions,je as transpileTypeScript,wr as userComponentFileExists,Hf as validateDirective,Ff as validateTemplate};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Jm,za,Ym,Ha,cf,lf,sn,tr,Zm,uf,df,Qm,y}from"./chunk-vapj4s7f.js";import"./chunk-ak09a5v6.js";import"./chunk-067sgh2j.js";import"./chunk-bjejmqk4.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-e6ky15dr.js";export{sn as buildCss,uf as extractClassNames,lf as fingerprintConfig,df as generateCss,Zm as getCachedCSS,Jm as getCssServeAsset,y as injectCss,za as loadCssEngine,Ha as loadCssEngineConfig,tr as rebuildCss,Ym as resetCssCache,cf as resolveUserCssConfig,Qm as withLinkedModuleBundles};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Gg,ra,ql,Xg,Jg,Yg,Zg,Qg,Kl,Gl,em,tm,nm,rm}from"./chunk-xjge15am.js";import"./chunk-39073rh9.js";import"./chunk-vapj4s7f.js";import"./chunk-ap30qs8p.js";import"./chunk-aa6fa3x4.js";import"./chunk-t413xatv.js";import"./chunk-cc2ss77r.js";import"./chunk-hava1caf.js";import"./chunk-7dc3n69c.js";import"./chunk-rt7q8dfs.js";import"./chunk-5ctdwyq1.js";import"./chunk-8v2vbc4y.js";import"./chunk-ak09a5v6.js";import"./chunk-f8fekg2d.js";import"./chunk-af7av42v.js";import"./chunk-stvw8y3c.js";import"./chunk-zjw6j2x0.js";import"./chunk-3t3p2c1t.js";import"./chunk-3ps07041.js";import"./chunk-067sgh2j.js";import"./chunk-bjejmqk4.js";import"./chunk-wp6q0geg.js";import"./chunk-xyyt8v1r.js";import"./chunk-zn3c0ew5.js";import"./chunk-e6ky15dr.js";export{ql as SUSPENSE_RESOLVER_RUNTIME,ra as buildSuspenseResolveScript,Qg as createStreamRenderer,Yg as extractStreamBoundaries,rm as generateHydrationRuntime,Gl as islandDirective,tm as processSectionDirectives,Jg as processStreamDirectives,em as registerStreamingDirectives,Xg as renderStreamingPage,Gg as streamTemplate,Zg as streamTemplateSimple,nm as streamToResponse,Kl as streamingSuspenseDirective};