@stacksjs/stx 0.2.825 → 0.2.827

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 (236) hide show
  1. package/dist/chunk-02zvytqx.js +2 -0
  2. package/dist/{chunk-bt0amey5.js → chunk-04z1xyrb.js} +2 -2
  3. package/dist/chunk-0jhq2kza.js +2 -0
  4. package/dist/{chunk-f0txsdpa.js → chunk-0rvntfhj.js} +3 -3
  5. package/dist/chunk-12m1qwzd.js +2 -0
  6. package/dist/chunk-17zrprh0.js +2 -0
  7. package/dist/chunk-1bpx9b0m.js +2 -0
  8. package/dist/{chunk-wy0gghvh.js → chunk-1vzncfka.js} +2 -2
  9. package/dist/chunk-2b1w7py1.js +2 -0
  10. package/dist/chunk-2mrdtxfy.js +2 -0
  11. package/dist/{chunk-2vqpz4qv.js → chunk-2qngyyaz.js} +2 -2
  12. package/dist/{chunk-7yb82rm6.js → chunk-2x9zhezb.js} +2 -2
  13. package/dist/{chunk-9fm8khcc.js → chunk-3esj6tb8.js} +5 -5
  14. package/dist/{chunk-3fwhb1q4.js → chunk-3g7bjpj6.js} +3 -3
  15. package/dist/{chunk-981z8va1.js → chunk-3p7r3ajd.js} +2 -2
  16. package/dist/chunk-3qx7whh5.js +2 -0
  17. package/dist/chunk-3vsz0vrk.js +2 -0
  18. package/dist/{chunk-en390342.js → chunk-3x3zcfxp.js} +48 -48
  19. package/dist/chunk-3zfras5s.js +2 -0
  20. package/dist/chunk-42c92rp3.js +2 -0
  21. package/dist/{chunk-0wgjhyb8.js → chunk-48z7tg83.js} +3 -3
  22. package/dist/chunk-4a3r1kh1.js +43 -0
  23. package/dist/{chunk-24d3yy27.js → chunk-4d8ep00w.js} +49 -49
  24. package/dist/chunk-4z0jpzdq.js +3 -0
  25. package/dist/{chunk-6qvn1h09.js → chunk-5201w0f1.js} +3 -3
  26. package/dist/{chunk-xmdcjyyx.js → chunk-543yvntm.js} +2 -2
  27. package/dist/{chunk-e99szqws.js → chunk-5phdmpa7.js} +6 -6
  28. package/dist/{chunk-06y0da27.js → chunk-5r63bv4g.js} +3 -3
  29. package/dist/chunk-67nq6csk.js +2 -0
  30. package/dist/chunk-6aak0b7c.js +2 -0
  31. package/dist/{chunk-7sh9fa3q.js → chunk-6k26n0sj.js} +2 -2
  32. package/dist/chunk-6r4teng3.js +2 -0
  33. package/dist/{chunk-d6d2s7n6.js → chunk-6tjm38e4.js} +2 -2
  34. package/dist/{chunk-06hc6rs6.js → chunk-716jrdcg.js} +1 -1
  35. package/dist/{chunk-ac2vz9c3.js → chunk-717qsbap.js} +10 -10
  36. package/dist/chunk-72n804gy.js +2 -0
  37. package/dist/chunk-7amk61bt.js +2 -0
  38. package/dist/{chunk-3yh6y00f.js → chunk-7k9yahng.js} +6 -6
  39. package/dist/{chunk-wf0n9gpj.js → chunk-7p8m82pj.js} +4 -4
  40. package/dist/{chunk-rzt51r2b.js → chunk-7z2ygy9p.js} +7 -7
  41. package/dist/chunk-8n8vj099.js +2 -0
  42. package/dist/chunk-8ta7f5en.js +2 -0
  43. package/dist/{chunk-r9e0r6jx.js → chunk-8y8kgw9s.js} +3 -3
  44. package/dist/{chunk-cnh6tcdj.js → chunk-8yy8qrcv.js} +10 -10
  45. package/dist/chunk-a7ewznxk.js +2 -0
  46. package/dist/{chunk-gjf8cjdt.js → chunk-ac9ncbfw.js} +3 -3
  47. package/dist/chunk-ahd8jdzx.js +2 -0
  48. package/dist/chunk-ay7ggc4k.js +2 -0
  49. package/dist/chunk-ayk94a19.js +2 -0
  50. package/dist/{chunk-mv3yhspn.js → chunk-b1q40vq4.js} +2 -2
  51. package/dist/{chunk-dsfdgqmd.js → chunk-b3nv89wq.js} +2 -2
  52. package/dist/{chunk-3axb6t08.js → chunk-b7tb00nz.js} +2 -2
  53. package/dist/chunk-b92vzax2.js +2 -0
  54. package/dist/{chunk-pbpr3bdy.js → chunk-bh35v908.js} +1 -1
  55. package/dist/chunk-bh7v78je.js +2 -0
  56. package/dist/{chunk-vfy3b7gm.js → chunk-bjvmmsvp.js} +6 -6
  57. package/dist/{chunk-djpmrctd.js → chunk-bwnwv91e.js} +8 -8
  58. package/dist/chunk-c7ybxv8x.js +2 -0
  59. package/dist/{chunk-3dz29mpg.js → chunk-c8vza3p0.js} +22 -22
  60. package/dist/{chunk-8ttmzcxb.js → chunk-c9mdvpf5.js} +29 -29
  61. package/dist/{chunk-5emrarpf.js → chunk-car6nhfe.js} +2 -2
  62. package/dist/{chunk-e4jwhmpb.js → chunk-cca18z35.js} +31 -31
  63. package/dist/chunk-cfrgrnej.js +2 -0
  64. package/dist/{chunk-vzbyn4nh.js → chunk-ckg6q98b.js} +5 -5
  65. package/dist/{chunk-k81trehg.js → chunk-cv1zc9dg.js} +2 -2
  66. package/dist/chunk-cw8vpk41.js +2 -0
  67. package/dist/chunk-d2n2zrdg.js +2 -0
  68. package/dist/{chunk-0scyzg9r.js → chunk-d9s37xm5.js} +19 -19
  69. package/dist/chunk-db1c0c3c.js +2 -0
  70. package/dist/{chunk-cxz4cdcn.js → chunk-e75dntfb.js} +2 -2
  71. package/dist/chunk-e8a6s6xs.js +25 -0
  72. package/dist/{chunk-wceg59n0.js → chunk-ekh3mxyp.js} +2 -2
  73. package/dist/{chunk-4mj9dem1.js → chunk-em8tv6nz.js} +2 -2
  74. package/dist/{chunk-7qk4exw1.js → chunk-ema1c29k.js} +2 -2
  75. package/dist/{chunk-z23arg8m.js → chunk-f49x34sr.js} +2 -2
  76. package/dist/{chunk-8w9spdbn.js → chunk-f6b7av6b.js} +9 -9
  77. package/dist/{chunk-9gmceny5.js → chunk-f7jgda7x.js} +5 -5
  78. package/dist/chunk-fb90n0by.js +2 -0
  79. package/dist/chunk-fevyb337.js +3 -0
  80. package/dist/chunk-fqq5qzm0.js +2 -0
  81. package/dist/chunk-fr9e8kb9.js +2 -0
  82. package/dist/{chunk-ge0k6c49.js → chunk-ftw0a5dm.js} +6 -6
  83. package/dist/{chunk-b4x5ndt9.js → chunk-fwktw49p.js} +4 -4
  84. package/dist/chunk-g4qzy5hv.js +2 -0
  85. package/dist/{chunk-tksjakyv.js → chunk-gcf97wgx.js} +1 -1
  86. package/dist/chunk-gg48cgx3.js +2 -0
  87. package/dist/{chunk-076fj387.js → chunk-hd378dgy.js} +1 -1
  88. package/dist/chunk-j9aftb7p.js +2 -0
  89. package/dist/chunk-jp6sbk05.js +2 -0
  90. package/dist/chunk-k6ye0159.js +3 -0
  91. package/dist/{chunk-vyj9xddw.js → chunk-kfkbqwyf.js} +2 -2
  92. package/dist/{chunk-ap2t6fdt.js → chunk-kh2n3zqa.js} +1 -1
  93. package/dist/{chunk-b1n2tq8f.js → chunk-kmqcvpz2.js} +5 -5
  94. package/dist/chunk-kshem79d.js +2 -0
  95. package/dist/chunk-kve27dy3.js +2 -0
  96. package/dist/chunk-m3tnxk01.js +2 -0
  97. package/dist/chunk-m716f2ga.js +2 -0
  98. package/dist/{chunk-3wjh3aw8.js → chunk-m973xh3a.js} +13 -13
  99. package/dist/chunk-m9bbhg46.js +3 -0
  100. package/dist/chunk-m9dj8pgb.js +2 -0
  101. package/dist/{chunk-gp37b8vw.js → chunk-mfebs2s2.js} +2 -2
  102. package/dist/{chunk-qj4r08jb.js → chunk-mxvevxb8.js} +4 -4
  103. package/dist/{chunk-btxnrqxf.js → chunk-myje6fhm.js} +5 -5
  104. package/dist/{chunk-1f7d1c0y.js → chunk-mypygxdm.js} +2 -2
  105. package/dist/{chunk-76eh43e9.js → chunk-nfpsaaqm.js} +2 -2
  106. package/dist/{chunk-zen28e3p.js → chunk-ng5revck.js} +29 -29
  107. package/dist/chunk-nxnkd48v.js +2 -0
  108. package/dist/chunk-pe5qqem0.js +2 -0
  109. package/dist/chunk-pg146fc5.js +2 -0
  110. package/dist/{chunk-67kbsav0.js → chunk-q5pwvr98.js} +1 -1
  111. package/dist/{chunk-2nj9aewf.js → chunk-qadce16v.js} +1 -1
  112. package/dist/chunk-qg2tpvdw.js +2 -0
  113. package/dist/chunk-qm6epp9h.js +2 -0
  114. package/dist/{chunk-faxbznng.js → chunk-qn06sy9j.js} +5 -5
  115. package/dist/{chunk-q7zwv88b.js → chunk-qnrgfm9v.js} +2 -2
  116. package/dist/{chunk-0kbzs147.js → chunk-qz82cpyv.js} +9 -9
  117. package/dist/chunk-rbq4dn2a.js +2 -0
  118. package/dist/{chunk-kvgxmb0s.js → chunk-ret52ds0.js} +6 -6
  119. package/dist/{chunk-xpy9yjyx.js → chunk-rkdsgfhd.js} +13 -13
  120. package/dist/{chunk-bfbh0hfn.js → chunk-rmygv0n0.js} +6 -6
  121. package/dist/{chunk-n7arptzc.js → chunk-s53wjw7y.js} +3 -3
  122. package/dist/{chunk-p1fpferp.js → chunk-s5dhvnnd.js} +6 -6
  123. package/dist/chunk-s5ejh2yx.js +2 -0
  124. package/dist/chunk-s6399qe7.js +2 -0
  125. package/dist/chunk-se3fqsxk.js +2 -0
  126. package/dist/chunk-t59bc7na.js +3 -0
  127. package/dist/{chunk-yr3ped5m.js → chunk-t96229jm.js} +2 -2
  128. package/dist/{chunk-z5hmwq1z.js → chunk-tngj0fp6.js} +8 -8
  129. package/dist/chunk-txzap6yn.js +2 -0
  130. package/dist/{chunk-g0zxp9qh.js → chunk-tzhs7drk.js} +11 -11
  131. package/dist/chunk-v1mwhvf8.js +2 -0
  132. package/dist/chunk-vb4xzz5c.js +2 -0
  133. package/dist/{chunk-me6kgvsm.js → chunk-vpnyqf0h.js} +1 -1
  134. package/dist/chunk-vxhq8n8y.js +2 -0
  135. package/dist/{chunk-mwxbdpb1.js → chunk-vyv76w55.js} +2 -2
  136. package/dist/chunk-w39cfxa6.js +2 -0
  137. package/dist/chunk-w9gpscjf.js +2 -0
  138. package/dist/chunk-wb6w807m.js +2 -0
  139. package/dist/chunk-wpyhavjy.js +2 -0
  140. package/dist/{chunk-j3st59hv.js → chunk-wr7bmkne.js} +2 -2
  141. package/dist/chunk-wt7qhv5b.js +2 -0
  142. package/dist/{chunk-y8p85kcj.js → chunk-wvds0s9m.js} +2 -2
  143. package/dist/chunk-x742wppj.js +2 -0
  144. package/dist/chunk-xdwnbr9b.js +4 -0
  145. package/dist/{chunk-a1htb5r5.js → chunk-xj3my6b9.js} +105 -105
  146. package/dist/{chunk-qz3fdmrc.js → chunk-xn9jg1q5.js} +3 -3
  147. package/dist/chunk-xrspzeqx.js +2 -0
  148. package/dist/{chunk-xegj9wqj.js → chunk-xtn0hnmz.js} +6 -6
  149. package/dist/{chunk-jb2rvsf4.js → chunk-y6nz6bk2.js} +3 -3
  150. package/dist/{chunk-cmnze7at.js → chunk-ybq56wam.js} +2 -2
  151. package/dist/{chunk-y9bj3566.js → chunk-yrw5ensv.js} +3 -3
  152. package/dist/{chunk-axwa3s1m.js → chunk-yv1vw0kx.js} +2 -2
  153. package/dist/{chunk-pvj0bpqg.js → chunk-z25w7kmr.js} +4 -4
  154. package/dist/chunk-zty254tw.js +2 -0
  155. package/dist/{chunk-j737tnvt.js → chunk-zvvv6x8c.js} +4 -4
  156. package/dist/cli.js +23 -23
  157. package/dist/craft-entry.js +2 -2
  158. package/dist/craft.js +2 -2
  159. package/dist/loops.d.ts +2 -0
  160. package/dist/loops.js +22 -3
  161. package/dist/performance-utils.d.ts +2 -0
  162. package/dist/performance-utils.js +7 -0
  163. package/dist/process.js +17 -3
  164. package/dist/pwa.js +3 -3
  165. package/dist/ssg.js +11 -11
  166. package/package.json +5 -5
  167. package/dist/chunk-030tgwve.js +0 -2
  168. package/dist/chunk-09285y4b.js +0 -2
  169. package/dist/chunk-0jvrzpfs.js +0 -2
  170. package/dist/chunk-1qwb0pyb.js +0 -2
  171. package/dist/chunk-30rpspzt.js +0 -43
  172. package/dist/chunk-3bf48zrh.js +0 -2
  173. package/dist/chunk-3bny2583.js +0 -2
  174. package/dist/chunk-3e7t4qzd.js +0 -2
  175. package/dist/chunk-40rzr6qj.js +0 -2
  176. package/dist/chunk-4sev2jfs.js +0 -2
  177. package/dist/chunk-5e5jschg.js +0 -3
  178. package/dist/chunk-5ea3zebc.js +0 -2
  179. package/dist/chunk-6h1qa3hw.js +0 -2
  180. package/dist/chunk-6tfhx4zw.js +0 -2
  181. package/dist/chunk-716qmx26.js +0 -2
  182. package/dist/chunk-7bjxmzre.js +0 -2
  183. package/dist/chunk-7mw1yc6j.js +0 -2
  184. package/dist/chunk-7pz76f28.js +0 -2
  185. package/dist/chunk-7vfq8t4x.js +0 -2
  186. package/dist/chunk-9w9vr35m.js +0 -2
  187. package/dist/chunk-a8fy7jv8.js +0 -2
  188. package/dist/chunk-akj26p4b.js +0 -3
  189. package/dist/chunk-an1cc36z.js +0 -2
  190. package/dist/chunk-b22yj5j5.js +0 -2
  191. package/dist/chunk-brhas9mp.js +0 -3
  192. package/dist/chunk-c1e45rtv.js +0 -2
  193. package/dist/chunk-cgamtmxv.js +0 -2
  194. package/dist/chunk-d30p1zvd.js +0 -2
  195. package/dist/chunk-dfy5g8cb.js +0 -2
  196. package/dist/chunk-e38gkp8q.js +0 -2
  197. package/dist/chunk-fm8hq9y2.js +0 -2
  198. package/dist/chunk-g4sdthck.js +0 -2
  199. package/dist/chunk-g8nqmnb7.js +0 -2
  200. package/dist/chunk-h67pm636.js +0 -2
  201. package/dist/chunk-hb8jxg45.js +0 -2
  202. package/dist/chunk-hfgzqapw.js +0 -2
  203. package/dist/chunk-hras294c.js +0 -25
  204. package/dist/chunk-j0hrk24j.js +0 -2
  205. package/dist/chunk-jjbdtj4w.js +0 -2
  206. package/dist/chunk-jzgyrxye.js +0 -2
  207. package/dist/chunk-k0xdvegc.js +0 -2
  208. package/dist/chunk-kg9gnar1.js +0 -2
  209. package/dist/chunk-kq5k2qbz.js +0 -2
  210. package/dist/chunk-m934bzg2.js +0 -2
  211. package/dist/chunk-mmeck545.js +0 -2
  212. package/dist/chunk-mz6qjee1.js +0 -2
  213. package/dist/chunk-ndjmt3vg.js +0 -3
  214. package/dist/chunk-pgpkrf6g.js +0 -2
  215. package/dist/chunk-prt4ntb0.js +0 -2
  216. package/dist/chunk-px6336z8.js +0 -2
  217. package/dist/chunk-q5bct2ks.js +0 -2
  218. package/dist/chunk-r2hjn9ds.js +0 -2
  219. package/dist/chunk-rqdnzbq0.js +0 -2
  220. package/dist/chunk-rrkn40eq.js +0 -2
  221. package/dist/chunk-s2zsa16d.js +0 -2
  222. package/dist/chunk-sddp2398.js +0 -2
  223. package/dist/chunk-sfr0767s.js +0 -2
  224. package/dist/chunk-sv4emtcj.js +0 -2
  225. package/dist/chunk-sx8j2e58.js +0 -2
  226. package/dist/chunk-t2tv5ezg.js +0 -2
  227. package/dist/chunk-tcyvwy8p.js +0 -2
  228. package/dist/chunk-tg18j1yf.js +0 -2
  229. package/dist/chunk-tj7dh2dz.js +0 -2
  230. package/dist/chunk-tsvnhc0c.js +0 -4
  231. package/dist/chunk-vafxrky2.js +0 -2
  232. package/dist/chunk-vvjp9xp0.js +0 -2
  233. package/dist/chunk-wpendr22.js +0 -3
  234. package/dist/chunk-x30gh7vt.js +0 -2
  235. package/dist/chunk-y3trpdp9.js +0 -2
  236. package/dist/chunk-zqsygwa0.js +0 -2
@@ -464,3 +464,10 @@ export function applyDefaultBudgets(monitor = getPerformanceMonitor()) {
464
464
  export function resetPerformanceMonitor() {
465
465
  _performanceMonitor = null;
466
466
  }
467
+ let lastRenderYield = 0;
468
+ export async function yieldDuringRendering() {
469
+ if (performance.now() - lastRenderYield < 16)
470
+ return;
471
+ await new Promise((resolve) => setTimeout(resolve, 0));
472
+ lastRenderYield = performance.now();
473
+ }
package/dist/process.js CHANGED
@@ -28,11 +28,11 @@ import { processBasicFormDirectives, processErrorDirective, processFormInputDire
28
28
  import { processTranslateDirective } from "./i18n.js";
29
29
  import { processIncludes, processStackPushDirectives, processStackReplacements } from "./includes.js";
30
30
  import { processJsDirectives, processTsDirectives } from "./js-ts.js";
31
- import { processLoops, reportDeferredLoopWarnings } from "./loops.js";
31
+ import { processLoopsAsync, reportDeferredLoopWarnings } from "./loops.js";
32
32
  import { processMarkdownDirectives } from "./markdown.js";
33
33
  import { processMethodDirectives } from "./method-spoofing.js";
34
34
  import { runPostProcessingMiddleware, runPreProcessingMiddleware } from "./middleware.js";
35
- import { performanceMonitor } from "./performance-utils.js";
35
+ import { performanceMonitor, yieldDuringRendering } from "./performance-utils.js";
36
36
  import { processRouteDirectives } from "./routes.js";
37
37
  import { injectSeoTags, processMetaDirectives, processSeoDirective, processStructuredData } from "./seo.js";
38
38
  import { fileExists, resolveTemplatePath, scopeSequenceKey } from "./utils.js";
@@ -370,6 +370,7 @@ function restoreEscapedMustaches(html) {
370
370
  });
371
371
  }
372
372
  export async function processDirectives(template, context, filePath, options, dependencies) {
373
+ await yieldDuringRendering();
373
374
  if (options.ssr === !1 && !options.autoShell && options.buildMode === "spa")
374
375
  return template;
375
376
  if (context.__stx_signals_gate === void 0)
@@ -816,11 +817,13 @@ async function interpolateClientScriptExpressions(output, context, filePath) {
816
817
  }
817
818
  async function processOtherDirectives(template, context, filePath, options, dependencies) {
818
819
  let output = template;
820
+ await yieldDuringRendering();
819
821
  const opts = options;
820
822
  output = await extractServerScriptVariables(output, context, filePath, options);
821
823
  output = await processJsDirectives(output, context, filePath);
822
824
  output = await processTsDirectives(output, context, filePath);
823
825
  output = await interpolateClientScriptExpressions(output, context, filePath);
826
+ await yieldDuringRendering();
824
827
  output = await processCustomDirectives(output, context, filePath, opts);
825
828
  if (usesSignalsInScript(output)) {
826
829
  output = convertSignalDirectivesToAttributes(output, context);
@@ -828,11 +831,14 @@ async function processOtherDirectives(template, context, filePath, options, depe
828
831
  output = convertServerLoopAttributesToDirectives(output, context);
829
832
  }
830
833
  output = preEvalLiteralReactiveIfs(output);
834
+ await yieldDuringRendering();
831
835
  const { processStreamDirectives } = await importOnce("stx/streaming", () => import("./streaming.js"));
832
836
  output = processStreamDirectives(output, context);
833
- output = processLoops(output, context, filePath, opts, !0);
837
+ output = await processLoopsAsync(output, context, filePath, opts, !0);
838
+ await yieldDuringRendering();
834
839
  output = await processDynamicComponents(output, context, filePath, opts, dependencies);
835
840
  output = await processComponents(output, context, filePath, opts, dependencies);
841
+ await yieldDuringRendering();
836
842
  output = processAnimationDirectives(output, context, filePath, opts);
837
843
  const { processDeferDirectives } = await importOnce("stx/defer", () => import("./defer.js"));
838
844
  output = processDeferDirectives(output, context, filePath);
@@ -854,6 +860,7 @@ async function processOtherDirectives(template, context, filePath, options, depe
854
860
  output = processVirtualListDirectives(output, context, filePath);
855
861
  output = processVirtualGridDirectives(output, context, filePath);
856
862
  output = processInfiniteListDirectives(output, context, filePath);
863
+ await yieldDuringRendering();
857
864
  const { processPartialHydrationDirectives, processStaticDirectives } = await importOnce("stx/partial-hydration", () => import("./partial-hydration.js"));
858
865
  output = processPartialHydrationDirectives(output, context, filePath);
859
866
  output = processStaticDirectives(output);
@@ -878,10 +885,12 @@ async function processOtherDirectives(template, context, filePath, options, depe
878
885
  output = processMethodDirectives(output);
879
886
  output = await processIncludes(output, context, filePath, opts, dependencies);
880
887
  output = await processComponents(output, context, filePath, opts, dependencies);
888
+ await yieldDuringRendering();
881
889
  output = output.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g, "");
882
890
  output = processRefAttributes(output);
883
891
  output = processConditionals(output, context, filePath);
884
892
  output = reportDeferredLoopWarnings(output);
893
+ await yieldDuringRendering();
885
894
  if (context.__stxProcessingDepth === 1)
886
895
  output = injectComponentClientFactories(output, context);
887
896
  output = processStatusDirective(output, context, { filePath, buildMode: opts.buildMode });
@@ -893,6 +902,7 @@ async function processOtherDirectives(template, context, filePath, options, depe
893
902
  output = await processMarkdownFileDirectives(output, context, filePath, opts);
894
903
  output = await processMarkdownDirectives(output, context, filePath);
895
904
  output = await processTranslateDirective(output, context, filePath, opts);
905
+ await yieldDuringRendering();
896
906
  output = processA11yDirectives(output, context, filePath, opts);
897
907
  output = processMetaDirectives(output, context, filePath, opts);
898
908
  output = processStructuredData(output, context, filePath);
@@ -904,6 +914,7 @@ async function processOtherDirectives(template, context, filePath, options, depe
904
914
  if (!opts.skipEventDirectives)
905
915
  output = processEventDirectives(output, context, filePath);
906
916
  output = processReactiveDirectives(output, context, filePath, options.skipSignalsRuntime === !0 && Number(context.__stxProcessingDepth) > 0);
917
+ await yieldDuringRendering();
907
918
  if (opts.debug) {
908
919
  const hasXData = /\bx-data\s*=/.test(output), hasSignals = hasSignalsSyntax(template);
909
920
  if (hasXData && hasSignals)
@@ -913,6 +924,7 @@ async function processOtherDirectives(template, context, filePath, options, depe
913
924
  }
914
925
  output = processServerBindings(output, context);
915
926
  output = await processExpressions(output, context, filePath);
927
+ await yieldDuringRendering();
916
928
  output = addCloakToUnresolvedExpressions(output);
917
929
  output = addCloakToConditionalDirectives(output);
918
930
  output = processTemplateBindings(output);
@@ -920,8 +932,10 @@ async function processOtherDirectives(template, context, filePath, options, depe
920
932
  output = processXElementDirectives(output);
921
933
  const pageFilePath = context.__originalFilePath || filePath, serverData = extractBridgeData(context);
922
934
  output = await processSignals(output, opts, pageFilePath, serverData);
935
+ await yieldDuringRendering();
923
936
  output = processAppearanceBootstrapDirective(output, context);
924
937
  output = await runPostProcessingMiddleware(output, context, filePath, opts);
938
+ await yieldDuringRendering();
925
939
  if (opts.media?.image?.autoSiblings) {
926
940
  const publicDir = opts.publicDir || "public", { rewriteImagesWithSiblings } = await importOnce("stx/image-optimization/auto-sibling", () => import("./image-optimization/auto-sibling.js"));
927
941
  output = await rewriteImagesWithSiblings(output, { publicDir });
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{eo,Ht,kl,Tg}from"./chunk-j737tnvt.js";import{Qs,Ii,_g,Cg,Eg}from"./chunk-bfbh0hfn.js";import{vl,xl,Sl,Sg,kg}from"./chunk-4mj9dem1.js";import{Ue,Tn,Oi}from"./chunk-y9bj3566.js";import{$g,Rg,Ag,Pg,to,fy}from"./chunk-1f7d1c0y.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-7vfq8t4x.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{eo,Vt,_l,Rg}from"./chunk-zvvv6x8c.js";import{Qs,Oi,Eg,Tg,$g}from"./chunk-rmygv0n0.js";import{xl,Sl,kl,_g,Cg}from"./chunk-em8tv6nz.js";import{We,$n,Ni}from"./chunk-yrw5ensv.js";import{Ag,Pg,Ig,Og,to,my}from"./chunk-mypygxdm.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-3vsz0vrk.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=Ue(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=eo(n,t);if(a){let s=Ht(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 Ii(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,xl as auditBuildOutput,vl as auditConfig,re as buildPwaAssets,Sl as calculateAuditResult,kg as formatAuditResult,Oi as formatSize,j as generateManifest,_ as generateManifestJson,Cg as generateManifestLink,F as generateOfflinePage,Ue as generatePrecacheManifest,Tn as generatePrecacheManifestJs,M as generatePwaIcons,Qs as generatePwaTags,eo as generateServiceWorker,Tg as generateServiceWorkerAuto,_g as generateSwRegistrationScript,Eg as generateThemeColorMeta,N as getExpectedIconPaths,Ht as getServiceWorkerFileName,Ii as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,kl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,to as pwaDirectives,$g as pwaInstallDirective,Ag as pwaOfflineDirective,Pg as pwaPushDirective,Rg as pwaUpdateDirective,fy as registerPwaDirectives,Sg 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=We(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=eo(n,t);if(a){let s=Vt(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 Oi(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,Sl as auditBuildOutput,xl as auditConfig,re as buildPwaAssets,kl as calculateAuditResult,Cg as formatAuditResult,Ni as formatSize,j as generateManifest,_ as generateManifestJson,Tg as generateManifestLink,F as generateOfflinePage,We as generatePrecacheManifest,$n as generatePrecacheManifestJs,M as generatePwaIcons,Qs as generatePwaTags,eo as generateServiceWorker,Rg as generateServiceWorkerAuto,Eg as generateSwRegistrationScript,$g as generateThemeColorMeta,N as getExpectedIconPaths,Vt as getServiceWorkerFileName,Oi as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,_l as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,to as pwaDirectives,Ag as pwaInstallDirective,Ig as pwaOfflineDirective,Og as pwaPushDirective,Pg as pwaUpdateDirective,my as registerPwaDirectives,_g as runPwaAudit,D as validateManifest};
package/dist/ssg.js CHANGED
@@ -1,13 +1,13 @@
1
1
  // @bun
2
- import"./chunk-7sh9fa3q.js";import{x,sl}from"./chunk-8ttmzcxb.js";import"./chunk-bt0amey5.js";import"./chunk-r9e0r6jx.js";import{Rt,y}from"./chunk-a1htb5r5.js";import"./chunk-2vqpz4qv.js";import"./chunk-axwa3s1m.js";import"./chunk-k81trehg.js";import{kt,_t,Ct,Et,Tt,$t}from"./chunk-qj4r08jb.js";import{a}from"./chunk-zen28e3p.js";import{Es}from"./chunk-xpy9yjyx.js";import"./chunk-wf0n9gpj.js";import"./chunk-faxbznng.js";import{he,en,tn}from"./chunk-z5hmwq1z.js";import"./chunk-gp37b8vw.js";import{b}from"./chunk-ac2vz9c3.js";import{yt,i}from"./chunk-24d3yy27.js";import"./chunk-djpmrctd.js";import"./chunk-g0zxp9qh.js";import{ps}from"./chunk-0kbzs147.js";import"./chunk-hras294c.js";import"./chunk-c84pxd2k.js";import{Za,Qa,ec}from"./chunk-gjf8cjdt.js";import{Zt,Yn,Zn}from"./chunk-ndjmt3vg.js";import{Qt}from"./chunk-xmdcjyyx.js";import"./chunk-5e5jschg.js";import"./chunk-wceg59n0.js";import{X,we}from"./chunk-e99szqws.js";import"./chunk-2nj9aewf.js";import"./chunk-jb2rvsf4.js";import{c}from"./chunk-brhas9mp.js";import{r,ge}from"./chunk-b4x5ndt9.js";import D from"fs";import f from"path";import{createHash as vt}from"crypto";function Pt(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 It(t){return Bun.hash(t).toString(16)}function ot(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,o=t.replace(Dt,(e,u,g,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(g))return e;if(n.minify)w=Pt(w);let p=It(w);if(!s.has(p))s.set(p,w);let P=n.integrity?` data-stx-integrity="sha384-${vt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),l=Array.from(s,([e,u])=>({hash:e,code:u}));return{html:o,chunks:l}}var Bt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(t))!==null)n.set(o[1],o[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(Bt.has(n.get(u[1])||""))l.add(u[2]);let g=/<\/head\s*>/iy,v=y(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(l.size===0||v===-1)return t;let w=Array.from(l).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!w)return t;return t.slice(0,v)+w+t.slice(v)}var jt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function K(t){let n=t.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Ft(t){for(let n of jt){let s=t[n];if(!s)continue;let o=K(s);if(o)return{url:o,source:"env",via:n}}return null}function lt(t){if(!t||typeof t!=="object")return null;let n=t,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?K(s):null}async function At(t){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=s.resolve(t,o);if(!n(l))continue;try{let e=await import(l),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let n=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let u=K(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let l=await At(n);if(l)return{url:l,source:"site.config",via:"url"};let e=Ft(s);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 Ot;function Lt(t){let n=r(t),{depths:s}=ge(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(n))!==null){if(s[l.index]!==0)continue;let u=x(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=x(n,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(l.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(n))!==null){if(s[l.index]!==0)continue;let u=sl(n,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 n="read";try{let s=await Bun.file(t).text();n="parse";let o=Qt(s),l=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>s.indexOf(e.fullTag)-s.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(r(g))&&Rt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(q);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();n="result";let p=Array.isArray(w)?{paths:w}:w;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let s=D.statSync(t),o=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of n)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,n){let s=this.cache.get(t);if(!s)return null;let o=ft(n).some((u)=>D.existsSync(u)),l=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&ps(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||l)return this.cache.delete(t),null;let e=this.getHash(n,s.dependencies??[]);if(s.hash!==e)return this.cache.delete(t),null;return s.html}set(t,n,s,o){let l=this.getHash(n,s);this.cache.set(t,{hash:l,html:o,generatedAt:Date.now(),dependencies:s})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let s=this.getFilePath(t);await D.promises.mkdir(f.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await D.promises.unlink(n)}async invalidatePattern(t){let n=f.join(this.cacheDir,"isr");if(!D.existsSync(n))return;let s=await D.promises.readdir(n);for(let o of s){let l=o.replace(/_/g,"/").replace(".json","");if(t.test(l))await D.promises.unlink(f.join(n,o))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function Ut(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let s=await gt(t.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${t.pattern} (${t.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let l of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(l.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return n}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let n of ft(t))if(await Bun.file(n).exists())try{let s=await import(n);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...l}=s;return l}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Gt(t,n,s){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let l=o[1];if(!l.includes("getStaticProps"))return null;try{let e=l.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
2
+ import"./chunk-6k26n0sj.js";import{x,ol}from"./chunk-c9mdvpf5.js";import"./chunk-04z1xyrb.js";import"./chunk-8y8kgw9s.js";import{At,y}from"./chunk-xj3my6b9.js";import"./chunk-2qngyyaz.js";import"./chunk-yv1vw0kx.js";import"./chunk-cv1zc9dg.js";import{_t,Ct,Et,Tt,$t,Rt}from"./chunk-mxvevxb8.js";import{a}from"./chunk-ng5revck.js";import{Es}from"./chunk-rkdsgfhd.js";import"./chunk-7p8m82pj.js";import"./chunk-qn06sy9j.js";import{ye,tn,nn}from"./chunk-tngj0fp6.js";import"./chunk-mfebs2s2.js";import{b}from"./chunk-717qsbap.js";import{bt,i}from"./chunk-4d8ep00w.js";import"./chunk-bwnwv91e.js";import"./chunk-tzhs7drk.js";import{ps}from"./chunk-qz82cpyv.js";import"./chunk-e8a6s6xs.js";import"./chunk-c84pxd2k.js";import{Qa,ec,tc}from"./chunk-ac9ncbfw.js";import{Qt,Zn,Qn}from"./chunk-4z0jpzdq.js";import{en}from"./chunk-543yvntm.js";import"./chunk-fevyb337.js";import"./chunk-ekh3mxyp.js";import{G,ve}from"./chunk-5phdmpa7.js";import"./chunk-qadce16v.js";import"./chunk-y6nz6bk2.js";import{c}from"./chunk-k6ye0159.js";import{r,me}from"./chunk-fwktw49p.js";import D from"fs";import f from"path";import{createHash as vt}from"crypto";function Pt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var kt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Dt(t){return Bun.hash(t).toString(16)}function ot(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,o=t.replace(kt,(e,u,g,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(g))return e;if(n.minify)w=Pt(w);let p=Dt(w);if(!s.has(p))s.set(p,w);let P=n.integrity?` data-stx-integrity="sha384-${vt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),l=Array.from(s,([e,u])=>({hash:e,code:u}));return{html:o,chunks:l}}var It=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(t))!==null)n.set(o[1],o[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(n.get(u[1])||""))l.add(u[2]);let g=/<\/head\s*>/iy,v=y(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(l.size===0||v===-1)return t;let w=Array.from(l).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" 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 n=t.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let n of Bt){let s=t[n];if(!s)continue;let o=X(s);if(o)return{url:o,source:"env",via:n}}return null}function lt(t){if(!t||typeof t!=="object")return null;let n=t,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?X(s):null}async function Ft(t){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=s.resolve(t,o);if(!n(l))continue;try{let e=await import(l),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let n=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let l=await Ft(n);if(l)return{url:l,source:"site.config",via:"url"};let e=jt(s);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 Ot;function Lt(t){let n=r(t),{depths:s}=me(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(n))!==null){if(s[l.index]!==0)continue;let u=x(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=x(n,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(l.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(n))!==null){if(s[l.index]!==0)continue;let u=ol(n,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 n="read";try{let s=await Bun.file(t).text();n="parse";let o=en(s),l=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>s.indexOf(e.fullTag)-s.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(r(g))&&At(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(J);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();n="result";let p=Array.isArray(w)?{paths:w}:w;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let s=D.statSync(t),o=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of n)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,n){let s=this.cache.get(t);if(!s)return null;let o=ft(n).some((u)=>D.existsSync(u)),l=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&ps(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||l)return this.cache.delete(t),null;let e=this.getHash(n,s.dependencies??[]);if(s.hash!==e)return this.cache.delete(t),null;return s.html}set(t,n,s,o){let l=this.getHash(n,s);this.cache.set(t,{hash:l,html:o,generatedAt:Date.now(),dependencies:s})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let s=this.getFilePath(t);await D.promises.mkdir(f.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await D.promises.unlink(n)}async invalidatePattern(t){let n=f.join(this.cacheDir,"isr");if(!D.existsSync(n))return;let s=await D.promises.readdir(n);for(let o of s){let l=o.replace(/_/g,"/").replace(".json","");if(t.test(l))await D.promises.unlink(f.join(n,o))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function Ut(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let s=await gt(t.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${t.pattern} (${t.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let l of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(l.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return n}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let n of ft(t))if(await Bun.file(n).exists())try{let s=await import(n);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...l}=s;return l}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Gt(t,n,s){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let l=o[1];if(!l.includes("getStaticProps"))return null;try{let e=l.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
7
  `)(n)}catch(e){return console.error(`Error executing getStaticProps in ${s}:`,e),null}}function Nt(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 mt(t,n,s={},o,l){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,n,t.filePath),v={...u||{},...g||{},...s,params:n,$route:{path:t.pattern,params:n}},w=new Set,p=[],P=[],E={...l,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{p.push(`${f.relative(process.cwd(),R.templatePath)}: ${R.message}
8
- resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(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,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let T of he(R))w.add(T);if(Object.keys(n).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${R}
8
+ resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(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,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let T of ye(R))w.add(T);if(Object.keys(n).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${R}
9
9
  </head>`);else S=`${R}
10
- ${S}`}if(S=await we(S,{router:o.router}),S=await b(S),o.minify!==!1)return{html:Ht(S),dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P};return{html:S,dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P}}function Ht(t){let n=[],s=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,l;while((l=o.exec(t))!==null){let u=t.slice(s,l.index);n.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=l[1],v=l[2],w=l[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),n.push(g+v+w),s=l.index+l[0].length}let e=t.slice(s);return n.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function zt(t){let n=0;for(let s=0;s<t.length;s++){let o=t.charCodeAt(s);n=(n<<5)-n+o,n=n&n}return`"${Math.abs(n).toString(36)}"`}function Wt(t,n,s,o){if(s?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return o.some((l)=>{if(l instanceof RegExp)return l.test(t);return l.endsWith("/")?t===l.slice(0,-1)||t.startsWith(l):t===l})}function qt(t,n){return`<?xml version="1.0" encoding="UTF-8"?>
10
+ ${S}`}if(S=await ve(S,{router:o.router}),S=await b(S),o.minify!==!1)return{html:Ht(S),dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P};return{html:S,dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P}}function Ht(t){let n=[],s=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,l;while((l=o.exec(t))!==null){let u=t.slice(s,l.index);n.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=l[1],v=l[2],w=l[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),n.push(g+v+w),s=l.index+l[0].length}let e=t.slice(s);return n.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function zt(t){let n=0;for(let s=0;s<t.length;s++){let o=t.charCodeAt(s);n=(n<<5)-n+o,n=n&n}return`"${Math.abs(n).toString(36)}"`}function Wt(t,n,s,o){if(s?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return o.some((l)=>{if(l instanceof RegExp)return l.test(t);return l.endsWith("/")?t===l.slice(0,-1)||t.startsWith(l):t===l})}function qt(t,n){return`<?xml version="1.0" encoding="UTF-8"?>
11
11
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
12
12
  ${t.map((o)=>{let l=new URL(o.loc,n).href,e=` <url>
13
13
  <loc>${F(l)}</loc>`;if(o.lastmod)e+=`
@@ -37,16 +37,16 @@ ${t.map((o)=>{let l=new URL(o.loc,n).href,e=` <url>
37
37
  ${s.join(`
38
38
  `)}
39
39
  </channel>
40
- </rss>`}async function Vt(t={}){let n=Date.now();tn();let s=await a(process.cwd()),o=s.build||{},l=await ut({explicit:t.domain||o.domain,stxConfig:s});if(l.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:l.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.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:[]},g=new Set,v=0,w={},p={};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-9w9vr35m.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-an1cc36z.js"),R=await S(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-9w9vr35m.js");await d('<div class="bg-black"></div>')}catch{}kt();let wt=s?.routeMiddleware?.dir||"middleware";await Ct(process.cwd(),wt);let J=_t();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let St=s?.routeMiddleware?.global||[];ec(s?.layoutsDir,c(process.cwd()));let Z=X(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Ut(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:h,params:G,props:xt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let A=await Bun.file(k.filePath).text(),O=Yt(A),bt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...St,...bt];if(nt.length>0){let B=Et(h,G,O||{}),L=Tt(B,null,void 0,{isServer:!0}),j=await $t(nt,L);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,H=te(String(C),h),U=ee(h,e);await D.promises.mkdir(f.dirname(U),{recursive:!0}),await Bun.write(U,H),u.successCount++,u.pages.push({route:h,outputPath:U,size:Buffer.byteLength(H),cached:!1}),_.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \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",`
40
+ </rss>`}async function Vt(t={}){let n=Date.now();nn();let s=await a(process.cwd()),o=s.build||{},l=await ut({explicit:t.domain||o.domain,stxConfig:s});if(l.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:l.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.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:[]},g=new Set,v=0,w={},p={};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-fr9e8kb9.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-qm6epp9h.js"),R=await S(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-fr9e8kb9.js");await d('<div class="bg-black"></div>')}catch{}_t();let wt=s?.routeMiddleware?.dir||"middleware";await Et(process.cwd(),wt);let V=Ct();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let yt=s?.routeMiddleware?.global||[];tc(s?.layoutsDir,c(process.cwd()));let Z=G(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Ut(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:h,params:N,props:St,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let A=await Bun.file(k.filePath).text(),O=Yt(A),xt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...yt,...xt];if(nt.length>0){let B=Tt(h,N,O||{}),L=$t(B,null,void 0,{isServer:!0}),j=await Rt(nt,L);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,z=Zt(String(C),h),U=te(h,e);await D.promises.mkdir(f.dirname(U),{recursive:!0}),await Bun.write(U,z),u.successCount++,u.pages.push({route:h,outputPath:U,size:Buffer.byteLength(z),cached:!1}),_.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \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 ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,G,xt,e,s);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 ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,N,St,e,s);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(h,k.filePath,B.dependencies,I)}let N;if(e.trailingSlash)N=f.join(e.outputDir,h,"index.html");else N=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:L}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(L.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of L){let H=f.join(j,`${C.hash}.js`);if(!await Bun.file(H).exists())await Bun.write(H,C.code);if(!g.has(C.hash)){g.add(C.hash);let U=Buffer.byteLength(C.code,"utf8");v+=U,w[C.hash]={bytes:U,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=L.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(N),{recursive:!0}),await Bun.write(N,I),!Wt(h,I,O,e.sitemapExclude))_.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,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?.(h,I)}catch(A){u.failedCount++,u.errors.push({route:h,error:A}),await e.hooks.onError?.(A,h),console.error(`Error generating ${h}:`,A)}}));let tt=en();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(h,k.filePath,B.dependencies,I)}let H;if(e.trailingSlash)H=f.join(e.outputDir,h,"index.html");else H=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:L}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(L.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of L){let z=f.join(j,`${C.hash}.js`);if(!await Bun.file(z).exists())await Bun.write(z,C.code);if(!g.has(C.hash)){g.add(C.hash);let U=Buffer.byteLength(C.code,"utf8");v+=U,w[C.hash]={bytes:U,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=L.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(H),{recursive:!0}),await Bun.write(H,I),!Wt(h,I,O,e.sitemapExclude))_.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,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?.(h,I)}catch(A){u.failedCount++,u.errors.push({route:h,error:A}),await e.hooks.onError?.(A,h),console.error(`Error generating ${h}:`,A)}}));let tt=tn();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
50
50
  `);throw Error(`Client script bundling failed:
51
51
  ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=f.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,k={...s,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,k,m);await Bun.write(f.join(e.outputDir,"404.html"),h)}else await Bun.write(f.join(e.outputDir,"404.html"),`<!DOCTYPE html>
52
52
  <html lang="en">
@@ -69,7 +69,7 @@ ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=f.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=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},G=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),G)}}let V=f.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,m={...s,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(V).text(),{},V,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&_.length>0){let d=qt(_,e.domain),m=f.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((h)=>typeof h==="string"),...d.disallow||[]],k=Es({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(f.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=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let z=Za(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=Qa(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&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=Zn();if(et)await Y(et,f.join(e.outputDir,Yn)),console.log(`Copied assets from ${Zt}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:w,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
72
+ </html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},N=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),N)}}let K=f.join(e.pagesDir,"error.stx");if(await Bun.file(K).exists()){let d=new Set,m={...s,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(K).text(),{},K,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&_.length>0){let d=qt(_,e.domain),m=f.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((h)=>typeof h==="string"),...d.disallow||[]],k=Es({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(f.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=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let W=Qa(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=ec(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=Qn();if(et)await Y(et,f.join(e.outputDir,Zn)),console.log(`Copied assets from ${Qt}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:w,pages:p};await Bun.write(f.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
@@ -77,8 +77,8 @@ Build complete!
77
77
  Cached: ${u.cachedCount}
78
78
  Failed: ${u.failedCount}
79
79
  Time: ${u.buildTime}ms${P}
80
- `),u}async function Y(t,n){await D.promises.mkdir(n,{recursive:!0});let s=await D.promises.readdir(t,{withFileTypes:!0});for(let o of s){let l=f.join(t,o.name),e=f.join(n,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(l,e);else await D.promises.copyFile(l,e)}}function Kt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),s=new ht(n),o=t.revalidate||3600;return{async get(l){let e=await s.get(l);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(l).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=X(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>l.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let g=l.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let w=await a(),{html:p}=await mt(u,v,{},t,w);await s.set(l,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${l}`)},async invalidate(l){if(typeof l==="string")await s.invalidate(l);else await s.invalidatePattern(l)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},l=n;if(s){let w=s[1];l=n.slice(s[0].length).trim();for(let p of w.split(`
81
- `)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),S=p.slice(P+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((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=S}}}let e=l.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=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let w=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:w})}return{content:e,data:o,toc:u}}}}function Yt(t){return yt(t)}function te(t,n){return`<!DOCTYPE html>
80
+ `),u}async function Y(t,n){await D.promises.mkdir(n,{recursive:!0});let s=await D.promises.readdir(t,{withFileTypes:!0});for(let o of s){let l=f.join(t,o.name),e=f.join(n,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(l,e);else await D.promises.copyFile(l,e)}}function Kt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),s=new ht(n),o=t.revalidate||3600;return{async get(l){let e=await s.get(l);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(l).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=G(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>l.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let g=l.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let w=await a(),{html:p}=await mt(u,v,{},t,w);await s.set(l,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${l}`)},async invalidate(l){if(typeof l==="string")await s.invalidate(l);else await s.invalidatePattern(l)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},l=n;if(s){let w=s[1];l=n.slice(s[0].length).trim();for(let p of w.split(`
81
+ `)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),S=p.slice(P+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((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=S}}}let e=l.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=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let w=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:w})}return{content:e,data:o,toc:u}}}}function Yt(t){return bt(t)}function Zt(t,n){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 ee(t,n){if(t==="/"||t==="")return f.join(n.outputDir,"index.html");let s=t.replace(/^\/|\/$/g,"");if(n.trailingSlash)return f.join(n.outputDir,s,"index.html");return f.join(n.outputDir,`${s}.html`)}var Te={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:q,createMarkdownLoader:Xt};export{Kt as createISRHandler,Xt as createMarkdownLoader,Nt as declaresPageAction,Te as default,q as defineStaticPaths,Vt as generateStaticSite,Wt as isExcludedFromSitemap};
93
+ </html>`}function te(t,n){if(t==="/"||t==="")return f.join(n.outputDir,"index.html");let s=t.replace(/^\/|\/$/g,"");if(n.trailingSlash)return f.join(n.outputDir,s,"index.html");return f.join(n.outputDir,`${s}.html`)}var Fe={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:J,createMarkdownLoader:Xt};export{Kt as createISRHandler,Xt as createMarkdownLoader,Nt as declaresPageAction,Fe as default,J as defineStaticPaths,Vt as generateStaticSite,Wt 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.825",
4
+ "version": "0.2.827",
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.21",
130
130
  "@stacksjs/clapp": "^0.2.16",
131
- "@stacksjs/desktop": "0.2.825",
132
- "@stacksjs/sanitizer": "0.2.825",
131
+ "@stacksjs/desktop": "0.2.827",
132
+ "@stacksjs/sanitizer": "0.2.827",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.825",
134
+ "bun-plugin-stx": "0.2.827",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.825",
136
+ "stx-router": "0.2.827",
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{hn,Qf,eg,tg,ng,rg,m,sg,mi,og,qc,Kc}from"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{hn as STX_ENGINE_BINDING_NAMES,mi as convertToCommonJS,qc as extractScriptFromTemplate,m as extractVariables,Kc as hasVariables,sg as isCompleteImport,rg as isMissingBindingFailure,tg as isModuleResolutionFailure,ng as isSyntaxFailure,og as splitDeclaration,Qf as stripTypeScript,eg as withoutStxReferrer};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{So,va,xa,bh}from"./chunk-6qvn1h09.js";export{So as NATIVE_COMPONENTS,va as compileToNative,xa as createHotReloadServer,bh as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{er,$e}from"./chunk-7sh9fa3q.js";export{er as describeBuildFailure,$e as formatBuildFailure};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Hl,hm,Vl,Ul,ym,bm}from"./chunk-yr3ped5m.js";import"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{bm as applySlots,ym as extractSlotContent,hm as parseSlotElement,Hl as parseSlots,Ul as processSlots,Vl as renderSlot};
@@ -1,43 +0,0 @@
1
- // @bun
2
- import{Q,ee,te,Nn,me,Te,gt,Xt,Mn,Dn,Ln,ne,jn,Bn}from"./chunk-akj26p4b.js";import{xt}from"./chunk-mv3yhspn.js";function Al(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=te,placeholder:l="none",formats:f=ee,widths:y=Q,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return K(s,I,w);if(A||!b)return Z(s);return G(s)}function K(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=Dn(r),v=Mn(r),w=typeof m==="object"?Xt(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=gt(z),J=ne(k);M.push(` <source type="${J}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
3
- #${k} {
4
- position: relative;
5
- background-image: url('${e.placeholder}');
6
- background-size: cover;
7
- background-position: center;
8
- }
9
- #${k} img {
10
- transition: opacity 0.3s ease;
11
- }
12
- #${k}.loaded img {
13
- opacity: 1;
14
- }
15
- `.trim();else if(h==="color")T=`
16
- #${k} {
17
- background-color: ${e.placeholder};
18
- }
19
- `.trim()}let _=a?` width="${a}"`:e?` width="${e.width}"`:"",H=i?` height="${i}"`:e?` height="${e.height}"`:"",Y=`${U}<picture>
20
- ${M.join(`
21
- `)}
22
- <img
23
- src="${v?.url||t}"
24
- alt="${B(n)}"${_}${H}${S}${A}${F}${R}${C}
25
- />
26
- </picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=ne(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:Y,preloadLink:V,placeholderCss:T}}function Z(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function G(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=te,formats:u=ee,widths:l=Q,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?Xt(a):a,C=`
27
- data-stx-image
28
- data-src="${r}"
29
- data-sizes="${R}"
30
- data-quality="${o}"
31
- data-formats="${u.join(",")}"
32
- data-widths="${l.join(",")}"
33
- `.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function ra(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function Pl(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=ra(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function B(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var D=new Map;function Il(){D.clear()}async function X(s,r){let e=`${s}:${JSON.stringify(r)}`;if(D.has(e))return D.get(e);try{let t=await Te(s,r);return D.set(e,t),t}catch{return null}}function sa(){return xt({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=se(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:Q),formats:a.formats||ee,quality:a.quality||te,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await me())return q(t,n||"",a);let o=await X(t,i);if(!o)return q(t,n||"",a);return ae(o,n||"",a)}})}function se(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=re(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function re(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function q(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function ae(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=gt(p),w=ne(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
34
- `;if(d+=l.join(`
35
- `)+`
36
- `,d+=` <img ${c.join(" ")} />
37
- `,d+="</picture>",e.placeholder&&n){let g=`stx-img-${Math.random().toString(36).slice(2,8)}`;if(e.placeholder==="blur"||e.placeholder==="thumbhash"){let p=n.replace(/'/g,"%27").replace(/"/g,"%22");d=`<div id="${g}" class="stx-image-placeholder" style="background-image: url('${p}'); background-size: cover;">
38
- ${d}
39
- </div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
40
- ${d}
41
- </div>`}}if(e.priority&&y){let g=ne(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
42
- `+d}return d}function x(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Ol=sa();import P from"fs";import j from"path";function Nl(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=ee,widths:a=Q,quality:i=te,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await me()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await Nn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ie(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ce(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await me())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>oe(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await Te(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=jn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${Bn(c.stats.savedBytes)}`)}}}function ie(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function oe(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ce(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&Ln(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function Ml(s,r,e={}){if(!await me())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return Te(s,{...e,outputDir:r})}async function Dl(s,r,e={}){let{formats:t=ee,widths:n=Q,quality:a=te,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await me())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await Te(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function oa(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function Ll(s,r){let e=oa(s);await Bun.write(r,JSON.stringify(e,null,2))}var Zg={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
43
- export{Al,ra,Pl,Il,sa,Ol,Nl,Ml,Dl,oa,Ll,Zg};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ma,mm}from"./chunk-67kbsav0.js";export{ma as definePlugin,mm as pluginManager};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Nf,us}from"./chunk-djpmrctd.js";import"./chunk-5e5jschg.js";import"./chunk-wceg59n0.js";import"./chunk-2nj9aewf.js";import{kr}from"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import{st}from"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{st as freeIdentifiers,us as processComponents,Nf as processESImports,kr as rendersAsElement};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ve,Us,hg,Yh,yg,Zh,Mt,p,U,Z,wn,Se,bg,vi,wg,Qh,_,vg,ey,R,ty}from"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{vg as applyFilters,Zh as clearCustomFilters,bg as clientLoopScopes,Us as defaultFilters,wn as escapeAttributeValue,p as escapeHtml,U as escapeHtmlValue,Z as escapeInterpolatedHtmlValue,R as evaluateExpression,ve as findMustacheEnd,yg as getAllFilters,wg as interpolateScriptAttributes,vi as interpolateScriptExpressions,Qh as interpolateScriptsInTemplate,_ as processExpressions,hg as registerFilter,Yh as registerFilters,Mt as replaceInterpolations,ey as resetRejectedExpressionWarnings,ty as unescapeHtml,Se as usesSignalsInScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{vn,xi}from"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";export{xi as generateRuntimeConfigTypes,vn as prepareRuntimeConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Kg}from"./chunk-06y0da27.js";import"./chunk-24d3yy27.js";import"./chunk-ac2vz9c3.js";import"./chunk-g0zxp9qh.js";import"./chunk-c84pxd2k.js";import"./chunk-djpmrctd.js";import"./chunk-5e5jschg.js";import"./chunk-hras294c.js";import"./chunk-wceg59n0.js";import"./chunk-0kbzs147.js";import"./chunk-e99szqws.js";import"./chunk-2nj9aewf.js";import"./chunk-gp37b8vw.js";import"./chunk-zen28e3p.js";import"./chunk-jb2rvsf4.js";import"./chunk-k81trehg.js";import"./chunk-wf0n9gpj.js";import"./chunk-xpy9yjyx.js";import"./chunk-qj4r08jb.js";import"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{Kg as startInteractive};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{U}from"./chunk-a1htb5r5.js";function n(t){return U(t)}
3
- export{n};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{m,mi,qc,Kc,cg,lg,ug,dg,pg,Vs,fg,je,Y,Be,gg,Cr,mg,Jc,Yc,bi,Fe,s,bn,Zc,h,fe,Jh}from"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{Yc as SIGNAL_COMPOSABLE_CALL,fe as clearComponentCache,bi as componentClientSignalNames,mi as convertToCommonJS,h as createDetailedErrorMessage,pg as extractDirectiveNames,qc as extractScriptFromTemplate,m as extractVariables,s as fileExists,Jh as getComponentCacheStats,lg as getPositionInfo,Y as getSharedTranspiler,Zc as getSourceLineInfo,dg as hasDirectives,Kc as hasVariables,mg as isHydrateTrigger,fg as isJavaScriptScript,Fe as renderComponentWithSlot,bn as resolveTemplatePath,gg as scopeOnRootElement,Vs as scopeSequenceKey,je as shouldTranspileTypeScript,Jc as slotContentHasExpressions,Be as transpileTypeScript,Cr as userComponentFileExists,ug as validateDirective,cg as validateTemplate};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ql}from"./chunk-mwxbdpb1.js";export{ql as rewriteImagesWithSiblings};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{jf,Mh,Dh,Lh,jh,Bf,Ff,Bh,Fh,Xo,zh,lr,ur,ws}from"./chunk-gp37b8vw.js";import{nt}from"./chunk-5emrarpf.js";import"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{jh as __setSignalsGeneratorsForTest,nt as cacheEngineFingerprint,ur as cacheTemplate,lr as checkCache,zh as clearDevCaches,Ff as getCachedRouterScript,Bf as getCachedSignalsRuntime,Bh as getServeClientAsset,Xo as getServeModuleBundle,ws as hashFilePath,Dh as invalidateFileCache,Lh as invalidateFileCacheByDir,Mh as readFileCached,Fh as registerServeModuleBundle,jf as templateCache};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{on,Ao,Po,Io,Eh,Oo}from"./chunk-faxbznng.js";import"./chunk-wf0n9gpj.js";import"./chunk-qj4r08jb.js";import"./chunk-2vqpz4qv.js";export{Po as buildServerApi,Eh as createServerApi,on as discoverServerApi,Ao as generateApiTypes,Oo as isServerApiSource,Io as productionApiDispatcher};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{rm}from"./chunk-0wgjhyb8.js";import"./chunk-kvgxmb0s.js";import"./chunk-0scyzg9r.js";import"./chunk-xmdcjyyx.js";import"./chunk-faxbznng.js";import"./chunk-24d3yy27.js";import"./chunk-ac2vz9c3.js";import"./chunk-g0zxp9qh.js";import"./chunk-c84pxd2k.js";import"./chunk-djpmrctd.js";import"./chunk-5e5jschg.js";import"./chunk-hras294c.js";import"./chunk-wceg59n0.js";import"./chunk-0kbzs147.js";import"./chunk-e99szqws.js";import"./chunk-2nj9aewf.js";import"./chunk-gp37b8vw.js";import"./chunk-zen28e3p.js";import"./chunk-jb2rvsf4.js";import"./chunk-k81trehg.js";import"./chunk-wf0n9gpj.js";import"./chunk-xpy9yjyx.js";import"./chunk-qj4r08jb.js";import"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{rm as buildForProduction};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ah,Of,Je,ac,Ph,is,as,cs}from"./chunk-g0zxp9qh.js";import"./chunk-djpmrctd.js";import"./chunk-5e5jschg.js";import"./chunk-wceg59n0.js";import"./chunk-2nj9aewf.js";import"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{Ph as clearOnceStore,ac as onceStore,Je as partialsCache,is as processIncludes,as as processStackPushDirectives,cs as processStackReplacements,Ah as resetUnscopedSignalWarnings,Of as topLevelElements};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{mu,_o,Kn,hu,yu,bu,wu,vu,xu,Su,ku,_u,Cu,Eu,Tu,$u,Ru,Au,Pu,Iu,Ou,Nu,Mu,Du,Lu,ju,Bu,Fu,zu,Hu,Vu,Uu,Wu,qu,Ku,Xu,Gu,Ju,Yu,Zu,Qu,ed,td,nd,rd,sd,od,id,Jt,Aa,ad,cd,ld,Pa,ud,dd,pd,fd,gd,md,Ia,hd,yd,bd,wd,vd,xd,Sd,kd,_d,Xn,Cd,Ed,Td,$d,Rd,Ad,Pd,Id,Od,Nd,Md,Dd,Co,Ld,jd,Bd,Fd,zd,Qr,es,Hd,Vd,Ud,Wd,qd,Oa,Kd,Xd,Gd,Na,Eo,Jd,Yd,Ma,Da,ts,La,Zd,Yt,Qd,ja,Ba,To,ep,$o,tp,np,rp,sp,op,ip,ap,Fa,cp,lp,za,up,dp,pp,fp,gp,mp,hp,yp,bp,wp,vp,xp,Sp,kp,_p,Cp,Ep,Tp,$p,Rp,Ap,Pp,Ip,Op,Ha,Np,Mp,Dp,Lp,jp,Bp,Fp,zp,Hp,Vp,Up,Gn,Va,Ua,Wp,Jn,qp,Kp,Xp,Wa,qa,ns,rs,Gp,Ro,Jp,Yp,Zp,Qp,ef,tf,nf,rf,sf,of,af,cf,lf,uf,df,pf,ff,gf,mf,hf,Ka,yf,bf,Xa,Ga,wf,vf}from"./chunk-e4jwhmpb.js";export{od as AVAILABLE_COMPONENTS,Oa as AutoUpdater,id as COMPONENT_STYLES,ns as DEFAULT_WATCH_INTERVAL_MS,qa as MAX_WATCH_INTERVAL_MS,Wa as MIN_WATCH_INTERVAL_MS,md as MODAL_STYLES,_u as TOAST_STYLES,Sd as TRAY_MENU_STYLES,Ma as UPDATE_MANIFEST_ASSET,dd as alert,Ap as appInfo,tf as appleScript,vf as applicationDataDirectory,ef as audio,bf as backgroundDelay,Ep as battery,Qp as biometric,Vp as bluetooth,af as bonjour,Yt as bundlePathForExecutable,ep as caffeinate,Kd as canReplaceBundle,Xd as clearQuarantine,yp as clipboard,gd as closeAllModals,Dd as closeAllWindows,ud as confirm,Op as contextMenu,ff as continuityCamera,pf as coreml,Wd as craftBinaryNotFoundMessage,Co as craftWindowArguments,Gn as crashReporter,Ku as createAccordion,Fu as createAutocomplete,Pu as createAvatar,Au as createBadge,Cu as createButton,Iu as createCard,ed as createChart,Tu as createCheckbox,Vu as createChip,td as createCodeEditor,Lu as createColorPicker,Qu as createDataGrid,ju as createDatePicker,es as createDiskImage,Nu as createDropdown,rd as createFileExplorer,Zd as createGitHubUpdateManifest,La as createGitHubUpdater,Hu as createImageView,fp as createInterval,zu as createLabel,Ju as createListView,nd as createMediaPlayer,hd as createMenubar,Gu as createModalComponent,wf as createNativeUpdateApi,Ga as createPantrySelfUpdater,op as createPreferences,Ru as createProgressBar,Du as createRadioButton,Mu as createRating,Wu as createScrollView,To as createSelfUpdater,$u as createSlider,qu as createSplitView,Xu as createStepper,Ia as createSystemTray,Yu as createTable,Ou as createTabs,Eu as createTextInput,Bu as createTimePicker,pp as createTimer,Uu as createTooltip,Zu as createTreeView,sd as createWebView,Ld as createWindow,Bd as createWindowWithHTML,$o as decaffeinate,Cp as deepLinks,gp as delay,xu as dismissAlertById,Su as dismissAllAlerts,kp as dragOut,Gd as extractBundle,nf as fileAssociations,Ro as focus,Yp as focusShortcutsReady,hp as formatCompact,sp as formatDuration,rp as formatRemainingTime,cp as formatShortcut,mp as formatTime,wp as fs,Na as generateUpdateManifest,ku as getActiveAlertCount,fd as getActiveModalCount,yd as getActiveTrayInstances,Nd as getActiveWindowIds,np as getCaffeinateStatus,hf as getCapabilities,Ka as getCapability,Id as getDesktopConfig,Ad as getDialogBridgeScript,dp as getRegisteredHotkeys,vd as getSimulatedTrayHTML,xd as getTrayBridgeScript,bd as getTrayInstance,Md as getWindow,zd as getWindowBridgeScript,Da as githubLatestAssetUrl,ts as githubReleaseAssetUrl,xp as globalShortcuts,Jn as handoff,Jp as hasFocusShortcuts,Wp as iap,ap as isAutoLaunchEnabled,yf as isAvailable,tp as isCaffeinated,_p as isDragOutAvailable,Fd as isWebviewAvailable,Dp as keychain,qp as liveActivities,Zp as localServer,Kp as location,of as log,Hd as macOSRuntimeExecutablePath,Ip as menu,df as midi,Bp as nativeAutoLaunch,Fp as nativeTray,zp as nativeWindow,Tp as network,bp as notifications,vu as notify,jd as openDevWindow,Vd as pack,Ud as packageApp,Xa as parsePantryUpdateManifest,Fa as parseShortcut,sf as pdf,Lp as permissions,jp as printing,pd as prompt,ja as quitLauncher,Eo as readBundleIdentity,Va as redactPII,lp as registerHotkey,Ba as relaunchBundle,mu as requestNotificationPermission,Od as resetDesktopConfig,qd as resolveCraftBinary,Qr as resolveCraftExecutablePath,Qd as runningBundleTeamId,Mp as screen,Xp as screenCapture,rs as screenSharing,mf as serial,gf as serviceMenu,ip as setAutoLaunch,Pd as setDesktopConfig,vp as shell,_o as showAlert,Ed as showAlertDialog,Cd as showColorPicker,Td as showConfirmDialog,$d as showErrorDialog,cd as showErrorModal,wu as showErrorToast,Aa as showInfoModal,hu as showInfoToast,Xn as showMessageBox,Jt as showModal,kd as showOpenDialog,Pa as showQuestionModal,_d as showSaveDialog,ld as showSuccessModal,yu as showSuccessToast,Kn as showToast,Rd as showWarningDialog,ad as showWarningModal,bu as showWarningToast,Ha as sidebar,Ua as signPayload,Up as speech,lf as speechRecognition,cf as spotlight,Pp as standardMenus,Jd as swapBundle,Np as system,rf as tags,Sp as theme,Hp as touchbar,wd as triggerTrayAction,up as unregisterAllHotkeys,za as unregisterHotkey,$p as updater,Yd as verifyBundleTrust,uf as vision,Gp as watchScreenSharing,Rp as windowEvents};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{tr,i}from"./chunk-24d3yy27.js";import"./chunk-ac2vz9c3.js";import"./chunk-g0zxp9qh.js";import"./chunk-c84pxd2k.js";import"./chunk-djpmrctd.js";import"./chunk-5e5jschg.js";import"./chunk-hras294c.js";import"./chunk-wceg59n0.js";import"./chunk-0kbzs147.js";import{we}from"./chunk-e99szqws.js";import"./chunk-2nj9aewf.js";import"./chunk-gp37b8vw.js";import"./chunk-zen28e3p.js";import"./chunk-jb2rvsf4.js";import"./chunk-k81trehg.js";import"./chunk-wf0n9gpj.js";import"./chunk-xpy9yjyx.js";import"./chunk-qj4r08jb.js";import{Oe,zs,Hs}from"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{tr as buildModulesTag,we as injectRouterScript,i as processDirectives,zs as processJsonDirective,Hs as processOnceDirective,Oe as validateClientScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{$f,oc,Th,ic,Rf,Af,cn,sr,$h,Pf,If,Rh,b}from"./chunk-ac2vz9c3.js";import"./chunk-gp37b8vw.js";import"./chunk-a1htb5r5.js";import"./chunk-axwa3s1m.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{cn as buildCss,Pf as extractClassNames,Af as fingerprintConfig,If as generateCss,$h as getCachedCSS,$f as getCssServeAsset,b as injectCss,oc as loadCssEngine,ic as loadCssEngineConfig,sr as rebuildCss,Th as resetCssCache,Rf as resolveUserCssConfig,Rh as withLinkedModuleBundles};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{qm,Km}from"./chunk-f0txsdpa.js";export{Km as ensureTeleportTargets,qm as processTeleportDirectives};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{Ke,re,Ya}from"./chunk-n7arptzc.js";import v from"fs";import g from"path";import V from"crypto";import{generatePlaceholder as T,processImage as L}from"ts-images";var Q=[320,640,768,1024,1280,1536,1920],ee=["webp","jpeg"],te=80,D=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function Nn(){return await d()!==null}async function me(){return!0}async function Te(t,e={}){let{widths:a=Q,formats:r=ee,quality:n=te,fit:c="cover",placeholder:i="none",outputDir:m=".stx/images",baseUrl:s="/images"}=e,h,l;if(typeof t==="string"){if(l=t,!await Bun.file(t).exists())throw new Xr(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((o)=>Buffer.from(o))}else l="buffer-input",h=t;let b=V.createHash("sha256").update(h).digest("hex").slice(0,12),j=await Kr(h),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(m,{recursive:!0});let B=[],A=g.basename(l,g.extname(l)),f=a.filter((o)=>o<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((o,p)=>o-p);for(let o of f){let p=Math.round(o/F);for(let w of r){let S=`${A}-${o}w-${b}.${w}`,P=g.join(m,S),q=`${s}/${S}`,E=await Wl(h,{width:o,height:p,format:w,quality:n,fit:c});await Bun.write(P,E),B.push({path:P,url:q,width:o,height:p,format:w,size:E.length})}}let y;if(i!=="none")y=await k(h,i);return{src:l,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function Kr(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return R(e)}function R(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new Xr("Unable to parse image dimensions","PARSE_ERROR")}async function Wl(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}return await Ya("img",async(r)=>{let n=g.join(r,`out.${e.format}`);return await L({input:t,output:n,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(n).arrayBuffer())})}async function k(t,e){let a=await d();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),s=await Kr(t);return`data:${U[s.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let s=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await Kr(t),n=Ke("ph"),c=g.join(n,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(c,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",s=await T(c,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&s.dominantColor)return s.dominantColor;if(s.dataURL)return s.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{re(n)}}function gt(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function Xt(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function Mn(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function Dn(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function Ln(t){let e=g.extname(t).toLowerCase();return D.includes(e)}function ne(t){return U[t]||"application/octet-stream"}function jn(t){return t.reduce((e,a)=>e+a.size,0)}function Bn(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class Xr extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
3
- export{Q,ee,te,Nn,me,Te,Kr,Wl,gt,Xt,Mn,Dn,Ln,ne,jn,Bn,Xr};