cloudcommerce 0.33.5 → 0.35.0

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 (320) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/action.yml +11 -3
  3. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  4. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  5. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  6. package/ecomplus-stores/barra-doce/package.json +2 -2
  7. package/package.json +7 -7
  8. package/packages/api/lib/api.js +1 -1
  9. package/packages/api/lib/api.js.map +1 -1
  10. package/packages/api/package.json +1 -1
  11. package/packages/api/src/api.ts +1 -1
  12. package/packages/apps/affilate-program/lib/events-to-affilate-program.js.map +1 -1
  13. package/packages/apps/affilate-program/package.json +2 -2
  14. package/packages/apps/correios/package.json +2 -2
  15. package/packages/apps/custom-payment/lib/custom-payment-create-transaction.js.map +1 -1
  16. package/packages/apps/custom-payment/lib/custom-payment-list-payments.js.map +1 -1
  17. package/packages/apps/custom-payment/package.json +1 -1
  18. package/packages/apps/custom-shipping/package.json +1 -1
  19. package/packages/apps/datafrete/lib/datafrete-webhook.js.map +1 -1
  20. package/packages/apps/datafrete/package.json +2 -2
  21. package/packages/apps/discounts/package.json +1 -1
  22. package/packages/apps/emails/lib/events-to-app-emails.js.map +1 -1
  23. package/packages/apps/emails/lib/functios-lib/abandoned-carts.js.map +1 -1
  24. package/packages/apps/emails/lib/functios-lib/handle-orders.js.map +1 -1
  25. package/packages/apps/emails/package.json +2 -2
  26. package/packages/apps/fb-conversions/lib/fb-conversions-events.js.map +1 -1
  27. package/packages/apps/fb-conversions/lib/functions-lib/create-fb-objects.js.map +1 -1
  28. package/packages/apps/fb-conversions/package.json +2 -2
  29. package/packages/apps/flash-courier/package.json +1 -1
  30. package/packages/apps/frenet/lib/functions-lib/database.js.map +1 -1
  31. package/packages/apps/frenet/lib/functions-lib/events-to-frenet.js.map +1 -1
  32. package/packages/apps/frenet/lib/functions-lib/remove-delivered.js.map +1 -1
  33. package/packages/apps/frenet/lib/functions-lib/tracking-codes.js.map +1 -1
  34. package/packages/apps/frenet/lib/functions-lib/update-fulfillments.js.map +1 -1
  35. package/packages/apps/frenet/package.json +2 -2
  36. package/packages/apps/galaxpay/lib/functions-lib/all-parses.js.map +1 -1
  37. package/packages/apps/galaxpay/lib/functions-lib/ecom/events-to-galaxpay.js.map +1 -1
  38. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/create-access.js.map +1 -1
  39. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/create-axios.js.map +1 -1
  40. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/auth/gerate-token.js.map +1 -1
  41. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/handle-plans.js.map +1 -1
  42. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/update-subscription.js.map +1 -1
  43. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.d.ts +1 -0
  44. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js.map +1 -1
  45. package/packages/apps/galaxpay/lib/galaxpay-create-transaction.js +2 -2
  46. package/packages/apps/galaxpay/lib/galaxpay-create-transaction.js.map +1 -1
  47. package/packages/apps/galaxpay/lib/galaxpay-events.js.map +1 -1
  48. package/packages/apps/galaxpay/lib/galaxpay-list-payments.js +1 -1
  49. package/packages/apps/galaxpay/lib/galaxpay-list-payments.js.map +1 -1
  50. package/packages/apps/galaxpay/package.json +2 -2
  51. package/packages/apps/google-analytics/lib/google-analytics-events.js +4 -4
  52. package/packages/apps/google-analytics/lib/google-analytics-events.js.map +1 -1
  53. package/packages/apps/google-analytics/package.json +2 -2
  54. package/packages/apps/google-analytics/src/google-analytics-events.ts +4 -4
  55. package/packages/apps/jadlog/package.json +1 -1
  56. package/packages/apps/loyalty-points/lib/functions-lib/cron-add-points.js.map +1 -1
  57. package/packages/apps/loyalty-points/lib/functions-lib/get-program-id.js.map +1 -1
  58. package/packages/apps/loyalty-points/lib/functions-lib/handle-loyalty-points-event.js.map +1 -1
  59. package/packages/apps/loyalty-points/lib/loyalty-create-transaction.js.map +1 -1
  60. package/packages/apps/loyalty-points/lib/loyalty-list-payments.js.map +1 -1
  61. package/packages/apps/loyalty-points/lib/loyalty-points-events.js.map +1 -1
  62. package/packages/apps/loyalty-points/package.json +1 -1
  63. package/packages/apps/mandae/package.json +1 -1
  64. package/packages/apps/melhor-envio/lib/functions-lib/database.js.map +1 -1
  65. package/packages/apps/melhor-envio/lib/functions-lib/events-to-melhor-envio.js.map +1 -1
  66. package/packages/apps/melhor-envio/lib/functions-lib/new-label.js.map +1 -1
  67. package/packages/apps/melhor-envio/lib/functions-lib/order-is-valid.js.map +1 -1
  68. package/packages/apps/melhor-envio/lib/functions-lib/tracking-codes.js.map +1 -1
  69. package/packages/apps/melhor-envio/package.json +2 -2
  70. package/packages/apps/mercadopago/lib/mp-create-transaction.js.map +1 -1
  71. package/packages/apps/mercadopago/lib/mp-list-payments.js.map +1 -1
  72. package/packages/apps/mercadopago/lib/mp-webhook.js.map +1 -1
  73. package/packages/apps/mercadopago/package.json +2 -2
  74. package/packages/apps/pagarme/lib/functions-lib/add-installments.js.map +1 -1
  75. package/packages/apps/pagarme/lib/functions-lib/parse-status-to-ecom.js.map +1 -1
  76. package/packages/apps/pagarme/lib/pagarme-create-transaction.js.map +1 -1
  77. package/packages/apps/pagarme/lib/pagarme-list-payments.js.map +1 -1
  78. package/packages/apps/pagarme/lib/pagarme-webhook.js.map +1 -1
  79. package/packages/apps/pagarme/package.json +2 -2
  80. package/packages/apps/pagarme-v5/lib/pagarme-v5-events.js.map +1 -1
  81. package/packages/apps/pagarme-v5/package.json +2 -2
  82. package/packages/apps/paghiper/lib/functions-lib/handle-webhook.d.ts +1 -0
  83. package/packages/apps/paghiper/lib/functions-lib/handle-webhook.js.map +1 -1
  84. package/packages/apps/paghiper/lib/paghiper-create-transaction.js.map +1 -1
  85. package/packages/apps/paghiper/lib/paghiper-list-payments.js.map +1 -1
  86. package/packages/apps/paghiper/lib/paghiper-webhook.js.map +1 -1
  87. package/packages/apps/paghiper/package.json +2 -2
  88. package/packages/apps/pix/lib/functions-lib/get-certificate.js.map +1 -1
  89. package/packages/apps/pix/lib/functions-lib/pix-auth/construtor.js.map +1 -1
  90. package/packages/apps/pix/lib/functions-lib/pix-auth/create-axios.js.map +1 -1
  91. package/packages/apps/pix/lib/functions-lib/pix-auth/oauth.js.map +1 -1
  92. package/packages/apps/pix/lib/pix-create-transaction.js.map +1 -1
  93. package/packages/apps/pix/lib/pix-list-payments.js.map +1 -1
  94. package/packages/apps/pix/lib/pix-webhook.js.map +1 -1
  95. package/packages/apps/pix/package.json +2 -2
  96. package/packages/apps/tiny-erp/lib/event-to-tiny.js.map +1 -1
  97. package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js.map +1 -1
  98. package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js.map +1 -1
  99. package/packages/apps/tiny-erp/lib/integration/export-product-to-tiny.js.map +1 -1
  100. package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js.map +1 -1
  101. package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js.map +1 -1
  102. package/packages/apps/tiny-erp/lib/integration/parsers/order-from-tiny.js.map +1 -1
  103. package/packages/apps/tiny-erp/lib/integration/parsers/order-to-tiny.js.map +1 -1
  104. package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js.map +1 -1
  105. package/packages/apps/tiny-erp/lib/integration/parsers/product-to-tiny.js.map +1 -1
  106. package/packages/apps/tiny-erp/lib/integration/parsers/status-from-tiny.js.map +1 -1
  107. package/packages/apps/tiny-erp/lib/integration/parsers/status-to-tiny.js.map +1 -1
  108. package/packages/apps/tiny-erp/lib/integration/post-tiny-erp.js.map +1 -1
  109. package/packages/apps/tiny-erp/lib/tiny-webhook.js.map +1 -1
  110. package/packages/apps/tiny-erp/package.json +2 -2
  111. package/packages/apps/webhooks/lib/events-to-webhooks-app.js.map +1 -1
  112. package/packages/apps/webhooks/package.json +2 -2
  113. package/packages/cli/package.json +1 -1
  114. package/packages/config/lib/config.js.map +1 -1
  115. package/packages/config/lib/env.js.map +1 -1
  116. package/packages/config/package.json +1 -1
  117. package/packages/emails/lib/index.js.map +1 -1
  118. package/packages/emails/lib/parse-template-to-html.js.map +1 -1
  119. package/packages/emails/lib/providers/sendgrid/index.js.map +1 -1
  120. package/packages/emails/lib/providers/sendgrid/parse-to-data.js.map +1 -1
  121. package/packages/emails/lib/providers/smtp/index.js.map +1 -1
  122. package/packages/emails/package.json +1 -1
  123. package/packages/eslint/package.json +1 -1
  124. package/packages/events/package.json +2 -2
  125. package/packages/feeds/lib/firebase/serve-feeds.js.map +1 -1
  126. package/packages/feeds/package.json +1 -1
  127. package/packages/firebase/lib/config.js.map +1 -1
  128. package/packages/firebase/lib/handlers/check-store-events.js.map +1 -1
  129. package/packages/firebase/lib/helpers/pubsub.js.map +1 -1
  130. package/packages/firebase/lib/helpers/update-app-data.js.map +1 -1
  131. package/packages/firebase/package.json +2 -2
  132. package/packages/i18n/package.json +1 -1
  133. package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
  134. package/packages/modules/lib/firebase/checkout.js.map +1 -1
  135. package/packages/modules/lib/firebase/functions-checkout/fix-items.js.map +1 -1
  136. package/packages/modules/lib/firebase/functions-checkout/get-custumerId.js.map +1 -1
  137. package/packages/modules/lib/firebase/functions-checkout/handle-order-transaction.js.map +1 -1
  138. package/packages/modules/lib/firebase/functions-checkout/new-order.js.map +1 -1
  139. package/packages/modules/lib/firebase/functions-checkout/request-to-module.js.map +1 -1
  140. package/packages/modules/lib/firebase/functions-checkout/utils.js.map +1 -1
  141. package/packages/modules/lib/firebase/handle-module.js.map +1 -1
  142. package/packages/modules/lib/firebase/serve-modules-api.js.map +1 -1
  143. package/packages/modules/lib/firebase.js.map +1 -1
  144. package/packages/modules/package.json +2 -2
  145. package/packages/passport/lib/firebase/authenticate-customer.js.map +1 -1
  146. package/packages/passport/lib/firebase/serve-passport-api.js.map +1 -1
  147. package/packages/passport/lib/firebase.js.map +1 -1
  148. package/packages/passport/package.json +2 -2
  149. package/packages/ssr/lib/analytics/send-to-ga4.js +44 -0
  150. package/packages/ssr/lib/analytics/send-to-ga4.js.map +1 -0
  151. package/packages/ssr/lib/analytics/send-to-meta.js +44 -0
  152. package/packages/ssr/lib/analytics/send-to-meta.js.map +1 -0
  153. package/packages/ssr/lib/analytics/send-to-tiktok.js +44 -0
  154. package/packages/ssr/lib/analytics/send-to-tiktok.js.map +1 -0
  155. package/packages/ssr/lib/analytics-events.js +52 -24
  156. package/packages/ssr/lib/analytics-events.js.map +1 -1
  157. package/packages/ssr/lib/firebase/serve-storefront.js +16 -3
  158. package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
  159. package/packages/ssr/package.json +6 -6
  160. package/packages/ssr/src/analytics/send-to-ga4.ts +56 -0
  161. package/packages/ssr/src/analytics/send-to-meta.ts +50 -0
  162. package/packages/ssr/src/analytics/send-to-tiktok.ts +49 -0
  163. package/packages/ssr/src/analytics-events.ts +57 -27
  164. package/packages/ssr/src/firebase/serve-storefront.ts +17 -3
  165. package/packages/storefront/.auto-imports.d.ts +1 -1
  166. package/packages/storefront/astro.config.mjs +5 -10
  167. package/packages/storefront/config/astro/mock-pwa-info.mjs +2 -0
  168. package/packages/storefront/dist/client/_astro/AccountPage.77d861e9.js +1 -0
  169. package/packages/storefront/dist/client/_astro/CartSidebar.005ec337.js +1 -0
  170. package/packages/storefront/dist/client/_astro/HeroSlider.b35ac2f9.js +1 -0
  171. package/packages/storefront/dist/client/_astro/PitchBar.7965ce11.js +1 -0
  172. package/packages/storefront/dist/client/_astro/Prices.862d15eb.js +1 -0
  173. package/packages/storefront/dist/client/_astro/ProductDetails.120b6513.js +1 -0
  174. package/packages/storefront/dist/client/_astro/ProductShelf.4a2f57cf.js +1 -0
  175. package/packages/storefront/dist/client/_astro/QuantitySelector.d7dd044c.js +1 -0
  176. package/packages/storefront/dist/client/_astro/SearchModal.0bf88bcc.js +1 -0
  177. package/packages/storefront/dist/client/_astro/ShopHeader.57302617.js +4 -0
  178. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.d927d271.js +1 -0
  179. package/packages/storefront/dist/client/_astro/_slug_.f458f318.css +1 -0
  180. package/packages/storefront/dist/client/_astro/afetch.f4507208.js +1 -0
  181. package/packages/storefront/dist/client/_astro/client.409c434f.js +1 -0
  182. package/packages/storefront/dist/client/_astro/customer-session.68901b4c.js +1 -0
  183. package/packages/storefront/dist/client/_astro/ecom-utils.f65876ca.js +1 -0
  184. package/packages/storefront/dist/client/_astro/firebase-app.992a296f.js +16 -0
  185. package/packages/storefront/dist/client/_astro/format-money.db179bca.js +1 -0
  186. package/packages/storefront/dist/client/_astro/hoisted.719d11e3.js +1 -0
  187. package/packages/storefront/dist/client/_astro/hoisted.f4c55052.js +1 -0
  188. package/packages/storefront/dist/client/_astro/i18n.614beec4.js +1 -0
  189. package/packages/storefront/dist/client/_astro/img-sizes.41e0efe4.js +1 -0
  190. package/packages/storefront/dist/client/_astro/img.27573b8b.js +1 -0
  191. package/packages/storefront/dist/client/_astro/{firebase-app.3f59f3c7.js → index-61e5ac61.bdc8d0cd.js} +129 -99
  192. package/packages/storefront/dist/client/_astro/index.aac4c53d.js +1 -0
  193. package/packages/storefront/dist/client/_astro/index.d93220be.js +1 -0
  194. package/packages/storefront/dist/client/_astro/modules-info.4373e917.js +1 -0
  195. package/packages/storefront/dist/client/_astro/name.2999355b.js +1 -0
  196. package/packages/storefront/dist/client/_astro/photoswipe-lightbox.esm.c157838f.js +4 -0
  197. package/packages/storefront/dist/client/_astro/photoswipe.01431ec7.js +2 -0
  198. package/packages/storefront/dist/client/_astro/photoswipe.esm.92c2d901.js +4 -0
  199. package/packages/storefront/dist/client/_astro/price.04ceb6c4.js +1 -0
  200. package/packages/storefront/dist/client/_astro/sf-utils.b04e1813.js +1 -0
  201. package/packages/storefront/dist/client/_astro/shopping-cart.608866aa.js +1 -0
  202. package/packages/storefront/dist/client/_astro/use-analytics.205d2b8f.js +1 -0
  203. package/packages/storefront/dist/client/_astro/use-product-card.cc44716b.js +1 -0
  204. package/packages/storefront/dist/client/robots.txt +1 -1
  205. package/packages/storefront/dist/server/chunks/CartSidebar_6cb69be3.mjs +203 -0
  206. package/packages/storefront/dist/server/chunks/SearchModal_930845a4.mjs +18 -0
  207. package/packages/storefront/dist/server/chunks/_.._07cccbbe.mjs +6 -0
  208. package/packages/storefront/dist/server/chunks/account_e71f4214.mjs +6 -0
  209. package/packages/storefront/dist/server/chunks/astro/assets-service_a9d9ab5f.mjs +544 -0
  210. package/packages/storefront/dist/server/chunks/{astro.708269c6.mjs → astro_d98f7186.mjs} +214 -1878
  211. package/packages/storefront/dist/server/chunks/index_414d53c7.mjs +6 -0
  212. package/packages/storefront/dist/server/chunks/index_a7b0afbf.mjs +6 -0
  213. package/packages/storefront/dist/server/chunks/node_7efff4d0.mjs +6 -0
  214. package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.0808946e.mjs → __e7ddf925.mjs} +2019 -1017
  215. package/packages/storefront/dist/server/chunks/pages/account_f14e6f5a.mjs +28 -0
  216. package/packages/storefront/dist/server/chunks/pages/index_b300d887.mjs +316 -0
  217. package/packages/storefront/dist/server/chunks/pages/node_2b0cb889.mjs +93 -0
  218. package/packages/storefront/dist/server/chunks/pages/~fallback_2bbdf875.mjs +40 -0
  219. package/packages/storefront/dist/server/chunks/photoswipe_9528923e.mjs +3 -0
  220. package/packages/storefront/dist/server/chunks/~fallback_43c17ff0.mjs +6 -0
  221. package/packages/storefront/dist/server/entry.mjs +1012 -2526
  222. package/packages/storefront/dist/server/manifest_4dba1382.mjs +1069 -0
  223. package/packages/storefront/dist/server/renderers.mjs +335 -51
  224. package/packages/storefront/package.json +11 -13
  225. package/packages/storefront/src/env.d.ts +1 -1
  226. package/packages/storefront/src/images/get-built-image.ts +36 -8
  227. package/packages/storefront/src/images/get-built-picture.ts +3 -130
  228. package/packages/storefront/src/images/picture-base.ts +135 -0
  229. package/packages/storefront/src/images/use-ssr-picture.ts +18 -10
  230. package/packages/storefront/src/lib/assets/forms.css +35 -30
  231. package/packages/storefront/src/lib/components/Carousel.vue +3 -1
  232. package/packages/storefront/src/lib/components/CarouselControl.vue +1 -1
  233. package/packages/storefront/src/lib/components/Drawer.vue +45 -7
  234. package/packages/storefront/src/lib/components/Picture.astro +47 -4
  235. package/packages/storefront/src/lib/components/globals/Fade.vue +1 -1
  236. package/packages/storefront/src/lib/composables/use-product-shelf.ts +1 -1
  237. package/packages/storefront/src/lib/scripts/vbeta-app.ts +25 -15
  238. package/packages/storefront/src/lib/state/search-engine.ts +101 -0
  239. package/packages/storefront/src/lib/state/shopping-cart.ts +52 -65
  240. package/packages/storefront/src/lib/state/use-analytics.ts +2 -1
  241. package/packages/storefront/src/lib/state/use-storage.ts +5 -2
  242. package/packages/test-base/lib/endpoints.js.map +1 -1
  243. package/packages/test-base/package.json +1 -1
  244. package/packages/types/package.json +1 -1
  245. package/packages/ssr/lib/analytics-providers/google-analytics.js +0 -48
  246. package/packages/ssr/lib/analytics-providers/google-analytics.js.map +0 -1
  247. package/packages/ssr/lib/analytics-providers/meta-conversions-api.js +0 -44
  248. package/packages/ssr/lib/analytics-providers/meta-conversions-api.js.map +0 -1
  249. package/packages/ssr/src/analytics-providers/google-analytics.ts +0 -67
  250. package/packages/ssr/src/analytics-providers/meta-conversions-api.ts +0 -57
  251. package/packages/storefront/dist/client/_astro/Carousel.4bf71bce.js +0 -1
  252. package/packages/storefront/dist/client/_astro/CartSidebar.05b12b39.js +0 -1
  253. package/packages/storefront/dist/client/_astro/HeroSlider.fe108a14.js +0 -1
  254. package/packages/storefront/dist/client/_astro/PitchBar.2c821b77.js +0 -1
  255. package/packages/storefront/dist/client/_astro/Prices.78eb0a61.js +0 -1
  256. package/packages/storefront/dist/client/_astro/ProductShelf.46d8a51c.js +0 -1
  257. package/packages/storefront/dist/client/_astro/SearchModal.cffd4c2d.js +0 -1
  258. package/packages/storefront/dist/client/_astro/ShopHeader.3694a82b.js +0 -4
  259. package/packages/storefront/dist/client/_astro/_...slug_.a4a7a874.css +0 -1
  260. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.ee681fa8.js +0 -1
  261. package/packages/storefront/dist/client/_astro/api.a2eda23e.js +0 -1
  262. package/packages/storefront/dist/client/_astro/client.e6d9439a.js +0 -1
  263. package/packages/storefront/dist/client/_astro/ecom-icon_CDmhA.png +0 -0
  264. package/packages/storefront/dist/client/_astro/ecom-icon_Z27EX9f.png +0 -0
  265. package/packages/storefront/dist/client/_astro/ecom-icon_Zo1CLq.png +0 -0
  266. package/packages/storefront/dist/client/_astro/format-money.923559cc.js +0 -1
  267. package/packages/storefront/dist/client/_astro/headphone_1Ekzdh.avif +0 -0
  268. package/packages/storefront/dist/client/_astro/headphone_Z1GbHcH.webp +0 -0
  269. package/packages/storefront/dist/client/_astro/hoisted.648beb9d.js +0 -1
  270. package/packages/storefront/dist/client/_astro/img.ec6ba316.js +0 -1
  271. package/packages/storefront/dist/client/_astro/index.fadf28bd.js +0 -1
  272. package/packages/storefront/dist/client/_astro/logo_144owC.webp +0 -0
  273. package/packages/storefront/dist/client/_astro/logo_1ug3XF.png +0 -0
  274. package/packages/storefront/dist/client/_astro/logo_Z1EIN1I.avif +0 -0
  275. package/packages/storefront/dist/client/_astro/modules-info.df822732.js +0 -1
  276. package/packages/storefront/dist/client/_astro/passion_1LvKlp.webp +0 -0
  277. package/packages/storefront/dist/client/_astro/passion_2PSWs.avif +0 -0
  278. package/packages/storefront/dist/client/_astro/preload-helper.cf010ec4.js +0 -1
  279. package/packages/storefront/dist/client/_astro/rect8589_1A8K2Q.webp +0 -0
  280. package/packages/storefront/dist/client/_astro/rect8589_1ND0he.png +0 -0
  281. package/packages/storefront/dist/client/_astro/rect8589_1mIaKd.png +0 -0
  282. package/packages/storefront/dist/client/_astro/rect8589_LhopI.avif +0 -0
  283. package/packages/storefront/dist/client/_astro/rect8589_Z1NFjiR.avif +0 -0
  284. package/packages/storefront/dist/client/_astro/rect8589_Z2a06Gx.png +0 -0
  285. package/packages/storefront/dist/client/_astro/rect8589_Z2nulUU.webp +0 -0
  286. package/packages/storefront/dist/client/_astro/rect8589_ZH7hsH.avif +0 -0
  287. package/packages/storefront/dist/client/_astro/rect8589_ZorpIx.webp +0 -0
  288. package/packages/storefront/dist/client/_astro/rect859_1CcLjM.avif +0 -0
  289. package/packages/storefront/dist/client/_astro/rect859_1IVKep.png +0 -0
  290. package/packages/storefront/dist/client/_astro/rect859_1zkdb4.webp +0 -0
  291. package/packages/storefront/dist/client/_astro/rect859_299fN7.avif +0 -0
  292. package/packages/storefront/dist/client/_astro/rect859_CnIof.png +0 -0
  293. package/packages/storefront/dist/client/_astro/rect859_Z1OtQaE.avif +0 -0
  294. package/packages/storefront/dist/client/_astro/rect859_flB3g.png +0 -0
  295. package/packages/storefront/dist/client/_astro/rect859_rsWaw.webp +0 -0
  296. package/packages/storefront/dist/client/_astro/rect859_sLbkT.webp +0 -0
  297. package/packages/storefront/dist/client/_astro/rect89_1yf5jS.avif +0 -0
  298. package/packages/storefront/dist/client/_astro/rect89_GQBli.webp +0 -0
  299. package/packages/storefront/dist/client/_astro/session-utm.744b0db3.js +0 -1
  300. package/packages/storefront/dist/client/_astro/workbox-window.prod.es5.a7b12eab.js +0 -2
  301. package/packages/storefront/dist/client/manifest.webmanifest +0 -1
  302. package/packages/storefront/dist/client/sw.js +0 -1
  303. package/packages/storefront/dist/client/workbox-1b331600.js +0 -1
  304. package/packages/storefront/dist/client/~fallback.html +0 -67
  305. package/packages/storefront/dist/client/~index.html +0 -113
  306. package/packages/storefront/dist/server/chunks/CartSidebar.4179ad81.mjs +0 -386
  307. package/packages/storefront/dist/server/chunks/SearchModal.146ce2f7.mjs +0 -37
  308. package/packages/storefront/dist/server/chunks/_...05c626ea.mjs +0 -28
  309. package/packages/storefront/dist/server/chunks/account@_@astro.5eaddaf8.mjs +0 -28
  310. package/packages/storefront/dist/server/chunks/index@_@astro.25a343cc.mjs +0 -28
  311. package/packages/storefront/dist/server/chunks/index@_@astro.2d2f2e33.mjs +0 -28
  312. package/packages/storefront/dist/server/chunks/pages/account.astro.32e7e6ef.mjs +0 -23
  313. package/packages/storefront/dist/server/chunks/pages/index.astro.d4145872.mjs +0 -186
  314. package/packages/storefront/dist/server/chunks/pages/~fallback.astro.84d4765b.mjs +0 -49
  315. package/packages/storefront/dist/server/chunks/~fallback@_@astro.86d710c3.mjs +0 -28
  316. package/packages/storefront/dist/server/images.dist.csv +0 -30
  317. package/packages/storefront/dist/server/images.src.csv +0 -11
  318. package/packages/storefront/dist/server/manifest.webmanifest +0 -1
  319. package/packages/storefront/dist/server/registerSW.js +0 -1
  320. package/packages/storefront/dist/server/static-builds.csv +0 -51
@@ -1,12 +1,4 @@
1
- import { compile } from 'path-to-regexp';
2
- import { serialize, parse } from 'cookie';
3
- import { joinPaths, slash, prependForwardSlash, removeTrailingForwardSlash, collapseDuplicateSlashes } from '@astrojs/internal-helpers/path';
4
- import { yellow, dim, bold, cyan, red, reset } from 'kleur/colors';
5
- import 'node:fs';
6
- import 'node:http';
7
- import { TLSSocket } from 'node:tls';
8
- import mime from 'mime';
9
- import 'string-width';
1
+ import { clsx } from 'clsx';
10
2
  import { escape } from 'html-escaper';
11
3
 
12
4
  const ClientAddressNotAvailable = {
@@ -18,7 +10,7 @@ const StaticClientAddressNotAvailable = {
18
10
  name: "StaticClientAddressNotAvailable",
19
11
  title: "`Astro.clientAddress` is not available in static mode.",
20
12
  message: "`Astro.clientAddress` is only available when using `output: 'server'` or `output: 'hybrid'`. Update your Astro config if you need SSR features.",
21
- hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR."
13
+ hint: "See https://docs.astro.build/en/guides/server-side-rendering/ for more information on how to enable SSR."
22
14
  };
23
15
  const NoMatchingStaticPathFound = {
24
16
  name: "NoMatchingStaticPathFound",
@@ -60,11 +52,11 @@ const NoClientOnlyHint = {
60
52
  message: (componentName) => `Unable to render \`${componentName}\`. When using the \`client:only\` hydration strategy, Astro needs a hint to use the correct renderer.`,
61
53
  hint: (probableRenderers) => `Did you mean to pass \`client:only="${probableRenderers}"\`? See https://docs.astro.build/en/reference/directives-reference/#clientonly for more information on client:only`
62
54
  };
63
- const InvalidGetStaticPathParam = {
64
- name: "InvalidGetStaticPathParam",
65
- title: "Invalid value returned by a `getStaticPaths` path.",
66
- message: (paramType) => `Invalid params given to \`getStaticPaths\` path. Expected an \`object\`, got \`${paramType}\``,
67
- hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
55
+ const InvalidGetStaticPathsEntry = {
56
+ name: "InvalidGetStaticPathsEntry",
57
+ title: "Invalid entry inside getStaticPath's return value",
58
+ message: (entryType) => `Invalid entry returned by getStaticPaths. Expected an object, got \`${entryType}\``,
59
+ hint: "If you're using a `.map` call, you might be looking for `.flatMap()` instead. See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
68
60
  };
69
61
  const InvalidGetStaticPathsReturn = {
70
62
  name: "InvalidGetStaticPathsReturn",
@@ -104,6 +96,12 @@ const ReservedSlotName = {
104
96
  title: "Invalid slot name.",
105
97
  message: (slotName) => `Unable to create a slot named \`${slotName}\`. \`${slotName}\` is a reserved slot name. Please update the name of this slot.`
106
98
  };
99
+ const NoMatchingImport = {
100
+ name: "NoMatchingImport",
101
+ title: "No import found for component.",
102
+ message: (componentName) => `Could not render \`${componentName}\`. No matching import has been found for \`${componentName}\`.`,
103
+ hint: "Please make sure the component is properly imported."
104
+ };
107
105
  const InvalidComponentArgs = {
108
106
  name: "InvalidComponentArgs",
109
107
  title: "Invalid component arguments.",
@@ -116,12 +114,61 @@ const PageNumberParamNotFound = {
116
114
  message: (paramName) => `[paginate()] page number param \`${paramName}\` not found in your filepath.`,
117
115
  hint: "Rename your file to `[page].astro` or `[...page].astro`."
118
116
  };
117
+ const ImageMissingAlt = {
118
+ name: "ImageMissingAlt",
119
+ title: "Missing alt property.",
120
+ message: "The alt property is required.",
121
+ hint: "The `alt` property is important for the purpose of accessibility, without it users using screen readers or other assistive technologies won't be able to understand what your image is supposed to represent. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-alt for more information."
122
+ };
123
+ const InvalidImageService = {
124
+ name: "InvalidImageService",
125
+ title: "Error while loading image service.",
126
+ message: "There was an error loading the configured image service. Please see the stack trace for more information."
127
+ };
128
+ const MissingImageDimension = {
129
+ name: "MissingImageDimension",
130
+ title: "Missing image dimensions",
131
+ message: (missingDimension, imageURL) => `Missing ${missingDimension === "both" ? "width and height attributes" : `${missingDimension} attribute`} for ${imageURL}. When using remote images, both dimensions are always required in order to avoid CLS.`,
132
+ hint: "If your image is inside your `src` folder, you probably meant to import it instead. See [the Imports guide for more information](https://docs.astro.build/en/guides/imports/#other-assets)."
133
+ };
134
+ const UnsupportedImageFormat = {
135
+ name: "UnsupportedImageFormat",
136
+ title: "Unsupported image format",
137
+ message: (format, imagePath, supportedFormats) => `Received unsupported format \`${format}\` from \`${imagePath}\`. Currently only ${supportedFormats.join(
138
+ ", "
139
+ )} are supported by our image services.`,
140
+ hint: "Using an `img` tag directly instead of the `Image` component might be what you're looking for."
141
+ };
142
+ const UnsupportedImageConversion = {
143
+ name: "UnsupportedImageConversion",
144
+ title: "Unsupported image conversion",
145
+ message: "Converting between vector (such as SVGs) and raster (such as PNGs and JPEGs) images is not currently supported."
146
+ };
119
147
  const PrerenderDynamicEndpointPathCollide = {
120
148
  name: "PrerenderDynamicEndpointPathCollide",
121
149
  title: "Prerendered dynamic endpoint has path collision.",
122
150
  message: (pathname) => `Could not render \`${pathname}\` with an \`undefined\` param as the generated path will collide during prerendering. Prevent passing \`undefined\` as \`params\` for the endpoint's \`getStaticPaths()\` function, or add an additional extension to the endpoint's filename.`,
123
151
  hint: (filename) => `Rename \`${filename}\` to \`${filename.replace(/\.(js|ts)/, (m) => `.json` + m)}\``
124
152
  };
153
+ const ExpectedImage = {
154
+ name: "ExpectedImage",
155
+ title: "Expected src to be an image.",
156
+ message: (src, typeofOptions, fullOptions) => `Expected \`src\` property for \`getImage\` or \`<Image />\` to be either an ESM imported image or a string with the path of a remote image. Received \`${src}\` (type: \`${typeofOptions}\`).
157
+
158
+ Full serialized options received: \`${fullOptions}\`.`,
159
+ hint: "This error can often happen because of a wrong path. Make sure the path to your image is correct. If you're passing an async function, make sure to call and await it."
160
+ };
161
+ const ExpectedImageOptions = {
162
+ name: "ExpectedImageOptions",
163
+ title: "Expected image options.",
164
+ message: (options) => `Expected getImage() parameter to be an object. Received \`${options}\`.`
165
+ };
166
+ const IncompatibleDescriptorOptions = {
167
+ name: "IncompatibleDescriptorOptions",
168
+ title: "Cannot set both `densities` and `widths`",
169
+ message: "Only one of `densities` or `widths` can be specified. In most cases, you'll probably want to use only `widths` if you require specific widths.",
170
+ hint: "Those attributes are used to construct a `srcset` attribute, which cannot have both `x` and `w` descriptors."
171
+ };
125
172
  const ResponseSentError = {
126
173
  name: "ResponseSentError",
127
174
  title: "Unable to set response.",
@@ -143,6 +190,12 @@ const LocalsNotAnObject = {
143
190
  message: "`locals` can only be assigned to an object. Other values like numbers, strings, etc. are not accepted.",
144
191
  hint: "If you tried to remove some information from the `locals` object, try to use `delete` or set the property to `undefined`."
145
192
  };
193
+ const LocalImageUsedWrongly = {
194
+ name: "LocalImageUsedWrongly",
195
+ title: "Local images must be imported.",
196
+ message: (imageFilePath) => `\`Image\`'s and \`getImage\`'s \`src\` parameter must be an imported image or an URL, it cannot be a string filepath. Received \`${imageFilePath}\`.`,
197
+ hint: "If you want to use an image from your `src` folder, you need to either import it or if the image is coming from a content collection, use the [image() schema helper](https://docs.astro.build/en/guides/images/#images-in-content-collections) See https://docs.astro.build/en/guides/images/#src-required for more information on the `src` property."
198
+ };
146
199
  const AstroGlobUsedOutside = {
147
200
  name: "AstroGlobUsedOutside",
148
201
  title: "Astro.glob() used outside of an Astro file.",
@@ -154,6 +207,18 @@ const AstroGlobNoMatch = {
154
207
  title: "Astro.glob() did not match any files.",
155
208
  message: (globStr) => `\`Astro.glob(${globStr})\` did not return any matching files. Check the pattern for typos.`
156
209
  };
210
+ const MissingSharp = {
211
+ name: "MissingSharp",
212
+ title: "Could not find Sharp.",
213
+ message: "Could not find Sharp. Please install Sharp (`sharp`) manually into your project or migrate to another image service.",
214
+ hint: "See Sharp's installation instructions for more information: https://sharp.pixelplumbing.com/install. If you are not relying on `astro:assets` to optimize, transform, or process any images, you can configure a passthrough image service instead of installing Sharp. See https://docs.astro.build/en/reference/errors/missing-sharp for more information.\n\nSee https://docs.astro.build/en/guides/images/#default-image-service for more information on how to migrate to another image service."
215
+ };
216
+ const CantRenderPage = {
217
+ name: "CantRenderPage",
218
+ title: "Astro can't render the route.",
219
+ message: "Astro cannot find any content to render for this route. There is no file or redirect associated with this route.",
220
+ hint: "If you expect to find a route here, this may be an Astro bug. Please file an issue/restart the dev server"
221
+ };
157
222
 
158
223
  function normalizeLF(code) {
159
224
  return code.replace(/\r\n|\r(?!\n)|\n/g, "\n");
@@ -191,9 +256,13 @@ function codeFrame(src, loc) {
191
256
  }
192
257
 
193
258
  class AstroError extends Error {
259
+ loc;
260
+ title;
261
+ hint;
262
+ frame;
263
+ type = "AstroError";
194
264
  constructor(props, ...params) {
195
265
  super(...params);
196
- this.type = "AstroError";
197
266
  const { name, title, message, stack, location, hint, frame } = props;
198
267
  this.title = title;
199
268
  this.name = name;
@@ -232,8 +301,7 @@ function validateArgs(args) {
232
301
  return true;
233
302
  }
234
303
  function baseCreateComponent(cb, moduleId, propagation) {
235
- var _a;
236
- const name = ((_a = moduleId == null ? void 0 : moduleId.split("/").pop()) == null ? void 0 : _a.replace(".astro", "")) ?? "";
304
+ const name = moduleId?.split("/").pop()?.replace(".astro", "") ?? "";
237
305
  const fn = (...args) => {
238
306
  if (!validateArgs(args)) {
239
307
  throw new AstroError({
@@ -261,7 +329,7 @@ function createComponent(arg1, moduleId, propagation) {
261
329
  }
262
330
  }
263
331
 
264
- const ASTRO_VERSION = "2.10.15";
332
+ const ASTRO_VERSION = "3.6.0";
265
333
 
266
334
  function createAstroGlobFn() {
267
335
  const globHandler = (importMetaGlobResult) => {
@@ -290,24 +358,36 @@ function createAstro(site) {
290
358
  };
291
359
  }
292
360
 
293
- function getHandlerFromModule(mod, method) {
361
+ function getHandlerFromModule(mod, method, logger) {
362
+ const lowerCaseMethod = method.toLowerCase();
363
+ if (mod[lowerCaseMethod]) {
364
+ logger.warn(
365
+ "astro",
366
+ `Lower case endpoint names are deprecated and will not be supported in Astro 4.0. Rename the endpoint ${lowerCaseMethod} to ${method}.`
367
+ );
368
+ }
294
369
  if (mod[method]) {
295
370
  return mod[method];
296
371
  }
372
+ if (mod[lowerCaseMethod]) {
373
+ return mod[lowerCaseMethod];
374
+ }
297
375
  if (method === "delete" && mod["del"]) {
298
376
  return mod["del"];
299
377
  }
300
378
  if (mod["all"]) {
301
379
  return mod["all"];
302
380
  }
381
+ if (mod["ALL"]) {
382
+ return mod["ALL"];
383
+ }
303
384
  return void 0;
304
385
  }
305
- async function renderEndpoint(mod, context, ssr) {
306
- var _a;
307
- const { request, params } = context;
308
- const chosenMethod = (_a = request.method) == null ? void 0 : _a.toLowerCase();
309
- const handler = getHandlerFromModule(mod, chosenMethod);
310
- if (!ssr && ssr === false && chosenMethod && chosenMethod !== "get") {
386
+ async function renderEndpoint(mod, context, ssr, logger) {
387
+ const { request } = context;
388
+ const chosenMethod = request.method?.toUpperCase();
389
+ const handler = getHandlerFromModule(mod, chosenMethod, logger);
390
+ if (!ssr && ssr === false && chosenMethod && chosenMethod !== "GET" && chosenMethod !== "get") {
311
391
  console.warn(`
312
392
  ${chosenMethod} requests are not available when building a static site. Update your config to \`output: 'server'\` or \`output: 'hybrid'\` with an \`export const prerender = false\` to handle ${chosenMethod} requests.`);
313
393
  }
@@ -320,30 +400,10 @@ ${chosenMethod} requests are not available when building a static site. Update y
320
400
  });
321
401
  return response;
322
402
  }
323
- if (handler.length > 1) {
324
- console.warn(`
325
- API routes with 2 arguments have been deprecated. Instead they take a single argument in the form of:
326
-
327
- export function get({ params, request }) {
328
- //...
329
- }
330
-
331
- Update your code to remove this warning.`);
332
- }
333
403
  const proxy = new Proxy(context, {
334
404
  get(target, prop) {
335
405
  if (prop in target) {
336
406
  return Reflect.get(target, prop);
337
- } else if (prop in params) {
338
- console.warn(`
339
- API routes no longer pass params as the first argument. Instead an object containing a params property is provided in the form of:
340
-
341
- export function get({ params }) {
342
- // ...
343
- }
344
-
345
- Update your code to remove this warning.`);
346
- return Reflect.get(params, prop);
347
407
  } else {
348
408
  return void 0;
349
409
  }
@@ -352,28 +412,6 @@ Update your code to remove this warning.`);
352
412
  return handler.call(mod, proxy, request);
353
413
  }
354
414
 
355
- function serializeListValue(value) {
356
- const hash = {};
357
- push(value);
358
- return Object.keys(hash).join(" ");
359
- function push(item) {
360
- if (item && typeof item.forEach === "function")
361
- item.forEach(push);
362
- else if (item === Object(item))
363
- Object.keys(item).forEach((name) => {
364
- if (item[name])
365
- push(name);
366
- });
367
- else {
368
- item = item === false || item == null ? "" : String(item).trim();
369
- if (item) {
370
- item.split(/\s+/).forEach((name) => {
371
- hash[name] = true;
372
- });
373
- }
374
- }
375
- }
376
- }
377
415
  function isPromise(value) {
378
416
  return !!value && typeof value === "object" && typeof value.then === "function";
379
417
  }
@@ -458,6 +496,11 @@ function unescapeHTML(str) {
458
496
  return markHTMLString(str);
459
497
  }
460
498
 
499
+ const AstroJSX = "astro:jsx";
500
+ function isVNode(vnode) {
501
+ return vnode && typeof vnode === "object" && vnode[AstroJSX];
502
+ }
503
+
461
504
  const RenderInstructionSymbol = Symbol.for("astro:render");
462
505
  function createRenderInstruction(instruction) {
463
506
  return Object.defineProperty(instruction, RenderInstructionSymbol, {
@@ -567,7 +610,8 @@ function extractDirectives(inputProps, clientDirectives) {
567
610
  let extracted = {
568
611
  isPage: false,
569
612
  hydration: null,
570
- props: {}
613
+ props: {},
614
+ propsWithoutTransitionAttributes: {}
571
615
  };
572
616
  for (const [key, value] of Object.entries(inputProps)) {
573
617
  if (key.startsWith("server:")) {
@@ -614,16 +658,16 @@ function extractDirectives(inputProps, clientDirectives) {
614
658
  break;
615
659
  }
616
660
  }
617
- } else if (key === "class:list") {
618
- if (value) {
619
- extracted.props[key.slice(0, -5)] = serializeListValue(value);
620
- }
621
661
  } else {
622
662
  extracted.props[key] = value;
663
+ if (!transitionDirectivesToCopyOnIsland.includes(key)) {
664
+ extracted.propsWithoutTransitionAttributes[key] = value;
665
+ }
623
666
  }
624
667
  }
625
668
  for (const sym of Object.getOwnPropertySymbols(inputProps)) {
626
669
  extracted.props[sym] = inputProps[sym];
670
+ extracted.propsWithoutTransitionAttributes[sym] = inputProps[sym];
627
671
  }
628
672
  return extracted;
629
673
  }
@@ -631,9 +675,10 @@ async function generateHydrateScript(scriptOptions, metadata) {
631
675
  const { renderer, result, astroId, props, attrs } = scriptOptions;
632
676
  const { hydrate, componentUrl, componentExport } = metadata;
633
677
  if (!componentExport.value) {
634
- throw new Error(
635
- `Unable to resolve a valid export for "${metadata.displayName}"! Please open an issue at https://astro.build/issues!`
636
- );
678
+ throw new AstroError({
679
+ ...NoMatchingImport,
680
+ message: NoMatchingImport.message(metadata.displayName)
681
+ });
637
682
  }
638
683
  const island = {
639
684
  children: "",
@@ -749,7 +794,7 @@ function isHeadAndContent(obj) {
749
794
  return typeof obj === "object" && !!obj[headAndContentSym];
750
795
  }
751
796
 
752
- var astro_island_prebuilt_default = `(()=>{var d;{let p={0:t=>u(t),1:t=>l(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(l(t)),5:t=>new Set(l(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},h=t=>{let[e,n]=t;return e in p?p[e](n):void 0},l=t=>t.map(h),u=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([e,n])=>[e,h(n)]));customElements.get("astro-island")||customElements.define("astro-island",(d=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=async()=>{var i;if(!this.hydrator||!this.isConnected)return;let e=(i=this.parentElement)==null?void 0:i.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let n=this.querySelectorAll("astro-slot"),o={},a=this.querySelectorAll("template[data-astro-template]");for(let r of a){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(o[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(let r of n){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(o[r.getAttribute("name")||"default"]=r.innerHTML)}let c;try{c=this.hasAttribute("props")?u(JSON.parse(this.getAttribute("props"))):{}}catch(r){let s=this.getAttribute("component-url")||"<unknown>",y=this.getAttribute("component-export");throw y&&(s+=\` (export \${y})\`),console.error(\`[hydrate] Error parsing props for component \${s}\`,this.getAttribute("props"),r),r}await this.hydrator(this)(this.Component,c,o,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))}}connectedCallback(){!this.hasAttribute("await-children")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((e,n)=>{n.disconnect(),setTimeout(()=>this.childrenConnectedCallback(),0)}).observe(this,{childList:!0})}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}start(){let e=JSON.parse(this.getAttribute("opts")),n=this.getAttribute("client");if(Astro[n]===void 0){window.addEventListener(\`astro:\${n}\`,()=>this.start(),{once:!0});return}Astro[n](async()=>{let o=this.getAttribute("renderer-url"),[a,{default:c}]=await Promise.all([import(this.getAttribute("component-url")),o?import(o):()=>()=>{}]),i=this.getAttribute("component-export")||"default";if(!i.includes("."))this.Component=a[i];else{this.Component=a;for(let r of i.split("."))this.Component=this.Component[r]}return this.hydrator=c,this.hydrate},e,this)}attributeChangedCallback(){this.hydrate()}},d.observedAttributes=["props"],d))}})();`;
797
+ var astro_island_prebuilt_default = `(()=>{var b=Object.defineProperty;var f=(c,o,i)=>o in c?b(c,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[o]=i;var l=(c,o,i)=>(f(c,typeof o!="symbol"?o+"":o,i),i);var p;{let c={0:t=>m(t),1:t=>i(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(i(t)),5:t=>new Set(i(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t)},o=t=>{let[e,r]=t;return e in c?c[e](r):void 0},i=t=>t.map(o),m=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([e,r])=>[e,o(r)]));customElements.get("astro-island")||customElements.define("astro-island",(p=class extends HTMLElement{constructor(){super(...arguments);l(this,"Component");l(this,"hydrator");l(this,"hydrate",async()=>{var d;if(!this.hydrator||!this.isConnected)return;let e=(d=this.parentElement)==null?void 0:d.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let r=this.querySelectorAll("astro-slot"),a={},h=this.querySelectorAll("template[data-astro-template]");for(let n of h){let s=n.closest(this.tagName);s!=null&&s.isSameNode(this)&&(a[n.getAttribute("data-astro-template")||"default"]=n.innerHTML,n.remove())}for(let n of r){let s=n.closest(this.tagName);s!=null&&s.isSameNode(this)&&(a[n.getAttribute("name")||"default"]=n.innerHTML)}let u;try{u=this.hasAttribute("props")?m(JSON.parse(this.getAttribute("props"))):{}}catch(n){let s=this.getAttribute("component-url")||"<unknown>",y=this.getAttribute("component-export");throw y&&(s+=\` (export \${y})\`),console.error(\`[hydrate] Error parsing props for component \${s}\`,this.getAttribute("props"),n),n}await this.hydrator(this)(this.Component,u,a,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});l(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),r.disconnect(),this.childrenConnectedCallback()},r=new MutationObserver(()=>{var a;((a=this.lastChild)==null?void 0:a.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});r.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}start(){let e=JSON.parse(this.getAttribute("opts")),r=this.getAttribute("client");if(Astro[r]===void 0){window.addEventListener(\`astro:\${r}\`,()=>this.start(),{once:!0});return}Astro[r](async()=>{let a=this.getAttribute("renderer-url"),[h,{default:u}]=await Promise.all([import(this.getAttribute("component-url")),a?import(a):()=>()=>{}]),d=this.getAttribute("component-export")||"default";if(!d.includes("."))this.Component=h[d];else{this.Component=h;for(let n of d.split("."))this.Component=this.Component[n]}return this.hydrator=u,this.hydrate},e,this)}attributeChangedCallback(){this.hydrate()}},l(p,"observedAttributes",["props"]),p))}})();`;
753
798
 
754
799
  const ISLAND_STYLES = `<style>astro-island,astro-slot,astro-static-slot{display:contents}</style>`;
755
800
  function determineIfNeedsHydrationScript(result) {
@@ -798,18 +843,15 @@ const toIdent = (k) => k.trim().replace(/(?:(?!^)\b\w|\s+|[^\w]+)/g, (match, ind
798
843
  });
799
844
  const toAttributeString = (value, shouldEscape = true) => shouldEscape ? String(value).replace(/&/g, "&#38;").replace(/"/g, "&#34;") : value;
800
845
  const kebab = (k) => k.toLowerCase() === k ? k : k.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
801
- const toStyleString = (obj) => Object.entries(obj).map(([k, v]) => {
846
+ const toStyleString = (obj) => Object.entries(obj).filter(([k, v]) => typeof v === "string" && v.trim() || typeof v === "number").map(([k, v]) => {
802
847
  if (k[0] !== "-" && k[1] !== "-")
803
848
  return `${kebab(k)}:${v}`;
804
- if (kebab(k) !== k)
805
- return `${kebab(k)}:var(${k});${k}:${v}`;
806
849
  return `${k}:${v}`;
807
850
  }).join(";");
808
851
  function defineScriptVars(vars) {
809
- var _a;
810
852
  let output = "";
811
853
  for (const [key, value] of Object.entries(vars)) {
812
- output += `const ${toIdent(key)} = ${(_a = JSON.stringify(value)) == null ? void 0 : _a.replace(
854
+ output += `const ${toIdent(key)} = ${JSON.stringify(value)?.replace(
813
855
  /<\/script>/g,
814
856
  "\\x3C/script>"
815
857
  )};
@@ -840,7 +882,7 @@ Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the
840
882
  return "";
841
883
  }
842
884
  if (key === "class:list") {
843
- const listValue = toAttributeString(serializeListValue(value), shouldEscape);
885
+ const listValue = toAttributeString(clsx(value), shouldEscape);
844
886
  if (listValue === "") {
845
887
  return "";
846
888
  }
@@ -921,7 +963,7 @@ function renderAllHeadContent(result) {
921
963
  return renderElement$1("script", script, false);
922
964
  });
923
965
  const links = Array.from(result.links).filter(uniqueElements).map((link) => renderElement$1("link", link, false));
924
- let content = links.join("\n") + styles.join("\n") + scripts.join("\n");
966
+ let content = styles.join("\n") + links.join("\n") + scripts.join("\n");
925
967
  if (result._metadata.extraHead.length > 0) {
926
968
  for (const part of result._metadata.extraHead) {
927
969
  content += part;
@@ -935,6 +977,8 @@ function* maybeRenderHead() {
935
977
 
936
978
  const slotString = Symbol.for("astro:slot-string");
937
979
  class SlotString extends HTMLString {
980
+ instructions;
981
+ [slotString];
938
982
  constructor(content, instructions) {
939
983
  super(content);
940
984
  this.instructions = instructions;
@@ -1017,13 +1061,13 @@ function stringifyChunk(result, chunk) {
1017
1061
  }
1018
1062
  }
1019
1063
  case "head": {
1020
- if (result._metadata.hasRenderedHead) {
1064
+ if (result._metadata.hasRenderedHead || result.partial) {
1021
1065
  return "";
1022
1066
  }
1023
1067
  return renderAllHeadContent(result);
1024
1068
  }
1025
1069
  case "maybe-head": {
1026
- if (result._metadata.hasRenderedHead || result._metadata.headInTree) {
1070
+ if (result._metadata.hasRenderedHead || result._metadata.headInTree || result.partial) {
1027
1071
  return "";
1028
1072
  }
1029
1073
  return renderAllHeadContent(result);
@@ -1079,6 +1123,8 @@ async function renderChild(destination, child) {
1079
1123
  });
1080
1124
  });
1081
1125
  for (const childRender of childRenders) {
1126
+ if (!childRender)
1127
+ continue;
1082
1128
  await childRender.renderToFinalDestination(destination);
1083
1129
  }
1084
1130
  } else if (typeof child === "function") {
@@ -1102,18 +1148,29 @@ async function renderChild(destination, child) {
1102
1148
  }
1103
1149
  }
1104
1150
 
1105
- var _a$1;
1106
1151
  const astroComponentInstanceSym = Symbol.for("astro.componentInstance");
1107
1152
  class AstroComponentInstance {
1153
+ [astroComponentInstanceSym] = true;
1154
+ result;
1155
+ props;
1156
+ slotValues;
1157
+ factory;
1158
+ returnValue;
1108
1159
  constructor(result, props, slots, factory) {
1109
- this[_a$1] = true;
1110
1160
  this.result = result;
1111
1161
  this.props = props;
1112
1162
  this.factory = factory;
1113
1163
  this.slotValues = {};
1114
1164
  for (const name in slots) {
1115
- const value = slots[name](result);
1116
- this.slotValues[name] = () => value;
1165
+ let didRender = false;
1166
+ let value = slots[name](result);
1167
+ this.slotValues[name] = () => {
1168
+ if (!didRender) {
1169
+ didRender = true;
1170
+ return value;
1171
+ }
1172
+ return slots[name](result);
1173
+ };
1117
1174
  }
1118
1175
  }
1119
1176
  async init(result) {
@@ -1137,7 +1194,6 @@ class AstroComponentInstance {
1137
1194
  }
1138
1195
  }
1139
1196
  }
1140
- _a$1 = astroComponentInstanceSym;
1141
1197
  function validateComponentProps(props, displayName) {
1142
1198
  if (props != null) {
1143
1199
  for (const prop of Object.keys(props)) {
@@ -1152,8 +1208,8 @@ function validateComponentProps(props, displayName) {
1152
1208
  function createAstroComponentInstance(result, displayName, factory, props, slots = {}) {
1153
1209
  validateComponentProps(props, displayName);
1154
1210
  const instance = new AstroComponentInstance(result, props, slots, factory);
1155
- if (isAPropagatingComponent(result, factory) && !result._metadata.propagators.has(factory)) {
1156
- result._metadata.propagators.set(factory, instance);
1211
+ if (isAPropagatingComponent(result, factory)) {
1212
+ result._metadata.propagators.add(instance);
1157
1213
  }
1158
1214
  return instance;
1159
1215
  }
@@ -1161,11 +1217,13 @@ function isAstroComponentInstance(obj) {
1161
1217
  return typeof obj === "object" && !!obj[astroComponentInstanceSym];
1162
1218
  }
1163
1219
 
1164
- var _a;
1165
1220
  const renderTemplateResultSym = Symbol.for("astro.renderTemplateResult");
1166
1221
  class RenderTemplateResult {
1222
+ [renderTemplateResultSym] = true;
1223
+ htmlParts;
1224
+ expressions;
1225
+ error;
1167
1226
  constructor(htmlParts, expressions) {
1168
- this[_a] = true;
1169
1227
  this.htmlParts = htmlParts;
1170
1228
  this.error = void 0;
1171
1229
  this.expressions = expressions.map((expression) => {
@@ -1198,7 +1256,6 @@ class RenderTemplateResult {
1198
1256
  }
1199
1257
  }
1200
1258
  }
1201
- _a = renderTemplateResultSym;
1202
1259
  function isRenderTemplateResult(obj) {
1203
1260
  return typeof obj === "object" && !!obj[renderTemplateResultSym];
1204
1261
  }
@@ -1222,7 +1279,7 @@ async function renderToString(result, componentFactory, props, children, isPage
1222
1279
  write(chunk) {
1223
1280
  if (isPage && !renderedFirstPageChunk) {
1224
1281
  renderedFirstPageChunk = true;
1225
- if (!/<!doctype html/i.test(String(chunk))) {
1282
+ if (!result.partial && !/<!doctype html/i.test(String(chunk))) {
1226
1283
  const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
1227
1284
  str += doctype;
1228
1285
  }
@@ -1255,7 +1312,7 @@ async function renderToReadableStream(result, componentFactory, props, children,
1255
1312
  write(chunk) {
1256
1313
  if (isPage && !renderedFirstPageChunk) {
1257
1314
  renderedFirstPageChunk = true;
1258
- if (!/<!doctype html/i.test(String(chunk))) {
1315
+ if (!result.partial && !/<!doctype html/i.test(String(chunk))) {
1259
1316
  const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
1260
1317
  controller.enqueue(encoder.encode(doctype));
1261
1318
  }
@@ -1276,7 +1333,7 @@ async function renderToReadableStream(result, componentFactory, props, children,
1276
1333
  } catch (e) {
1277
1334
  if (AstroError.is(e) && !e.loc) {
1278
1335
  e.setLocation({
1279
- file: route == null ? void 0 : route.component
1336
+ file: route?.component
1280
1337
  });
1281
1338
  }
1282
1339
  setTimeout(() => controller.error(e), 0);
@@ -1292,9 +1349,9 @@ async function callComponentAsTemplateResultOrResponse(result, componentFactory,
1292
1349
  } else if (!isRenderTemplateResult(factoryResult)) {
1293
1350
  throw new AstroError({
1294
1351
  ...OnlyResponseCanBeReturned,
1295
- message: OnlyResponseCanBeReturned.message(route == null ? void 0 : route.route, typeof factoryResult),
1352
+ message: OnlyResponseCanBeReturned.message(route?.route, typeof factoryResult),
1296
1353
  location: {
1297
- file: route == null ? void 0 : route.component
1354
+ file: route?.component
1298
1355
  }
1299
1356
  });
1300
1357
  }
@@ -1324,7 +1381,7 @@ async function renderHTMLElement(result, constructor, props, slots) {
1324
1381
  attrHTML += ` ${attr}="${toAttributeString(await props[attr])}"`;
1325
1382
  }
1326
1383
  return markHTMLString(
1327
- `<${name}${attrHTML}>${await renderSlotToString(result, slots == null ? void 0 : slots.default)}</${name}>`
1384
+ `<${name}${attrHTML}>${await renderSlotToString(result, slots?.default)}</${name}>`
1328
1385
  );
1329
1386
  }
1330
1387
  function getHTMLElementName(constructor) {
@@ -1338,7 +1395,7 @@ function getHTMLElementName(constructor) {
1338
1395
  const needsHeadRenderingSymbol = Symbol.for("astro.needsHeadRendering");
1339
1396
  const rendererAliases = /* @__PURE__ */ new Map([["solid", "solid-js"]]);
1340
1397
  function guessRenderers(componentUrl) {
1341
- const extname = componentUrl == null ? void 0 : componentUrl.split(".").pop();
1398
+ const extname = componentUrl?.split(".").pop();
1342
1399
  switch (extname) {
1343
1400
  case "svelte":
1344
1401
  return ["@astrojs/svelte"];
@@ -1371,7 +1428,6 @@ function removeStaticAstroSlot(html, supportsAstroStaticSlot) {
1371
1428
  return html.replace(exp, "");
1372
1429
  }
1373
1430
  async function renderFrameworkComponent(result, displayName, Component, _props, slots = {}) {
1374
- var _a, _b, _c;
1375
1431
  if (!Component && !_props["client:only"]) {
1376
1432
  throw new Error(
1377
1433
  `Unable to render ${displayName} because it is ${Component}!
@@ -1383,7 +1439,10 @@ Did you forget to import the component or is it possible there is a typo?`
1383
1439
  astroStaticSlot: true,
1384
1440
  displayName
1385
1441
  };
1386
- const { hydration, isPage, props } = extractDirectives(_props, clientDirectives);
1442
+ const { hydration, isPage, props, propsWithoutTransitionAttributes } = extractDirectives(
1443
+ _props,
1444
+ clientDirectives
1445
+ );
1387
1446
  let html = "";
1388
1447
  let attrs = void 0;
1389
1448
  if (hydration) {
@@ -1447,7 +1506,7 @@ Did you forget to import the component or is it possible there is a typo?`
1447
1506
  renderer = validRenderers[0];
1448
1507
  }
1449
1508
  if (!renderer) {
1450
- const extname = (_a = metadata.componentUrl) == null ? void 0 : _a.split(".").pop();
1509
+ const extname = metadata.componentUrl?.split(".").pop();
1451
1510
  renderer = renderers.filter(
1452
1511
  ({ name }) => name === `@astrojs/${extname}` || name === extname
1453
1512
  )[0];
@@ -1472,7 +1531,7 @@ Did you forget to import the component or is it possible there is a typo?`
1472
1531
  ...NoMatchingRenderer,
1473
1532
  message: NoMatchingRenderer.message(
1474
1533
  metadata.displayName,
1475
- (_b = metadata == null ? void 0 : metadata.componentUrl) == null ? void 0 : _b.split(".").pop(),
1534
+ metadata?.componentUrl?.split(".").pop(),
1476
1535
  plural,
1477
1536
  validRenderers.length
1478
1537
  ),
@@ -1485,7 +1544,7 @@ Did you forget to import the component or is it possible there is a typo?`
1485
1544
  ({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
1486
1545
  { result },
1487
1546
  Component,
1488
- props,
1547
+ propsWithoutTransitionAttributes,
1489
1548
  children,
1490
1549
  metadata
1491
1550
  ));
@@ -1505,12 +1564,12 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
1505
1564
  }
1506
1565
  } else {
1507
1566
  if (metadata.hydrate === "only") {
1508
- html = await renderSlotToString(result, slots == null ? void 0 : slots.fallback);
1567
+ html = await renderSlotToString(result, slots?.fallback);
1509
1568
  } else {
1510
1569
  ({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
1511
1570
  { result },
1512
1571
  Component,
1513
- props,
1572
+ propsWithoutTransitionAttributes,
1514
1573
  children,
1515
1574
  metadata
1516
1575
  ));
@@ -1547,18 +1606,17 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
1547
1606
  if (!hydration) {
1548
1607
  return {
1549
1608
  render(destination) {
1550
- var _a2;
1551
1609
  if (slotInstructions) {
1552
1610
  for (const instruction of slotInstructions) {
1553
1611
  destination.write(instruction);
1554
1612
  }
1555
1613
  }
1556
- if (isPage || (renderer == null ? void 0 : renderer.name) === "astro:jsx") {
1614
+ if (isPage || renderer?.name === "astro:jsx") {
1557
1615
  destination.write(html);
1558
1616
  } else if (html && html.length > 0) {
1559
1617
  destination.write(
1560
1618
  markHTMLString(
1561
- removeStaticAstroSlot(html, ((_a2 = renderer == null ? void 0 : renderer.ssr) == null ? void 0 : _a2.supportsAstroStaticSlot) ?? false)
1619
+ removeStaticAstroSlot(html, renderer?.ssr?.supportsAstroStaticSlot ?? false)
1562
1620
  )
1563
1621
  );
1564
1622
  }
@@ -1581,7 +1639,7 @@ ${serializeProps(
1581
1639
  if (html) {
1582
1640
  if (Object.keys(children).length > 0) {
1583
1641
  for (const key of Object.keys(children)) {
1584
- let tagName = ((_c = renderer == null ? void 0 : renderer.ssr) == null ? void 0 : _c.supportsAstroStaticSlot) ? !!metadata.hydrate ? "astro-slot" : "astro-static-slot" : "astro-slot";
1642
+ let tagName = renderer?.ssr?.supportsAstroStaticSlot ? !!metadata.hydrate ? "astro-slot" : "astro-static-slot" : "astro-slot";
1585
1643
  let expectedHTML = key === "default" ? `<${tagName}>` : `<${tagName} name="${key}">`;
1586
1644
  if (!html.includes(expectedHTML)) {
1587
1645
  unrenderedSlots.push(key);
@@ -1597,6 +1655,7 @@ ${serializeProps(
1597
1655
  island.children = `${html ?? ""}${template}`;
1598
1656
  if (island.children) {
1599
1657
  island.props["await-children"] = "";
1658
+ island.children += `<!--astro:end-->`;
1600
1659
  }
1601
1660
  return {
1602
1661
  render(destination) {
@@ -1617,7 +1676,7 @@ function sanitizeElementName(tag) {
1617
1676
  return tag.trim().split(unsafe)[0].trim();
1618
1677
  }
1619
1678
  async function renderFragmentComponent(result, slots = {}) {
1620
- const children = await renderSlotToString(result, slots == null ? void 0 : slots.default);
1679
+ const children = await renderSlotToString(result, slots?.default);
1621
1680
  return {
1622
1681
  render(destination) {
1623
1682
  if (children == null)
@@ -1651,6 +1710,7 @@ async function renderComponent(result, displayName, Component, props, slots = {}
1651
1710
  if (isFragmentComponent(Component)) {
1652
1711
  return await renderFragmentComponent(result, slots);
1653
1712
  }
1713
+ props = normalizeProps(props);
1654
1714
  if (isHTMLComponent(Component)) {
1655
1715
  return await renderHTMLComponent(result, Component, props, slots);
1656
1716
  }
@@ -1659,6 +1719,17 @@ async function renderComponent(result, displayName, Component, props, slots = {}
1659
1719
  }
1660
1720
  return await renderFrameworkComponent(result, displayName, Component, props, slots);
1661
1721
  }
1722
+ function normalizeProps(props) {
1723
+ if (props["class:list"] !== void 0) {
1724
+ const value = props["class:list"];
1725
+ delete props["class:list"];
1726
+ props["class"] = clsx(props["class"], value);
1727
+ if (props["class"] === "") {
1728
+ delete props["class"];
1729
+ }
1730
+ }
1731
+ return props;
1732
+ }
1662
1733
  async function renderComponentToString(result, displayName, Component, props, slots = {}, isPage = false, route) {
1663
1734
  let str = "";
1664
1735
  let renderedFirstPageChunk = false;
@@ -1673,7 +1744,7 @@ async function renderComponentToString(result, displayName, Component, props, sl
1673
1744
  write(chunk) {
1674
1745
  if (isPage && !renderedFirstPageChunk) {
1675
1746
  renderedFirstPageChunk = true;
1676
- if (!/<!doctype html/i.test(String(chunk))) {
1747
+ if (!result.partial && !/<!doctype html/i.test(String(chunk))) {
1677
1748
  const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
1678
1749
  str += doctype + head;
1679
1750
  }
@@ -1688,7 +1759,7 @@ async function renderComponentToString(result, displayName, Component, props, sl
1688
1759
  } catch (e) {
1689
1760
  if (AstroError.is(e) && !e.loc) {
1690
1761
  e.setLocation({
1691
- file: route == null ? void 0 : route.component
1762
+ file: route?.component
1692
1763
  });
1693
1764
  }
1694
1765
  throw e;
@@ -1696,7 +1767,7 @@ async function renderComponentToString(result, displayName, Component, props, sl
1696
1767
  return str;
1697
1768
  }
1698
1769
  function nonAstroPageNeedsHeadInjection(pageComponent) {
1699
- return !!(pageComponent == null ? void 0 : pageComponent[needsHeadRenderingSymbol]);
1770
+ return !!pageComponent?.[needsHeadRenderingSymbol];
1700
1771
  }
1701
1772
 
1702
1773
  const ClientOnlyPlaceholder = "astro-client-only";
@@ -1705,6 +1776,7 @@ class Skip {
1705
1776
  this.vnode = vnode;
1706
1777
  this.count = 0;
1707
1778
  }
1779
+ count;
1708
1780
  increment() {
1709
1781
  this.count++;
1710
1782
  }
@@ -1714,8 +1786,8 @@ class Skip {
1714
1786
  isCompleted() {
1715
1787
  return this.count > 2;
1716
1788
  }
1789
+ static symbol = Symbol("astro:jsx:skip");
1717
1790
  }
1718
- Skip.symbol = Symbol("astro:jsx:skip");
1719
1791
  let originalConsoleError;
1720
1792
  let consoleFilterRefs = 0;
1721
1793
  async function renderJSX(result, vnode) {
@@ -1808,7 +1880,7 @@ Did you forget to import the component or is it possible there is a typo?`);
1808
1880
  try {
1809
1881
  const output2 = await vnode.type(vnode.props ?? {});
1810
1882
  let renderResult;
1811
- if (output2 == null ? void 0 : output2[AstroJSX]) {
1883
+ if (output2?.[AstroJSX]) {
1812
1884
  renderResult = await renderJSXVNode(result, output2, skip);
1813
1885
  return renderResult;
1814
1886
  } else if (!output2) {
@@ -1910,76 +1982,9 @@ function filteredConsoleError(msg, ...rest) {
1910
1982
  originalConsoleError(msg, ...rest);
1911
1983
  }
1912
1984
 
1913
- const isNodeJS = typeof process === "object" && Object.prototype.toString.call(process) === "[object process]";
1914
- let StreamingCompatibleResponse;
1915
- function createResponseClass() {
1916
- StreamingCompatibleResponse = class extends Response {
1917
- #isStream;
1918
- #body;
1919
- constructor(body, init) {
1920
- let isStream = body instanceof ReadableStream;
1921
- super(isStream ? null : body, init);
1922
- this.#isStream = isStream;
1923
- this.#body = body;
1924
- }
1925
- get body() {
1926
- return this.#body;
1927
- }
1928
- async text() {
1929
- if (this.#isStream && isNodeJS) {
1930
- let decoder = new TextDecoder();
1931
- let body = this.#body;
1932
- let out = "";
1933
- for await (let chunk of streamAsyncIterator(body)) {
1934
- out += decoder.decode(chunk);
1935
- }
1936
- return out;
1937
- }
1938
- return super.text();
1939
- }
1940
- async arrayBuffer() {
1941
- if (this.#isStream && isNodeJS) {
1942
- let body = this.#body;
1943
- let chunks = [];
1944
- let len = 0;
1945
- for await (let chunk of streamAsyncIterator(body)) {
1946
- chunks.push(chunk);
1947
- len += chunk.length;
1948
- }
1949
- let ab = new Uint8Array(len);
1950
- let offset = 0;
1951
- for (const chunk of chunks) {
1952
- ab.set(chunk, offset);
1953
- offset += chunk.length;
1954
- }
1955
- return ab;
1956
- }
1957
- return super.arrayBuffer();
1958
- }
1959
- clone() {
1960
- return new StreamingCompatibleResponse(this.#body, {
1961
- status: this.status,
1962
- statusText: this.statusText,
1963
- headers: this.headers
1964
- });
1965
- }
1966
- };
1967
- return StreamingCompatibleResponse;
1968
- }
1969
- const createResponse = isNodeJS ? (body, init) => {
1970
- if (typeof body === "string" || ArrayBuffer.isView(body)) {
1971
- return new Response(body, init);
1972
- }
1973
- if (typeof StreamingCompatibleResponse === "undefined") {
1974
- return new (createResponseClass())(body, init);
1975
- }
1976
- return new StreamingCompatibleResponse(body, init);
1977
- } : (body, init) => new Response(body, init);
1978
-
1979
- async function renderPage$1(result, componentFactory, props, children, streaming, route) {
1980
- var _a, _b;
1985
+ async function renderPage(result, componentFactory, props, children, streaming, route) {
1981
1986
  if (!isAstroComponentFactory(componentFactory)) {
1982
- result._metadata.headInTree = ((_a = result.componentMetadata.get(componentFactory.moduleId)) == null ? void 0 : _a.containsHead) ?? false;
1987
+ result._metadata.headInTree = result.componentMetadata.get(componentFactory.moduleId)?.containsHead ?? false;
1983
1988
  const pageProps = { ...props ?? {}, "server:root": true };
1984
1989
  const str = await renderComponentToString(
1985
1990
  result,
@@ -1998,7 +2003,7 @@ async function renderPage$1(result, componentFactory, props, children, streaming
1998
2003
  ])
1999
2004
  });
2000
2005
  }
2001
- result._metadata.headInTree = ((_b = result.componentMetadata.get(componentFactory.moduleId)) == null ? void 0 : _b.containsHead) ?? false;
2006
+ result._metadata.headInTree = result.componentMetadata.get(componentFactory.moduleId)?.containsHead ?? false;
2002
2007
  let body;
2003
2008
  if (streaming) {
2004
2009
  body = await renderToReadableStream(result, componentFactory, props, children, true, route);
@@ -2013,10 +2018,27 @@ async function renderPage$1(result, componentFactory, props, children, streaming
2013
2018
  body = encoder.encode(body);
2014
2019
  headers.set("Content-Length", body.byteLength.toString());
2015
2020
  }
2016
- const response = createResponse(body, { ...init, headers });
2021
+ if (route?.component.endsWith(".md")) {
2022
+ headers.set("Content-Type", "text/html; charset=utf-8");
2023
+ }
2024
+ const response = new Response(body, { ...init, headers });
2017
2025
  return response;
2018
2026
  }
2019
2027
 
2028
+ const transitionNameMap = /* @__PURE__ */ new WeakMap();
2029
+ function incrementTransitionNumber(result) {
2030
+ let num = 1;
2031
+ if (transitionNameMap.has(result)) {
2032
+ num = transitionNameMap.get(result) + 1;
2033
+ }
2034
+ transitionNameMap.set(result, num);
2035
+ return num;
2036
+ }
2037
+ function createTransitionScope(result, hash) {
2038
+ const num = incrementTransitionNumber(result);
2039
+ return `astro-${hash}-${num}`;
2040
+ }
2041
+
2020
2042
  function spreadAttributes(values = {}, _name, { class: scopedClassName } = {}) {
2021
2043
  let output = "";
2022
2044
  if (scopedClassName) {
@@ -2034,1690 +2056,4 @@ function spreadAttributes(values = {}, _name, { class: scopedClassName } = {}) {
2034
2056
  return markHTMLString(output);
2035
2057
  }
2036
2058
 
2037
- const AstroJSX = "astro:jsx";
2038
- const Empty = Symbol("empty");
2039
- const toSlotName = (slotAttr) => slotAttr;
2040
- function isVNode(vnode) {
2041
- return vnode && typeof vnode === "object" && vnode[AstroJSX];
2042
- }
2043
- function transformSlots(vnode) {
2044
- if (typeof vnode.type === "string")
2045
- return vnode;
2046
- const slots = {};
2047
- if (isVNode(vnode.props.children)) {
2048
- const child = vnode.props.children;
2049
- if (!isVNode(child))
2050
- return;
2051
- if (!("slot" in child.props))
2052
- return;
2053
- const name = toSlotName(child.props.slot);
2054
- slots[name] = [child];
2055
- slots[name]["$$slot"] = true;
2056
- delete child.props.slot;
2057
- delete vnode.props.children;
2058
- }
2059
- if (Array.isArray(vnode.props.children)) {
2060
- vnode.props.children = vnode.props.children.map((child) => {
2061
- if (!isVNode(child))
2062
- return child;
2063
- if (!("slot" in child.props))
2064
- return child;
2065
- const name = toSlotName(child.props.slot);
2066
- if (Array.isArray(slots[name])) {
2067
- slots[name].push(child);
2068
- } else {
2069
- slots[name] = [child];
2070
- slots[name]["$$slot"] = true;
2071
- }
2072
- delete child.props.slot;
2073
- return Empty;
2074
- }).filter((v) => v !== Empty);
2075
- }
2076
- Object.assign(vnode.props, slots);
2077
- }
2078
- function markRawChildren(child) {
2079
- if (typeof child === "string")
2080
- return markHTMLString(child);
2081
- if (Array.isArray(child))
2082
- return child.map((c) => markRawChildren(c));
2083
- return child;
2084
- }
2085
- function transformSetDirectives(vnode) {
2086
- if (!("set:html" in vnode.props || "set:text" in vnode.props))
2087
- return;
2088
- if ("set:html" in vnode.props) {
2089
- const children = markRawChildren(vnode.props["set:html"]);
2090
- delete vnode.props["set:html"];
2091
- Object.assign(vnode.props, { children });
2092
- return;
2093
- }
2094
- if ("set:text" in vnode.props) {
2095
- const children = vnode.props["set:text"];
2096
- delete vnode.props["set:text"];
2097
- Object.assign(vnode.props, { children });
2098
- return;
2099
- }
2100
- }
2101
- function createVNode(type, props) {
2102
- const vnode = {
2103
- [Renderer]: "astro:jsx",
2104
- [AstroJSX]: true,
2105
- type,
2106
- props: props ?? {}
2107
- };
2108
- transformSetDirectives(vnode);
2109
- transformSlots(vnode);
2110
- return vnode;
2111
- }
2112
-
2113
- const slotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
2114
- async function check(Component, props, { default: children = null, ...slotted } = {}) {
2115
- if (typeof Component !== "function")
2116
- return false;
2117
- const slots = {};
2118
- for (const [key, value] of Object.entries(slotted)) {
2119
- const name = slotName(key);
2120
- slots[name] = value;
2121
- }
2122
- try {
2123
- const result = await Component({ ...props, ...slots, children });
2124
- return result[AstroJSX];
2125
- } catch (e) {
2126
- const error = e;
2127
- if (Component[Symbol.for("mdx-component")]) {
2128
- throw createFormattedError({
2129
- message: error.message,
2130
- title: error.name,
2131
- hint: `This issue often occurs when your MDX component encounters runtime errors.`,
2132
- name: error.name,
2133
- stack: error.stack
2134
- });
2135
- }
2136
- }
2137
- return false;
2138
- }
2139
- async function renderToStaticMarkup(Component, props = {}, { default: children = null, ...slotted } = {}) {
2140
- const slots = {};
2141
- for (const [key, value] of Object.entries(slotted)) {
2142
- const name = slotName(key);
2143
- slots[name] = value;
2144
- }
2145
- const { result } = this;
2146
- const html = await renderJSX(result, createVNode(Component, { ...props, ...slots, children }));
2147
- return { html };
2148
- }
2149
- function createFormattedError({ message, name, stack, hint }) {
2150
- const error = new Error(message);
2151
- error.name = name;
2152
- error.stack = stack;
2153
- error.hint = hint;
2154
- return error;
2155
- }
2156
- var server_default = {
2157
- check,
2158
- renderToStaticMarkup
2159
- };
2160
-
2161
- function getRouteGenerator(segments, addTrailingSlash) {
2162
- const template = segments.map((segment) => {
2163
- return "/" + segment.map((part) => {
2164
- if (part.spread) {
2165
- return `:${part.content.slice(3)}(.*)?`;
2166
- } else if (part.dynamic) {
2167
- return `:${part.content}`;
2168
- } else {
2169
- return part.content.normalize().replace(/\?/g, "%3F").replace(/#/g, "%23").replace(/%5B/g, "[").replace(/%5D/g, "]").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2170
- }
2171
- }).join("");
2172
- }).join("");
2173
- let trailing = "";
2174
- if (addTrailingSlash === "always" && segments.length) {
2175
- trailing = "/";
2176
- }
2177
- const toPath = compile(template + trailing);
2178
- return toPath;
2179
- }
2180
-
2181
- function deserializeRouteData(rawRouteData) {
2182
- return {
2183
- route: rawRouteData.route,
2184
- type: rawRouteData.type,
2185
- pattern: new RegExp(rawRouteData.pattern),
2186
- params: rawRouteData.params,
2187
- component: rawRouteData.component,
2188
- generate: getRouteGenerator(rawRouteData.segments, rawRouteData._meta.trailingSlash),
2189
- pathname: rawRouteData.pathname || void 0,
2190
- segments: rawRouteData.segments,
2191
- prerender: rawRouteData.prerender,
2192
- redirect: rawRouteData.redirect,
2193
- redirectRoute: rawRouteData.redirectRoute ? deserializeRouteData(rawRouteData.redirectRoute) : void 0
2194
- };
2195
- }
2196
-
2197
- function deserializeManifest(serializedManifest) {
2198
- const routes = [];
2199
- for (const serializedRoute of serializedManifest.routes) {
2200
- routes.push({
2201
- ...serializedRoute,
2202
- routeData: deserializeRouteData(serializedRoute.routeData)
2203
- });
2204
- const route = serializedRoute;
2205
- route.routeData = deserializeRouteData(serializedRoute.routeData);
2206
- }
2207
- const assets = new Set(serializedManifest.assets);
2208
- const componentMetadata = new Map(serializedManifest.componentMetadata);
2209
- const clientDirectives = new Map(serializedManifest.clientDirectives);
2210
- return {
2211
- ...serializedManifest,
2212
- assets,
2213
- componentMetadata,
2214
- clientDirectives,
2215
- routes
2216
- };
2217
- }
2218
-
2219
- const DELETED_EXPIRATION = /* @__PURE__ */ new Date(0);
2220
- const DELETED_VALUE = "deleted";
2221
- const responseSentSymbol$2 = Symbol.for("astro.responseSent");
2222
- class AstroCookie {
2223
- constructor(value) {
2224
- this.value = value;
2225
- }
2226
- json() {
2227
- if (this.value === void 0) {
2228
- throw new Error(`Cannot convert undefined to an object.`);
2229
- }
2230
- return JSON.parse(this.value);
2231
- }
2232
- number() {
2233
- return Number(this.value);
2234
- }
2235
- boolean() {
2236
- if (this.value === "false")
2237
- return false;
2238
- if (this.value === "0")
2239
- return false;
2240
- return Boolean(this.value);
2241
- }
2242
- }
2243
- class AstroCookies {
2244
- #request;
2245
- #requestValues;
2246
- #outgoing;
2247
- constructor(request) {
2248
- this.#request = request;
2249
- this.#requestValues = null;
2250
- this.#outgoing = null;
2251
- }
2252
- /**
2253
- * Astro.cookies.delete(key) is used to delete a cookie. Using this method will result
2254
- * in a Set-Cookie header added to the response.
2255
- * @param key The cookie to delete
2256
- * @param options Options related to this deletion, such as the path of the cookie.
2257
- */
2258
- delete(key, options) {
2259
- const serializeOptions = {
2260
- expires: DELETED_EXPIRATION
2261
- };
2262
- if (options == null ? void 0 : options.domain) {
2263
- serializeOptions.domain = options.domain;
2264
- }
2265
- if (options == null ? void 0 : options.path) {
2266
- serializeOptions.path = options.path;
2267
- }
2268
- this.#ensureOutgoingMap().set(key, [
2269
- DELETED_VALUE,
2270
- serialize(key, DELETED_VALUE, serializeOptions),
2271
- false
2272
- ]);
2273
- }
2274
- /**
2275
- * Astro.cookies.get(key) is used to get a cookie value. The cookie value is read from the
2276
- * request. If you have set a cookie via Astro.cookies.set(key, value), the value will be taken
2277
- * from that set call, overriding any values already part of the request.
2278
- * @param key The cookie to get.
2279
- * @returns An object containing the cookie value as well as convenience methods for converting its value.
2280
- */
2281
- get(key) {
2282
- var _a;
2283
- if ((_a = this.#outgoing) == null ? void 0 : _a.has(key)) {
2284
- let [serializedValue, , isSetValue] = this.#outgoing.get(key);
2285
- if (isSetValue) {
2286
- return new AstroCookie(serializedValue);
2287
- } else {
2288
- return new AstroCookie(void 0);
2289
- }
2290
- }
2291
- const values = this.#ensureParsed();
2292
- const value = values[key];
2293
- return new AstroCookie(value);
2294
- }
2295
- /**
2296
- * Astro.cookies.has(key) returns a boolean indicating whether this cookie is either
2297
- * part of the initial request or set via Astro.cookies.set(key)
2298
- * @param key The cookie to check for.
2299
- * @returns
2300
- */
2301
- has(key) {
2302
- var _a;
2303
- if ((_a = this.#outgoing) == null ? void 0 : _a.has(key)) {
2304
- let [, , isSetValue] = this.#outgoing.get(key);
2305
- return isSetValue;
2306
- }
2307
- const values = this.#ensureParsed();
2308
- return !!values[key];
2309
- }
2310
- /**
2311
- * Astro.cookies.set(key, value) is used to set a cookie's value. If provided
2312
- * an object it will be stringified via JSON.stringify(value). Additionally you
2313
- * can provide options customizing how this cookie will be set, such as setting httpOnly
2314
- * in order to prevent the cookie from being read in client-side JavaScript.
2315
- * @param key The name of the cookie to set.
2316
- * @param value A value, either a string or other primitive or an object.
2317
- * @param options Options for the cookie, such as the path and security settings.
2318
- */
2319
- set(key, value, options) {
2320
- let serializedValue;
2321
- if (typeof value === "string") {
2322
- serializedValue = value;
2323
- } else {
2324
- let toStringValue = value.toString();
2325
- if (toStringValue === Object.prototype.toString.call(value)) {
2326
- serializedValue = JSON.stringify(value);
2327
- } else {
2328
- serializedValue = toStringValue;
2329
- }
2330
- }
2331
- const serializeOptions = {};
2332
- if (options) {
2333
- Object.assign(serializeOptions, options);
2334
- }
2335
- this.#ensureOutgoingMap().set(key, [
2336
- serializedValue,
2337
- serialize(key, serializedValue, serializeOptions),
2338
- true
2339
- ]);
2340
- if (this.#request[responseSentSymbol$2]) {
2341
- throw new AstroError({
2342
- ...ResponseSentError
2343
- });
2344
- }
2345
- }
2346
- /**
2347
- * Astro.cookies.header() returns an iterator for the cookies that have previously
2348
- * been set by either Astro.cookies.set() or Astro.cookies.delete().
2349
- * This method is primarily used by adapters to set the header on outgoing responses.
2350
- * @returns
2351
- */
2352
- *headers() {
2353
- if (this.#outgoing == null)
2354
- return;
2355
- for (const [, value] of this.#outgoing) {
2356
- yield value[1];
2357
- }
2358
- }
2359
- #ensureParsed() {
2360
- if (!this.#requestValues) {
2361
- this.#parse();
2362
- }
2363
- if (!this.#requestValues) {
2364
- this.#requestValues = {};
2365
- }
2366
- return this.#requestValues;
2367
- }
2368
- #ensureOutgoingMap() {
2369
- if (!this.#outgoing) {
2370
- this.#outgoing = /* @__PURE__ */ new Map();
2371
- }
2372
- return this.#outgoing;
2373
- }
2374
- #parse() {
2375
- const raw = this.#request.headers.get("cookie");
2376
- if (!raw) {
2377
- return;
2378
- }
2379
- this.#requestValues = parse(raw);
2380
- }
2381
- }
2382
-
2383
- const astroCookiesSymbol = Symbol.for("astro.cookies");
2384
- function attachToResponse(response, cookies) {
2385
- Reflect.set(response, astroCookiesSymbol, cookies);
2386
- }
2387
- function getFromResponse(response) {
2388
- let cookies = Reflect.get(response, astroCookiesSymbol);
2389
- if (cookies != null) {
2390
- return cookies;
2391
- } else {
2392
- return void 0;
2393
- }
2394
- }
2395
- function* getSetCookiesFromResponse(response) {
2396
- const cookies = getFromResponse(response);
2397
- if (!cookies) {
2398
- return [];
2399
- }
2400
- for (const headerValue of cookies.headers()) {
2401
- yield headerValue;
2402
- }
2403
- return [];
2404
- }
2405
-
2406
- const dateTimeFormat = new Intl.DateTimeFormat([], {
2407
- hour: "2-digit",
2408
- minute: "2-digit",
2409
- second: "2-digit"
2410
- });
2411
- const levels = {
2412
- debug: 20,
2413
- info: 30,
2414
- warn: 40,
2415
- error: 50,
2416
- silent: 90
2417
- };
2418
- function log(opts, level, type, message) {
2419
- const logLevel = opts.level;
2420
- const dest = opts.dest;
2421
- const event = {
2422
- type,
2423
- level,
2424
- message
2425
- };
2426
- if (levels[logLevel] > levels[level]) {
2427
- return;
2428
- }
2429
- dest.write(event);
2430
- }
2431
- function warn(opts, type, message) {
2432
- return log(opts, "warn", type, message);
2433
- }
2434
- function error(opts, type, message) {
2435
- return log(opts, "error", type, message);
2436
- }
2437
- function debug(...args) {
2438
- if ("_astroGlobalDebug" in globalThis) {
2439
- globalThis._astroGlobalDebug(...args);
2440
- }
2441
- }
2442
- if (typeof process !== "undefined") {
2443
- let proc = process;
2444
- if ("argv" in proc && Array.isArray(proc.argv)) {
2445
- if (proc.argv.includes("--verbose")) ; else if (proc.argv.includes("--silent")) ; else ;
2446
- }
2447
- }
2448
-
2449
- let lastMessage;
2450
- let lastMessageCount = 1;
2451
- const consoleLogDestination = {
2452
- write(event) {
2453
- let dest = console.error;
2454
- if (levels[event.level] < levels["error"]) {
2455
- dest = console.log;
2456
- }
2457
- function getPrefix() {
2458
- let prefix = "";
2459
- let type = event.type;
2460
- if (type) {
2461
- prefix += dim(dateTimeFormat.format(/* @__PURE__ */ new Date()) + " ");
2462
- if (event.level === "info") {
2463
- type = bold(cyan(`[${type}]`));
2464
- } else if (event.level === "warn") {
2465
- type = bold(yellow(`[${type}]`));
2466
- } else if (event.level === "error") {
2467
- type = bold(red(`[${type}]`));
2468
- }
2469
- prefix += `${type} `;
2470
- }
2471
- return reset(prefix);
2472
- }
2473
- let message = event.message;
2474
- if (message === lastMessage) {
2475
- lastMessageCount++;
2476
- message = `${message} ${yellow(`(x${lastMessageCount})`)}`;
2477
- } else {
2478
- lastMessage = message;
2479
- lastMessageCount = 1;
2480
- }
2481
- const outMessage = getPrefix() + message;
2482
- dest(outMessage);
2483
- return true;
2484
- }
2485
- };
2486
-
2487
- const RedirectComponentInstance = {
2488
- default() {
2489
- return new Response(null, {
2490
- status: 301
2491
- });
2492
- }
2493
- };
2494
- const RedirectSinglePageBuiltModule = {
2495
- page: () => Promise.resolve(RedirectComponentInstance),
2496
- onRequest: (ctx, next) => next(),
2497
- renderers: []
2498
- };
2499
-
2500
- function routeIsRedirect(route) {
2501
- return (route == null ? void 0 : route.type) === "redirect";
2502
- }
2503
- function redirectRouteGenerate(redirectRoute, data) {
2504
- const routeData = redirectRoute.redirectRoute;
2505
- const route = redirectRoute.redirect;
2506
- if (typeof routeData !== "undefined") {
2507
- return (routeData == null ? void 0 : routeData.generate(data)) || (routeData == null ? void 0 : routeData.pathname) || "/";
2508
- } else if (typeof route === "string") {
2509
- return route;
2510
- } else if (typeof route === "undefined") {
2511
- return "/";
2512
- }
2513
- return route.destination;
2514
- }
2515
- function redirectRouteStatus(redirectRoute, method = "GET") {
2516
- const routeData = redirectRoute.redirectRoute;
2517
- if (typeof (routeData == null ? void 0 : routeData.redirect) === "object") {
2518
- return routeData.redirect.status;
2519
- } else if (method !== "GET") {
2520
- return 308;
2521
- }
2522
- return 301;
2523
- }
2524
-
2525
- async function callMiddleware(logging, onRequest, apiContext, responseFunction) {
2526
- let nextCalled = false;
2527
- let responseFunctionPromise = void 0;
2528
- const next = async () => {
2529
- nextCalled = true;
2530
- responseFunctionPromise = responseFunction();
2531
- return responseFunctionPromise;
2532
- };
2533
- let middlewarePromise = onRequest(apiContext, next);
2534
- return await Promise.resolve(middlewarePromise).then(async (value) => {
2535
- if (isEndpointOutput(value)) {
2536
- warn(
2537
- logging,
2538
- "middleware",
2539
- `Using simple endpoints can cause unexpected issues in the chain of middleware functions.
2540
- It's strongly suggested to use full ${bold("Response")} objects.`
2541
- );
2542
- }
2543
- if (nextCalled) {
2544
- if (typeof value !== "undefined") {
2545
- if (value instanceof Response === false) {
2546
- throw new AstroError(MiddlewareNotAResponse);
2547
- }
2548
- return value;
2549
- } else {
2550
- if (responseFunctionPromise) {
2551
- return responseFunctionPromise;
2552
- } else {
2553
- throw new AstroError(MiddlewareNotAResponse);
2554
- }
2555
- }
2556
- } else if (typeof value === "undefined") {
2557
- throw new AstroError(MiddlewareNoDataOrNextCalled);
2558
- } else if (value instanceof Response === false) {
2559
- throw new AstroError(MiddlewareNotAResponse);
2560
- } else {
2561
- return value;
2562
- }
2563
- });
2564
- }
2565
- function isEndpointOutput(endpointResult) {
2566
- return !(endpointResult instanceof Response) && typeof endpointResult === "object" && typeof endpointResult.body === "string";
2567
- }
2568
-
2569
- const clientAddressSymbol$2 = Symbol.for("astro.clientAddress");
2570
- const clientLocalsSymbol$2 = Symbol.for("astro.locals");
2571
- function createAPIContext({
2572
- request,
2573
- params,
2574
- site,
2575
- props,
2576
- adapterName
2577
- }) {
2578
- const context = {
2579
- cookies: new AstroCookies(request),
2580
- request,
2581
- params,
2582
- site: site ? new URL(site) : void 0,
2583
- generator: `Astro v${ASTRO_VERSION}`,
2584
- props,
2585
- redirect(path, status) {
2586
- return new Response(null, {
2587
- status: status || 302,
2588
- headers: {
2589
- Location: path
2590
- }
2591
- });
2592
- },
2593
- url: new URL(request.url),
2594
- get clientAddress() {
2595
- if (!(clientAddressSymbol$2 in request)) {
2596
- if (adapterName) {
2597
- throw new AstroError({
2598
- ...ClientAddressNotAvailable,
2599
- message: ClientAddressNotAvailable.message(adapterName)
2600
- });
2601
- } else {
2602
- throw new AstroError(StaticClientAddressNotAvailable);
2603
- }
2604
- }
2605
- return Reflect.get(request, clientAddressSymbol$2);
2606
- }
2607
- };
2608
- Object.defineProperty(context, "locals", {
2609
- enumerable: true,
2610
- get() {
2611
- return Reflect.get(request, clientLocalsSymbol$2);
2612
- },
2613
- set(val) {
2614
- if (typeof val !== "object") {
2615
- throw new AstroError(LocalsNotAnObject);
2616
- } else {
2617
- Reflect.set(request, clientLocalsSymbol$2, val);
2618
- }
2619
- }
2620
- });
2621
- return context;
2622
- }
2623
- async function callEndpoint(mod, env, ctx, onRequest) {
2624
- var _a;
2625
- const context = createAPIContext({
2626
- request: ctx.request,
2627
- params: ctx.params,
2628
- props: ctx.props,
2629
- site: env.site,
2630
- adapterName: env.adapterName
2631
- });
2632
- let response;
2633
- if (onRequest) {
2634
- response = await callMiddleware(
2635
- env.logging,
2636
- onRequest,
2637
- context,
2638
- async () => {
2639
- return await renderEndpoint(mod, context, env.ssr);
2640
- }
2641
- );
2642
- } else {
2643
- response = await renderEndpoint(mod, context, env.ssr);
2644
- }
2645
- if (response instanceof Response) {
2646
- attachToResponse(response, context.cookies);
2647
- return {
2648
- type: "response",
2649
- response
2650
- };
2651
- }
2652
- if (env.ssr && !((_a = ctx.route) == null ? void 0 : _a.prerender)) {
2653
- if (response.hasOwnProperty("headers")) {
2654
- warn(
2655
- env.logging,
2656
- "ssr",
2657
- "Setting headers is not supported when returning an object. Please return an instance of Response. See https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes for more information."
2658
- );
2659
- }
2660
- if (response.encoding) {
2661
- warn(
2662
- env.logging,
2663
- "ssr",
2664
- "`encoding` is ignored in SSR. To return a charset other than UTF-8, please return an instance of Response. See https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes for more information."
2665
- );
2666
- }
2667
- }
2668
- return {
2669
- ...response,
2670
- type: "simple",
2671
- cookies: context.cookies
2672
- };
2673
- }
2674
-
2675
- const clientAddressSymbol$1 = Symbol.for("astro.clientAddress");
2676
- const responseSentSymbol$1 = Symbol.for("astro.responseSent");
2677
- function getFunctionExpression(slot) {
2678
- var _a;
2679
- if (!slot)
2680
- return;
2681
- if (((_a = slot.expressions) == null ? void 0 : _a.length) !== 1)
2682
- return;
2683
- return slot.expressions[0];
2684
- }
2685
- class Slots {
2686
- #result;
2687
- #slots;
2688
- #loggingOpts;
2689
- constructor(result, slots, logging) {
2690
- this.#result = result;
2691
- this.#slots = slots;
2692
- this.#loggingOpts = logging;
2693
- if (slots) {
2694
- for (const key of Object.keys(slots)) {
2695
- if (this[key] !== void 0) {
2696
- throw new AstroError({
2697
- ...ReservedSlotName,
2698
- message: ReservedSlotName.message(key)
2699
- });
2700
- }
2701
- Object.defineProperty(this, key, {
2702
- get() {
2703
- return true;
2704
- },
2705
- enumerable: true
2706
- });
2707
- }
2708
- }
2709
- }
2710
- has(name) {
2711
- if (!this.#slots)
2712
- return false;
2713
- return Boolean(this.#slots[name]);
2714
- }
2715
- async render(name, args = []) {
2716
- if (!this.#slots || !this.has(name))
2717
- return;
2718
- const result = this.#result;
2719
- if (!Array.isArray(args)) {
2720
- warn(
2721
- this.#loggingOpts,
2722
- "Astro.slots.render",
2723
- `Expected second parameter to be an array, received a ${typeof args}. If you're trying to pass an array as a single argument and getting unexpected results, make sure you're passing your array as a item of an array. Ex: Astro.slots.render('default', [["Hello", "World"]])`
2724
- );
2725
- } else if (args.length > 0) {
2726
- const slotValue = this.#slots[name];
2727
- const component = typeof slotValue === "function" ? await slotValue(result) : await slotValue;
2728
- const expression = getFunctionExpression(component);
2729
- if (expression) {
2730
- const slot = async () => typeof expression === "function" ? expression(...args) : expression;
2731
- return await renderSlotToString(result, slot).then((res) => {
2732
- return res != null ? String(res) : res;
2733
- });
2734
- }
2735
- if (typeof component === "function") {
2736
- return await renderJSX(result, component(...args)).then(
2737
- (res) => res != null ? String(res) : res
2738
- );
2739
- }
2740
- }
2741
- const content = await renderSlotToString(result, this.#slots[name]);
2742
- const outHTML = chunkToString(result, content);
2743
- return outHTML;
2744
- }
2745
- }
2746
- let renderMarkdown = null;
2747
- function createResult(args) {
2748
- const { markdown, params, request, resolve, locals } = args;
2749
- const url = new URL(request.url);
2750
- const headers = new Headers();
2751
- headers.set("Content-Type", "text/html");
2752
- const response = {
2753
- status: args.status,
2754
- statusText: "OK",
2755
- headers
2756
- };
2757
- Object.defineProperty(response, "headers", {
2758
- value: response.headers,
2759
- enumerable: true,
2760
- writable: false
2761
- });
2762
- let cookies = args.cookies;
2763
- const result = {
2764
- styles: args.styles ?? /* @__PURE__ */ new Set(),
2765
- scripts: args.scripts ?? /* @__PURE__ */ new Set(),
2766
- links: args.links ?? /* @__PURE__ */ new Set(),
2767
- componentMetadata: args.componentMetadata ?? /* @__PURE__ */ new Map(),
2768
- renderers: args.renderers,
2769
- clientDirectives: args.clientDirectives,
2770
- compressHTML: args.compressHTML,
2771
- pathname: args.pathname,
2772
- cookies,
2773
- /** This function returns the `Astro` faux-global */
2774
- createAstro(astroGlobal, props, slots) {
2775
- const astroSlots = new Slots(result, slots, args.logging);
2776
- const Astro = {
2777
- // @ts-expect-error
2778
- __proto__: astroGlobal,
2779
- get clientAddress() {
2780
- if (!(clientAddressSymbol$1 in request)) {
2781
- if (args.adapterName) {
2782
- throw new AstroError({
2783
- ...ClientAddressNotAvailable,
2784
- message: ClientAddressNotAvailable.message(args.adapterName)
2785
- });
2786
- } else {
2787
- throw new AstroError(StaticClientAddressNotAvailable);
2788
- }
2789
- }
2790
- return Reflect.get(request, clientAddressSymbol$1);
2791
- },
2792
- get cookies() {
2793
- if (cookies) {
2794
- return cookies;
2795
- }
2796
- cookies = new AstroCookies(request);
2797
- result.cookies = cookies;
2798
- return cookies;
2799
- },
2800
- params,
2801
- props,
2802
- locals,
2803
- request,
2804
- url,
2805
- redirect(path, status) {
2806
- if (request[responseSentSymbol$1]) {
2807
- throw new AstroError({
2808
- ...ResponseSentError
2809
- });
2810
- }
2811
- return new Response(null, {
2812
- status: status || 302,
2813
- headers: {
2814
- Location: path
2815
- }
2816
- });
2817
- },
2818
- response,
2819
- slots: astroSlots
2820
- };
2821
- Object.defineProperty(Astro, "__renderMarkdown", {
2822
- // Ensure this API is not exposed to users
2823
- enumerable: false,
2824
- writable: false,
2825
- // TODO: Remove this hole "Deno" logic once our plugin gets Deno support
2826
- value: async function(content, opts) {
2827
- if (typeof Deno !== "undefined") {
2828
- throw new Error("Markdown is not supported in Deno SSR");
2829
- }
2830
- if (!renderMarkdown) {
2831
- let astroRemark = "@astrojs/";
2832
- astroRemark += "markdown-remark";
2833
- renderMarkdown = (await import(astroRemark)).renderMarkdown;
2834
- }
2835
- const { code } = await renderMarkdown(content, { ...markdown, ...opts ?? {} });
2836
- return code;
2837
- }
2838
- });
2839
- return Astro;
2840
- },
2841
- resolve,
2842
- response,
2843
- _metadata: {
2844
- hasHydrationScript: false,
2845
- hasRenderedHead: false,
2846
- hasDirectives: /* @__PURE__ */ new Set(),
2847
- headInTree: false,
2848
- extraHead: [],
2849
- propagators: /* @__PURE__ */ new Map()
2850
- }
2851
- };
2852
- return result;
2853
- }
2854
-
2855
- async function renderPage({ mod, renderContext, env, cookies }) {
2856
- if (routeIsRedirect(renderContext.route)) {
2857
- return new Response(null, {
2858
- status: redirectRouteStatus(renderContext.route, renderContext.request.method),
2859
- headers: {
2860
- location: redirectRouteGenerate(renderContext.route, renderContext.params)
2861
- }
2862
- });
2863
- }
2864
- const Component = mod.default;
2865
- if (!Component)
2866
- throw new Error(`Expected an exported Astro component but received typeof ${typeof Component}`);
2867
- const result = createResult({
2868
- adapterName: env.adapterName,
2869
- links: renderContext.links,
2870
- styles: renderContext.styles,
2871
- logging: env.logging,
2872
- markdown: env.markdown,
2873
- params: renderContext.params,
2874
- pathname: renderContext.pathname,
2875
- componentMetadata: renderContext.componentMetadata,
2876
- resolve: env.resolve,
2877
- renderers: env.renderers,
2878
- clientDirectives: env.clientDirectives,
2879
- compressHTML: env.compressHTML,
2880
- request: renderContext.request,
2881
- site: env.site,
2882
- scripts: renderContext.scripts,
2883
- ssr: env.ssr,
2884
- status: renderContext.status ?? 200,
2885
- cookies,
2886
- locals: renderContext.locals ?? {}
2887
- });
2888
- if (typeof mod.components === "object") {
2889
- Object.assign(renderContext.props, { components: mod.components });
2890
- }
2891
- let response = await renderPage$1(
2892
- result,
2893
- Component,
2894
- renderContext.props,
2895
- null,
2896
- env.streaming,
2897
- renderContext.route
2898
- );
2899
- if (result.cookies) {
2900
- attachToResponse(response, result.cookies);
2901
- }
2902
- return response;
2903
- }
2904
- async function tryRenderRoute(routeType, renderContext, env, mod, onRequest) {
2905
- const apiContext = createAPIContext({
2906
- request: renderContext.request,
2907
- params: renderContext.params,
2908
- props: renderContext.props,
2909
- site: env.site,
2910
- adapterName: env.adapterName
2911
- });
2912
- switch (routeType) {
2913
- case "page":
2914
- case "redirect": {
2915
- if (onRequest) {
2916
- return await callMiddleware(
2917
- env.logging,
2918
- onRequest,
2919
- apiContext,
2920
- () => {
2921
- return renderPage({
2922
- mod,
2923
- renderContext,
2924
- env,
2925
- cookies: apiContext.cookies
2926
- });
2927
- }
2928
- );
2929
- } else {
2930
- return await renderPage({
2931
- mod,
2932
- renderContext,
2933
- env,
2934
- cookies: apiContext.cookies
2935
- });
2936
- }
2937
- }
2938
- case "endpoint": {
2939
- const result = await callEndpoint(
2940
- mod,
2941
- env,
2942
- renderContext,
2943
- onRequest
2944
- );
2945
- return result;
2946
- }
2947
- default:
2948
- throw new Error(`Couldn't find route of type [${routeType}]`);
2949
- }
2950
- }
2951
- function isResponse(result, routeType) {
2952
- return result instanceof Response && (routeType === "page" || routeType === "redirect");
2953
- }
2954
-
2955
- const VALID_PARAM_TYPES = ["string", "number", "undefined"];
2956
- function validateGetStaticPathsParameter([key, value], route) {
2957
- if (!VALID_PARAM_TYPES.includes(typeof value)) {
2958
- throw new AstroError({
2959
- ...GetStaticPathsInvalidRouteParam,
2960
- message: GetStaticPathsInvalidRouteParam.message(key, value, typeof value),
2961
- location: {
2962
- file: route
2963
- }
2964
- });
2965
- }
2966
- }
2967
- function validateDynamicRouteModule(mod, {
2968
- ssr,
2969
- route
2970
- }) {
2971
- if ((!ssr || route.prerender) && !mod.getStaticPaths) {
2972
- throw new AstroError({
2973
- ...GetStaticPathsRequired,
2974
- location: { file: route.component }
2975
- });
2976
- }
2977
- }
2978
- function validateGetStaticPathsResult(result, logging, route) {
2979
- if (!Array.isArray(result)) {
2980
- throw new AstroError({
2981
- ...InvalidGetStaticPathsReturn,
2982
- message: InvalidGetStaticPathsReturn.message(typeof result),
2983
- location: {
2984
- file: route.component
2985
- }
2986
- });
2987
- }
2988
- result.forEach((pathObject) => {
2989
- if (pathObject.params === void 0 || pathObject.params === null || pathObject.params && Object.keys(pathObject.params).length === 0) {
2990
- throw new AstroError({
2991
- ...GetStaticPathsExpectedParams,
2992
- location: {
2993
- file: route.component
2994
- }
2995
- });
2996
- }
2997
- if (typeof pathObject.params !== "object") {
2998
- throw new AstroError({
2999
- ...InvalidGetStaticPathParam,
3000
- message: InvalidGetStaticPathParam.message(typeof pathObject.params),
3001
- location: {
3002
- file: route.component
3003
- }
3004
- });
3005
- }
3006
- for (const [key, val] of Object.entries(pathObject.params)) {
3007
- if (!(typeof val === "undefined" || typeof val === "string" || typeof val === "number")) {
3008
- warn(
3009
- logging,
3010
- "getStaticPaths",
3011
- `invalid path param: ${key}. A string, number or undefined value was expected, but got \`${JSON.stringify(
3012
- val
3013
- )}\`.`
3014
- );
3015
- }
3016
- if (typeof val === "string" && val === "") {
3017
- warn(
3018
- logging,
3019
- "getStaticPaths",
3020
- `invalid path param: ${key}. \`undefined\` expected for an optional param, but got empty string.`
3021
- );
3022
- }
3023
- }
3024
- });
3025
- }
3026
-
3027
- function getParams(array) {
3028
- const fn = (match) => {
3029
- const params = {};
3030
- array.forEach((key, i) => {
3031
- if (key.startsWith("...")) {
3032
- params[key.slice(3)] = match[i + 1] ? decodeURIComponent(match[i + 1]) : void 0;
3033
- } else {
3034
- params[key] = decodeURIComponent(match[i + 1]);
3035
- }
3036
- });
3037
- return params;
3038
- };
3039
- return fn;
3040
- }
3041
- function stringifyParams(params, route) {
3042
- const validatedParams = Object.entries(params).reduce((acc, next) => {
3043
- validateGetStaticPathsParameter(next, route.component);
3044
- const [key, value] = next;
3045
- acc[key] = value == null ? void 0 : value.toString();
3046
- return acc;
3047
- }, {});
3048
- return JSON.stringify(route.generate(validatedParams));
3049
- }
3050
-
3051
- function generatePaginateFunction(routeMatch) {
3052
- return function paginateUtility(data, args = {}) {
3053
- let { pageSize: _pageSize, params: _params, props: _props } = args;
3054
- const pageSize = _pageSize || 10;
3055
- const paramName = "page";
3056
- const additionalParams = _params || {};
3057
- const additionalProps = _props || {};
3058
- let includesFirstPageNumber;
3059
- if (routeMatch.params.includes(`...${paramName}`)) {
3060
- includesFirstPageNumber = false;
3061
- } else if (routeMatch.params.includes(`${paramName}`)) {
3062
- includesFirstPageNumber = true;
3063
- } else {
3064
- throw new AstroError({
3065
- ...PageNumberParamNotFound,
3066
- message: PageNumberParamNotFound.message(paramName)
3067
- });
3068
- }
3069
- const lastPage = Math.max(1, Math.ceil(data.length / pageSize));
3070
- const result = [...Array(lastPage).keys()].map((num) => {
3071
- const pageNum = num + 1;
3072
- const start = pageSize === Infinity ? 0 : (pageNum - 1) * pageSize;
3073
- const end = Math.min(start + pageSize, data.length);
3074
- const params = {
3075
- ...additionalParams,
3076
- [paramName]: includesFirstPageNumber || pageNum > 1 ? String(pageNum) : void 0
3077
- };
3078
- const current = correctIndexRoute(routeMatch.generate({ ...params }));
3079
- const next = pageNum === lastPage ? void 0 : correctIndexRoute(routeMatch.generate({ ...params, page: String(pageNum + 1) }));
3080
- const prev = pageNum === 1 ? void 0 : correctIndexRoute(
3081
- routeMatch.generate({
3082
- ...params,
3083
- page: !includesFirstPageNumber && pageNum - 1 === 1 ? void 0 : String(pageNum - 1)
3084
- })
3085
- );
3086
- return {
3087
- params,
3088
- props: {
3089
- ...additionalProps,
3090
- page: {
3091
- data: data.slice(start, end),
3092
- start,
3093
- end: end - 1,
3094
- size: pageSize,
3095
- total: data.length,
3096
- currentPage: pageNum,
3097
- lastPage,
3098
- url: { current, next, prev }
3099
- }
3100
- }
3101
- };
3102
- });
3103
- return result;
3104
- };
3105
- }
3106
- function correctIndexRoute(route) {
3107
- if (route === "") {
3108
- return "/";
3109
- }
3110
- return route;
3111
- }
3112
-
3113
- async function callGetStaticPaths({
3114
- mod,
3115
- route,
3116
- routeCache,
3117
- isValidate,
3118
- logging,
3119
- ssr
3120
- }) {
3121
- const cached = routeCache.get(route);
3122
- if (cached == null ? void 0 : cached.staticPaths)
3123
- return cached.staticPaths;
3124
- validateDynamicRouteModule(mod, { ssr, route });
3125
- if (ssr && !route.prerender) {
3126
- const entry = Object.assign([], { keyed: /* @__PURE__ */ new Map() });
3127
- routeCache.set(route, { ...cached, staticPaths: entry });
3128
- return entry;
3129
- }
3130
- if (!mod.getStaticPaths) {
3131
- throw new Error("Unexpected Error.");
3132
- }
3133
- let staticPaths = [];
3134
- staticPaths = await mod.getStaticPaths({
3135
- paginate: generatePaginateFunction(route),
3136
- rss() {
3137
- throw new AstroError(GetStaticPathsRemovedRSSHelper);
3138
- }
3139
- });
3140
- if (Array.isArray(staticPaths)) {
3141
- staticPaths = staticPaths.flat();
3142
- }
3143
- if (isValidate) {
3144
- validateGetStaticPathsResult(staticPaths, logging, route);
3145
- }
3146
- const keyedStaticPaths = staticPaths;
3147
- keyedStaticPaths.keyed = /* @__PURE__ */ new Map();
3148
- for (const sp of keyedStaticPaths) {
3149
- const paramsKey = stringifyParams(sp.params, route);
3150
- keyedStaticPaths.keyed.set(paramsKey, sp);
3151
- }
3152
- routeCache.set(route, { ...cached, staticPaths: keyedStaticPaths });
3153
- return keyedStaticPaths;
3154
- }
3155
- class RouteCache {
3156
- constructor(logging, mode = "production") {
3157
- this.cache = {};
3158
- this.logging = logging;
3159
- this.mode = mode;
3160
- }
3161
- /** Clear the cache. */
3162
- clearAll() {
3163
- this.cache = {};
3164
- }
3165
- set(route, entry) {
3166
- var _a;
3167
- if (this.mode === "production" && ((_a = this.cache[route.component]) == null ? void 0 : _a.staticPaths)) {
3168
- warn(
3169
- this.logging,
3170
- "routeCache",
3171
- `Internal Warning: route cache overwritten. (${route.component})`
3172
- );
3173
- }
3174
- this.cache[route.component] = entry;
3175
- }
3176
- get(route) {
3177
- return this.cache[route.component];
3178
- }
3179
- }
3180
- function findPathItemByKey(staticPaths, params, route) {
3181
- const paramsKey = stringifyParams(params, route);
3182
- const matchedStaticPath = staticPaths.keyed.get(paramsKey);
3183
- if (matchedStaticPath) {
3184
- return matchedStaticPath;
3185
- }
3186
- debug("findPathItemByKey", `Unexpected cache miss looking for ${paramsKey}`);
3187
- }
3188
-
3189
- async function getParamsAndProps(opts) {
3190
- const { logging, mod, route, routeCache, pathname, ssr } = opts;
3191
- if (!route || route.pathname) {
3192
- return [{}, {}];
3193
- }
3194
- const params = getRouteParams(route, pathname) ?? {};
3195
- validatePrerenderEndpointCollision(route, mod, params);
3196
- const staticPaths = await callGetStaticPaths({
3197
- mod,
3198
- route,
3199
- routeCache,
3200
- isValidate: true,
3201
- logging,
3202
- ssr
3203
- });
3204
- const matchedStaticPath = findPathItemByKey(staticPaths, params, route);
3205
- if (!matchedStaticPath && (ssr ? route.prerender : true)) {
3206
- throw new AstroError({
3207
- ...NoMatchingStaticPathFound,
3208
- message: NoMatchingStaticPathFound.message(pathname),
3209
- hint: NoMatchingStaticPathFound.hint([route.component])
3210
- });
3211
- }
3212
- const props = (matchedStaticPath == null ? void 0 : matchedStaticPath.props) ? { ...matchedStaticPath.props } : {};
3213
- return [params, props];
3214
- }
3215
- function getRouteParams(route, pathname) {
3216
- if (route.params.length) {
3217
- const paramsMatch = route.pattern.exec(decodeURIComponent(pathname));
3218
- if (paramsMatch) {
3219
- return getParams(route.params)(paramsMatch);
3220
- }
3221
- }
3222
- }
3223
- function validatePrerenderEndpointCollision(route, mod, params) {
3224
- if (route.type === "endpoint" && mod.getStaticPaths) {
3225
- const lastSegment = route.segments[route.segments.length - 1];
3226
- const paramValues = Object.values(params);
3227
- const lastParam = paramValues[paramValues.length - 1];
3228
- if (lastSegment.length === 1 && lastSegment[0].dynamic && lastParam === void 0) {
3229
- throw new AstroError({
3230
- ...PrerenderDynamicEndpointPathCollide,
3231
- message: PrerenderDynamicEndpointPathCollide.message(route.route),
3232
- hint: PrerenderDynamicEndpointPathCollide.hint(route.component),
3233
- location: {
3234
- file: route.component
3235
- }
3236
- });
3237
- }
3238
- }
3239
- }
3240
-
3241
- const clientLocalsSymbol$1 = Symbol.for("astro.locals");
3242
- async function createRenderContext(options) {
3243
- const request = options.request;
3244
- const pathname = options.pathname ?? new URL(request.url).pathname;
3245
- const [params, props] = await getParamsAndProps({
3246
- mod: options.mod,
3247
- route: options.route,
3248
- routeCache: options.env.routeCache,
3249
- pathname,
3250
- logging: options.env.logging,
3251
- ssr: options.env.ssr
3252
- });
3253
- const context = {
3254
- ...options,
3255
- pathname,
3256
- params,
3257
- props
3258
- };
3259
- Object.defineProperty(context, "locals", {
3260
- enumerable: true,
3261
- get() {
3262
- return Reflect.get(request, clientLocalsSymbol$1);
3263
- },
3264
- set(val) {
3265
- if (typeof val !== "object") {
3266
- throw new AstroError(LocalsNotAnObject);
3267
- } else {
3268
- Reflect.set(request, clientLocalsSymbol$1, val);
3269
- }
3270
- }
3271
- });
3272
- return context;
3273
- }
3274
-
3275
- function createEnvironment(options) {
3276
- return options;
3277
- }
3278
-
3279
- function createAssetLink(href, base, assetsPrefix) {
3280
- if (assetsPrefix) {
3281
- return joinPaths(assetsPrefix, slash(href));
3282
- } else if (base) {
3283
- return prependForwardSlash(joinPaths(base, slash(href)));
3284
- } else {
3285
- return href;
3286
- }
3287
- }
3288
- function createStylesheetElement(stylesheet, base, assetsPrefix) {
3289
- if (stylesheet.type === "inline") {
3290
- return {
3291
- props: {
3292
- type: "text/css"
3293
- },
3294
- children: stylesheet.content
3295
- };
3296
- } else {
3297
- return {
3298
- props: {
3299
- rel: "stylesheet",
3300
- href: createAssetLink(stylesheet.src, base, assetsPrefix)
3301
- },
3302
- children: ""
3303
- };
3304
- }
3305
- }
3306
- function createStylesheetElementSet(stylesheets, base, assetsPrefix) {
3307
- return new Set(stylesheets.map((s) => createStylesheetElement(s, base, assetsPrefix)));
3308
- }
3309
- function createModuleScriptElement(script, base, assetsPrefix) {
3310
- if (script.type === "external") {
3311
- return createModuleScriptElementWithSrc(script.value, base, assetsPrefix);
3312
- } else {
3313
- return {
3314
- props: {
3315
- type: "module"
3316
- },
3317
- children: script.value
3318
- };
3319
- }
3320
- }
3321
- function createModuleScriptElementWithSrc(src, base, assetsPrefix) {
3322
- return {
3323
- props: {
3324
- type: "module",
3325
- src: createAssetLink(src, base, assetsPrefix)
3326
- },
3327
- children: ""
3328
- };
3329
- }
3330
-
3331
- function matchRoute(pathname, manifest) {
3332
- return manifest.routes.find((route) => route.pattern.test(decodeURI(pathname)));
3333
- }
3334
-
3335
- const clientLocalsSymbol = Symbol.for("astro.locals");
3336
- const responseSentSymbol = Symbol.for("astro.responseSent");
3337
- const STATUS_CODES = /* @__PURE__ */ new Set([404, 500]);
3338
- class App {
3339
- /**
3340
- * The current environment of the application
3341
- */
3342
- #env;
3343
- #manifest;
3344
- #manifestData;
3345
- #routeDataToRouteInfo;
3346
- #encoder = new TextEncoder();
3347
- #logging = {
3348
- dest: consoleLogDestination,
3349
- level: "info"
3350
- };
3351
- #baseWithoutTrailingSlash;
3352
- constructor(manifest, streaming = true) {
3353
- this.#manifest = manifest;
3354
- this.#manifestData = {
3355
- routes: manifest.routes.map((route) => route.routeData)
3356
- };
3357
- this.#routeDataToRouteInfo = new Map(manifest.routes.map((route) => [route.routeData, route]));
3358
- this.#baseWithoutTrailingSlash = removeTrailingForwardSlash(this.#manifest.base);
3359
- this.#env = this.#createEnvironment(streaming);
3360
- }
3361
- set setManifest(newManifest) {
3362
- this.#manifest = newManifest;
3363
- }
3364
- /**
3365
- * Creates an environment by reading the stored manifest
3366
- *
3367
- * @param streaming
3368
- * @private
3369
- */
3370
- #createEnvironment(streaming = false) {
3371
- return createEnvironment({
3372
- adapterName: this.#manifest.adapterName,
3373
- logging: this.#logging,
3374
- markdown: this.#manifest.markdown,
3375
- mode: "production",
3376
- compressHTML: this.#manifest.compressHTML,
3377
- renderers: this.#manifest.renderers,
3378
- clientDirectives: this.#manifest.clientDirectives,
3379
- resolve: async (specifier) => {
3380
- if (!(specifier in this.#manifest.entryModules)) {
3381
- throw new Error(`Unable to resolve [${specifier}]`);
3382
- }
3383
- const bundlePath = this.#manifest.entryModules[specifier];
3384
- switch (true) {
3385
- case bundlePath.startsWith("data:"):
3386
- case bundlePath.length === 0: {
3387
- return bundlePath;
3388
- }
3389
- default: {
3390
- return createAssetLink(bundlePath, this.#manifest.base, this.#manifest.assetsPrefix);
3391
- }
3392
- }
3393
- },
3394
- routeCache: new RouteCache(this.#logging),
3395
- site: this.#manifest.site,
3396
- ssr: true,
3397
- streaming
3398
- });
3399
- }
3400
- set setManifestData(newManifestData) {
3401
- this.#manifestData = newManifestData;
3402
- }
3403
- removeBase(pathname) {
3404
- if (pathname.startsWith(this.#manifest.base)) {
3405
- return pathname.slice(this.#baseWithoutTrailingSlash.length + 1);
3406
- }
3407
- return pathname;
3408
- }
3409
- // Disable no-unused-vars to avoid breaking signature change
3410
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3411
- match(request, _opts = {}) {
3412
- const url = new URL(request.url);
3413
- if (this.#manifest.assets.has(url.pathname))
3414
- return void 0;
3415
- const pathname = prependForwardSlash(this.removeBase(url.pathname));
3416
- const routeData = matchRoute(pathname, this.#manifestData);
3417
- if (!routeData || routeData.prerender)
3418
- return void 0;
3419
- return routeData;
3420
- }
3421
- async render(request, routeData, locals) {
3422
- if (request.url !== collapseDuplicateSlashes(request.url)) {
3423
- request = new Request(collapseDuplicateSlashes(request.url), request);
3424
- }
3425
- if (!routeData) {
3426
- routeData = this.match(request);
3427
- }
3428
- if (!routeData) {
3429
- return this.#renderError(request, { status: 404 });
3430
- }
3431
- Reflect.set(request, clientLocalsSymbol, locals ?? {});
3432
- const defaultStatus = this.#getDefaultStatusCode(routeData.route);
3433
- const mod = await this.#getModuleForRoute(routeData);
3434
- const pageModule = await mod.page();
3435
- const url = new URL(request.url);
3436
- const renderContext = await this.#createRenderContext(
3437
- url,
3438
- request,
3439
- routeData,
3440
- mod,
3441
- defaultStatus
3442
- );
3443
- let response;
3444
- try {
3445
- response = await tryRenderRoute(
3446
- routeData.type,
3447
- renderContext,
3448
- this.#env,
3449
- pageModule,
3450
- mod.onRequest
3451
- );
3452
- } catch (err) {
3453
- error(this.#logging, "ssr", err.stack || err.message || String(err));
3454
- return this.#renderError(request, { status: 500 });
3455
- }
3456
- if (isResponse(response, routeData.type)) {
3457
- if (STATUS_CODES.has(response.status)) {
3458
- return this.#renderError(request, {
3459
- response,
3460
- status: response.status
3461
- });
3462
- }
3463
- Reflect.set(response, responseSentSymbol, true);
3464
- return response;
3465
- } else {
3466
- if (response.type === "response") {
3467
- if (response.response.headers.get("X-Astro-Response") === "Not-Found") {
3468
- return this.#renderError(request, {
3469
- response: response.response,
3470
- status: 404
3471
- });
3472
- }
3473
- return response.response;
3474
- } else {
3475
- const headers = new Headers();
3476
- const mimeType = mime.getType(url.pathname);
3477
- if (mimeType) {
3478
- headers.set("Content-Type", `${mimeType};charset=utf-8`);
3479
- } else {
3480
- headers.set("Content-Type", "text/plain;charset=utf-8");
3481
- }
3482
- const bytes = response.encoding !== "binary" ? this.#encoder.encode(response.body) : response.body;
3483
- headers.set("Content-Length", bytes.byteLength.toString());
3484
- const newResponse = new Response(bytes, {
3485
- status: 200,
3486
- headers
3487
- });
3488
- attachToResponse(newResponse, response.cookies);
3489
- return newResponse;
3490
- }
3491
- }
3492
- }
3493
- setCookieHeaders(response) {
3494
- return getSetCookiesFromResponse(response);
3495
- }
3496
- /**
3497
- * Creates the render context of the current route
3498
- */
3499
- async #createRenderContext(url, request, routeData, page, status = 200) {
3500
- if (routeData.type === "endpoint") {
3501
- const pathname = "/" + this.removeBase(url.pathname);
3502
- const mod = await page.page();
3503
- const handler = mod;
3504
- return await createRenderContext({
3505
- request,
3506
- pathname,
3507
- route: routeData,
3508
- status,
3509
- env: this.#env,
3510
- mod: handler
3511
- });
3512
- } else {
3513
- const pathname = prependForwardSlash(this.removeBase(url.pathname));
3514
- const info = this.#routeDataToRouteInfo.get(routeData);
3515
- const links = /* @__PURE__ */ new Set();
3516
- const styles = createStylesheetElementSet(info.styles);
3517
- let scripts = /* @__PURE__ */ new Set();
3518
- for (const script of info.scripts) {
3519
- if ("stage" in script) {
3520
- if (script.stage === "head-inline") {
3521
- scripts.add({
3522
- props: {},
3523
- children: script.children
3524
- });
3525
- }
3526
- } else {
3527
- scripts.add(createModuleScriptElement(script));
3528
- }
3529
- }
3530
- const mod = await page.page();
3531
- return await createRenderContext({
3532
- request,
3533
- pathname,
3534
- componentMetadata: this.#manifest.componentMetadata,
3535
- scripts,
3536
- styles,
3537
- links,
3538
- route: routeData,
3539
- status,
3540
- mod,
3541
- env: this.#env
3542
- });
3543
- }
3544
- }
3545
- /**
3546
- * If it is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
3547
- * This also handles pre-rendered /404 or /500 routes
3548
- */
3549
- async #renderError(request, { status, response: originalResponse }) {
3550
- const errorRouteData = matchRoute("/" + status, this.#manifestData);
3551
- const url = new URL(request.url);
3552
- if (errorRouteData) {
3553
- if (errorRouteData.prerender) {
3554
- const maybeDotHtml = errorRouteData.route.endsWith(`/${status}`) ? ".html" : "";
3555
- const statusURL = new URL(
3556
- `${this.#baseWithoutTrailingSlash}/${status}${maybeDotHtml}`,
3557
- url
3558
- );
3559
- const response2 = await fetch(statusURL.toString());
3560
- const override = { status };
3561
- return this.#mergeResponses(response2, originalResponse, override);
3562
- }
3563
- const mod = await this.#getModuleForRoute(errorRouteData);
3564
- try {
3565
- const newRenderContext = await this.#createRenderContext(
3566
- url,
3567
- request,
3568
- errorRouteData,
3569
- mod,
3570
- status
3571
- );
3572
- const page = await mod.page();
3573
- const response2 = await tryRenderRoute(
3574
- "page",
3575
- // this is hardcoded to ensure proper behavior for missing endpoints
3576
- newRenderContext,
3577
- this.#env,
3578
- page
3579
- );
3580
- return this.#mergeResponses(response2, originalResponse);
3581
- } catch {
3582
- }
3583
- }
3584
- const response = this.#mergeResponses(new Response(null, { status }), originalResponse);
3585
- Reflect.set(response, responseSentSymbol, true);
3586
- return response;
3587
- }
3588
- #mergeResponses(newResponse, oldResponse, override) {
3589
- if (!oldResponse) {
3590
- if (override !== void 0) {
3591
- return new Response(newResponse.body, {
3592
- status: override.status,
3593
- statusText: newResponse.statusText,
3594
- headers: newResponse.headers
3595
- });
3596
- }
3597
- return newResponse;
3598
- }
3599
- const { statusText, headers } = oldResponse;
3600
- const status = (override == null ? void 0 : override.status) ? override.status : oldResponse.status === 200 ? newResponse.status : oldResponse.status;
3601
- return new Response(newResponse.body, {
3602
- status,
3603
- statusText: status === 200 ? newResponse.statusText : statusText,
3604
- headers: new Headers(Array.from(headers))
3605
- });
3606
- }
3607
- #getDefaultStatusCode(route) {
3608
- route = removeTrailingForwardSlash(route);
3609
- if (route.endsWith("/404"))
3610
- return 404;
3611
- if (route.endsWith("/500"))
3612
- return 500;
3613
- return 200;
3614
- }
3615
- async #getModuleForRoute(route) {
3616
- if (route.type === "redirect") {
3617
- return RedirectSinglePageBuiltModule;
3618
- } else {
3619
- if (this.#manifest.pageMap) {
3620
- const importComponentInstance = this.#manifest.pageMap.get(route.component);
3621
- if (!importComponentInstance) {
3622
- throw new Error(
3623
- `Unexpectedly unable to find a component instance for route ${route.route}`
3624
- );
3625
- }
3626
- const pageModule = await importComponentInstance();
3627
- return pageModule;
3628
- } else if (this.#manifest.pageModule) {
3629
- const importComponentInstance = this.#manifest.pageModule;
3630
- return importComponentInstance;
3631
- } else {
3632
- throw new Error(
3633
- "Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage. This is an internal error, please file an issue."
3634
- );
3635
- }
3636
- }
3637
- }
3638
- }
3639
-
3640
- const clientAddressSymbol = Symbol.for("astro.clientAddress");
3641
- function createRequestFromNodeRequest(req, options) {
3642
- var _a;
3643
- const protocol = req.socket instanceof TLSSocket || req.headers["x-forwarded-proto"] === "https" ? "https" : "http";
3644
- const hostname = req.headers.host || req.headers[":authority"];
3645
- const url = `${protocol}://${hostname}${req.url}`;
3646
- const headers = makeRequestHeaders(req);
3647
- const method = req.method || "GET";
3648
- let bodyProps = {};
3649
- const bodyAllowed = method !== "HEAD" && method !== "GET" && !(options == null ? void 0 : options.emptyBody);
3650
- if (bodyAllowed) {
3651
- bodyProps = makeRequestBody(req);
3652
- }
3653
- const request = new Request(url, {
3654
- method,
3655
- headers,
3656
- ...bodyProps
3657
- });
3658
- if ((_a = req.socket) == null ? void 0 : _a.remoteAddress) {
3659
- Reflect.set(request, clientAddressSymbol, req.socket.remoteAddress);
3660
- }
3661
- return request;
3662
- }
3663
- function makeRequestHeaders(req) {
3664
- const headers = new Headers();
3665
- for (const [name, value] of Object.entries(req.headers)) {
3666
- if (value === void 0) {
3667
- continue;
3668
- }
3669
- if (Array.isArray(value)) {
3670
- for (const item of value) {
3671
- headers.append(name, item);
3672
- }
3673
- } else {
3674
- headers.append(name, value);
3675
- }
3676
- }
3677
- return headers;
3678
- }
3679
- function makeRequestBody(req) {
3680
- if (req.body !== void 0) {
3681
- if (typeof req.body === "string" && req.body.length > 0) {
3682
- return { body: Buffer.from(req.body) };
3683
- }
3684
- if (typeof req.body === "object" && req.body !== null && Object.keys(req.body).length > 0) {
3685
- return { body: Buffer.from(JSON.stringify(req.body)) };
3686
- }
3687
- if (typeof req.body === "object" && req.body !== null && typeof req.body[Symbol.asyncIterator] !== "undefined") {
3688
- return asyncIterableToBodyProps(req.body);
3689
- }
3690
- }
3691
- return asyncIterableToBodyProps(req);
3692
- }
3693
- function asyncIterableToBodyProps(iterable) {
3694
- return {
3695
- // Node uses undici for the Request implementation. Undici accepts
3696
- // a non-standard async iterable for the body.
3697
- // @ts-expect-error
3698
- body: iterable,
3699
- // The duplex property is required when using a ReadableStream or async
3700
- // iterable for the body. The type definitions do not include the duplex
3701
- // property because they are not up-to-date.
3702
- // @ts-expect-error
3703
- duplex: "half"
3704
- };
3705
- }
3706
- class NodeApp extends App {
3707
- match(req, opts = {}) {
3708
- if (!(req instanceof Request)) {
3709
- req = createRequestFromNodeRequest(req, {
3710
- emptyBody: true
3711
- });
3712
- }
3713
- return super.match(req, opts);
3714
- }
3715
- render(req, routeData, locals) {
3716
- if (!(req instanceof Request)) {
3717
- req = createRequestFromNodeRequest(req);
3718
- }
3719
- return super.render(req, routeData, locals);
3720
- }
3721
- }
3722
-
3723
- export { Fragment as F, NodeApp as N, createComponent as a, addAttribute as b, createAstro as c, renderComponent as d, renderSlotToString as e, renderAllHeadContent as f, renderSlot as g, deserializeManifest as h, server_default as i, maybeRenderHead as m, renderTemplate as r, spreadAttributes as s, unescapeHTML as u };
2059
+ export { AstroError as A, GetStaticPathsExpectedParams as B, ClientAddressNotAvailable as C, GetStaticPathsInvalidRouteParam as D, ExpectedImage as E, Fragment as F, GetStaticPathsRequired as G, GetStaticPathsRemovedRSSHelper as H, IncompatibleDescriptorOptions as I, PrerenderDynamicEndpointPathCollide as J, LocalsNotAnObject as K, LocalImageUsedWrongly as L, MissingImageDimension as M, NoMatchingStaticPathFound as N, ASTRO_VERSION as O, PageNumberParamNotFound as P, renderEndpoint as Q, ReservedSlotName as R, StaticClientAddressNotAvailable as S, UnsupportedImageFormat as U, UnsupportedImageConversion as a, ExpectedImageOptions as b, InvalidImageService as c, MissingSharp as d, createAstro as e, createComponent as f, ImageMissingAlt as g, addAttribute as h, renderComponent as i, createTransitionScope as j, renderSlotToString as k, renderAllHeadContent as l, maybeRenderHead as m, renderSlot as n, renderJSX as o, chunkToString as p, ResponseSentError as q, renderTemplate as r, spreadAttributes as s, CantRenderPage as t, unescapeHTML as u, renderPage as v, MiddlewareNoDataOrNextCalled as w, MiddlewareNotAResponse as x, InvalidGetStaticPathsReturn as y, InvalidGetStaticPathsEntry as z };