plum-e2e 1.2.0 → 1.2.1

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 (302) hide show
  1. package/backend/_scaffold/utils/browser.ts +1 -0
  2. package/backend/package-lock.json +2 -2
  3. package/backend/package.json +1 -1
  4. package/bin/plum.js +4 -3
  5. package/frontend/.svelte-kit/adapter-node/.vite/manifest.json +190 -0
  6. package/frontend/.svelte-kit/adapter-node/_app/immutable/assets/Badge.DLLowvEA.css +17 -0
  7. package/frontend/.svelte-kit/adapter-node/_app/immutable/assets/Button.cBruH0aD.css +17 -0
  8. package/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_layout.D7eM-6MV.css +17 -0
  9. package/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_page.BVnUajEa.css +17 -0
  10. package/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_page.CGnCsn5q.css +17 -0
  11. package/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_page.DBhBrHFz.css +17 -0
  12. package/frontend/.svelte-kit/adapter-node/_app/immutable/assets/_page.DOqo0UR4.css +17 -0
  13. package/frontend/.svelte-kit/adapter-node/chunks/Badge.js +30 -0
  14. package/frontend/.svelte-kit/adapter-node/chunks/Button.js +32 -0
  15. package/frontend/.svelte-kit/adapter-node/chunks/attributes.js +34 -0
  16. package/frontend/.svelte-kit/adapter-node/chunks/client.js +59 -0
  17. package/frontend/.svelte-kit/adapter-node/chunks/equality.js +31 -0
  18. package/frontend/.svelte-kit/adapter-node/chunks/escaping.js +36 -0
  19. package/frontend/.svelte-kit/adapter-node/chunks/exports.js +247 -0
  20. package/frontend/.svelte-kit/adapter-node/chunks/index.js +1135 -0
  21. package/frontend/.svelte-kit/adapter-node/chunks/internal.js +695 -0
  22. package/frontend/.svelte-kit/adapter-node/chunks/reports.js +57 -0
  23. package/frontend/.svelte-kit/adapter-node/entries/fallbacks/error.svelte.js +44 -0
  24. package/frontend/.svelte-kit/adapter-node/entries/pages/_layout.svelte.js +181 -0
  25. package/frontend/.svelte-kit/adapter-node/entries/pages/_page.svelte.js +164 -0
  26. package/frontend/.svelte-kit/adapter-node/entries/pages/reports/_page.svelte.js +141 -0
  27. package/frontend/.svelte-kit/adapter-node/entries/pages/reports/_slug_/_page.svelte.js +42 -0
  28. package/frontend/.svelte-kit/adapter-node/entries/pages/scheduled-tests/_page.svelte.js +179 -0
  29. package/frontend/.svelte-kit/adapter-node/index.js +3144 -0
  30. package/frontend/.svelte-kit/adapter-node/internal.js +30 -0
  31. package/frontend/.svelte-kit/adapter-node/manifest-full.js +77 -0
  32. package/frontend/.svelte-kit/adapter-node/manifest.js +81 -0
  33. package/frontend/.svelte-kit/adapter-node/nodes/0.js +25 -0
  34. package/frontend/.svelte-kit/adapter-node/nodes/1.js +25 -0
  35. package/frontend/.svelte-kit/adapter-node/nodes/2.js +25 -0
  36. package/frontend/.svelte-kit/adapter-node/nodes/3.js +25 -0
  37. package/frontend/.svelte-kit/adapter-node/nodes/4.js +25 -0
  38. package/frontend/.svelte-kit/adapter-node/nodes/5.js +25 -0
  39. package/frontend/.svelte-kit/ambient.d.ts +240 -0
  40. package/frontend/.svelte-kit/generated/client/app.js +51 -0
  41. package/frontend/.svelte-kit/generated/client/matchers.js +18 -0
  42. package/frontend/.svelte-kit/generated/client/nodes/0.js +18 -0
  43. package/frontend/.svelte-kit/generated/client/nodes/1.js +18 -0
  44. package/frontend/.svelte-kit/generated/client/nodes/2.js +18 -0
  45. package/frontend/.svelte-kit/generated/client/nodes/3.js +18 -0
  46. package/frontend/.svelte-kit/generated/client/nodes/4.js +18 -0
  47. package/frontend/.svelte-kit/generated/client/nodes/5.js +18 -0
  48. package/frontend/.svelte-kit/generated/client-optimized/app.js +51 -0
  49. package/frontend/.svelte-kit/generated/client-optimized/matchers.js +18 -0
  50. package/frontend/.svelte-kit/generated/client-optimized/nodes/0.js +18 -0
  51. package/frontend/.svelte-kit/generated/client-optimized/nodes/1.js +18 -0
  52. package/frontend/.svelte-kit/generated/client-optimized/nodes/2.js +18 -0
  53. package/frontend/.svelte-kit/generated/client-optimized/nodes/3.js +18 -0
  54. package/frontend/.svelte-kit/generated/client-optimized/nodes/4.js +18 -0
  55. package/frontend/.svelte-kit/generated/client-optimized/nodes/5.js +18 -0
  56. package/frontend/.svelte-kit/generated/root.js +20 -0
  57. package/frontend/.svelte-kit/generated/root.svelte +83 -0
  58. package/frontend/.svelte-kit/generated/server/internal.js +65 -0
  59. package/frontend/.svelte-kit/non-ambient.d.ts +42 -0
  60. package/frontend/.svelte-kit/output/client/.vite/manifest.json +289 -0
  61. package/frontend/.svelte-kit/output/client/_app/immutable/assets/0.CnXRuPt4.css +17 -0
  62. package/frontend/.svelte-kit/output/client/_app/immutable/assets/2.CGnCsn5q.css +17 -0
  63. package/frontend/.svelte-kit/output/client/_app/immutable/assets/3.BVnUajEa.css +17 -0
  64. package/frontend/.svelte-kit/output/client/_app/immutable/assets/4.DBhBrHFz.css +17 -0
  65. package/frontend/.svelte-kit/output/client/_app/immutable/assets/5.D93VAB-w.css +17 -0
  66. package/frontend/.svelte-kit/output/client/_app/immutable/assets/Badge.DLLowvEA.css +17 -0
  67. package/frontend/.svelte-kit/output/client/_app/immutable/assets/Button.cBruH0aD.css +17 -0
  68. package/frontend/.svelte-kit/output/client/_app/immutable/assets/_layout.D7eM-6MV.css +17 -0
  69. package/frontend/.svelte-kit/output/client/_app/immutable/assets/_page.BVnUajEa.css +17 -0
  70. package/frontend/.svelte-kit/output/client/_app/immutable/assets/_page.CGnCsn5q.css +17 -0
  71. package/frontend/.svelte-kit/output/client/_app/immutable/assets/_page.DBhBrHFz.css +17 -0
  72. package/frontend/.svelte-kit/output/client/_app/immutable/assets/_page.DOqo0UR4.css +17 -0
  73. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/B0bn91RF.js +18 -0
  74. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/B1kE5jmt.js +23 -0
  75. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/BKz6FZdB.js +18 -0
  76. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/Be4iUAB0.js +18 -0
  77. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/BpaMqo9O.js +18 -0
  78. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/Bt3-Z7H1.js +18 -0
  79. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/CHV2KnPr.js +18 -0
  80. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/CJ8q7g9Y.js +18 -0
  81. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/Cit9MuSg.js +20 -0
  82. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/CwBTqcbj.js +18 -0
  83. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/DBk3zeq4.js +18 -0
  84. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/DFJLQFic.js +18 -0
  85. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/DTUE7kkY.js +18 -0
  86. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/IYPwzKs_.js +20 -0
  87. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/oc0we5Us.js +18 -0
  88. package/frontend/.svelte-kit/output/client/_app/immutable/chunks/rVEKg0Ak.js +18 -0
  89. package/frontend/.svelte-kit/output/client/_app/immutable/entry/app.C2MbX06K.js +19 -0
  90. package/frontend/.svelte-kit/output/client/_app/immutable/entry/start.GiBry-lw.js +18 -0
  91. package/frontend/.svelte-kit/output/client/_app/immutable/nodes/0.BsCYK-Tn.js +21 -0
  92. package/frontend/.svelte-kit/output/client/_app/immutable/nodes/1.N4gjrCnX.js +18 -0
  93. package/frontend/.svelte-kit/output/client/_app/immutable/nodes/2.D9yQNzK8.js +18 -0
  94. package/frontend/.svelte-kit/output/client/_app/immutable/nodes/3.CBC5WvNb.js +18 -0
  95. package/frontend/.svelte-kit/output/client/_app/immutable/nodes/4.BU6UZHSE.js +19 -0
  96. package/frontend/.svelte-kit/output/client/_app/immutable/nodes/5.Dzzfrntl.js +18 -0
  97. package/frontend/.svelte-kit/output/client/_app/version.json +1 -0
  98. package/frontend/.svelte-kit/output/client/favicon.png +0 -0
  99. package/frontend/.svelte-kit/output/server/.vite/manifest.json +190 -0
  100. package/frontend/.svelte-kit/output/server/_app/immutable/assets/Badge.DLLowvEA.css +17 -0
  101. package/frontend/.svelte-kit/output/server/_app/immutable/assets/Button.cBruH0aD.css +17 -0
  102. package/frontend/.svelte-kit/output/server/_app/immutable/assets/_layout.D7eM-6MV.css +17 -0
  103. package/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.BVnUajEa.css +17 -0
  104. package/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.CGnCsn5q.css +17 -0
  105. package/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DBhBrHFz.css +17 -0
  106. package/frontend/.svelte-kit/output/server/_app/immutable/assets/_page.DOqo0UR4.css +17 -0
  107. package/frontend/.svelte-kit/output/server/chunks/Badge.js +30 -0
  108. package/frontend/.svelte-kit/output/server/chunks/Button.js +32 -0
  109. package/frontend/.svelte-kit/output/server/chunks/attributes.js +34 -0
  110. package/frontend/.svelte-kit/output/server/chunks/client.js +59 -0
  111. package/frontend/.svelte-kit/output/server/chunks/equality.js +31 -0
  112. package/frontend/.svelte-kit/output/server/chunks/escaping.js +36 -0
  113. package/frontend/.svelte-kit/output/server/chunks/exports.js +247 -0
  114. package/frontend/.svelte-kit/output/server/chunks/index.js +1135 -0
  115. package/frontend/.svelte-kit/output/server/chunks/internal.js +695 -0
  116. package/frontend/.svelte-kit/output/server/chunks/reports.js +57 -0
  117. package/frontend/.svelte-kit/output/server/entries/fallbacks/error.svelte.js +44 -0
  118. package/frontend/.svelte-kit/output/server/entries/pages/_layout.svelte.js +181 -0
  119. package/frontend/.svelte-kit/output/server/entries/pages/_page.svelte.js +164 -0
  120. package/frontend/.svelte-kit/output/server/entries/pages/reports/_page.svelte.js +141 -0
  121. package/frontend/.svelte-kit/output/server/entries/pages/reports/_slug_/_page.svelte.js +42 -0
  122. package/frontend/.svelte-kit/output/server/entries/pages/scheduled-tests/_page.svelte.js +179 -0
  123. package/frontend/.svelte-kit/output/server/index.js +3144 -0
  124. package/frontend/.svelte-kit/output/server/internal.js +30 -0
  125. package/frontend/.svelte-kit/output/server/manifest-full.js +77 -0
  126. package/frontend/.svelte-kit/output/server/manifest.js +77 -0
  127. package/frontend/.svelte-kit/output/server/nodes/0.js +25 -0
  128. package/frontend/.svelte-kit/output/server/nodes/1.js +25 -0
  129. package/frontend/.svelte-kit/output/server/nodes/2.js +25 -0
  130. package/frontend/.svelte-kit/output/server/nodes/3.js +25 -0
  131. package/frontend/.svelte-kit/output/server/nodes/4.js +25 -0
  132. package/frontend/.svelte-kit/output/server/nodes/5.js +25 -0
  133. package/frontend/.svelte-kit/tsconfig.json +49 -0
  134. package/frontend/build/client/_app/immutable/assets/0.CnXRuPt4.css +17 -0
  135. package/frontend/build/client/_app/immutable/assets/0.CnXRuPt4.css.br +0 -0
  136. package/frontend/build/client/_app/immutable/assets/0.CnXRuPt4.css.gz +0 -0
  137. package/frontend/build/client/_app/immutable/assets/2.CGnCsn5q.css +17 -0
  138. package/frontend/build/client/_app/immutable/assets/2.CGnCsn5q.css.br +0 -0
  139. package/frontend/build/client/_app/immutable/assets/2.CGnCsn5q.css.gz +0 -0
  140. package/frontend/build/client/_app/immutable/assets/3.BVnUajEa.css +17 -0
  141. package/frontend/build/client/_app/immutable/assets/3.BVnUajEa.css.br +0 -0
  142. package/frontend/build/client/_app/immutable/assets/3.BVnUajEa.css.gz +0 -0
  143. package/frontend/build/client/_app/immutable/assets/4.DBhBrHFz.css +17 -0
  144. package/frontend/build/client/_app/immutable/assets/4.DBhBrHFz.css.br +0 -0
  145. package/frontend/build/client/_app/immutable/assets/4.DBhBrHFz.css.gz +0 -0
  146. package/frontend/build/client/_app/immutable/assets/5.D93VAB-w.css +17 -0
  147. package/frontend/build/client/_app/immutable/assets/5.D93VAB-w.css.br +0 -0
  148. package/frontend/build/client/_app/immutable/assets/5.D93VAB-w.css.gz +0 -0
  149. package/frontend/build/client/_app/immutable/assets/Badge.DLLowvEA.css +17 -0
  150. package/frontend/build/client/_app/immutable/assets/Badge.DLLowvEA.css.br +0 -0
  151. package/frontend/build/client/_app/immutable/assets/Badge.DLLowvEA.css.gz +0 -0
  152. package/frontend/build/client/_app/immutable/assets/Button.cBruH0aD.css +17 -0
  153. package/frontend/build/client/_app/immutable/assets/Button.cBruH0aD.css.br +0 -0
  154. package/frontend/build/client/_app/immutable/assets/Button.cBruH0aD.css.gz +0 -0
  155. package/frontend/build/client/_app/immutable/assets/_layout.D7eM-6MV.css +17 -0
  156. package/frontend/build/client/_app/immutable/assets/_layout.D7eM-6MV.css.br +0 -0
  157. package/frontend/build/client/_app/immutable/assets/_layout.D7eM-6MV.css.gz +0 -0
  158. package/frontend/build/client/_app/immutable/assets/_page.BVnUajEa.css +17 -0
  159. package/frontend/build/client/_app/immutable/assets/_page.BVnUajEa.css.br +0 -0
  160. package/frontend/build/client/_app/immutable/assets/_page.BVnUajEa.css.gz +0 -0
  161. package/frontend/build/client/_app/immutable/assets/_page.CGnCsn5q.css +17 -0
  162. package/frontend/build/client/_app/immutable/assets/_page.CGnCsn5q.css.br +0 -0
  163. package/frontend/build/client/_app/immutable/assets/_page.CGnCsn5q.css.gz +0 -0
  164. package/frontend/build/client/_app/immutable/assets/_page.DBhBrHFz.css +17 -0
  165. package/frontend/build/client/_app/immutable/assets/_page.DBhBrHFz.css.br +0 -0
  166. package/frontend/build/client/_app/immutable/assets/_page.DBhBrHFz.css.gz +0 -0
  167. package/frontend/build/client/_app/immutable/assets/_page.DOqo0UR4.css +17 -0
  168. package/frontend/build/client/_app/immutable/assets/_page.DOqo0UR4.css.br +0 -0
  169. package/frontend/build/client/_app/immutable/assets/_page.DOqo0UR4.css.gz +0 -0
  170. package/frontend/build/client/_app/immutable/chunks/B0bn91RF.js +18 -0
  171. package/frontend/build/client/_app/immutable/chunks/B0bn91RF.js.br +0 -0
  172. package/frontend/build/client/_app/immutable/chunks/B0bn91RF.js.gz +0 -0
  173. package/frontend/build/client/_app/immutable/chunks/B1kE5jmt.js +23 -0
  174. package/frontend/build/client/_app/immutable/chunks/B1kE5jmt.js.br +0 -0
  175. package/frontend/build/client/_app/immutable/chunks/B1kE5jmt.js.gz +0 -0
  176. package/frontend/build/client/_app/immutable/chunks/BKz6FZdB.js +18 -0
  177. package/frontend/build/client/_app/immutable/chunks/BKz6FZdB.js.br +0 -0
  178. package/frontend/build/client/_app/immutable/chunks/BKz6FZdB.js.gz +0 -0
  179. package/frontend/build/client/_app/immutable/chunks/Be4iUAB0.js +18 -0
  180. package/frontend/build/client/_app/immutable/chunks/Be4iUAB0.js.br +0 -0
  181. package/frontend/build/client/_app/immutable/chunks/Be4iUAB0.js.gz +0 -0
  182. package/frontend/build/client/_app/immutable/chunks/BpaMqo9O.js +18 -0
  183. package/frontend/build/client/_app/immutable/chunks/BpaMqo9O.js.br +0 -0
  184. package/frontend/build/client/_app/immutable/chunks/BpaMqo9O.js.gz +0 -0
  185. package/frontend/build/client/_app/immutable/chunks/Bt3-Z7H1.js +18 -0
  186. package/frontend/build/client/_app/immutable/chunks/Bt3-Z7H1.js.br +0 -0
  187. package/frontend/build/client/_app/immutable/chunks/Bt3-Z7H1.js.gz +0 -0
  188. package/frontend/build/client/_app/immutable/chunks/CHV2KnPr.js +18 -0
  189. package/frontend/build/client/_app/immutable/chunks/CHV2KnPr.js.br +18 -0
  190. package/frontend/build/client/_app/immutable/chunks/CHV2KnPr.js.gz +0 -0
  191. package/frontend/build/client/_app/immutable/chunks/CJ8q7g9Y.js +18 -0
  192. package/{resources/comments-format.text → frontend/build/client/_app/immutable/chunks/CJ8q7g9Y.js.br} +0 -0
  193. package/frontend/build/client/_app/immutable/chunks/CJ8q7g9Y.js.gz +0 -0
  194. package/frontend/build/client/_app/immutable/chunks/Cit9MuSg.js +20 -0
  195. package/frontend/build/client/_app/immutable/chunks/Cit9MuSg.js.br +0 -0
  196. package/frontend/build/client/_app/immutable/chunks/Cit9MuSg.js.gz +0 -0
  197. package/frontend/build/client/_app/immutable/chunks/CwBTqcbj.js +18 -0
  198. package/frontend/build/client/_app/immutable/chunks/CwBTqcbj.js.br +0 -0
  199. package/frontend/build/client/_app/immutable/chunks/CwBTqcbj.js.gz +0 -0
  200. package/frontend/build/client/_app/immutable/chunks/DBk3zeq4.js +18 -0
  201. package/frontend/build/client/_app/immutable/chunks/DBk3zeq4.js.br +0 -0
  202. package/frontend/build/client/_app/immutable/chunks/DBk3zeq4.js.gz +0 -0
  203. package/frontend/build/client/_app/immutable/chunks/DFJLQFic.js +18 -0
  204. package/frontend/build/client/_app/immutable/chunks/DFJLQFic.js.br +0 -0
  205. package/frontend/build/client/_app/immutable/chunks/DFJLQFic.js.gz +0 -0
  206. package/frontend/build/client/_app/immutable/chunks/DTUE7kkY.js +18 -0
  207. package/frontend/build/client/_app/immutable/chunks/DTUE7kkY.js.br +0 -0
  208. package/frontend/build/client/_app/immutable/chunks/DTUE7kkY.js.gz +0 -0
  209. package/frontend/build/client/_app/immutable/chunks/IYPwzKs_.js +20 -0
  210. package/frontend/build/client/_app/immutable/chunks/IYPwzKs_.js.br +0 -0
  211. package/frontend/build/client/_app/immutable/chunks/IYPwzKs_.js.gz +0 -0
  212. package/frontend/build/client/_app/immutable/chunks/oc0we5Us.js +18 -0
  213. package/frontend/build/client/_app/immutable/chunks/oc0we5Us.js.br +0 -0
  214. package/frontend/build/client/_app/immutable/chunks/oc0we5Us.js.gz +0 -0
  215. package/frontend/build/client/_app/immutable/chunks/rVEKg0Ak.js +18 -0
  216. package/frontend/build/client/_app/immutable/chunks/rVEKg0Ak.js.br +0 -0
  217. package/frontend/build/client/_app/immutable/chunks/rVEKg0Ak.js.gz +0 -0
  218. package/frontend/build/client/_app/immutable/entry/app.C2MbX06K.js +19 -0
  219. package/frontend/build/client/_app/immutable/entry/app.C2MbX06K.js.br +0 -0
  220. package/frontend/build/client/_app/immutable/entry/app.C2MbX06K.js.gz +0 -0
  221. package/frontend/build/client/_app/immutable/entry/start.GiBry-lw.js +18 -0
  222. package/frontend/build/client/_app/immutable/entry/start.GiBry-lw.js.br +18 -0
  223. package/frontend/build/client/_app/immutable/entry/start.GiBry-lw.js.gz +0 -0
  224. package/frontend/build/client/_app/immutable/nodes/0.BsCYK-Tn.js +21 -0
  225. package/frontend/build/client/_app/immutable/nodes/0.BsCYK-Tn.js.br +0 -0
  226. package/frontend/build/client/_app/immutable/nodes/0.BsCYK-Tn.js.gz +0 -0
  227. package/frontend/build/client/_app/immutable/nodes/1.N4gjrCnX.js +18 -0
  228. package/frontend/build/client/_app/immutable/nodes/1.N4gjrCnX.js.br +0 -0
  229. package/frontend/build/client/_app/immutable/nodes/1.N4gjrCnX.js.gz +0 -0
  230. package/frontend/build/client/_app/immutable/nodes/2.D9yQNzK8.js +18 -0
  231. package/frontend/build/client/_app/immutable/nodes/2.D9yQNzK8.js.br +0 -0
  232. package/frontend/build/client/_app/immutable/nodes/2.D9yQNzK8.js.gz +0 -0
  233. package/frontend/build/client/_app/immutable/nodes/3.CBC5WvNb.js +18 -0
  234. package/frontend/build/client/_app/immutable/nodes/3.CBC5WvNb.js.br +0 -0
  235. package/frontend/build/client/_app/immutable/nodes/3.CBC5WvNb.js.gz +0 -0
  236. package/frontend/build/client/_app/immutable/nodes/4.BU6UZHSE.js +19 -0
  237. package/frontend/build/client/_app/immutable/nodes/4.BU6UZHSE.js.br +0 -0
  238. package/frontend/build/client/_app/immutable/nodes/4.BU6UZHSE.js.gz +0 -0
  239. package/frontend/build/client/_app/immutable/nodes/5.Dzzfrntl.js +18 -0
  240. package/frontend/build/client/_app/immutable/nodes/5.Dzzfrntl.js.br +0 -0
  241. package/frontend/build/client/_app/immutable/nodes/5.Dzzfrntl.js.gz +0 -0
  242. package/frontend/build/client/_app/version.json +1 -0
  243. package/frontend/build/client/_app/version.json.br +0 -0
  244. package/frontend/build/client/_app/version.json.gz +0 -0
  245. package/frontend/build/client/favicon.png +0 -0
  246. package/frontend/build/env.js +111 -0
  247. package/frontend/build/handler.js +1511 -0
  248. package/frontend/build/index.js +362 -0
  249. package/frontend/build/server/chunks/0-BFfqmlsS.js +26 -0
  250. package/frontend/build/server/chunks/0-BFfqmlsS.js.map +17 -0
  251. package/frontend/build/server/chunks/1-hso3H4Ax.js +26 -0
  252. package/frontend/build/server/chunks/1-hso3H4Ax.js.map +17 -0
  253. package/frontend/build/server/chunks/2-BSZWXCWp.js +26 -0
  254. package/frontend/build/server/chunks/2-BSZWXCWp.js.map +17 -0
  255. package/frontend/build/server/chunks/3-BYumY9dv.js +26 -0
  256. package/frontend/build/server/chunks/3-BYumY9dv.js.map +17 -0
  257. package/frontend/build/server/chunks/4-2UUrCVtM.js +26 -0
  258. package/frontend/build/server/chunks/4-2UUrCVtM.js.map +17 -0
  259. package/frontend/build/server/chunks/5-C2_y_fwT.js +26 -0
  260. package/frontend/build/server/chunks/5-C2_y_fwT.js.map +17 -0
  261. package/frontend/build/server/chunks/Badge-CC4U7C0c.js +30 -0
  262. package/frontend/build/server/chunks/Badge-CC4U7C0c.js.map +17 -0
  263. package/frontend/build/server/chunks/Button-BLkPicwS.js +33 -0
  264. package/frontend/build/server/chunks/Button-BLkPicwS.js.map +17 -0
  265. package/frontend/build/server/chunks/_layout.svelte-Bfxcj9C6.js +183 -0
  266. package/frontend/build/server/chunks/_layout.svelte-Bfxcj9C6.js.map +17 -0
  267. package/frontend/build/server/chunks/_page.svelte-DEK6UvaI.js +45 -0
  268. package/frontend/build/server/chunks/_page.svelte-DEK6UvaI.js.map +17 -0
  269. package/frontend/build/server/chunks/_page.svelte-DScVdHOq.js +142 -0
  270. package/frontend/build/server/chunks/_page.svelte-DScVdHOq.js.map +17 -0
  271. package/frontend/build/server/chunks/_page.svelte-Ns7w2sZt.js +180 -0
  272. package/frontend/build/server/chunks/_page.svelte-Ns7w2sZt.js.map +17 -0
  273. package/frontend/build/server/chunks/_page.svelte-s6ZIOitT.js +165 -0
  274. package/frontend/build/server/chunks/_page.svelte-s6ZIOitT.js.map +17 -0
  275. package/frontend/build/server/chunks/attributes-BeaNKpgU.js +34 -0
  276. package/frontend/build/server/chunks/attributes-BeaNKpgU.js.map +17 -0
  277. package/frontend/build/server/chunks/client-C9IaEwNo.js +52 -0
  278. package/frontend/build/server/chunks/client-C9IaEwNo.js.map +17 -0
  279. package/frontend/build/server/chunks/error.svelte-HKBv5sQT.js +45 -0
  280. package/frontend/build/server/chunks/error.svelte-HKBv5sQT.js.map +17 -0
  281. package/frontend/build/server/chunks/escaping-CqgfEcN3.js +36 -0
  282. package/frontend/build/server/chunks/escaping-CqgfEcN3.js.map +17 -0
  283. package/frontend/build/server/chunks/exports-OxlCJ8yE.js +192 -0
  284. package/frontend/build/server/chunks/exports-OxlCJ8yE.js.map +17 -0
  285. package/frontend/build/server/chunks/index-CjHlq1kt.js +1076 -0
  286. package/frontend/build/server/chunks/index-CjHlq1kt.js.map +17 -0
  287. package/frontend/build/server/chunks/reports-D3ZeYSmi.js +56 -0
  288. package/frontend/build/server/chunks/reports-D3ZeYSmi.js.map +17 -0
  289. package/frontend/build/server/index.js +5015 -0
  290. package/frontend/build/server/index.js.map +17 -0
  291. package/frontend/build/server/manifest.js +84 -0
  292. package/frontend/build/server/manifest.js.map +17 -0
  293. package/frontend/build/shims.js +49 -0
  294. package/frontend/package-lock.json +2 -2
  295. package/frontend/package.json +1 -1
  296. package/package.json +1 -1
  297. package/.claude/settings.local.json +0 -29
  298. package/.husky/pre-commit +0 -2
  299. package/.prettierignore +0 -21
  300. package/.prettierrc +0 -15
  301. package/.vscode/settings.json +0 -10
  302. package/license-config.json +0 -37
@@ -0,0 +1,1511 @@
1
+ /*
2
+ * This file is part of Plum.
3
+ *
4
+ * Plum is free software: you can redistribute it and/or modify
5
+ * it under the terms of the GNU General Public License as published by
6
+ * the Free Software Foundation, either version 3 of the License, or
7
+ * (at your option) any later version.
8
+ *
9
+ * Plum is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with Plum. If not, see https://www.gnu.org/licenses/.
16
+ */
17
+
18
+ import './shims.js';
19
+ import * as fs from 'node:fs';
20
+ import fs__default, { readdirSync, statSync, createReadStream } from 'node:fs';
21
+ import path, { resolve, join, sep, normalize } from 'node:path';
22
+ import process from 'node:process';
23
+ import * as qs from 'node:querystring';
24
+ import { fileURLToPath } from 'node:url';
25
+ import { Readable } from 'node:stream';
26
+ import { Server } from './server/index.js';
27
+ import { manifest, prerendered, base } from './server/manifest.js';
28
+ import { env } from './env.js';
29
+
30
+ function totalist(dir, callback, pre='') {
31
+ dir = resolve('.', dir);
32
+ let arr = readdirSync(dir);
33
+ let i=0, abs, stats;
34
+ for (; i < arr.length; i++) {
35
+ abs = join(dir, arr[i]);
36
+ stats = statSync(abs);
37
+ stats.isDirectory()
38
+ ? totalist(abs, callback, join(pre, arr[i]))
39
+ : callback(join(pre, arr[i]), abs, stats);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * @typedef ParsedURL
45
+ * @type {import('.').ParsedURL}
46
+ */
47
+
48
+ /**
49
+ * @typedef Request
50
+ * @property {string} url
51
+ * @property {ParsedURL} _parsedUrl
52
+ */
53
+
54
+ /**
55
+ * @param {Request} req
56
+ * @returns {ParsedURL|void}
57
+ */
58
+ function parse(req) {
59
+ let raw = req.url;
60
+ if (raw == null) return;
61
+
62
+ let prev = req._parsedUrl;
63
+ if (prev && prev.raw === raw) return prev;
64
+
65
+ let pathname=raw, search='', query;
66
+
67
+ if (raw.length > 1) {
68
+ let idx = raw.indexOf('?', 1);
69
+
70
+ if (idx !== -1) {
71
+ search = raw.substring(idx);
72
+ pathname = raw.substring(0, idx);
73
+ if (search.length > 1) {
74
+ query = qs.parse(search.substring(1));
75
+ }
76
+ }
77
+ }
78
+
79
+ return req._parsedUrl = { pathname, search, query, raw };
80
+ }
81
+
82
+ const mimes = {
83
+ "3g2": "video/3gpp2",
84
+ "3gp": "video/3gpp",
85
+ "3gpp": "video/3gpp",
86
+ "3mf": "model/3mf",
87
+ "aac": "audio/aac",
88
+ "ac": "application/pkix-attr-cert",
89
+ "adp": "audio/adpcm",
90
+ "adts": "audio/aac",
91
+ "ai": "application/postscript",
92
+ "aml": "application/automationml-aml+xml",
93
+ "amlx": "application/automationml-amlx+zip",
94
+ "amr": "audio/amr",
95
+ "apng": "image/apng",
96
+ "appcache": "text/cache-manifest",
97
+ "appinstaller": "application/appinstaller",
98
+ "appx": "application/appx",
99
+ "appxbundle": "application/appxbundle",
100
+ "asc": "application/pgp-keys",
101
+ "atom": "application/atom+xml",
102
+ "atomcat": "application/atomcat+xml",
103
+ "atomdeleted": "application/atomdeleted+xml",
104
+ "atomsvc": "application/atomsvc+xml",
105
+ "au": "audio/basic",
106
+ "avci": "image/avci",
107
+ "avcs": "image/avcs",
108
+ "avif": "image/avif",
109
+ "aw": "application/applixware",
110
+ "bdoc": "application/bdoc",
111
+ "bin": "application/octet-stream",
112
+ "bmp": "image/bmp",
113
+ "bpk": "application/octet-stream",
114
+ "btf": "image/prs.btif",
115
+ "btif": "image/prs.btif",
116
+ "buffer": "application/octet-stream",
117
+ "ccxml": "application/ccxml+xml",
118
+ "cdfx": "application/cdfx+xml",
119
+ "cdmia": "application/cdmi-capability",
120
+ "cdmic": "application/cdmi-container",
121
+ "cdmid": "application/cdmi-domain",
122
+ "cdmio": "application/cdmi-object",
123
+ "cdmiq": "application/cdmi-queue",
124
+ "cer": "application/pkix-cert",
125
+ "cgm": "image/cgm",
126
+ "cjs": "application/node",
127
+ "class": "application/java-vm",
128
+ "coffee": "text/coffeescript",
129
+ "conf": "text/plain",
130
+ "cpl": "application/cpl+xml",
131
+ "cpt": "application/mac-compactpro",
132
+ "crl": "application/pkix-crl",
133
+ "css": "text/css",
134
+ "csv": "text/csv",
135
+ "cu": "application/cu-seeme",
136
+ "cwl": "application/cwl",
137
+ "cww": "application/prs.cww",
138
+ "davmount": "application/davmount+xml",
139
+ "dbk": "application/docbook+xml",
140
+ "deb": "application/octet-stream",
141
+ "def": "text/plain",
142
+ "deploy": "application/octet-stream",
143
+ "dib": "image/bmp",
144
+ "disposition-notification": "message/disposition-notification",
145
+ "dist": "application/octet-stream",
146
+ "distz": "application/octet-stream",
147
+ "dll": "application/octet-stream",
148
+ "dmg": "application/octet-stream",
149
+ "dms": "application/octet-stream",
150
+ "doc": "application/msword",
151
+ "dot": "application/msword",
152
+ "dpx": "image/dpx",
153
+ "drle": "image/dicom-rle",
154
+ "dsc": "text/prs.lines.tag",
155
+ "dssc": "application/dssc+der",
156
+ "dtd": "application/xml-dtd",
157
+ "dump": "application/octet-stream",
158
+ "dwd": "application/atsc-dwd+xml",
159
+ "ear": "application/java-archive",
160
+ "ecma": "application/ecmascript",
161
+ "elc": "application/octet-stream",
162
+ "emf": "image/emf",
163
+ "eml": "message/rfc822",
164
+ "emma": "application/emma+xml",
165
+ "emotionml": "application/emotionml+xml",
166
+ "eps": "application/postscript",
167
+ "epub": "application/epub+zip",
168
+ "exe": "application/octet-stream",
169
+ "exi": "application/exi",
170
+ "exp": "application/express",
171
+ "exr": "image/aces",
172
+ "ez": "application/andrew-inset",
173
+ "fdf": "application/fdf",
174
+ "fdt": "application/fdt+xml",
175
+ "fits": "image/fits",
176
+ "g3": "image/g3fax",
177
+ "gbr": "application/rpki-ghostbusters",
178
+ "geojson": "application/geo+json",
179
+ "gif": "image/gif",
180
+ "glb": "model/gltf-binary",
181
+ "gltf": "model/gltf+json",
182
+ "gml": "application/gml+xml",
183
+ "gpx": "application/gpx+xml",
184
+ "gram": "application/srgs",
185
+ "grxml": "application/srgs+xml",
186
+ "gxf": "application/gxf",
187
+ "gz": "application/gzip",
188
+ "h261": "video/h261",
189
+ "h263": "video/h263",
190
+ "h264": "video/h264",
191
+ "heic": "image/heic",
192
+ "heics": "image/heic-sequence",
193
+ "heif": "image/heif",
194
+ "heifs": "image/heif-sequence",
195
+ "hej2": "image/hej2k",
196
+ "held": "application/atsc-held+xml",
197
+ "hjson": "application/hjson",
198
+ "hlp": "application/winhlp",
199
+ "hqx": "application/mac-binhex40",
200
+ "hsj2": "image/hsj2",
201
+ "htm": "text/html",
202
+ "html": "text/html",
203
+ "ics": "text/calendar",
204
+ "ief": "image/ief",
205
+ "ifb": "text/calendar",
206
+ "iges": "model/iges",
207
+ "igs": "model/iges",
208
+ "img": "application/octet-stream",
209
+ "in": "text/plain",
210
+ "ini": "text/plain",
211
+ "ink": "application/inkml+xml",
212
+ "inkml": "application/inkml+xml",
213
+ "ipfix": "application/ipfix",
214
+ "iso": "application/octet-stream",
215
+ "its": "application/its+xml",
216
+ "jade": "text/jade",
217
+ "jar": "application/java-archive",
218
+ "jhc": "image/jphc",
219
+ "jls": "image/jls",
220
+ "jp2": "image/jp2",
221
+ "jpe": "image/jpeg",
222
+ "jpeg": "image/jpeg",
223
+ "jpf": "image/jpx",
224
+ "jpg": "image/jpeg",
225
+ "jpg2": "image/jp2",
226
+ "jpgm": "image/jpm",
227
+ "jpgv": "video/jpeg",
228
+ "jph": "image/jph",
229
+ "jpm": "image/jpm",
230
+ "jpx": "image/jpx",
231
+ "js": "text/javascript",
232
+ "json": "application/json",
233
+ "json5": "application/json5",
234
+ "jsonld": "application/ld+json",
235
+ "jsonml": "application/jsonml+json",
236
+ "jsx": "text/jsx",
237
+ "jt": "model/jt",
238
+ "jxr": "image/jxr",
239
+ "jxra": "image/jxra",
240
+ "jxrs": "image/jxrs",
241
+ "jxs": "image/jxs",
242
+ "jxsc": "image/jxsc",
243
+ "jxsi": "image/jxsi",
244
+ "jxss": "image/jxss",
245
+ "kar": "audio/midi",
246
+ "ktx": "image/ktx",
247
+ "ktx2": "image/ktx2",
248
+ "less": "text/less",
249
+ "lgr": "application/lgr+xml",
250
+ "list": "text/plain",
251
+ "litcoffee": "text/coffeescript",
252
+ "log": "text/plain",
253
+ "lostxml": "application/lost+xml",
254
+ "lrf": "application/octet-stream",
255
+ "m1v": "video/mpeg",
256
+ "m21": "application/mp21",
257
+ "m2a": "audio/mpeg",
258
+ "m2v": "video/mpeg",
259
+ "m3a": "audio/mpeg",
260
+ "m4a": "audio/mp4",
261
+ "m4p": "application/mp4",
262
+ "m4s": "video/iso.segment",
263
+ "ma": "application/mathematica",
264
+ "mads": "application/mads+xml",
265
+ "maei": "application/mmt-aei+xml",
266
+ "man": "text/troff",
267
+ "manifest": "text/cache-manifest",
268
+ "map": "application/json",
269
+ "mar": "application/octet-stream",
270
+ "markdown": "text/markdown",
271
+ "mathml": "application/mathml+xml",
272
+ "mb": "application/mathematica",
273
+ "mbox": "application/mbox",
274
+ "md": "text/markdown",
275
+ "mdx": "text/mdx",
276
+ "me": "text/troff",
277
+ "mesh": "model/mesh",
278
+ "meta4": "application/metalink4+xml",
279
+ "metalink": "application/metalink+xml",
280
+ "mets": "application/mets+xml",
281
+ "mft": "application/rpki-manifest",
282
+ "mid": "audio/midi",
283
+ "midi": "audio/midi",
284
+ "mime": "message/rfc822",
285
+ "mj2": "video/mj2",
286
+ "mjp2": "video/mj2",
287
+ "mjs": "text/javascript",
288
+ "mml": "text/mathml",
289
+ "mods": "application/mods+xml",
290
+ "mov": "video/quicktime",
291
+ "mp2": "audio/mpeg",
292
+ "mp21": "application/mp21",
293
+ "mp2a": "audio/mpeg",
294
+ "mp3": "audio/mpeg",
295
+ "mp4": "video/mp4",
296
+ "mp4a": "audio/mp4",
297
+ "mp4s": "application/mp4",
298
+ "mp4v": "video/mp4",
299
+ "mpd": "application/dash+xml",
300
+ "mpe": "video/mpeg",
301
+ "mpeg": "video/mpeg",
302
+ "mpf": "application/media-policy-dataset+xml",
303
+ "mpg": "video/mpeg",
304
+ "mpg4": "video/mp4",
305
+ "mpga": "audio/mpeg",
306
+ "mpp": "application/dash-patch+xml",
307
+ "mrc": "application/marc",
308
+ "mrcx": "application/marcxml+xml",
309
+ "ms": "text/troff",
310
+ "mscml": "application/mediaservercontrol+xml",
311
+ "msh": "model/mesh",
312
+ "msi": "application/octet-stream",
313
+ "msix": "application/msix",
314
+ "msixbundle": "application/msixbundle",
315
+ "msm": "application/octet-stream",
316
+ "msp": "application/octet-stream",
317
+ "mtl": "model/mtl",
318
+ "musd": "application/mmt-usd+xml",
319
+ "mxf": "application/mxf",
320
+ "mxmf": "audio/mobile-xmf",
321
+ "mxml": "application/xv+xml",
322
+ "n3": "text/n3",
323
+ "nb": "application/mathematica",
324
+ "nq": "application/n-quads",
325
+ "nt": "application/n-triples",
326
+ "obj": "model/obj",
327
+ "oda": "application/oda",
328
+ "oga": "audio/ogg",
329
+ "ogg": "audio/ogg",
330
+ "ogv": "video/ogg",
331
+ "ogx": "application/ogg",
332
+ "omdoc": "application/omdoc+xml",
333
+ "onepkg": "application/onenote",
334
+ "onetmp": "application/onenote",
335
+ "onetoc": "application/onenote",
336
+ "onetoc2": "application/onenote",
337
+ "opf": "application/oebps-package+xml",
338
+ "opus": "audio/ogg",
339
+ "otf": "font/otf",
340
+ "owl": "application/rdf+xml",
341
+ "oxps": "application/oxps",
342
+ "p10": "application/pkcs10",
343
+ "p7c": "application/pkcs7-mime",
344
+ "p7m": "application/pkcs7-mime",
345
+ "p7s": "application/pkcs7-signature",
346
+ "p8": "application/pkcs8",
347
+ "pdf": "application/pdf",
348
+ "pfr": "application/font-tdpfr",
349
+ "pgp": "application/pgp-encrypted",
350
+ "pkg": "application/octet-stream",
351
+ "pki": "application/pkixcmp",
352
+ "pkipath": "application/pkix-pkipath",
353
+ "pls": "application/pls+xml",
354
+ "png": "image/png",
355
+ "prc": "model/prc",
356
+ "prf": "application/pics-rules",
357
+ "provx": "application/provenance+xml",
358
+ "ps": "application/postscript",
359
+ "pskcxml": "application/pskc+xml",
360
+ "pti": "image/prs.pti",
361
+ "qt": "video/quicktime",
362
+ "raml": "application/raml+yaml",
363
+ "rapd": "application/route-apd+xml",
364
+ "rdf": "application/rdf+xml",
365
+ "relo": "application/p2p-overlay+xml",
366
+ "rif": "application/reginfo+xml",
367
+ "rl": "application/resource-lists+xml",
368
+ "rld": "application/resource-lists-diff+xml",
369
+ "rmi": "audio/midi",
370
+ "rnc": "application/relax-ng-compact-syntax",
371
+ "rng": "application/xml",
372
+ "roa": "application/rpki-roa",
373
+ "roff": "text/troff",
374
+ "rq": "application/sparql-query",
375
+ "rs": "application/rls-services+xml",
376
+ "rsat": "application/atsc-rsat+xml",
377
+ "rsd": "application/rsd+xml",
378
+ "rsheet": "application/urc-ressheet+xml",
379
+ "rss": "application/rss+xml",
380
+ "rtf": "text/rtf",
381
+ "rtx": "text/richtext",
382
+ "rusd": "application/route-usd+xml",
383
+ "s3m": "audio/s3m",
384
+ "sbml": "application/sbml+xml",
385
+ "scq": "application/scvp-cv-request",
386
+ "scs": "application/scvp-cv-response",
387
+ "sdp": "application/sdp",
388
+ "senmlx": "application/senml+xml",
389
+ "sensmlx": "application/sensml+xml",
390
+ "ser": "application/java-serialized-object",
391
+ "setpay": "application/set-payment-initiation",
392
+ "setreg": "application/set-registration-initiation",
393
+ "sgi": "image/sgi",
394
+ "sgm": "text/sgml",
395
+ "sgml": "text/sgml",
396
+ "shex": "text/shex",
397
+ "shf": "application/shf+xml",
398
+ "shtml": "text/html",
399
+ "sieve": "application/sieve",
400
+ "sig": "application/pgp-signature",
401
+ "sil": "audio/silk",
402
+ "silo": "model/mesh",
403
+ "siv": "application/sieve",
404
+ "slim": "text/slim",
405
+ "slm": "text/slim",
406
+ "sls": "application/route-s-tsid+xml",
407
+ "smi": "application/smil+xml",
408
+ "smil": "application/smil+xml",
409
+ "snd": "audio/basic",
410
+ "so": "application/octet-stream",
411
+ "spdx": "text/spdx",
412
+ "spp": "application/scvp-vp-response",
413
+ "spq": "application/scvp-vp-request",
414
+ "spx": "audio/ogg",
415
+ "sql": "application/sql",
416
+ "sru": "application/sru+xml",
417
+ "srx": "application/sparql-results+xml",
418
+ "ssdl": "application/ssdl+xml",
419
+ "ssml": "application/ssml+xml",
420
+ "stk": "application/hyperstudio",
421
+ "stl": "model/stl",
422
+ "stpx": "model/step+xml",
423
+ "stpxz": "model/step-xml+zip",
424
+ "stpz": "model/step+zip",
425
+ "styl": "text/stylus",
426
+ "stylus": "text/stylus",
427
+ "svg": "image/svg+xml",
428
+ "svgz": "image/svg+xml",
429
+ "swidtag": "application/swid+xml",
430
+ "t": "text/troff",
431
+ "t38": "image/t38",
432
+ "td": "application/urc-targetdesc+xml",
433
+ "tei": "application/tei+xml",
434
+ "teicorpus": "application/tei+xml",
435
+ "text": "text/plain",
436
+ "tfi": "application/thraud+xml",
437
+ "tfx": "image/tiff-fx",
438
+ "tif": "image/tiff",
439
+ "tiff": "image/tiff",
440
+ "toml": "application/toml",
441
+ "tr": "text/troff",
442
+ "trig": "application/trig",
443
+ "ts": "video/mp2t",
444
+ "tsd": "application/timestamped-data",
445
+ "tsv": "text/tab-separated-values",
446
+ "ttc": "font/collection",
447
+ "ttf": "font/ttf",
448
+ "ttl": "text/turtle",
449
+ "ttml": "application/ttml+xml",
450
+ "txt": "text/plain",
451
+ "u3d": "model/u3d",
452
+ "u8dsn": "message/global-delivery-status",
453
+ "u8hdr": "message/global-headers",
454
+ "u8mdn": "message/global-disposition-notification",
455
+ "u8msg": "message/global",
456
+ "ubj": "application/ubjson",
457
+ "uri": "text/uri-list",
458
+ "uris": "text/uri-list",
459
+ "urls": "text/uri-list",
460
+ "vcard": "text/vcard",
461
+ "vrml": "model/vrml",
462
+ "vtt": "text/vtt",
463
+ "vxml": "application/voicexml+xml",
464
+ "war": "application/java-archive",
465
+ "wasm": "application/wasm",
466
+ "wav": "audio/wav",
467
+ "weba": "audio/webm",
468
+ "webm": "video/webm",
469
+ "webmanifest": "application/manifest+json",
470
+ "webp": "image/webp",
471
+ "wgsl": "text/wgsl",
472
+ "wgt": "application/widget",
473
+ "wif": "application/watcherinfo+xml",
474
+ "wmf": "image/wmf",
475
+ "woff": "font/woff",
476
+ "woff2": "font/woff2",
477
+ "wrl": "model/vrml",
478
+ "wsdl": "application/wsdl+xml",
479
+ "wspolicy": "application/wspolicy+xml",
480
+ "x3d": "model/x3d+xml",
481
+ "x3db": "model/x3d+fastinfoset",
482
+ "x3dbz": "model/x3d+binary",
483
+ "x3dv": "model/x3d-vrml",
484
+ "x3dvz": "model/x3d+vrml",
485
+ "x3dz": "model/x3d+xml",
486
+ "xaml": "application/xaml+xml",
487
+ "xav": "application/xcap-att+xml",
488
+ "xca": "application/xcap-caps+xml",
489
+ "xcs": "application/calendar+xml",
490
+ "xdf": "application/xcap-diff+xml",
491
+ "xdssc": "application/dssc+xml",
492
+ "xel": "application/xcap-el+xml",
493
+ "xenc": "application/xenc+xml",
494
+ "xer": "application/patch-ops-error+xml",
495
+ "xfdf": "application/xfdf",
496
+ "xht": "application/xhtml+xml",
497
+ "xhtml": "application/xhtml+xml",
498
+ "xhvml": "application/xv+xml",
499
+ "xlf": "application/xliff+xml",
500
+ "xm": "audio/xm",
501
+ "xml": "text/xml",
502
+ "xns": "application/xcap-ns+xml",
503
+ "xop": "application/xop+xml",
504
+ "xpl": "application/xproc+xml",
505
+ "xsd": "application/xml",
506
+ "xsf": "application/prs.xsf+xml",
507
+ "xsl": "application/xml",
508
+ "xslt": "application/xml",
509
+ "xspf": "application/xspf+xml",
510
+ "xvm": "application/xv+xml",
511
+ "xvml": "application/xv+xml",
512
+ "yaml": "text/yaml",
513
+ "yang": "application/yang",
514
+ "yin": "application/yin+xml",
515
+ "yml": "text/yaml",
516
+ "zip": "application/zip"
517
+ };
518
+
519
+ function lookup(extn) {
520
+ let tmp = ('' + extn).trim().toLowerCase();
521
+ let idx = tmp.lastIndexOf('.');
522
+ return mimes[!~idx ? tmp : tmp.substring(++idx)];
523
+ }
524
+
525
+ const noop = () => {};
526
+
527
+ function isMatch(uri, arr) {
528
+ for (let i=0; i < arr.length; i++) {
529
+ if (arr[i].test(uri)) return true;
530
+ }
531
+ }
532
+
533
+ function toAssume(uri, extns) {
534
+ let i=0, x, len=uri.length - 1;
535
+ if (uri.charCodeAt(len) === 47) {
536
+ uri = uri.substring(0, len);
537
+ }
538
+
539
+ let arr=[], tmp=`${uri}/index`;
540
+ for (; i < extns.length; i++) {
541
+ x = extns[i] ? `.${extns[i]}` : '';
542
+ if (uri) arr.push(uri + x);
543
+ arr.push(tmp + x);
544
+ }
545
+
546
+ return arr;
547
+ }
548
+
549
+ function viaCache(cache, uri, extns) {
550
+ let i=0, data, arr=toAssume(uri, extns);
551
+ for (; i < arr.length; i++) {
552
+ if (data = cache[arr[i]]) return data;
553
+ }
554
+ }
555
+
556
+ function viaLocal(dir, isEtag, uri, extns) {
557
+ let i=0, arr=toAssume(uri, extns);
558
+ let abs, stats, name, headers;
559
+ for (; i < arr.length; i++) {
560
+ abs = normalize(
561
+ join(dir, name=arr[i])
562
+ );
563
+
564
+ if (abs.startsWith(dir) && fs.existsSync(abs)) {
565
+ stats = fs.statSync(abs);
566
+ if (stats.isDirectory()) continue;
567
+ headers = toHeaders(name, stats, isEtag);
568
+ headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store';
569
+ return { abs, stats, headers };
570
+ }
571
+ }
572
+ }
573
+
574
+ function is404(req, res) {
575
+ return (res.statusCode=404,res.end());
576
+ }
577
+
578
+ function send(req, res, file, stats, headers) {
579
+ let code=200, tmp, opts={};
580
+ headers = { ...headers };
581
+
582
+ for (let key in headers) {
583
+ tmp = res.getHeader(key);
584
+ if (tmp) headers[key] = tmp;
585
+ }
586
+
587
+ if (tmp = res.getHeader('content-type')) {
588
+ headers['Content-Type'] = tmp;
589
+ }
590
+
591
+ if (req.headers.range) {
592
+ code = 206;
593
+ let [x, y] = req.headers.range.replace('bytes=', '').split('-');
594
+ let end = opts.end = parseInt(y, 10) || stats.size - 1;
595
+ let start = opts.start = parseInt(x, 10) || 0;
596
+
597
+ if (end >= stats.size) {
598
+ end = stats.size - 1;
599
+ }
600
+
601
+ if (start >= stats.size) {
602
+ res.setHeader('Content-Range', `bytes */${stats.size}`);
603
+ res.statusCode = 416;
604
+ return res.end();
605
+ }
606
+
607
+ headers['Content-Range'] = `bytes ${start}-${end}/${stats.size}`;
608
+ headers['Content-Length'] = (end - start + 1);
609
+ headers['Accept-Ranges'] = 'bytes';
610
+ }
611
+
612
+ res.writeHead(code, headers);
613
+ fs.createReadStream(file, opts).pipe(res);
614
+ }
615
+
616
+ const ENCODING = {
617
+ '.br': 'br',
618
+ '.gz': 'gzip',
619
+ };
620
+
621
+ function toHeaders(name, stats, isEtag) {
622
+ let enc = ENCODING[name.slice(-3)];
623
+
624
+ let ctype = lookup(name.slice(0, enc && -3)) || '';
625
+ if (ctype === 'text/html') ctype += ';charset=utf-8';
626
+
627
+ let headers = {
628
+ 'Content-Length': stats.size,
629
+ 'Content-Type': ctype,
630
+ 'Last-Modified': stats.mtime.toUTCString(),
631
+ };
632
+
633
+ if (enc) headers['Content-Encoding'] = enc;
634
+ if (isEtag) headers['ETag'] = `W/"${stats.size}-${stats.mtime.getTime()}"`;
635
+
636
+ return headers;
637
+ }
638
+
639
+ function sirv (dir, opts={}) {
640
+ dir = resolve(dir || '.');
641
+
642
+ let isNotFound = opts.onNoMatch || is404;
643
+ let setHeaders = opts.setHeaders || noop;
644
+
645
+ let extensions = opts.extensions || ['html', 'htm'];
646
+ let gzips = opts.gzip && extensions.map(x => `${x}.gz`).concat('gz');
647
+ let brots = opts.brotli && extensions.map(x => `${x}.br`).concat('br');
648
+
649
+ const FILES = {};
650
+
651
+ let fallback = '/';
652
+ let isEtag = !!opts.etag;
653
+ let isSPA = !!opts.single;
654
+ if (typeof opts.single === 'string') {
655
+ let idx = opts.single.lastIndexOf('.');
656
+ fallback += !!~idx ? opts.single.substring(0, idx) : opts.single;
657
+ }
658
+
659
+ let ignores = [];
660
+ if (opts.ignores !== false) {
661
+ ignores.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/); // any extn
662
+ if (opts.dotfiles) ignores.push(/\/\.\w/);
663
+ else ignores.push(/\/\.well-known/);
664
+ [].concat(opts.ignores || []).forEach(x => {
665
+ ignores.push(new RegExp(x, 'i'));
666
+ });
667
+ }
668
+
669
+ let cc = opts.maxAge != null && `public,max-age=${opts.maxAge}`;
670
+ if (cc && opts.immutable) cc += ',immutable';
671
+ else if (cc && opts.maxAge === 0) cc += ',must-revalidate';
672
+
673
+ if (!opts.dev) {
674
+ totalist(dir, (name, abs, stats) => {
675
+ if (/\.well-known[\\+\/]/.test(name)) ; // keep
676
+ else if (!opts.dotfiles && /(^\.|[\\+|\/+]\.)/.test(name)) return;
677
+
678
+ let headers = toHeaders(name, stats, isEtag);
679
+ if (cc) headers['Cache-Control'] = cc;
680
+
681
+ FILES['/' + name.normalize().replace(/\\+/g, '/')] = { abs, stats, headers };
682
+ });
683
+ }
684
+
685
+ let lookup = opts.dev ? viaLocal.bind(0, dir + sep, isEtag) : viaCache.bind(0, FILES);
686
+
687
+ return function (req, res, next) {
688
+ let extns = [''];
689
+ let pathname = parse(req).pathname;
690
+ let val = req.headers['accept-encoding'] || '';
691
+ if (gzips && val.includes('gzip')) extns.unshift(...gzips);
692
+ if (brots && /(br|brotli)/i.test(val)) extns.unshift(...brots);
693
+ extns.push(...extensions); // [...br, ...gz, orig, ...exts]
694
+
695
+ if (pathname.indexOf('%') !== -1) {
696
+ try { pathname = decodeURI(pathname); }
697
+ catch (err) { /* malform uri */ }
698
+ }
699
+
700
+ let data = lookup(pathname, extns) || isSPA && !isMatch(pathname, ignores) && lookup(fallback, extns);
701
+ if (!data) return next ? next() : isNotFound(req, res);
702
+
703
+ if (isEtag && req.headers['if-none-match'] === data.headers['ETag']) {
704
+ res.writeHead(304);
705
+ return res.end();
706
+ }
707
+
708
+ if (gzips || brots) {
709
+ res.setHeader('Vary', 'Accept-Encoding');
710
+ }
711
+
712
+ setHeaders(res, pathname, data.stats);
713
+ send(req, res, data.abs, data.stats, data.headers);
714
+ };
715
+ }
716
+
717
+ var defaultParseOptions = {
718
+ decodeValues: true,
719
+ map: false,
720
+ silent: false,
721
+ split: "auto", // auto = split strings but not arrays
722
+ };
723
+
724
+ function isForbiddenKey(key) {
725
+ return typeof key !== "string" || key in {};
726
+ }
727
+
728
+ function createNullObj() {
729
+ return Object.create(null);
730
+ }
731
+
732
+ function isNonEmptyString(str) {
733
+ return typeof str === "string" && !!str.trim();
734
+ }
735
+
736
+ function parseString(setCookieValue, options) {
737
+ var parts = setCookieValue.split(";").filter(isNonEmptyString);
738
+
739
+ var nameValuePairStr = parts.shift();
740
+ var parsed = parseNameValuePair(nameValuePairStr);
741
+ var name = parsed.name;
742
+ var value = parsed.value;
743
+
744
+ options = options
745
+ ? Object.assign({}, defaultParseOptions, options)
746
+ : defaultParseOptions;
747
+
748
+ if (isForbiddenKey(name)) {
749
+ return null;
750
+ }
751
+
752
+ try {
753
+ value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value
754
+ } catch (e) {
755
+ console.error(
756
+ "set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",
757
+ e
758
+ );
759
+ }
760
+
761
+ var cookie = createNullObj();
762
+ cookie.name = name;
763
+ cookie.value = value;
764
+
765
+ parts.forEach(function (part) {
766
+ var sides = part.split("=");
767
+ var key = sides.shift().trimLeft().toLowerCase();
768
+ if (isForbiddenKey(key)) {
769
+ return;
770
+ }
771
+ var value = sides.join("=");
772
+ if (key === "expires") {
773
+ cookie.expires = new Date(value);
774
+ } else if (key === "max-age") {
775
+ var n = parseInt(value, 10);
776
+ if (!Number.isNaN(n)) cookie.maxAge = n;
777
+ } else if (key === "secure") {
778
+ cookie.secure = true;
779
+ } else if (key === "httponly") {
780
+ cookie.httpOnly = true;
781
+ } else if (key === "samesite") {
782
+ cookie.sameSite = value;
783
+ } else if (key === "partitioned") {
784
+ cookie.partitioned = true;
785
+ } else if (key) {
786
+ cookie[key] = value;
787
+ }
788
+ });
789
+
790
+ return cookie;
791
+ }
792
+
793
+ function parseNameValuePair(nameValuePairStr) {
794
+ // Parses name-value-pair according to rfc6265bis draft
795
+
796
+ var name = "";
797
+ var value = "";
798
+ var nameValueArr = nameValuePairStr.split("=");
799
+ if (nameValueArr.length > 1) {
800
+ name = nameValueArr.shift();
801
+ value = nameValueArr.join("="); // everything after the first =, joined by a "=" if there was more than one part
802
+ } else {
803
+ value = nameValuePairStr;
804
+ }
805
+
806
+ return { name: name, value: value };
807
+ }
808
+
809
+ function parseSetCookie(input, options) {
810
+ options = options
811
+ ? Object.assign({}, defaultParseOptions, options)
812
+ : defaultParseOptions;
813
+
814
+ if (!input) {
815
+ if (!options.map) {
816
+ return [];
817
+ } else {
818
+ return createNullObj();
819
+ }
820
+ }
821
+
822
+ if (input.headers) {
823
+ if (typeof input.headers.getSetCookie === "function") {
824
+ // for fetch responses - they combine headers of the same type in the headers array,
825
+ // but getSetCookie returns an uncombined array
826
+ input = input.headers.getSetCookie();
827
+ } else if (input.headers["set-cookie"]) {
828
+ // fast-path for node.js (which automatically normalizes header names to lower-case)
829
+ input = input.headers["set-cookie"];
830
+ } else {
831
+ // slow-path for other environments - see #25
832
+ var sch =
833
+ input.headers[
834
+ Object.keys(input.headers).find(function (key) {
835
+ return key.toLowerCase() === "set-cookie";
836
+ })
837
+ ];
838
+ // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
839
+ if (!sch && input.headers.cookie && !options.silent) {
840
+ console.warn(
841
+ "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
842
+ );
843
+ }
844
+ input = sch;
845
+ }
846
+ }
847
+
848
+ var split = options.split;
849
+ var isArray = Array.isArray(input);
850
+
851
+ if (split === "auto") {
852
+ split = !isArray;
853
+ }
854
+
855
+ if (!isArray) {
856
+ input = [input];
857
+ }
858
+
859
+ input = input.filter(isNonEmptyString);
860
+
861
+ if (split) {
862
+ input = input.map(splitCookiesString).flat();
863
+ }
864
+
865
+ if (!options.map) {
866
+ return input
867
+ .map(function (str) {
868
+ return parseString(str, options);
869
+ })
870
+ .filter(Boolean);
871
+ } else {
872
+ var cookies = createNullObj();
873
+ return input.reduce(function (cookies, str) {
874
+ var cookie = parseString(str, options);
875
+ if (cookie && !isForbiddenKey(cookie.name)) {
876
+ cookies[cookie.name] = cookie;
877
+ }
878
+ return cookies;
879
+ }, cookies);
880
+ }
881
+ }
882
+
883
+ /*
884
+ Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
885
+ that are within a single set-cookie field-value, such as in the Expires portion.
886
+
887
+ This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
888
+ Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
889
+ React Native's fetch does this for *every* header, including set-cookie.
890
+
891
+ Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
892
+ Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
893
+ */
894
+ function splitCookiesString(cookiesString) {
895
+ if (Array.isArray(cookiesString)) {
896
+ return cookiesString;
897
+ }
898
+ if (typeof cookiesString !== "string") {
899
+ return [];
900
+ }
901
+
902
+ var cookiesStrings = [];
903
+ var pos = 0;
904
+ var start;
905
+ var ch;
906
+ var lastComma;
907
+ var nextStart;
908
+ var cookiesSeparatorFound;
909
+
910
+ function skipWhitespace() {
911
+ while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
912
+ pos += 1;
913
+ }
914
+ return pos < cookiesString.length;
915
+ }
916
+
917
+ function notSpecialChar() {
918
+ ch = cookiesString.charAt(pos);
919
+
920
+ return ch !== "=" && ch !== ";" && ch !== ",";
921
+ }
922
+
923
+ while (pos < cookiesString.length) {
924
+ start = pos;
925
+ cookiesSeparatorFound = false;
926
+
927
+ while (skipWhitespace()) {
928
+ ch = cookiesString.charAt(pos);
929
+ if (ch === ",") {
930
+ // ',' is a cookie separator if we have later first '=', not ';' or ','
931
+ lastComma = pos;
932
+ pos += 1;
933
+
934
+ skipWhitespace();
935
+ nextStart = pos;
936
+
937
+ while (pos < cookiesString.length && notSpecialChar()) {
938
+ pos += 1;
939
+ }
940
+
941
+ // currently special character
942
+ if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
943
+ // we found cookies separator
944
+ cookiesSeparatorFound = true;
945
+ // pos is inside the next cookie, so back up and return it.
946
+ pos = nextStart;
947
+ cookiesStrings.push(cookiesString.substring(start, lastComma));
948
+ start = pos;
949
+ } else {
950
+ // in param ',' or param separator ';',
951
+ // we continue from that comma
952
+ pos = lastComma + 1;
953
+ }
954
+ } else {
955
+ pos += 1;
956
+ }
957
+ }
958
+
959
+ if (!cookiesSeparatorFound || pos >= cookiesString.length) {
960
+ cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
961
+ }
962
+ }
963
+
964
+ return cookiesStrings;
965
+ }
966
+
967
+ // named export for CJS
968
+ parseSetCookie.parseSetCookie = parseSetCookie;
969
+ // for backwards compatibility
970
+ parseSetCookie.parse = parseSetCookie;
971
+ parseSetCookie.parseString = parseString;
972
+ parseSetCookie.splitCookiesString = splitCookiesString;
973
+
974
+ /** @import { StandardSchemaV1 } from '@standard-schema/spec' */
975
+
976
+
977
+ /**
978
+ * An error that was thrown from within the SvelteKit runtime that is not fatal and doesn't result in a 500, such as a 404.
979
+ * `SvelteKitError` goes through `handleError`.
980
+ * @extends Error
981
+ */
982
+ class SvelteKitError extends Error {
983
+ /**
984
+ * @param {number} status
985
+ * @param {string} text
986
+ * @param {string} message
987
+ */
988
+ constructor(status, text, message) {
989
+ super(message);
990
+ this.status = status;
991
+ this.text = text;
992
+ }
993
+ }
994
+
995
+ /**
996
+ * @param {import('http').IncomingMessage} req
997
+ * @param {number} [body_size_limit]
998
+ */
999
+ function get_raw_body(req, body_size_limit) {
1000
+ const h = req.headers;
1001
+
1002
+ if (!h['content-type']) {
1003
+ return null;
1004
+ }
1005
+
1006
+ const content_length = Number(h['content-length']);
1007
+
1008
+ // check if no request body
1009
+ if (
1010
+ (req.httpVersionMajor === 1 && isNaN(content_length) && h['transfer-encoding'] == null) ||
1011
+ content_length === 0
1012
+ ) {
1013
+ return null;
1014
+ }
1015
+
1016
+ if (req.destroyed) {
1017
+ const readable = new ReadableStream();
1018
+ void readable.cancel();
1019
+ return readable;
1020
+ }
1021
+
1022
+ let size = 0;
1023
+ let cancelled = false;
1024
+
1025
+ return new ReadableStream({
1026
+ start(controller) {
1027
+ if (body_size_limit !== undefined && content_length > body_size_limit) {
1028
+ let message = `Content-length of ${content_length} exceeds limit of ${body_size_limit} bytes.`;
1029
+
1030
+ if (body_size_limit === 0) {
1031
+ // https://github.com/sveltejs/kit/pull/11589
1032
+ // TODO this exists to aid migration — remove in a future version
1033
+ message += ' To disable body size limits, specify Infinity rather than 0.';
1034
+ }
1035
+
1036
+ const error = new SvelteKitError(413, 'Payload Too Large', message);
1037
+
1038
+ controller.error(error);
1039
+ return;
1040
+ }
1041
+
1042
+ req.on('error', (error) => {
1043
+ cancelled = true;
1044
+ controller.error(error);
1045
+ });
1046
+
1047
+ req.on('end', () => {
1048
+ if (cancelled) return;
1049
+ controller.close();
1050
+ });
1051
+
1052
+ req.on('data', (chunk) => {
1053
+ if (cancelled) return;
1054
+
1055
+ size += chunk.length;
1056
+ if (size > content_length) {
1057
+ cancelled = true;
1058
+
1059
+ const constraint = content_length ? 'content-length' : 'BODY_SIZE_LIMIT';
1060
+ const message = `request body size exceeded ${constraint} of ${content_length}`;
1061
+
1062
+ const error = new SvelteKitError(413, 'Payload Too Large', message);
1063
+ controller.error(error);
1064
+
1065
+ return;
1066
+ }
1067
+
1068
+ controller.enqueue(chunk);
1069
+
1070
+ if (controller.desiredSize === null || controller.desiredSize <= 0) {
1071
+ req.pause();
1072
+ }
1073
+ });
1074
+ },
1075
+
1076
+ pull() {
1077
+ req.resume();
1078
+ },
1079
+
1080
+ cancel(reason) {
1081
+ cancelled = true;
1082
+ req.destroy(reason);
1083
+ }
1084
+ });
1085
+ }
1086
+
1087
+ /**
1088
+ * @param {{
1089
+ * request: import('http').IncomingMessage;
1090
+ * base: string;
1091
+ * bodySizeLimit?: number;
1092
+ * }} options
1093
+ * @returns {Promise<Request>}
1094
+ */
1095
+ // TODO 3.0 make the signature synchronous?
1096
+ // eslint-disable-next-line @typescript-eslint/require-await
1097
+ async function getRequest({ request, base, bodySizeLimit }) {
1098
+ let headers = /** @type {Record<string, string>} */ (request.headers);
1099
+ if (request.httpVersionMajor >= 2) {
1100
+ // the Request constructor rejects headers with ':' in the name
1101
+ headers = Object.assign({}, headers);
1102
+ // https://www.rfc-editor.org/rfc/rfc9113.html#section-8.3.1-2.3.5
1103
+ if (headers[':authority']) {
1104
+ headers.host = headers[':authority'];
1105
+ }
1106
+ delete headers[':authority'];
1107
+ delete headers[':method'];
1108
+ delete headers[':path'];
1109
+ delete headers[':scheme'];
1110
+ }
1111
+
1112
+ // TODO: Whenever Node >=22 is minimum supported version, we can use `request.readableAborted`
1113
+ // @see https://github.com/nodejs/node/blob/5cf3c3e24c7257a0c6192ed8ef71efec8ddac22b/lib/internal/streams/readable.js#L1443-L1453
1114
+ const controller = new AbortController();
1115
+ let errored = false;
1116
+ let end_emitted = false;
1117
+ request.once('error', () => (errored = true));
1118
+ request.once('end', () => (end_emitted = true));
1119
+ request.once('close', () => {
1120
+ if ((errored || request.destroyed) && !end_emitted) {
1121
+ controller.abort();
1122
+ }
1123
+ });
1124
+
1125
+ return new Request(base + request.url, {
1126
+ // @ts-expect-error
1127
+ duplex: 'half',
1128
+ method: request.method,
1129
+ headers: Object.entries(headers),
1130
+ signal: controller.signal,
1131
+ body:
1132
+ request.method === 'GET' || request.method === 'HEAD'
1133
+ ? undefined
1134
+ : get_raw_body(request, bodySizeLimit)
1135
+ });
1136
+ }
1137
+
1138
+ /**
1139
+ * @param {import('http').ServerResponse} res
1140
+ * @param {Response} response
1141
+ * @returns {Promise<void>}
1142
+ */
1143
+ // TODO 3.0 make the signature synchronous?
1144
+ // eslint-disable-next-line @typescript-eslint/require-await
1145
+ async function setResponse(res, response) {
1146
+ for (const [key, value] of response.headers) {
1147
+ try {
1148
+ res.setHeader(
1149
+ key,
1150
+ key === 'set-cookie'
1151
+ ? splitCookiesString(
1152
+ // This is absurd but necessary, TODO: investigate why
1153
+ /** @type {string}*/ (response.headers.get(key))
1154
+ )
1155
+ : value
1156
+ );
1157
+ } catch (error) {
1158
+ res.getHeaderNames().forEach((name) => res.removeHeader(name));
1159
+ res.writeHead(500).end(String(error));
1160
+ return;
1161
+ }
1162
+ }
1163
+
1164
+ res.writeHead(response.status);
1165
+
1166
+ if (!response.body) {
1167
+ res.end();
1168
+ return;
1169
+ }
1170
+
1171
+ if (response.body.locked) {
1172
+ res.end(
1173
+ 'Fatal error: Response body is locked. ' +
1174
+ "This can happen when the response was already read (for example through 'response.json()' or 'response.text()')."
1175
+ );
1176
+ return;
1177
+ }
1178
+
1179
+ const reader = response.body.getReader();
1180
+
1181
+ if (res.destroyed) {
1182
+ void reader.cancel();
1183
+ return;
1184
+ }
1185
+
1186
+ const cancel = (/** @type {Error|undefined} */ error) => {
1187
+ res.off('close', cancel);
1188
+ res.off('error', cancel);
1189
+
1190
+ // If the reader has already been interrupted with an error earlier,
1191
+ // then it will appear here, it is useless, but it needs to be catch.
1192
+ reader.cancel(error).catch(() => {});
1193
+ if (error) res.destroy(error);
1194
+ };
1195
+
1196
+ res.on('close', cancel);
1197
+ res.on('error', cancel);
1198
+
1199
+ void next();
1200
+ async function next() {
1201
+ try {
1202
+ for (;;) {
1203
+ const { done, value } = await reader.read();
1204
+
1205
+ if (done) break;
1206
+
1207
+ if (!res.write(value)) {
1208
+ res.once('drain', next);
1209
+ return;
1210
+ }
1211
+ }
1212
+ res.end();
1213
+ } catch (error) {
1214
+ cancel(error instanceof Error ? error : new Error(String(error)));
1215
+ }
1216
+ }
1217
+ }
1218
+
1219
+ /**
1220
+ * Converts a file on disk to a readable stream
1221
+ * @param {string} file
1222
+ * @returns {ReadableStream}
1223
+ * @since 2.4.0
1224
+ */
1225
+ function createReadableStream(file) {
1226
+ return /** @type {ReadableStream} */ (Readable.toWeb(createReadStream(file)));
1227
+ }
1228
+
1229
+ /**
1230
+ * Parses the given value into number of bytes.
1231
+ *
1232
+ * @param {string} value - Size in bytes. Can also be specified with a unit suffix kilobytes (K), megabytes (M), or gigabytes (G).
1233
+ * @returns {number}
1234
+ */
1235
+ function parse_as_bytes(value) {
1236
+ const multiplier =
1237
+ {
1238
+ K: 1024,
1239
+ M: 1024 * 1024,
1240
+ G: 1024 * 1024 * 1024
1241
+ }[value[value.length - 1]?.toUpperCase()] ?? 1;
1242
+ return Number(multiplier != 1 ? value.substring(0, value.length - 1) : value) * multiplier;
1243
+ }
1244
+
1245
+ /**
1246
+ * Parses and validates an origin URL.
1247
+ *
1248
+ * @param {string | undefined} value - Origin URL with http:// or https:// protocol
1249
+ * @returns {string | undefined} The validated origin, or undefined if value is undefined
1250
+ * @throws {Error} If value is provided but invalid
1251
+ */
1252
+ function parse_origin(value) {
1253
+ if (value === undefined) {
1254
+ return undefined;
1255
+ }
1256
+
1257
+ const trimmed = value.trim();
1258
+
1259
+ let url;
1260
+ try {
1261
+ url = new URL(trimmed);
1262
+ } catch (error) {
1263
+ throw new Error(
1264
+ `Invalid ORIGIN: '${trimmed}'. ` +
1265
+ `ORIGIN must be a valid URL with http:// or https:// protocol. ` +
1266
+ `For example: 'http://localhost:3000' or 'https://my.site'`,
1267
+ { cause: error }
1268
+ );
1269
+ }
1270
+
1271
+ if (url.protocol !== 'http:' && url.protocol !== 'https:') {
1272
+ throw new Error(
1273
+ `Invalid ORIGIN: '${trimmed}'. ` +
1274
+ `Only http:// and https:// protocols are supported. ` +
1275
+ `Received protocol: ${url.protocol}`
1276
+ );
1277
+ }
1278
+
1279
+ return url.origin;
1280
+ }
1281
+
1282
+ /* global "" */
1283
+ /* global true */
1284
+
1285
+ const server = new Server(manifest);
1286
+
1287
+ // parse_origin validates ORIGIN and throws descriptive errors for invalid values
1288
+ const origin = parse_origin(env('ORIGIN', undefined));
1289
+
1290
+ const xff_depth = parseInt(env('XFF_DEPTH', '1'));
1291
+ const address_header = env('ADDRESS_HEADER', '').toLowerCase();
1292
+ const protocol_header = env('PROTOCOL_HEADER', '').toLowerCase();
1293
+ const host_header = env('HOST_HEADER', '').toLowerCase();
1294
+ const port_header = env('PORT_HEADER', '').toLowerCase();
1295
+
1296
+ const body_size_limit = parse_as_bytes(env('BODY_SIZE_LIMIT', '512K'));
1297
+
1298
+ if (isNaN(body_size_limit)) {
1299
+ throw new Error(
1300
+ `Invalid BODY_SIZE_LIMIT: '${env('BODY_SIZE_LIMIT')}'. Please provide a numeric value.`
1301
+ );
1302
+ }
1303
+
1304
+ const dir = path.dirname(fileURLToPath(import.meta.url));
1305
+
1306
+ const asset_dir = `${dir}/client${base}`;
1307
+
1308
+ await server.init({
1309
+ env: /** @type {Record<string, string>} */ (process.env),
1310
+ read: (file) => createReadableStream(`${asset_dir}/${file}`)
1311
+ });
1312
+
1313
+ /**
1314
+ * @param {string} path
1315
+ * @param {boolean} client
1316
+ */
1317
+ function serve(path, client = false) {
1318
+ return fs__default.existsSync(path)
1319
+ ? sirv(path, {
1320
+ etag: true,
1321
+ gzip: true,
1322
+ brotli: true,
1323
+ setHeaders: client
1324
+ ? (res, pathname) => {
1325
+ // only apply to build directory, not e.g. version.json
1326
+ if (
1327
+ pathname.startsWith(`/${manifest.appPath}/immutable/`) &&
1328
+ res.statusCode === 200
1329
+ ) {
1330
+ res.setHeader('cache-control', 'public,max-age=31536000,immutable');
1331
+ }
1332
+ }
1333
+ : undefined
1334
+ })
1335
+ : undefined;
1336
+ }
1337
+
1338
+ // required because the static file server ignores trailing slashes
1339
+ /** @returns {import('polka').Middleware} */
1340
+ function serve_prerendered() {
1341
+ const handler = serve(path.join(dir, 'prerendered'));
1342
+
1343
+ return (req, res, next) => {
1344
+ let { pathname, search, query } = parse(req);
1345
+
1346
+ try {
1347
+ pathname = decodeURIComponent(pathname);
1348
+ } catch {
1349
+ // ignore invalid URI
1350
+ }
1351
+
1352
+ if (prerendered.has(pathname)) {
1353
+ return handler?.(req, res, next);
1354
+ }
1355
+
1356
+ // remove or add trailing slash as appropriate
1357
+ let location = pathname.at(-1) === '/' ? pathname.slice(0, -1) : pathname + '/';
1358
+ if (prerendered.has(location)) {
1359
+ if (query) location += search;
1360
+ res.writeHead(308, { location }).end();
1361
+ } else {
1362
+ void next();
1363
+ }
1364
+ };
1365
+ }
1366
+
1367
+ /** @type {import('polka').Middleware} */
1368
+ const ssr = async (req, res) => {
1369
+ /** @type {Request} */
1370
+ let request;
1371
+
1372
+ try {
1373
+ request = await getRequest({
1374
+ base: origin || get_origin(req.headers),
1375
+ request: req,
1376
+ bodySizeLimit: body_size_limit
1377
+ });
1378
+ } catch {
1379
+ res.statusCode = 400;
1380
+ res.end('Bad Request');
1381
+ return;
1382
+ }
1383
+
1384
+ await setResponse(
1385
+ res,
1386
+ await server.respond(request, {
1387
+ platform: { req },
1388
+ getClientAddress: () => {
1389
+ if (address_header) {
1390
+ if (!(address_header in req.headers)) {
1391
+ throw new Error(
1392
+ `Address header was specified with ${
1393
+ "" + 'ADDRESS_HEADER'
1394
+ }=${address_header} but is absent from request`
1395
+ );
1396
+ }
1397
+
1398
+ const value = /** @type {string} */ (req.headers[address_header]) || '';
1399
+
1400
+ if (address_header === 'x-forwarded-for') {
1401
+ const addresses = value.split(',');
1402
+
1403
+ if (xff_depth < 1) {
1404
+ throw new Error(`${"" + 'XFF_DEPTH'} must be a positive integer`);
1405
+ }
1406
+
1407
+ if (xff_depth > addresses.length) {
1408
+ throw new Error(
1409
+ `${"" + 'XFF_DEPTH'} is ${xff_depth}, but only found ${
1410
+ addresses.length
1411
+ } addresses`
1412
+ );
1413
+ }
1414
+ return addresses[addresses.length - xff_depth].trim();
1415
+ }
1416
+
1417
+ return value;
1418
+ }
1419
+
1420
+ return (
1421
+ req.connection?.remoteAddress ||
1422
+ // @ts-expect-error
1423
+ req.connection?.socket?.remoteAddress ||
1424
+ req.socket?.remoteAddress ||
1425
+ // @ts-expect-error
1426
+ req.info?.remoteAddress
1427
+ );
1428
+ }
1429
+ })
1430
+ );
1431
+ };
1432
+
1433
+ /** @param {import('polka').Middleware[]} handlers */
1434
+ function sequence(handlers) {
1435
+ /** @type {import('polka').Middleware} */
1436
+ return (req, res, next) => {
1437
+ /**
1438
+ * @param {number} i
1439
+ * @returns {ReturnType<import('polka').Middleware>}
1440
+ */
1441
+ function handle(i) {
1442
+ if (i < handlers.length) {
1443
+ return handlers[i](req, res, () => handle(i + 1));
1444
+ } else {
1445
+ return next();
1446
+ }
1447
+ }
1448
+
1449
+ return handle(0);
1450
+ };
1451
+ }
1452
+
1453
+ /**
1454
+ * @param {string} name
1455
+ * @param {string | string[] | undefined} value
1456
+ * @returns {string | undefined}
1457
+ */
1458
+ function normalise_header(name, value) {
1459
+ if (!name) return undefined;
1460
+ if (Array.isArray(value)) {
1461
+ if (value.length === 0) return undefined;
1462
+ if (value.length === 1) return value[0];
1463
+ throw new Error(
1464
+ `Multiple values provided for ${name} header where only one expected: ${value}`
1465
+ );
1466
+ }
1467
+ return value;
1468
+ }
1469
+
1470
+ /**
1471
+ * @param {import('http').IncomingHttpHeaders} headers
1472
+ * @returns {string}
1473
+ */
1474
+ function get_origin(headers) {
1475
+ const protocol = decodeURIComponent(
1476
+ normalise_header(protocol_header, headers[protocol_header]) || 'https'
1477
+ );
1478
+
1479
+ // this helps us avoid host injections through the protocol header
1480
+ if (protocol.includes(':')) {
1481
+ throw new Error(
1482
+ `The ${protocol_header} header specified ${protocol} which is an invalid because it includes \`:\`. It should only contain the protocol scheme (e.g. \`https\`)`
1483
+ );
1484
+ }
1485
+
1486
+ const host =
1487
+ normalise_header(host_header, headers[host_header]) ||
1488
+ normalise_header('host', headers['host']);
1489
+ if (!host) {
1490
+ const header_names = host_header ? `${host_header} or host headers` : 'host header';
1491
+ throw new Error(
1492
+ `Could not determine host. The request must have a value provided by the ${header_names}`
1493
+ );
1494
+ }
1495
+
1496
+ const port = normalise_header(port_header, headers[port_header]);
1497
+ if (port && isNaN(+port)) {
1498
+ throw new Error(
1499
+ `The ${port_header} header specified ${port} which is an invalid port because it is not a number. The value should only contain the port number (e.g. 443)`
1500
+ );
1501
+ }
1502
+
1503
+ return port ? `${protocol}://${host}:${port}` : `${protocol}://${host}`;
1504
+ }
1505
+
1506
+ const handler = sequence(
1507
+ /** @type {(import('sirv').RequestHandler | import('polka').Middleware)[]} */
1508
+ ([serve(path.join(dir, 'client'), true), serve_prerendered(), ssr].filter(Boolean))
1509
+ );
1510
+
1511
+ export { handler };