cloudcommerce 0.8.7 → 0.9.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 (158) hide show
  1. package/.github/renovate.json +1 -2
  2. package/CHANGELOG.md +44 -0
  3. package/ecomplus-stores/monocard/functions/core/package.json +1 -1
  4. package/ecomplus-stores/monocard/functions/events/package.json +2 -2
  5. package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
  6. package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
  7. package/ecomplus-stores/monocard/functions/ssr/content/layout.json +37 -0
  8. package/ecomplus-stores/monocard/functions/ssr/package.json +6 -6
  9. package/ecomplus-stores/monocard/functions/ssr/src/components/FeatureTabs.astro +1 -1
  10. package/ecomplus-stores/monocard/functions/ssr/src/components/FeatureTabs.vue +23 -10
  11. package/ecomplus-stores/monocard/functions/ssr/src/components/PitchBar.vue +2 -2
  12. package/ecomplus-stores/monocard/functions/ssr/src/components/ShopHeader.vue +11 -10
  13. package/ecomplus-stores/monocard/functions/ssr/src/components/ShopSidenavCategory.vue +2 -2
  14. package/ecomplus-stores/monocard/functions/ssr/src/layouts/Pages.astro +28 -14
  15. package/ecomplus-stores/monocard/functions/ssr/src/main/Home.astro +3 -3
  16. package/ecomplus-stores/monocard/functions/ssr/src/main/Wildcard.astro +9 -7
  17. package/ecomplus-stores/monocard/functions/ssr/src/pages/[...slug].astro +2 -2
  18. package/ecomplus-stores/monocard/functions/ssr/src/pages/fallback.astro +1 -1
  19. package/ecomplus-stores/monocard/functions/ssr/src/pages/index.astro +2 -2
  20. package/ecomplus-stores/monocard/package.json +1 -1
  21. package/package.json +10 -10
  22. package/packages/api/lib/api.d.ts +27 -11
  23. package/packages/api/package.json +1 -1
  24. package/packages/apps/correios/package.json +3 -3
  25. package/packages/apps/custom-payment/package.json +1 -1
  26. package/packages/apps/custom-shipping/package.json +1 -1
  27. package/packages/apps/datafrete/package.json +3 -3
  28. package/packages/apps/discounts/package.json +1 -1
  29. package/packages/apps/emails/lib/functios-lib/abandoned-carts.js +2 -1
  30. package/packages/apps/emails/lib/functios-lib/abandoned-carts.js.map +1 -1
  31. package/packages/apps/emails/package.json +2 -2
  32. package/packages/apps/emails/src/functios-lib/abandoned-carts.ts +2 -1
  33. package/packages/apps/fb-conversions/package.json +2 -2
  34. package/packages/apps/frenet/lib/functions-lib/tracking-codes.js +2 -1
  35. package/packages/apps/frenet/lib/functions-lib/tracking-codes.js.map +1 -1
  36. package/packages/apps/frenet/package.json +3 -3
  37. package/packages/apps/frenet/src/functions-lib/tracking-codes.ts +2 -1
  38. package/packages/apps/galaxpay/lib/functions-lib/ecom/events-to-galaxpay.js +1 -1
  39. package/packages/apps/galaxpay/lib/functions-lib/ecom/events-to-galaxpay.js.map +1 -1
  40. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js +101 -37
  41. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js.map +1 -1
  42. package/packages/apps/galaxpay/package.json +3 -3
  43. package/packages/apps/galaxpay/src/functions-lib/ecom/events-to-galaxpay.ts +1 -1
  44. package/packages/apps/galaxpay/src/functions-lib/galaxpay/webhook.ts +123 -39
  45. package/packages/apps/google-analytics/package.json +3 -3
  46. package/packages/apps/infinitepay/package.json +3 -3
  47. package/packages/apps/jadlog/package.json +2 -2
  48. package/packages/apps/loyalty-points/package.json +1 -1
  49. package/packages/apps/melhor-envio/lib/functions-lib/tracking-codes.js +1 -1
  50. package/packages/apps/melhor-envio/lib/functions-lib/tracking-codes.js.map +1 -1
  51. package/packages/apps/melhor-envio/package.json +3 -3
  52. package/packages/apps/melhor-envio/src/functions-lib/tracking-codes.ts +1 -1
  53. package/packages/apps/mercadopago/package.json +3 -3
  54. package/packages/apps/pagarme/package.json +3 -3
  55. package/packages/apps/paghiper/package.json +3 -3
  56. package/packages/apps/pix/package.json +3 -3
  57. package/packages/apps/tiny-erp/package.json +3 -3
  58. package/packages/apps/webhooks/package.json +3 -3
  59. package/packages/cli/package.json +1 -1
  60. package/packages/config/package.json +1 -1
  61. package/packages/emails/package.json +2 -2
  62. package/packages/events/package.json +2 -2
  63. package/packages/firebase/package.json +2 -2
  64. package/packages/i18n/package.json +1 -1
  65. package/packages/modules/package.json +3 -3
  66. package/packages/passport/package.json +2 -2
  67. package/packages/ssr/package.json +5 -5
  68. package/packages/storefront/client.d.ts +1 -1
  69. package/packages/storefront/config/storefront.cms.cjs +17 -12
  70. package/packages/storefront/config/storefront.cms.mjs +17 -12
  71. package/packages/storefront/dist/client/_astro/Carousel.dfb3f26a.js +1 -0
  72. package/packages/storefront/dist/client/_astro/HeroSlider.34436243.js +1 -0
  73. package/packages/storefront/dist/client/_astro/PitchBar.1c993792.js +1 -0
  74. package/packages/storefront/dist/client/_astro/Prices.70885f17.js +1 -0
  75. package/packages/storefront/dist/client/_astro/ShopHeader.e901fad5.js +4 -0
  76. package/packages/storefront/dist/client/_astro/_...slug_.9a31c59e.css +1 -0
  77. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.0c2b7f88.js +1 -0
  78. package/packages/storefront/dist/client/_astro/client.4e825332.js +1 -0
  79. package/packages/storefront/dist/client/_astro/{firebase-app.d090c84e.js → firebase-app.247497b8.js} +22 -22
  80. package/packages/storefront/dist/client/_astro/{format-money.ab6b71eb.js → format-money.f09b89ed.js} +1 -1
  81. package/packages/storefront/dist/client/_astro/{hoisted.541b5c05.js → hoisted.56fa2eff.js} +1 -1
  82. package/packages/storefront/dist/client/_astro/index.1eaf97c3.css +1 -0
  83. package/packages/storefront/dist/client/_astro/index.9018a8da.js +1 -0
  84. package/packages/storefront/dist/client/_astro/{modules-info.06ac0727.js → modules-info.2a72e536.js} +1 -1
  85. package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.1fd80976.js +1 -0
  86. package/packages/storefront/dist/client/_astro/session-utm.ac492493.js +1 -0
  87. package/packages/storefront/dist/client/img/uploads/ecom-icon.png +0 -0
  88. package/packages/storefront/dist/client/img/uploads/logo.png +0 -0
  89. package/packages/storefront/dist/client/manifest.webmanifest +1 -1
  90. package/packages/storefront/dist/client/sw.js +1 -1
  91. package/packages/storefront/dist/client/workbox-e0d788d4.js +1 -1
  92. package/packages/storefront/dist/server/chunks/{astro.9781c0a7.mjs → astro.39f7f387.mjs} +910 -295
  93. package/packages/storefront/dist/server/chunks/pages/{all.b355675e.mjs → all.b15cad2d.mjs} +408 -246
  94. package/packages/storefront/dist/server/entry.mjs +32 -19
  95. package/packages/storefront/dist/server/manifest.webmanifest +1 -1
  96. package/packages/storefront/package.json +15 -15
  97. package/packages/storefront/server.d.ts +1 -1
  98. package/packages/storefront/src/images/use-ssr-picture.ts +30 -10
  99. package/packages/storefront/src/lib/assets/base.css +4 -2
  100. package/packages/storefront/src/lib/cms.d.ts +14 -18
  101. package/packages/storefront/src/lib/components/Carousel.vue +16 -10
  102. package/packages/storefront/src/lib/components/CarouselControl.vue +2 -2
  103. package/packages/storefront/src/lib/components/Drawer.vue +5 -5
  104. package/packages/storefront/src/lib/components/HeroPicture.astro +54 -0
  105. package/packages/storefront/src/lib/components/LoginForm.vue +3 -2
  106. package/packages/storefront/src/lib/components/SocialNetworkLink.vue +2 -2
  107. package/packages/storefront/src/lib/components/_injection-keys.ts +5 -3
  108. package/packages/storefront/src/lib/components/globals/AImg.vue +4 -5
  109. package/packages/storefront/src/lib/components/globals/ALink.vue +2 -2
  110. package/packages/storefront/src/lib/components/globals/Fade.vue +5 -5
  111. package/packages/storefront/src/lib/composables/use-hero-slider.ts +38 -0
  112. package/packages/storefront/src/lib/composables/use-prices.ts +6 -3
  113. package/packages/storefront/src/lib/composables/use-shop-header.ts +30 -14
  114. package/packages/storefront/src/lib/composables/use-sticky-header.ts +15 -12
  115. package/packages/storefront/src/lib/layouts/Base.astro +1 -1
  116. package/packages/storefront/src/lib/layouts/BaseBody.astro +2 -2
  117. package/packages/storefront/src/lib/layouts/BaseHead.astro +2 -2
  118. package/packages/storefront/src/lib/layouts/sections/use-hero-section.ts +48 -0
  119. package/packages/storefront/src/lib/layouts/use-home-main.ts +16 -0
  120. package/packages/storefront/src/lib/layouts/use-page-layout.ts +41 -0
  121. package/packages/storefront/src/lib/pages/_vue.ts +1 -1
  122. package/packages/storefront/src/lib/scripts/modules-info-preset.ts +5 -2
  123. package/packages/storefront/src/lib/scripts/session-utm.ts +6 -1
  124. package/packages/storefront/src/lib/ssr-context.ts +24 -15
  125. package/packages/storefront/src/lib/state/customer-session.ts +14 -2
  126. package/packages/storefront/src/lib/state/shopping-cart/add-cart-item.ts +8 -10
  127. package/packages/storefront/src/lib/state/shopping-cart.ts +4 -3
  128. package/packages/storefront/src/vue-globals.d.ts +3 -2
  129. package/packages/storefront/tailwind.config.cjs +10 -3
  130. package/packages/storefront/tsconfig.json +3 -1
  131. package/packages/storefront/uno.config.cjs +8 -4
  132. package/packages/types/package.json +1 -1
  133. package/ecomplus-stores/monocard/functions/ssr/content/code.json +0 -5
  134. package/ecomplus-stores/monocard/functions/ssr/content/footer.json +0 -46
  135. package/ecomplus-stores/monocard/functions/ssr/content/header.json +0 -23
  136. package/ecomplus-stores/monocard/functions/ssr/content/menu.json +0 -6
  137. package/ecomplus-stores/monocard/functions/ssr/content/metatags.json +0 -5
  138. package/ecomplus-stores/monocard/functions/ssr/src/components/header/HeaderButtonLink.vue +0 -5
  139. package/ecomplus-stores/monocard/functions/ssr/src/components/header/HeaderButtons.vue +0 -39
  140. package/ecomplus-stores/monocard/functions/ssr/src/components/header/HeaderNav.vue +0 -61
  141. package/ecomplus-stores/monocard/functions/ssr/src/components/header/HeaderNavLink.vue +0 -5
  142. package/packages/storefront/dist/client/_astro/PitchBar.5d55c359.js +0 -1
  143. package/packages/storefront/dist/client/_astro/Prices.55399c72.js +0 -1
  144. package/packages/storefront/dist/client/_astro/ProductCard.7e891c08.js +0 -1
  145. package/packages/storefront/dist/client/_astro/ShopHeader.6bbe1a17.js +0 -4
  146. package/packages/storefront/dist/client/_astro/_...slug_.45f0edaf.css +0 -1
  147. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.77ed7c18.js +0 -1
  148. package/packages/storefront/dist/client/_astro/client.0de2f274.js +0 -1
  149. package/packages/storefront/dist/client/_astro/index.ff4f0b30.js +0 -1
  150. package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.d2f39f33.js +0 -1
  151. package/packages/storefront/dist/client/_astro/session-utm.72684b84.js +0 -1
  152. package/packages/storefront/dist/client/img/uploads/icon.png +0 -0
  153. package/packages/storefront/dist/client/img/uploads/large-icon.png +0 -0
  154. package/packages/storefront/dist/client/img/uploads/logo.webp +0 -0
  155. package/packages/storefront/src/lib/components/ProductCard.vue +0 -36
  156. package/packages/storefront/src/lib/layouts/PagesHeader.astro +0 -51
  157. /package/packages/storefront/dist/client/_astro/{index.0c833781.css → index.e56fc6b3.css} +0 -0
  158. /package/packages/storefront/dist/client/_astro/{server.1bc2fa51.css → server.1dabec03.css} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { compile } from 'path-to-regexp';
2
2
  import { serialize, parse } from 'cookie';
3
3
  import 'fs';
4
+ import 'http';
4
5
  import { TLSSocket } from 'tls';
5
6
  import mime from 'mime';
6
7
  import { yellow, dim, bold, cyan, red, reset } from 'kleur/colors';
@@ -53,201 +54,149 @@ function deserializeManifest(serializedManifest) {
53
54
  route.routeData = deserializeRouteData(serializedRoute.routeData);
54
55
  }
55
56
  const assets = new Set(serializedManifest.assets);
56
- const propagation = new Map(serializedManifest.propagation);
57
+ const componentMetadata = new Map(serializedManifest.componentMetadata);
57
58
  return {
58
59
  ...serializedManifest,
59
60
  assets,
60
- propagation,
61
+ componentMetadata,
61
62
  routes
62
63
  };
63
64
  }
64
65
 
65
- const DELETED_EXPIRATION = new Date(0);
66
- const DELETED_VALUE = "deleted";
67
- class AstroCookie {
68
- constructor(value) {
69
- this.value = value;
70
- }
71
- json() {
72
- if (this.value === void 0) {
73
- throw new Error(`Cannot convert undefined to an object.`);
74
- }
75
- return JSON.parse(this.value);
76
- }
77
- number() {
78
- return Number(this.value);
79
- }
80
- boolean() {
81
- if (this.value === "false")
82
- return false;
83
- if (this.value === "0")
84
- return false;
85
- return Boolean(this.value);
86
- }
87
- }
88
- class AstroCookies {
89
- #request;
90
- #requestValues;
91
- #outgoing;
92
- constructor(request) {
93
- this.#request = request;
94
- this.#requestValues = null;
95
- this.#outgoing = null;
96
- }
97
- delete(key, options) {
98
- const serializeOptions = {
99
- expires: DELETED_EXPIRATION
100
- };
101
- if (options == null ? void 0 : options.domain) {
102
- serializeOptions.domain = options.domain;
103
- }
104
- if (options == null ? void 0 : options.path) {
105
- serializeOptions.path = options.path;
106
- }
107
- this.#ensureOutgoingMap().set(key, [
108
- DELETED_VALUE,
109
- serialize(key, DELETED_VALUE, serializeOptions),
110
- false
111
- ]);
112
- }
113
- get(key) {
114
- if (this.#outgoing !== null && this.#outgoing.has(key)) {
115
- let [serializedValue, , isSetValue] = this.#outgoing.get(key);
116
- if (isSetValue) {
117
- return new AstroCookie(serializedValue);
118
- } else {
119
- return new AstroCookie(void 0);
120
- }
121
- }
122
- const values = this.#ensureParsed();
123
- const value = values[key];
124
- return new AstroCookie(value);
125
- }
126
- has(key) {
127
- if (this.#outgoing !== null && this.#outgoing.has(key)) {
128
- let [, , isSetValue] = this.#outgoing.get(key);
129
- return isSetValue;
130
- }
131
- const values = this.#ensureParsed();
132
- return !!values[key];
133
- }
134
- set(key, value, options) {
135
- let serializedValue;
136
- if (typeof value === "string") {
137
- serializedValue = value;
138
- } else {
139
- let toStringValue = value.toString();
140
- if (toStringValue === Object.prototype.toString.call(value)) {
141
- serializedValue = JSON.stringify(value);
142
- } else {
143
- serializedValue = toStringValue;
144
- }
145
- }
146
- const serializeOptions = {};
147
- if (options) {
148
- Object.assign(serializeOptions, options);
149
- }
150
- this.#ensureOutgoingMap().set(key, [
151
- serializedValue,
152
- serialize(key, serializedValue, serializeOptions),
153
- true
154
- ]);
155
- }
156
- *headers() {
157
- if (this.#outgoing == null)
158
- return;
159
- for (const [, value] of this.#outgoing) {
160
- yield value[1];
161
- }
162
- }
163
- #ensureParsed() {
164
- if (!this.#requestValues) {
165
- this.#parse();
166
- }
167
- if (!this.#requestValues) {
168
- this.#requestValues = {};
169
- }
170
- return this.#requestValues;
171
- }
172
- #ensureOutgoingMap() {
173
- if (!this.#outgoing) {
174
- this.#outgoing = /* @__PURE__ */ new Map();
175
- }
176
- return this.#outgoing;
177
- }
178
- #parse() {
179
- const raw = this.#request.headers.get("cookie");
180
- if (!raw) {
181
- return;
182
- }
183
- this.#requestValues = parse(raw);
184
- }
185
- }
186
-
187
- const astroCookiesSymbol = Symbol.for("astro.cookies");
188
- function attachToResponse(response, cookies) {
189
- Reflect.set(response, astroCookiesSymbol, cookies);
190
- }
191
- function getFromResponse(response) {
192
- let cookies = Reflect.get(response, astroCookiesSymbol);
193
- if (cookies != null) {
194
- return cookies;
195
- } else {
196
- return void 0;
197
- }
198
- }
199
- function* getSetCookiesFromResponse(response) {
200
- const cookies = getFromResponse(response);
201
- if (!cookies) {
202
- return [];
203
- }
204
- for (const headerValue of cookies.headers()) {
205
- yield headerValue;
206
- }
207
- return [];
208
- }
209
-
210
- const defineErrors = (errs) => errs;
211
- const AstroErrorData = defineErrors({
66
+ const AstroErrorData = {
67
+ /**
68
+ * @docs
69
+ * @kind heading
70
+ * @name Astro Errors
71
+ */
72
+ /**
73
+ * @docs
74
+ * @message
75
+ * Unknown compiler error.
76
+ * @see
77
+ * - [withastro/compiler issues list](https://astro.build/issues/compiler)
78
+ * @description
79
+ * Astro encountered an unknown error while compiling your files. In most cases, this is not your fault, but an issue in our compiler.
80
+ *
81
+ * If there isn't one already, please [create an issue](https://astro.build/issues/compiler).
82
+ */
212
83
  UnknownCompilerError: {
213
84
  title: "Unknown compiler error.",
214
85
  code: 1e3,
215
86
  hint: "This is almost always a problem with the Astro compiler, not your code. Please open an issue at https://astro.build/issues/compiler."
216
87
  },
88
+ // 1xxx and 2xxx codes are reserved for compiler errors and warnings respectively
89
+ /**
90
+ * @docs
91
+ * @see
92
+ * - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project)
93
+ * - [Astro.redirect](https://docs.astro.build/en/guides/server-side-rendering/#astroredirect)
94
+ * @description
95
+ * The `Astro.redirect` function is only available when [Server-side rendering](/en/guides/server-side-rendering/) is enabled.
96
+ *
97
+ * To redirect on a static website, the [meta refresh attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) can be used. Certain hosts also provide config-based redirects (ex: [Netlify redirects](https://docs.netlify.com/routing/redirects/)).
98
+ */
217
99
  StaticRedirectNotAvailable: {
218
100
  title: "`Astro.redirect` is not available in static mode.",
219
101
  code: 3001,
220
102
  message: "Redirects are only available when using `output: 'server'`. Update your Astro config if you need SSR features.",
221
103
  hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR."
222
104
  },
105
+ /**
106
+ * @docs
107
+ * @see
108
+ * - [Official integrations](https://docs.astro.build/en/guides/integrations-guide/#official-integrations)
109
+ * - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#astroclientaddress)
110
+ * @description
111
+ * The adapter you're using unfortunately does not support `Astro.clientAddress`.
112
+ */
223
113
  ClientAddressNotAvailable: {
224
114
  title: "`Astro.clientAddress` is not available in current adapter.",
225
115
  code: 3002,
226
116
  message: (adapterName) => `\`Astro.clientAddress\` is not available in the \`${adapterName}\` adapter. File an issue with the adapter to add support.`
227
117
  },
118
+ /**
119
+ * @docs
120
+ * @see
121
+ * - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project)
122
+ * - [Astro.clientAddress](https://docs.astro.build/en/reference/api-reference/#astroclientaddress)
123
+ * @description
124
+ * The `Astro.clientAddress` property is only available when [Server-side rendering](https://docs.astro.build/en/guides/server-side-rendering/) is enabled.
125
+ *
126
+ * To get the user's IP address in static mode, different APIs such as [Ipify](https://www.ipify.org/) can be used in a [Client-side script](https://docs.astro.build/en/guides/client-side-scripts/) or it may be possible to get the user's IP using a serverless function hosted on your hosting provider.
127
+ */
228
128
  StaticClientAddressNotAvailable: {
229
129
  title: "`Astro.clientAddress` is not available in static mode.",
230
130
  code: 3003,
231
131
  message: "`Astro.clientAddress` is only available when using `output: 'server'`. Update your Astro config if you need SSR features.",
232
132
  hint: "See https://docs.astro.build/en/guides/server-side-rendering/#enabling-ssr-in-your-project for more information on how to enable SSR."
233
133
  },
134
+ /**
135
+ * @docs
136
+ * @see
137
+ * - [getStaticPaths()](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
138
+ * @description
139
+ * A [dynamic route](https://docs.astro.build/en/core-concepts/routing/#dynamic-routes) was matched, but no corresponding path was found for the requested parameters. This is often caused by a typo in either the generated or the requested path.
140
+ */
234
141
  NoMatchingStaticPathFound: {
235
142
  title: "No static path found for requested path.",
236
143
  code: 3004,
237
144
  message: (pathName) => `A \`getStaticPaths()\` route pattern was matched, but no matching static path was found for requested path \`${pathName}\`.`,
238
145
  hint: (possibleRoutes) => `Possible dynamic routes being matched: ${possibleRoutes.join(", ")}.`
239
146
  },
147
+ /**
148
+ * @docs
149
+ * @message Route returned a `RETURNED_VALUE`. Only a Response can be returned from Astro files.
150
+ * @see
151
+ * - [Response](https://docs.astro.build/en/guides/server-side-rendering/#response)
152
+ * @description
153
+ * Only instances of [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned inside Astro files.
154
+ * ```astro title="pages/login.astro"
155
+ * ---
156
+ * return new Response(null, {
157
+ * status: 404,
158
+ * statusText: 'Not found'
159
+ * });
160
+ *
161
+ * // Alternatively, for redirects, Astro.redirect also returns an instance of Response
162
+ * return Astro.redirect('/login');
163
+ * ---
164
+ * ```
165
+ *
166
+ */
240
167
  OnlyResponseCanBeReturned: {
241
168
  title: "Invalid type returned by Astro page.",
242
169
  code: 3005,
243
170
  message: (route, returnedValue) => `Route \`${route ? route : ""}\` returned a \`${returnedValue}\`. Only a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned from Astro files.`,
244
171
  hint: "See https://docs.astro.build/en/guides/server-side-rendering/#response for more information."
245
172
  },
173
+ /**
174
+ * @docs
175
+ * @see
176
+ * - [`client:media`](https://docs.astro.build/en/reference/directives-reference/#clientmedia)
177
+ * @description
178
+ * A [media query](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries) parameter is required when using the `client:media` directive.
179
+ *
180
+ * ```astro
181
+ * <Counter client:media="(max-width: 640px)" />
182
+ * ```
183
+ */
246
184
  MissingMediaQueryDirective: {
247
185
  title: "Missing value for `client:media` directive.",
248
186
  code: 3006,
249
187
  message: 'Media query not provided for `client:media` directive. A media query similar to `client:media="(max-width: 600px)"` must be provided'
250
188
  },
189
+ /**
190
+ * @docs
191
+ * @message Unable to render `COMPONENT_NAME`. There are `RENDERER_COUNT` renderer(s) configured in your `astro.config.mjs` file, but none were able to server-side render `COMPONENT_NAME`.
192
+ * @see
193
+ * - [Frameworks components](https://docs.astro.build/en/core-concepts/framework-components/)
194
+ * - [UI Frameworks](https://docs.astro.build/en/guides/integrations-guide/#official-integrations)
195
+ * @description
196
+ * None of the installed integrations were able to render the component you imported. Make sure to install the appropriate integration for the type of component you are trying to include in your page.
197
+ *
198
+ * For JSX / TSX files, [@astrojs/react](https://docs.astro.build/en/guides/integrations-guide/react/), [@astrojs/preact](https://docs.astro.build/en/guides/integrations-guide/preact/) or [@astrojs/solid-js](https://docs.astro.build/en/guides/integrations-guide/solid-js/) can be used. For Vue and Svelte files, the [@astrojs/vue](https://docs.astro.build/en/guides/integrations-guide/vue/) and [@astrojs/svelte](https://docs.astro.build/en/guides/integrations-guide/svelte/) integrations can be used respectively
199
+ */
251
200
  NoMatchingRenderer: {
252
201
  title: "No matching renderer found.",
253
202
  code: 3007,
@@ -259,48 +208,175 @@ but ${plural ? "none were." : "it was not."} able to server-side render \`${comp
259
208
 
260
209
  See https://docs.astro.build/en/core-concepts/framework-components/ for more information on how to install and configure integrations.`
261
210
  },
211
+ /**
212
+ * @docs
213
+ * @see
214
+ * - [addRenderer option](https://docs.astro.build/en/reference/integrations-reference/#addrenderer-option)
215
+ * - [Hydrating framework components](https://docs.astro.build/en/core-concepts/framework-components/#hydrating-interactive-components)
216
+ * @description
217
+ * Astro tried to hydrate a component on the client, but the renderer used does not provide a client entrypoint to use to hydrate.
218
+ *
219
+ */
262
220
  NoClientEntrypoint: {
263
221
  title: "No client entrypoint specified in renderer.",
264
222
  code: 3008,
265
223
  message: (componentName, clientDirective, rendererName) => `\`${componentName}\` component has a \`client:${clientDirective}\` directive, but no client entrypoint was provided by \`${rendererName}\`.`,
266
224
  hint: "See https://docs.astro.build/en/reference/integrations-reference/#addrenderer-option for more information on how to configure your renderer."
267
225
  },
226
+ /**
227
+ * @docs
228
+ * @see
229
+ * - [`client:only`](https://docs.astro.build/en/reference/directives-reference/#clientonly)
230
+ * @description
231
+ *
232
+ * `client:only` components are not run on the server, as such Astro does not know (and cannot guess) which renderer to use and require a hint. Like such:
233
+ *
234
+ * ```astro
235
+ * <SomeReactComponent client:only="react" />
236
+ * ```
237
+ */
268
238
  NoClientOnlyHint: {
269
239
  title: "Missing hint on client:only directive.",
270
240
  code: 3009,
271
241
  message: (componentName) => `Unable to render \`${componentName}\`. When using the \`client:only\` hydration strategy, Astro needs a hint to use the correct renderer.`,
272
242
  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`
273
243
  },
244
+ /**
245
+ * @docs
246
+ * @see
247
+ * - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
248
+ * - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
249
+ * @description
250
+ * The `params` property in `getStaticPaths`'s return value (an array of objects) should also be an object.
251
+ *
252
+ * ```astro title="pages/blog/[id].astro"
253
+ * ---
254
+ * export async function getStaticPaths() {
255
+ * return [
256
+ * { params: { slug: "blog" } },
257
+ * { params: { slug: "about" } }
258
+ * ];
259
+ *}
260
+ *---
261
+ * ```
262
+ */
274
263
  InvalidGetStaticPathParam: {
275
264
  title: "Invalid value returned by a `getStaticPaths` path.",
276
265
  code: 3010,
277
266
  message: (paramType) => `Invalid params given to \`getStaticPaths\` path. Expected an \`object\`, got \`${paramType}\``,
278
267
  hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
279
268
  },
269
+ /**
270
+ * @docs
271
+ * @see
272
+ * - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
273
+ * - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
274
+ * @description
275
+ * `getStaticPaths`'s return value must be an array of objects.
276
+ *
277
+ * ```ts title="pages/blog/[id].astro"
278
+ * export async function getStaticPaths() {
279
+ * return [ // <-- Array
280
+ * { params: { slug: "blog" } },
281
+ * { params: { slug: "about" } }
282
+ * ];
283
+ *}
284
+ * ```
285
+ */
280
286
  InvalidGetStaticPathsReturn: {
281
287
  title: "Invalid value returned by getStaticPaths.",
282
288
  code: 3011,
283
289
  message: (returnType) => `Invalid type returned by \`getStaticPaths\`. Expected an \`array\`, got \`${returnType}\``,
284
290
  hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
285
291
  },
292
+ /**
293
+ * @docs
294
+ * @see
295
+ * - [RSS Guide](https://docs.astro.build/en/guides/rss/)
296
+ * @description
297
+ * `getStaticPaths` no longer expose an helper for generating a RSS feed. We recommend migrating to the [@astrojs/rss](https://docs.astro.build/en/guides/rss/#setting-up-astrojsrss)integration instead.
298
+ */
286
299
  GetStaticPathsRemovedRSSHelper: {
287
300
  title: "getStaticPaths RSS helper is not available anymore.",
288
301
  code: 3012,
289
302
  message: "The RSS helper has been removed from `getStaticPaths`. Try the new @astrojs/rss package instead.",
290
303
  hint: "See https://docs.astro.build/en/guides/rss/ for more information."
291
304
  },
305
+ /**
306
+ * @docs
307
+ * @see
308
+ * - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
309
+ * - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
310
+ * @description
311
+ * Every route specified by `getStaticPaths` require a `params` property specifying the path parameters needed to match the route.
312
+ *
313
+ * For instance, the following code:
314
+ * ```astro title="pages/blog/[id].astro"
315
+ * ---
316
+ * export async function getStaticPaths() {
317
+ * return [
318
+ * { params: { id: '1' } }
319
+ * ];
320
+ * }
321
+ * ---
322
+ * ```
323
+ * Will create the following route: `site.com/blog/1`.
324
+ */
292
325
  GetStaticPathsExpectedParams: {
293
326
  title: "Missing params property on `getStaticPaths` route.",
294
327
  code: 3013,
295
328
  message: "Missing or empty required `params` property on `getStaticPaths` route.",
296
329
  hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
297
330
  },
331
+ /**
332
+ * @docs
333
+ * @see
334
+ * - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
335
+ * - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
336
+ * @description
337
+ * Since `params` are encoded into the URL, only certain types are supported as values.
338
+ *
339
+ * ```astro title="/route/[id].astro"
340
+ * ---
341
+ * export async function getStaticPaths() {
342
+ * return [
343
+ * { params: { id: '1' } } // Works
344
+ * { params: { id: 2 } } // Works
345
+ * { params: { id: false } } // Does not work
346
+ * ];
347
+ * }
348
+ * ---
349
+ * ```
350
+ *
351
+ * In routes using [rest parameters](https://docs.astro.build/en/core-concepts/routing/#rest-parameters), `undefined` can be used to represent a path with no parameters passed in the URL:
352
+ *
353
+ * ```astro title="/route/[...id].astro"
354
+ * ---
355
+ * export async function getStaticPaths() {
356
+ * return [
357
+ * { params: { id: 1 } } // /route/1
358
+ * { params: { id: 2 } } // /route/2
359
+ * { params: { id: undefined } } // /route/
360
+ * ];
361
+ * }
362
+ * ---
363
+ * ```
364
+ */
298
365
  GetStaticPathsInvalidRouteParam: {
299
366
  title: "Invalid value for `getStaticPaths` route parameter.",
300
367
  code: 3014,
301
368
  message: (key, value, valueType) => `Invalid getStaticPaths route parameter for \`${key}\`. Expected undefined, a string or a number, received \`${valueType}\` (\`${value}\`)`,
302
369
  hint: "See https://docs.astro.build/en/reference/api-reference/#getstaticpaths for more information on getStaticPaths."
303
370
  },
371
+ /**
372
+ * @docs
373
+ * @see
374
+ * - [Dynamic Routes](https://docs.astro.build/en/core-concepts/routing/#dynamic-routes)
375
+ * - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
376
+ * - [Server-side Rendering](https://docs.astro.build/en/guides/server-side-rendering/)
377
+ * @description
378
+ * In [Static Mode](https://docs.astro.build/en/core-concepts/routing/#static-ssg-mode), all routes must be determined at build time. As such, dynamic routes must `export` a `getStaticPaths` function returning the different paths to generate.
379
+ */
304
380
  GetStaticPathsRequired: {
305
381
  title: "`getStaticPaths()` function required for dynamic routes.",
306
382
  code: 3015,
@@ -310,23 +386,51 @@ See https://docs.astro.build/en/core-concepts/framework-components/ for more inf
310
386
  Alternatively, set \`output: "server"\` in your Astro config file to switch to a non-static server build. This error can also occur if using \`export const prerender = true;\`.
311
387
  See https://docs.astro.build/en/guides/server-side-rendering/ for more information on non-static rendering.`
312
388
  },
389
+ /**
390
+ * @docs
391
+ * @see
392
+ * - [Named slots](https://docs.astro.build/en/core-concepts/astro-components/#named-slots)
393
+ * @description
394
+ * Certain words cannot be used for slot names due to being already used internally.
395
+ */
313
396
  ReservedSlotName: {
314
397
  title: "Invalid slot name.",
315
398
  code: 3016,
316
399
  message: (slotName) => `Unable to create a slot named \`${slotName}\`. \`${slotName}\` is a reserved slot name. Please update the name of this slot.`
317
400
  },
401
+ /**
402
+ * @docs
403
+ * @see
404
+ * - [Server-side Rendering](https://docs.astro.build/en/guides/server-side-rendering/)
405
+ * - [Adding an Adapter](https://docs.astro.build/en/guides/server-side-rendering/#adding-an-adapter)
406
+ * @description
407
+ * To use server-side rendering, an adapter needs to be installed so Astro knows how to generate the proper output for your targeted deployment platform.
408
+ */
318
409
  NoAdapterInstalled: {
319
410
  title: "Cannot use Server-side Rendering without an adapter.",
320
411
  code: 3017,
321
412
  message: `Cannot use \`output: 'server'\` without an adapter. Please install and configure the appropriate server adapter for your final deployment.`,
322
413
  hint: "See https://docs.astro.build/en/guides/server-side-rendering/ for more information."
323
414
  },
415
+ /**
416
+ * @docs
417
+ * @description
418
+ * No import statement was found for one of the components. If there is an import statement, make sure you are using the same identifier in both the imports and the component usage.
419
+ */
324
420
  NoMatchingImport: {
325
421
  title: "No import found for component.",
326
422
  code: 3018,
327
423
  message: (componentName) => `Could not render \`${componentName}\`. No matching import has been found for \`${componentName}\`.`,
328
424
  hint: "Please make sure the component is properly imported."
329
425
  },
426
+ /**
427
+ * @docs
428
+ * @message
429
+ * **Example error messages:**<br/>
430
+ * InvalidPrerenderExport: A `prerender` export has been detected, but its value cannot be statically analyzed.
431
+ * @description
432
+ * The `prerender` feature only supports a subset of valid JavaScript — be sure to use exactly `export const prerender = true` so that our compiler can detect this directive at build time. Variables, `let`, and `var` declarations are not supported.
433
+ */
330
434
  InvalidPrerenderExport: {
331
435
  title: "Invalid prerender export.",
332
436
  code: 3019,
@@ -342,35 +446,96 @@ Expected \`true\` value but got \`${suffix}\`.`;
342
446
  },
343
447
  hint: "Mutable values declared at runtime are not supported. Please make sure to use exactly `export const prerender = true`."
344
448
  },
449
+ /**
450
+ * @docs
451
+ * @message
452
+ * **Example error messages:**<br/>
453
+ * InvalidComponentArgs: Invalid arguments passed to `<MyAstroComponent>` component.
454
+ * @description
455
+ * Astro components cannot be rendered manually via a function call, such as `Component()` or `{items.map(Component)}`. Prefer the component syntax `<Component />` or `{items.map(item => <Component {...item} />)}`.
456
+ */
345
457
  InvalidComponentArgs: {
346
458
  title: "Invalid component arguments.",
347
459
  code: 3020,
348
460
  message: (name) => `Invalid arguments passed to${name ? ` <${name}>` : ""} component.`,
349
461
  hint: "Astro components cannot be rendered directly via function call, such as `Component()` or `{items.map(Component)}`."
350
462
  },
463
+ /**
464
+ * @docs
465
+ * @see
466
+ * - [Pagination](https://docs.astro.build/en/core-concepts/routing/#pagination)
467
+ * @description
468
+ * The page number parameter was not found in your filepath.
469
+ */
351
470
  PageNumberParamNotFound: {
352
471
  title: "Page number param not found.",
353
472
  code: 3021,
354
473
  message: (paramName) => `[paginate()] page number param \`${paramName}\` not found in your filepath.`,
355
474
  hint: "Rename your file to `[page].astro` or `[...page].astro`."
356
475
  },
476
+ /**
477
+ * @docs
478
+ * @see
479
+ * - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
480
+ * - [Image component](https://docs.astro.build/en/guides/assets/#image--astroassets)
481
+ * - [Image component#alt](https://docs.astro.build/en/guides/assets/#alt-required)
482
+ * @description
483
+ * The `alt` property allows you to provide descriptive alt text to users of screen readers and other assistive technologies. In order to ensure your images are accessible, the `Image` component requires that an `alt` be specified.
484
+ *
485
+ * If the image is merely decorative (i.e. doesn’t contribute to the understanding of the page), set `alt=""` so that screen readers know to ignore the image.
486
+ */
357
487
  ImageMissingAlt: {
358
- title: "Missing alt property",
488
+ title: "Missing alt property.",
359
489
  code: 3022,
360
490
  message: "The alt property is required.",
361
491
  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."
362
492
  },
493
+ /**
494
+ * @docs
495
+ * @see
496
+ * - [Image Service API](https://docs.astro.build/en/reference/image-service-reference/)
497
+ * @description
498
+ * There was an error while loading the configured image service. This can be caused by various factors, such as your image service not properly exporting a compatible object in its default export, or an incorrect path.
499
+ *
500
+ * If you believe that your service is properly configured and this error is wrong, please [open an issue](https://astro.build/issues/).
501
+ */
363
502
  InvalidImageService: {
364
- title: "Error while loading image service",
503
+ title: "Error while loading image service.",
365
504
  code: 3023,
366
505
  message: "There was an error loading the configured image service. Please see the stack trace for more information."
367
506
  },
507
+ /**
508
+ * @docs
509
+ * @message
510
+ * Missing width and height attributes for `IMAGE_URL`. When using remote images, both dimensions are always required in order to avoid cumulative layout shift (CLS).
511
+ * @see
512
+ * - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
513
+ * - [Image component#width-and-height](https://docs.astro.build/en/guides/assets/#width-and-height)
514
+ * @description
515
+ * For remote images, `width` and `height` cannot be inferred from the original file. As such, in order to avoid CLS, those two properties are always required.
516
+ *
517
+ * 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).
518
+ */
368
519
  MissingImageDimension: {
369
520
  title: "Missing image dimensions",
370
521
  code: 3024,
371
522
  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.`,
372
523
  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)."
373
524
  },
525
+ /**
526
+ * @docs
527
+ * @description
528
+ * The built-in image services do not currently support optimizing all image formats.
529
+ *
530
+ * For unsupported formats such as SVGs and GIFs, you may be able to use an `img` tag directly:
531
+ * ```astro
532
+ * ---
533
+ * import rocket from '../assets/images/rocket.svg'
534
+ * ---
535
+ *
536
+ * <img src={rocket.src} width={rocket.width} height={rocket.height} alt="A rocketship in space." />
537
+ * ```
538
+ */
374
539
  UnsupportedImageFormat: {
375
540
  title: "Unsupported image format",
376
541
  code: 3025,
@@ -379,90 +544,346 @@ Expected \`true\` value but got \`${suffix}\`.`;
379
544
  )} are supported for optimization.`,
380
545
  hint: "If you do not need optimization, using an `img` tag directly instead of the `Image` component might be what you're looking for."
381
546
  },
547
+ /**
548
+ * @docs
549
+ * @see
550
+ * - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
551
+ * - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
552
+ * @description
553
+ * The endpoint is prerendered with an `undefined` param so the generated path will collide with another route.
554
+ *
555
+ * If you cannot prevent passing `undefined`, then an additional extension can be added to the endpoint file name to generate the file with a different name. For example, renaming `pages/api/[slug].ts` to `pages/api/[slug].json.ts`.
556
+ */
557
+ PrerenderDynamicEndpointPathCollide: {
558
+ title: "Prerendered dynamic endpoint has path collision.",
559
+ code: 3026,
560
+ 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.`,
561
+ hint: (filename) => `Rename \`${filename}\` to \`${filename.replace(/\.(js|ts)/, (m) => `.json` + m)}\``
562
+ },
563
+ /**
564
+ * @docs
565
+ * @see
566
+ * - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
567
+ * @description
568
+ * An image's `src` property is not valid. The Image component requires the `src` attribute to be either an image that has been ESM imported or a string. This is also true for the first parameter of `getImage()`.
569
+ *
570
+ * ```astro
571
+ * ---
572
+ * import { Image } from "astro:assets";
573
+ * import myImage from "../assets/my_image.png";
574
+ * ---
575
+ *
576
+ * <Image src={myImage} alt="..." />
577
+ * <Image src="https://example.com/logo.png" width={300} height={300} alt="..." />
578
+ * ```
579
+ *
580
+ * In most cases, this error happens when the value passed to `src` is undefined.
581
+ */
582
+ ExpectedImage: {
583
+ title: "Expected src to be an image.",
584
+ code: 3027,
585
+ message: (options) => `Expected \`src\` property to be either an ESM imported image or a string with the path of a remote image. Received \`${options}\`.`,
586
+ hint: "This error can often happen because of a wrong path. Make sure the path to your image is correct."
587
+ },
588
+ /**
589
+ * @docs
590
+ * @see
591
+ * - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
592
+ * @description
593
+ * `getImage()`'s first parameter should be an object with the different properties to apply to your image.
594
+ *
595
+ * ```ts
596
+ * import { getImage } from "astro:assets";
597
+ * import myImage from "../assets/my_image.png";
598
+ *
599
+ * const optimizedImage = await getImage({src: myImage, width: 300, height: 300});
600
+ * ```
601
+ *
602
+ * In most cases, this error happens because parameters were passed directly instead of inside an object.
603
+ */
604
+ ExpectedImageOptions: {
605
+ title: "Expected image options.",
606
+ code: 3028,
607
+ message: (options) => `Expected getImage() parameter to be an object. Received \`${options}\`.`
608
+ },
609
+ /**
610
+ * @docs
611
+ * @message
612
+ * Could not find requested image `IMAGE_PATH` at `FULL_IMAGE_PATH`.
613
+ * @see
614
+ * - [Assets (Experimental)](https://docs.astro.build/en/guides/assets/)
615
+ * @description
616
+ * Astro could not find an image you included in your Markdown content. Usually, this is simply caused by a typo in the path.
617
+ *
618
+ * Images in Markdown are relative to the current file. To refer to an image that is located in the same folder as the `.md` file, the path should start with `./`
619
+ */
620
+ MarkdownImageNotFound: {
621
+ title: "Image not found.",
622
+ code: 3029,
623
+ message: (imagePath, fullImagePath) => `Could not find requested image \`${imagePath}\`${fullImagePath ? ` at \`${fullImagePath}\`.` : "."}`,
624
+ hint: "This is often caused by a typo in the image path. Please make sure the file exists, and is spelled correctly."
625
+ },
626
+ /**
627
+ * @docs
628
+ * @description
629
+ * Making changes to the response, such as setting headers, cookies, and the status code cannot be done outside of page components.
630
+ */
631
+ ResponseSentError: {
632
+ title: "Unable to set response",
633
+ code: 3030,
634
+ message: "The response has already been sent to the browser and cannot be altered."
635
+ },
636
+ // No headings here, that way Vite errors are merged with Astro ones in the docs, which makes more sense to users.
637
+ // Vite Errors - 4xxx
638
+ /**
639
+ * @docs
640
+ * @see
641
+ * - [Vite troubleshooting guide](https://vitejs.dev/guide/troubleshooting.html)
642
+ * @description
643
+ * Vite encountered an unknown error while rendering your project. We unfortunately do not know what happened (or we would tell you!)
644
+ *
645
+ * If you can reliably cause this error to happen, we'd appreciate if you could [open an issue](https://astro.build/issues/)
646
+ */
382
647
  UnknownViteError: {
383
648
  title: "Unknown Vite Error.",
384
649
  code: 4e3
385
650
  },
651
+ /**
652
+ * @docs
653
+ * @see
654
+ * - [Type Imports](https://docs.astro.build/en/guides/typescript/#type-imports)
655
+ * @description
656
+ * Astro could not import the requested file. Oftentimes, this is caused by the import path being wrong (either because the file does not exist, or there is a typo in the path)
657
+ *
658
+ * This message can also appear when a type is imported without specifying that it is a [type import](https://docs.astro.build/en/guides/typescript/#type-imports).
659
+ */
386
660
  FailedToLoadModuleSSR: {
387
661
  title: "Could not import file.",
388
662
  code: 4001,
389
663
  message: (importName) => `Could not import \`${importName}\`.`,
390
664
  hint: "This is often caused by a typo in the import path. Please make sure the file exists."
391
665
  },
666
+ /**
667
+ * @docs
668
+ * @see
669
+ * - [Glob Patterns](https://docs.astro.build/en/guides/imports/#glob-patterns)
670
+ * @description
671
+ * Astro encountered an invalid glob pattern. This is often caused by the glob pattern not being a valid file path.
672
+ */
392
673
  InvalidGlob: {
393
674
  title: "Invalid glob pattern.",
394
675
  code: 4002,
395
676
  message: (globPattern) => `Invalid glob pattern: \`${globPattern}\`. Glob patterns must start with './', '../' or '/'.`,
396
677
  hint: "See https://docs.astro.build/en/guides/imports/#glob-patterns for more information on supported glob patterns."
397
678
  },
679
+ /**
680
+ * @docs
681
+ * @kind heading
682
+ * @name CSS Errors
683
+ */
684
+ // CSS Errors - 5xxx
685
+ /**
686
+ * @docs
687
+ * @see
688
+ * - [Styles and CSS](https://docs.astro.build/en/guides/styling/)
689
+ * @description
690
+ * Astro encountered an unknown error while parsing your CSS. Oftentimes, this is caused by a syntax error and the error message should contain more information.
691
+ */
398
692
  UnknownCSSError: {
399
693
  title: "Unknown CSS Error.",
400
694
  code: 5e3
401
695
  },
696
+ /**
697
+ * @docs
698
+ * @message
699
+ * **Example error messages:**<br/>
700
+ * CSSSyntaxError: Missed semicolon<br/>
701
+ * CSSSyntaxError: Unclosed string<br/>
702
+ * @description
703
+ * Astro encountered an error while parsing your CSS, due to a syntax error. This is often caused by a missing semicolon.
704
+ */
402
705
  CSSSyntaxError: {
403
706
  title: "CSS Syntax Error.",
404
707
  code: 5001
405
708
  },
709
+ /**
710
+ * @docs
711
+ * @kind heading
712
+ * @name Markdown Errors
713
+ */
714
+ // Markdown Errors - 6xxx
715
+ /**
716
+ * @docs
717
+ * @description
718
+ * Astro encountered an unknown error while parsing your Markdown. Oftentimes, this is caused by a syntax error and the error message should contain more information.
719
+ */
406
720
  UnknownMarkdownError: {
407
721
  title: "Unknown Markdown Error.",
408
722
  code: 6e3
409
723
  },
724
+ /**
725
+ * @docs
726
+ * @message
727
+ * **Example error messages:**<br/>
728
+ * can not read an implicit mapping pair; a colon is missed<br/>
729
+ * unexpected end of the stream within a double quoted scalar<br/>
730
+ * can not read a block mapping entry; a multiline key may not be an implicit key
731
+ * @description
732
+ * Astro encountered an error while parsing the frontmatter of your Markdown file.
733
+ * This is often caused by a mistake in the syntax, such as a missing colon or a missing end quote.
734
+ */
410
735
  MarkdownFrontmatterParseError: {
411
736
  title: "Failed to parse Markdown frontmatter.",
412
737
  code: 6001
413
738
  },
739
+ /**
740
+ * @docs
741
+ * @see
742
+ * - [Modifying frontmatter programmatically](https://docs.astro.build/en/guides/markdown-content/#modifying-frontmatter-programmatically)
743
+ * @description
744
+ * A remark or rehype plugin attempted to inject invalid frontmatter. This occurs when "astro.frontmatter" is set to `null`, `undefined`, or an invalid JSON object.
745
+ */
414
746
  InvalidFrontmatterInjectionError: {
415
747
  title: "Invalid frontmatter injection.",
416
748
  code: 6003,
417
749
  message: 'A remark or rehype plugin attempted to inject invalid frontmatter. Ensure "astro.frontmatter" is set to a valid JSON object that is not `null` or `undefined`.',
418
750
  hint: "See the frontmatter injection docs https://docs.astro.build/en/guides/markdown-content/#modifying-frontmatter-programmatically for more information."
419
751
  },
752
+ /**
753
+ * @docs
754
+ * @see
755
+ * - [MDX installation and usage](https://docs.astro.build/en/guides/integrations-guide/mdx/)
756
+ * @description
757
+ * Unable to find the official `@astrojs/mdx` integration. This error is raised when using MDX files without an MDX integration installed.
758
+ */
420
759
  MdxIntegrationMissingError: {
421
760
  title: "MDX integration missing.",
422
761
  code: 6004,
423
762
  message: (file) => `Unable to render ${file}. Ensure that the \`@astrojs/mdx\` integration is installed.`,
424
763
  hint: "See the MDX integration docs for installation and usage instructions: https://docs.astro.build/en/guides/integrations-guide/mdx/"
425
764
  },
765
+ // Config Errors - 7xxx
766
+ /**
767
+ * @docs
768
+ * @see
769
+ * - [Configuration Reference](https://docs.astro.build/en/reference/configuration-reference/)
770
+ * @description
771
+ * Astro encountered an unknown error loading your Astro configuration file.
772
+ * This is often caused by a syntax error in your config and the message should offer more information.
773
+ *
774
+ * If you can reliably cause this error to happen, we'd appreciate if you could [open an issue](https://astro.build/issues/)
775
+ */
426
776
  UnknownConfigError: {
427
777
  title: "Unknown configuration error.",
428
778
  code: 7e3
429
779
  },
780
+ /**
781
+ * @docs
782
+ * @see
783
+ * - [--config](https://docs.astro.build/en/reference/cli-reference/#--config-path)
784
+ * @description
785
+ * The specified configuration file using `--config` could not be found. Make sure that it exists or that the path is correct
786
+ */
430
787
  ConfigNotFound: {
431
788
  title: "Specified configuration file not found.",
432
789
  code: 7001,
433
790
  message: (configFile) => `Unable to resolve \`--config "${configFile}"\`. Does the file exist?`
434
791
  },
792
+ /**
793
+ * @docs
794
+ * @see
795
+ * - [Configuration reference](https://docs.astro.build/en/reference/configuration-reference/)
796
+ * @description
797
+ * Astro detected a legacy configuration option in your configuration file.
798
+ */
435
799
  ConfigLegacyKey: {
436
800
  title: "Legacy configuration detected.",
437
801
  code: 7002,
438
802
  message: (legacyConfigKey) => `Legacy configuration detected: \`${legacyConfigKey}\`.`,
439
803
  hint: "Please update your configuration to the new format.\nSee https://astro.build/config for more information."
440
804
  },
805
+ /**
806
+ * @docs
807
+ * @kind heading
808
+ * @name CLI Errors
809
+ */
810
+ // CLI Errors - 8xxx
811
+ /**
812
+ * @docs
813
+ * @description
814
+ * Astro encountered an unknown error while starting one of its CLI commands. The error message should contain more information.
815
+ *
816
+ * If you can reliably cause this error to happen, we'd appreciate if you could [open an issue](https://astro.build/issues/)
817
+ */
441
818
  UnknownCLIError: {
442
819
  title: "Unknown CLI Error.",
443
820
  code: 8e3
444
821
  },
822
+ /**
823
+ * @docs
824
+ * @description
825
+ * `astro sync` command failed to generate content collection types.
826
+ * @see
827
+ * - [Content collections documentation](https://docs.astro.build/en/guides/content-collections/)
828
+ */
445
829
  GenerateContentTypesError: {
446
830
  title: "Failed to generate content types.",
447
831
  code: 8001,
448
- message: "`astro sync` command failed to generate content collection types.",
832
+ message: (errorMessage) => `\`astro sync\` command failed to generate content collection types: ${errorMessage}`,
449
833
  hint: "Check your `src/content/config.*` file for typos."
450
834
  },
835
+ /**
836
+ * @docs
837
+ * @kind heading
838
+ * @name Content Collection Errors
839
+ */
840
+ // Content Collection Errors - 9xxx
841
+ /**
842
+ * @docs
843
+ * @description
844
+ * Astro encountered an unknown error loading your content collections.
845
+ * This can be caused by certain errors inside your `src/content/config.ts` file or some internal errors.
846
+ *
847
+ * If you can reliably cause this error to happen, we'd appreciate if you could [open an issue](https://astro.build/issues/)
848
+ */
451
849
  UnknownContentCollectionError: {
452
850
  title: "Unknown Content Collection Error.",
453
851
  code: 9e3
454
852
  },
853
+ /**
854
+ * @docs
855
+ * @message
856
+ * **Example error message:**<br/>
857
+ * **blog** → **post.md** frontmatter does not match collection schema.<br/>
858
+ * "title" is required.<br/>
859
+ * "date" must be a valid date.
860
+ * @description
861
+ * A Markdown or MDX entry in `src/content/` does not match its collection schema.
862
+ * Make sure that all required fields are present, and that all fields are of the correct type.
863
+ * You can check against the collection schema in your `src/content/config.*` file.
864
+ * See the [Content collections documentation](https://docs.astro.build/en/guides/content-collections/) for more information.
865
+ */
455
866
  InvalidContentEntryFrontmatterError: {
456
867
  title: "Content entry frontmatter does not match schema.",
457
868
  code: 9001,
458
869
  message: (collection, entryId, error) => {
459
870
  return [
460
- `${String(collection)} \u2192 ${String(entryId)} frontmatter does not match collection schema.`,
871
+ `**${String(collection)} \u2192 ${String(
872
+ entryId
873
+ )}** frontmatter does not match collection schema.`,
461
874
  ...error.errors.map((zodError) => zodError.message)
462
875
  ].join("\n");
463
876
  },
464
877
  hint: "See https://docs.astro.build/en/guides/content-collections/ for more information on content schemas."
465
878
  },
879
+ /**
880
+ * @docs
881
+ * @message `COLLECTION_NAME` → `ENTRY_ID` has an invalid slug. `slug` must be a string.
882
+ * @see
883
+ * - [The reserved entry `slug` field](https://docs.astro.build/en/guides/content-collections/)
884
+ * @description
885
+ * An entry in `src/content/` has an invalid `slug`. This field is reserved for generating entry slugs, and must be a string when present.
886
+ */
466
887
  InvalidContentEntrySlugError: {
467
888
  title: "Invalid content entry slug.",
468
889
  code: 9002,
@@ -473,6 +894,14 @@ Expected \`true\` value but got \`${suffix}\`.`;
473
894
  },
474
895
  hint: "See https://docs.astro.build/en/guides/content-collections/ for more on the `slug` field."
475
896
  },
897
+ /**
898
+ * @docs
899
+ * @message A content collection schema should not contain `slug` since it is reserved for slug generation. Remove this from your `COLLECTION_NAME` collection schema.
900
+ * @see
901
+ * - [The reserved entry `slug` field](https://docs.astro.build/en/guides/content-collections/)
902
+ * @description
903
+ * A content collection schema should not contain the `slug` field. This is reserved by Astro for generating entry slugs. Remove the `slug` field from your schema, or choose a different name.
904
+ */
476
905
  ContentSchemaContainsSlugError: {
477
906
  title: "Content Schema should not contain `slug`.",
478
907
  code: 9003,
@@ -481,11 +910,12 @@ Expected \`true\` value but got \`${suffix}\`.`;
481
910
  },
482
911
  hint: "See https://docs.astro.build/en/guides/content-collections/ for more on the `slug` field."
483
912
  },
913
+ // Generic catch-all - Only use this in extreme cases, like if there was a cosmic ray bit flip
484
914
  UnknownError: {
485
915
  title: "Unknown Error.",
486
916
  code: 99999
487
917
  }
488
- });
918
+ };
489
919
 
490
920
  function normalizeLF(code) {
491
921
  return code.replace(/\r\n|\r(?!\n)|\n/g, "\n");
@@ -574,6 +1004,191 @@ class AstroError extends Error {
574
1004
  }
575
1005
  }
576
1006
 
1007
+ const DELETED_EXPIRATION = /* @__PURE__ */ new Date(0);
1008
+ const DELETED_VALUE = "deleted";
1009
+ const responseSentSymbol$2 = Symbol.for("astro.responseSent");
1010
+ class AstroCookie {
1011
+ constructor(value) {
1012
+ this.value = value;
1013
+ }
1014
+ json() {
1015
+ if (this.value === void 0) {
1016
+ throw new Error(`Cannot convert undefined to an object.`);
1017
+ }
1018
+ return JSON.parse(this.value);
1019
+ }
1020
+ number() {
1021
+ return Number(this.value);
1022
+ }
1023
+ boolean() {
1024
+ if (this.value === "false")
1025
+ return false;
1026
+ if (this.value === "0")
1027
+ return false;
1028
+ return Boolean(this.value);
1029
+ }
1030
+ }
1031
+ class AstroCookies {
1032
+ #request;
1033
+ #requestValues;
1034
+ #outgoing;
1035
+ constructor(request) {
1036
+ this.#request = request;
1037
+ this.#requestValues = null;
1038
+ this.#outgoing = null;
1039
+ }
1040
+ /**
1041
+ * Astro.cookies.delete(key) is used to delete a cookie. Using this method will result
1042
+ * in a Set-Cookie header added to the response.
1043
+ * @param key The cookie to delete
1044
+ * @param options Options related to this deletion, such as the path of the cookie.
1045
+ */
1046
+ delete(key, options) {
1047
+ const serializeOptions = {
1048
+ expires: DELETED_EXPIRATION
1049
+ };
1050
+ if (options == null ? void 0 : options.domain) {
1051
+ serializeOptions.domain = options.domain;
1052
+ }
1053
+ if (options == null ? void 0 : options.path) {
1054
+ serializeOptions.path = options.path;
1055
+ }
1056
+ this.#ensureOutgoingMap().set(key, [
1057
+ DELETED_VALUE,
1058
+ serialize(key, DELETED_VALUE, serializeOptions),
1059
+ false
1060
+ ]);
1061
+ }
1062
+ /**
1063
+ * Astro.cookies.get(key) is used to get a cookie value. The cookie value is read from the
1064
+ * request. If you have set a cookie via Astro.cookies.set(key, value), the value will be taken
1065
+ * from that set call, overriding any values already part of the request.
1066
+ * @param key The cookie to get.
1067
+ * @returns An object containing the cookie value as well as convenience methods for converting its value.
1068
+ */
1069
+ get(key) {
1070
+ if (this.#outgoing !== null && this.#outgoing.has(key)) {
1071
+ let [serializedValue, , isSetValue] = this.#outgoing.get(key);
1072
+ if (isSetValue) {
1073
+ return new AstroCookie(serializedValue);
1074
+ } else {
1075
+ return new AstroCookie(void 0);
1076
+ }
1077
+ }
1078
+ const values = this.#ensureParsed();
1079
+ const value = values[key];
1080
+ return new AstroCookie(value);
1081
+ }
1082
+ /**
1083
+ * Astro.cookies.has(key) returns a boolean indicating whether this cookie is either
1084
+ * part of the initial request or set via Astro.cookies.set(key)
1085
+ * @param key The cookie to check for.
1086
+ * @returns
1087
+ */
1088
+ has(key) {
1089
+ if (this.#outgoing !== null && this.#outgoing.has(key)) {
1090
+ let [, , isSetValue] = this.#outgoing.get(key);
1091
+ return isSetValue;
1092
+ }
1093
+ const values = this.#ensureParsed();
1094
+ return !!values[key];
1095
+ }
1096
+ /**
1097
+ * Astro.cookies.set(key, value) is used to set a cookie's value. If provided
1098
+ * an object it will be stringified via JSON.stringify(value). Additionally you
1099
+ * can provide options customizing how this cookie will be set, such as setting httpOnly
1100
+ * in order to prevent the cookie from being read in client-side JavaScript.
1101
+ * @param key The name of the cookie to set.
1102
+ * @param value A value, either a string or other primitive or an object.
1103
+ * @param options Options for the cookie, such as the path and security settings.
1104
+ */
1105
+ set(key, value, options) {
1106
+ let serializedValue;
1107
+ if (typeof value === "string") {
1108
+ serializedValue = value;
1109
+ } else {
1110
+ let toStringValue = value.toString();
1111
+ if (toStringValue === Object.prototype.toString.call(value)) {
1112
+ serializedValue = JSON.stringify(value);
1113
+ } else {
1114
+ serializedValue = toStringValue;
1115
+ }
1116
+ }
1117
+ const serializeOptions = {};
1118
+ if (options) {
1119
+ Object.assign(serializeOptions, options);
1120
+ }
1121
+ this.#ensureOutgoingMap().set(key, [
1122
+ serializedValue,
1123
+ serialize(key, serializedValue, serializeOptions),
1124
+ true
1125
+ ]);
1126
+ if (this.#request[responseSentSymbol$2]) {
1127
+ throw new AstroError({
1128
+ ...AstroErrorData.ResponseSentError
1129
+ });
1130
+ }
1131
+ }
1132
+ /**
1133
+ * Astro.cookies.header() returns an iterator for the cookies that have previously
1134
+ * been set by either Astro.cookies.set() or Astro.cookies.delete().
1135
+ * This method is primarily used by adapters to set the header on outgoing responses.
1136
+ * @returns
1137
+ */
1138
+ *headers() {
1139
+ if (this.#outgoing == null)
1140
+ return;
1141
+ for (const [, value] of this.#outgoing) {
1142
+ yield value[1];
1143
+ }
1144
+ }
1145
+ #ensureParsed() {
1146
+ if (!this.#requestValues) {
1147
+ this.#parse();
1148
+ }
1149
+ if (!this.#requestValues) {
1150
+ this.#requestValues = {};
1151
+ }
1152
+ return this.#requestValues;
1153
+ }
1154
+ #ensureOutgoingMap() {
1155
+ if (!this.#outgoing) {
1156
+ this.#outgoing = /* @__PURE__ */ new Map();
1157
+ }
1158
+ return this.#outgoing;
1159
+ }
1160
+ #parse() {
1161
+ const raw = this.#request.headers.get("cookie");
1162
+ if (!raw) {
1163
+ return;
1164
+ }
1165
+ this.#requestValues = parse(raw);
1166
+ }
1167
+ }
1168
+
1169
+ const astroCookiesSymbol = Symbol.for("astro.cookies");
1170
+ function attachToResponse(response, cookies) {
1171
+ Reflect.set(response, astroCookiesSymbol, cookies);
1172
+ }
1173
+ function getFromResponse(response) {
1174
+ let cookies = Reflect.get(response, astroCookiesSymbol);
1175
+ if (cookies != null) {
1176
+ return cookies;
1177
+ } else {
1178
+ return void 0;
1179
+ }
1180
+ }
1181
+ function* getSetCookiesFromResponse(response) {
1182
+ const cookies = getFromResponse(response);
1183
+ if (!cookies) {
1184
+ return [];
1185
+ }
1186
+ for (const headerValue of cookies.headers()) {
1187
+ yield headerValue;
1188
+ }
1189
+ return [];
1190
+ }
1191
+
577
1192
  function validateArgs(args) {
578
1193
  if (args.length !== 3)
579
1194
  return false;
@@ -611,7 +1226,7 @@ function createComponent(arg1, moduleId) {
611
1226
  }
612
1227
  }
613
1228
 
614
- const ASTRO_VERSION = "2.1.2";
1229
+ const ASTRO_VERSION = "2.3.0";
615
1230
 
616
1231
  function createAstroGlobFn() {
617
1232
  const globHandler = (importMetaGlobResult, globValue) => {
@@ -883,7 +1498,7 @@ var media_prebuilt_default = `(self.Astro=self.Astro||{}).media=(s,a)=>{const t=
883
1498
 
884
1499
  var only_prebuilt_default = `(self.Astro=self.Astro||{}).only=t=>{(async()=>await(await t())())()},window.dispatchEvent(new Event("astro:only"));`;
885
1500
 
886
- var visible_prebuilt_default = `(self.Astro=self.Astro||{}).visible=(s,c,n)=>{const r=async()=>{await(await s())()};let i=new IntersectionObserver(e=>{for(const t of e)if(!!t.isIntersecting){i.disconnect(),r();break}});for(let e=0;e<n.children.length;e++){const t=n.children[e];i.observe(t)}},window.dispatchEvent(new Event("astro:visible"));`;
1501
+ var visible_prebuilt_default = `(self.Astro=self.Astro||{}).visible=(s,c,n)=>{const r=async()=>{await(await s())()};let i=new IntersectionObserver(e=>{for(const t of e)if(t.isIntersecting){i.disconnect(),r();break}});for(let e=0;e<n.children.length;e++){const t=n.children[e];i.observe(t)}},window.dispatchEvent(new Event("astro:visible"));`;
887
1502
 
888
1503
  var astro_island_prebuilt_default = `var l;{const c={0:t=>t,1:t=>JSON.parse(t,o),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,o)),5:t=>new Set(JSON.parse(t,o)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(JSON.parse(t)),9:t=>new Uint16Array(JSON.parse(t)),10:t=>new Uint32Array(JSON.parse(t))},o=(t,s)=>{if(t===""||!Array.isArray(s))return s;const[e,n]=s;return e in c?c[e](n):void 0};customElements.get("astro-island")||customElements.define("astro-island",(l=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=()=>{if(!this.hydrator||this.parentElement&&this.parentElement.closest("astro-island[ssr]"))return;const s=this.querySelectorAll("astro-slot"),e={},n=this.querySelectorAll("template[data-astro-template]");for(const r of n){const i=r.closest(this.tagName);!i||!i.isSameNode(this)||(e[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(const r of s){const i=r.closest(this.tagName);!i||!i.isSameNode(this)||(e[r.getAttribute("name")||"default"]=r.innerHTML)}const a=this.hasAttribute("props")?JSON.parse(this.getAttribute("props"),o):{};this.hydrator(this)(this.Component,a,e,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),window.removeEventListener("astro:hydrate",this.hydrate),window.dispatchEvent(new CustomEvent("astro:hydrate"))}}connectedCallback(){!this.hasAttribute("await-children")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((s,e)=>{e.disconnect(),this.childrenConnectedCallback()}).observe(this,{childList:!0})}async childrenConnectedCallback(){window.addEventListener("astro:hydrate",this.hydrate);let s=this.getAttribute("before-hydration-url");s&&await import(s),this.start()}start(){const s=JSON.parse(this.getAttribute("opts")),e=this.getAttribute("client");if(Astro[e]===void 0){window.addEventListener(\`astro:\${e}\`,()=>this.start(),{once:!0});return}Astro[e](async()=>{const n=this.getAttribute("renderer-url"),[a,{default:r}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),i=this.getAttribute("component-export")||"default";if(!i.includes("."))this.Component=a[i];else{this.Component=a;for(const d of i.split("."))this.Component=this.Component[d]}return this.hydrator=r,this.hydrate},s,this)}attributeChangedCallback(){this.hydrator&&this.hydrate()}},l.observedAttributes=["props"],l))}`;
889
1504
 
@@ -917,9 +1532,9 @@ function getDirectiveScriptText(directive) {
917
1532
  function getPrescripts(type, directive) {
918
1533
  switch (type) {
919
1534
  case "both":
920
- return `<style>astro-island,astro-slot{display:contents}</style><script>${getDirectiveScriptText(directive) + astro_island_prebuilt_default}<\/script>`;
1535
+ return `<style>astro-island,astro-slot{display:contents}</style><script>${getDirectiveScriptText(directive) + astro_island_prebuilt_default}</script>`;
921
1536
  case "directive":
922
- return `<script>${getDirectiveScriptText(directive)}<\/script>`;
1537
+ return `<script>${getDirectiveScriptText(directive)}</script>`;
923
1538
  }
924
1539
  return "";
925
1540
  }
@@ -1048,32 +1663,6 @@ function* maybeRenderHead(result) {
1048
1663
  yield { type: "maybe-head", result, scope: result.scope };
1049
1664
  }
1050
1665
 
1051
- const ScopeFlags = {
1052
- Astro: 1 << 0,
1053
- JSX: 1 << 1,
1054
- Slot: 1 << 2,
1055
- HeadBuffer: 1 << 3,
1056
- RenderSlot: 1 << 4
1057
- };
1058
- function addScopeFlag(result, flag) {
1059
- result.scope |= flag;
1060
- }
1061
- function hasScopeFlag(result, flag) {
1062
- return (result.scope & flag) === flag;
1063
- }
1064
- function createScopedResult(result, flag) {
1065
- const scopedResult = Object.create(result, {
1066
- scope: {
1067
- writable: true,
1068
- value: result.scope
1069
- }
1070
- });
1071
- if (flag != null) {
1072
- addScopeFlag(scopedResult, flag);
1073
- }
1074
- return scopedResult;
1075
- }
1076
-
1077
1666
  const headAndContentSym = Symbol.for("astro.headAndContent");
1078
1667
  function isHeadAndContent(obj) {
1079
1668
  return typeof obj === "object" && !!obj[headAndContentSym];
@@ -1137,8 +1726,7 @@ function isAstroComponentFactory(obj) {
1137
1726
  return obj == null ? false : obj.isAstroComponentFactory === true;
1138
1727
  }
1139
1728
  async function renderToString(result, componentFactory, props, children) {
1140
- const scoped = createScopedResult(result, ScopeFlags.Astro);
1141
- const factoryResult = await componentFactory(scoped, props, children);
1729
+ const factoryResult = await componentFactory(result, props, children);
1142
1730
  if (factoryResult instanceof Response) {
1143
1731
  const response = factoryResult;
1144
1732
  throw response;
@@ -1152,8 +1740,8 @@ async function renderToString(result, componentFactory, props, children) {
1152
1740
  }
1153
1741
  function isAPropagatingComponent(result, factory) {
1154
1742
  let hint = factory.propagation || "none";
1155
- if (factory.moduleId && result.propagation.has(factory.moduleId) && hint === "none") {
1156
- hint = result.propagation.get(factory.moduleId);
1743
+ if (factory.moduleId && result.componentMetadata.has(factory.moduleId) && hint === "none") {
1744
+ hint = result.componentMetadata.get(factory.moduleId).propagation;
1157
1745
  }
1158
1746
  return hint === "in-tree" || hint === "self";
1159
1747
  }
@@ -1331,6 +1919,7 @@ async function generateHydrateScript(scriptOptions, metadata) {
1331
1919
  const island = {
1332
1920
  children: "",
1333
1921
  props: {
1922
+ // This is for HMR, probably can avoid it in prod
1334
1923
  uid: astroId
1335
1924
  }
1336
1925
  };
@@ -1369,9 +1958,8 @@ class AstroComponentInstance {
1369
1958
  this.props = props;
1370
1959
  this.factory = factory;
1371
1960
  this.slotValues = {};
1372
- const scoped = createScopedResult(result, ScopeFlags.Slot);
1373
1961
  for (const name in slots) {
1374
- const value = slots[name](scoped);
1962
+ const value = slots[name](result);
1375
1963
  this.slotValues[name] = () => value;
1376
1964
  }
1377
1965
  }
@@ -1459,28 +2047,30 @@ class SlotString extends HTMLString {
1459
2047
  function isSlotString(str) {
1460
2048
  return !!str[slotString];
1461
2049
  }
1462
- async function renderSlot(result, slotted, fallback) {
2050
+ async function* renderSlot(result, slotted, fallback) {
1463
2051
  if (slotted) {
1464
- const scoped = createScopedResult(result, ScopeFlags.Slot);
1465
- let iterator = renderChild(typeof slotted === "function" ? slotted(scoped) : slotted);
1466
- let content = "";
1467
- let instructions = null;
1468
- for await (const chunk of iterator) {
1469
- if (typeof chunk.type === "string") {
1470
- if (instructions === null) {
1471
- instructions = [];
1472
- }
1473
- instructions.push(chunk);
1474
- } else {
1475
- content += chunk;
2052
+ let iterator = renderChild(typeof slotted === "function" ? slotted(result) : slotted);
2053
+ yield* iterator;
2054
+ }
2055
+ if (fallback && !slotted) {
2056
+ yield* renderSlot(result, fallback);
2057
+ }
2058
+ }
2059
+ async function renderSlotToString(result, slotted, fallback) {
2060
+ let content = "";
2061
+ let instructions = null;
2062
+ let iterator = renderSlot(result, slotted, fallback);
2063
+ for await (const chunk of iterator) {
2064
+ if (typeof chunk.type === "string") {
2065
+ if (instructions === null) {
2066
+ instructions = [];
1476
2067
  }
2068
+ instructions.push(chunk);
2069
+ } else {
2070
+ content += chunk;
1477
2071
  }
1478
- return markHTMLString(new SlotString(content, instructions));
1479
2072
  }
1480
- if (fallback) {
1481
- return renderSlot(result, fallback);
1482
- }
1483
- return "";
2073
+ return markHTMLString(new SlotString(content, instructions));
1484
2074
  }
1485
2075
  async function renderSlots(result, slots = {}) {
1486
2076
  let slotInstructions = null;
@@ -1488,7 +2078,7 @@ async function renderSlots(result, slots = {}) {
1488
2078
  if (slots) {
1489
2079
  await Promise.all(
1490
2080
  Object.entries(slots).map(
1491
- ([key, value]) => renderSlot(result, value).then((output) => {
2081
+ ([key, value]) => renderSlotToString(result, value).then((output) => {
1492
2082
  if (output.instructions) {
1493
2083
  if (slotInstructions === null) {
1494
2084
  slotInstructions = [];
@@ -1530,41 +2120,9 @@ function stringifyChunk(result, chunk) {
1530
2120
  return renderAllHeadContent(result);
1531
2121
  }
1532
2122
  case "maybe-head": {
1533
- if (result._metadata.hasRenderedHead) {
2123
+ if (result._metadata.hasRenderedHead || result._metadata.headInTree) {
1534
2124
  return "";
1535
2125
  }
1536
- const scope = instruction.scope;
1537
- switch (scope) {
1538
- case ScopeFlags.JSX | ScopeFlags.Slot | ScopeFlags.Astro:
1539
- case ScopeFlags.JSX | ScopeFlags.Astro | ScopeFlags.HeadBuffer:
1540
- case ScopeFlags.JSX | ScopeFlags.Slot | ScopeFlags.Astro | ScopeFlags.HeadBuffer: {
1541
- return "";
1542
- }
1543
- case ScopeFlags.JSX | ScopeFlags.Astro: {
1544
- if (hasScopeFlag(result, ScopeFlags.JSX)) {
1545
- return "";
1546
- }
1547
- break;
1548
- }
1549
- case ScopeFlags.Slot:
1550
- case ScopeFlags.Slot | ScopeFlags.HeadBuffer: {
1551
- if (hasScopeFlag(result, ScopeFlags.RenderSlot)) {
1552
- return "";
1553
- }
1554
- break;
1555
- }
1556
- case ScopeFlags.HeadBuffer: {
1557
- if (hasScopeFlag(result, ScopeFlags.JSX | ScopeFlags.HeadBuffer)) {
1558
- return "";
1559
- }
1560
- break;
1561
- }
1562
- case ScopeFlags.RenderSlot | ScopeFlags.Astro:
1563
- case ScopeFlags.RenderSlot | ScopeFlags.Astro | ScopeFlags.JSX:
1564
- case ScopeFlags.RenderSlot | ScopeFlags.Astro | ScopeFlags.JSX | ScopeFlags.HeadBuffer: {
1565
- return "";
1566
- }
1567
- }
1568
2126
  return renderAllHeadContent(result);
1569
2127
  }
1570
2128
  }
@@ -1677,8 +2235,7 @@ Did you forget to import the component or is it possible there is a typo?`);
1677
2235
  props[key] = value;
1678
2236
  }
1679
2237
  }
1680
- const scoped = createScopedResult(result, ScopeFlags.JSX);
1681
- const html = markHTMLString(await renderToString(scoped, vnode.type, props, slots));
2238
+ const html = markHTMLString(await renderToString(result, vnode.type, props, slots));
1682
2239
  return html;
1683
2240
  }
1684
2241
  case (!vnode.type && vnode.type !== 0):
@@ -1895,7 +2452,7 @@ async function renderHTMLElement(result, constructor, props, slots) {
1895
2452
  attrHTML += ` ${attr}="${toAttributeString(await props[attr])}"`;
1896
2453
  }
1897
2454
  return markHTMLString(
1898
- `<${name}${attrHTML}>${await renderSlot(result, slots == null ? void 0 : slots.default)}</${name}>`
2455
+ `<${name}${attrHTML}>${await renderSlotToString(result, slots == null ? void 0 : slots.default)}</${name}>`
1899
2456
  );
1900
2457
  }
1901
2458
  function getHTMLElementName(constructor) {
@@ -2057,7 +2614,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
2057
2614
  }
2058
2615
  } else {
2059
2616
  if (metadata.hydrate === "only") {
2060
- html = await renderSlot(result, slots == null ? void 0 : slots.fallback);
2617
+ html = await renderSlotToString(result, slots == null ? void 0 : slots.fallback);
2061
2618
  } else {
2062
2619
  ({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
2063
2620
  { result },
@@ -2152,7 +2709,7 @@ function sanitizeElementName(tag) {
2152
2709
  return tag.trim().split(unsafe)[0].trim();
2153
2710
  }
2154
2711
  async function renderFragmentComponent(result, slots = {}) {
2155
- const children = await renderSlot(result, slots == null ? void 0 : slots.default);
2712
+ const children = await renderSlotToString(result, slots == null ? void 0 : slots.default);
2156
2713
  if (children == null) {
2157
2714
  return children;
2158
2715
  }
@@ -2273,23 +2830,32 @@ async function iterableToHTMLBytes(result, iterable, onDocTypeInjection) {
2273
2830
  }
2274
2831
  async function bufferHeadContent(result) {
2275
2832
  const iterator = result.propagators.values();
2276
- const scoped = createScopedResult(result, ScopeFlags.HeadBuffer);
2277
2833
  while (true) {
2278
2834
  const { value, done } = iterator.next();
2279
2835
  if (done) {
2280
2836
  break;
2281
2837
  }
2282
- const returnValue = await value.init(scoped);
2838
+ const returnValue = await value.init(result);
2283
2839
  if (isHeadAndContent(returnValue)) {
2284
2840
  result.extraHead.push(returnValue.head);
2285
2841
  }
2286
2842
  }
2287
2843
  }
2288
2844
  async function renderPage$1(result, componentFactory, props, children, streaming, route) {
2845
+ var _a, _b;
2289
2846
  if (!isAstroComponentFactory(componentFactory)) {
2847
+ result._metadata.headInTree = ((_a = result.componentMetadata.get(componentFactory.moduleId)) == null ? void 0 : _a.containsHead) ?? false;
2290
2848
  const pageProps = { ...props ?? {}, "server:root": true };
2291
2849
  let output;
2850
+ let head = "";
2292
2851
  try {
2852
+ if (nonAstroPageNeedsHeadInjection(componentFactory)) {
2853
+ const parts = new HTMLParts();
2854
+ for await (const chunk of maybeRenderHead(result)) {
2855
+ parts.append(chunk, result);
2856
+ }
2857
+ head = parts.toString();
2858
+ }
2293
2859
  const renderResult = await renderComponent(
2294
2860
  result,
2295
2861
  componentFactory.name,
@@ -2311,11 +2877,7 @@ async function renderPage$1(result, componentFactory, props, children, streaming
2311
2877
  throw e;
2312
2878
  }
2313
2879
  const bytes = await iterableToHTMLBytes(result, output, async (parts) => {
2314
- if (nonAstroPageNeedsHeadInjection(componentFactory)) {
2315
- for await (let chunk of maybeRenderHead(result)) {
2316
- parts.append(chunk, result);
2317
- }
2318
- }
2880
+ parts.append(head, result);
2319
2881
  });
2320
2882
  return new Response(bytes, {
2321
2883
  headers: new Headers([
@@ -2324,6 +2886,7 @@ async function renderPage$1(result, componentFactory, props, children, streaming
2324
2886
  ])
2325
2887
  });
2326
2888
  }
2889
+ result._metadata.headInTree = ((_b = result.componentMetadata.get(componentFactory.moduleId)) == null ? void 0 : _b.containsHead) ?? false;
2327
2890
  const factoryReturnValue = await componentFactory(result, props, children);
2328
2891
  const factoryIsHeadAndContent = isHeadAndContent(factoryReturnValue);
2329
2892
  if (isRenderTemplateResult(factoryReturnValue) || factoryIsHeadAndContent) {
@@ -2547,6 +3110,7 @@ function stringifyParams(params, routeComponent) {
2547
3110
  }
2548
3111
 
2549
3112
  const clientAddressSymbol$2 = Symbol.for("astro.clientAddress");
3113
+ const responseSentSymbol$1 = Symbol.for("astro.responseSent");
2550
3114
  function onlyAvailableInSSR(name) {
2551
3115
  return function _onlyAvailableInSSR() {
2552
3116
  switch (name) {
@@ -2596,7 +3160,7 @@ class Slots {
2596
3160
  async render(name, args = []) {
2597
3161
  if (!this.#slots || !this.has(name))
2598
3162
  return;
2599
- const scoped = createScopedResult(this.#result, ScopeFlags.RenderSlot);
3163
+ const result = this.#result;
2600
3164
  if (!Array.isArray(args)) {
2601
3165
  warn(
2602
3166
  this.#loggingOpts,
@@ -2605,20 +3169,22 @@ class Slots {
2605
3169
  );
2606
3170
  } else if (args.length > 0) {
2607
3171
  const slotValue = this.#slots[name];
2608
- const component = typeof slotValue === "function" ? await slotValue(scoped) : await slotValue;
3172
+ const component = typeof slotValue === "function" ? await slotValue(result) : await slotValue;
2609
3173
  const expression = getFunctionExpression(component);
2610
3174
  if (expression) {
2611
3175
  const slot = () => expression(...args);
2612
- return await renderSlot(scoped, slot).then((res) => res != null ? String(res) : res);
3176
+ return await renderSlotToString(result, slot).then(
3177
+ (res) => res != null ? String(res) : res
3178
+ );
2613
3179
  }
2614
3180
  if (typeof component === "function") {
2615
- return await renderJSX(scoped, component(...args)).then(
3181
+ return await renderJSX(result, component(...args)).then(
2616
3182
  (res) => res != null ? String(res) : res
2617
3183
  );
2618
3184
  }
2619
3185
  }
2620
- const content = await renderSlot(scoped, this.#slots[name]);
2621
- const outHTML = stringifyChunk(scoped, content);
3186
+ const content = await renderSlotToString(result, this.#slots[name]);
3187
+ const outHTML = stringifyChunk(result, content);
2622
3188
  return outHTML;
2623
3189
  }
2624
3190
  }
@@ -2639,18 +3205,21 @@ function createResult(args) {
2639
3205
  writable: false
2640
3206
  });
2641
3207
  let cookies = void 0;
3208
+ let componentMetadata = args.componentMetadata ?? /* @__PURE__ */ new Map();
2642
3209
  const result = {
2643
3210
  styles: args.styles ?? /* @__PURE__ */ new Set(),
2644
3211
  scripts: args.scripts ?? /* @__PURE__ */ new Set(),
2645
3212
  links: args.links ?? /* @__PURE__ */ new Set(),
2646
- propagation: args.propagation ?? /* @__PURE__ */ new Map(),
3213
+ componentMetadata,
2647
3214
  propagators: /* @__PURE__ */ new Map(),
2648
3215
  extraHead: [],
2649
3216
  scope: 0,
2650
3217
  cookies,
3218
+ /** This function returns the `Astro` faux-global */
2651
3219
  createAstro(astroGlobal, props, slots) {
2652
3220
  const astroSlots = new Slots(result, slots, args.logging);
2653
3221
  const Astro = {
3222
+ // @ts-expect-error
2654
3223
  __proto__: astroGlobal,
2655
3224
  get clientAddress() {
2656
3225
  if (!(clientAddressSymbol$2 in request)) {
@@ -2678,6 +3247,11 @@ function createResult(args) {
2678
3247
  request,
2679
3248
  url,
2680
3249
  redirect: args.ssr ? (path, status) => {
3250
+ if (request[responseSentSymbol$1]) {
3251
+ throw new AstroError({
3252
+ ...AstroErrorData.ResponseSentError
3253
+ });
3254
+ }
2681
3255
  return new Response(null, {
2682
3256
  status: status || 302,
2683
3257
  headers: {
@@ -2689,8 +3263,10 @@ function createResult(args) {
2689
3263
  slots: astroSlots
2690
3264
  };
2691
3265
  Object.defineProperty(Astro, "__renderMarkdown", {
3266
+ // Ensure this API is not exposed to users
2692
3267
  enumerable: false,
2693
3268
  writable: false,
3269
+ // TODO: Remove this hole "Deno" logic once our plugin gets Deno support
2694
3270
  value: async function(content, opts) {
2695
3271
  if (typeof Deno !== "undefined") {
2696
3272
  throw new Error("Markdown is not supported in Deno SSR");
@@ -2712,7 +3288,8 @@ function createResult(args) {
2712
3288
  pathname,
2713
3289
  hasHydrationScript: false,
2714
3290
  hasRenderedHead: false,
2715
- hasDirectives: /* @__PURE__ */ new Set()
3291
+ hasDirectives: /* @__PURE__ */ new Set(),
3292
+ headInTree: false
2716
3293
  },
2717
3294
  response
2718
3295
  };
@@ -2746,6 +3323,14 @@ function generatePaginateFunction(routeMatch) {
2746
3323
  ...additionalParams,
2747
3324
  [paramName]: includesFirstPageNumber || pageNum > 1 ? String(pageNum) : void 0
2748
3325
  };
3326
+ const current = correctIndexRoute(routeMatch.generate({ ...params }));
3327
+ const next = pageNum === lastPage ? void 0 : correctIndexRoute(routeMatch.generate({ ...params, page: String(pageNum + 1) }));
3328
+ const prev = pageNum === 1 ? void 0 : correctIndexRoute(
3329
+ routeMatch.generate({
3330
+ ...params,
3331
+ page: !includesFirstPageNumber && pageNum - 1 === 1 ? void 0 : String(pageNum - 1)
3332
+ })
3333
+ );
2749
3334
  return {
2750
3335
  params,
2751
3336
  props: {
@@ -2758,14 +3343,7 @@ function generatePaginateFunction(routeMatch) {
2758
3343
  total: data.length,
2759
3344
  currentPage: pageNum,
2760
3345
  lastPage,
2761
- url: {
2762
- current: routeMatch.generate({ ...params }),
2763
- next: pageNum === lastPage ? void 0 : routeMatch.generate({ ...params, page: String(pageNum + 1) }),
2764
- prev: pageNum === 1 ? void 0 : routeMatch.generate({
2765
- ...params,
2766
- page: !includesFirstPageNumber && pageNum - 1 === 1 ? "" : String(pageNum - 1)
2767
- })
2768
- }
3346
+ url: { current, next, prev }
2769
3347
  }
2770
3348
  }
2771
3349
  };
@@ -2773,6 +3351,12 @@ function generatePaginateFunction(routeMatch) {
2773
3351
  return result;
2774
3352
  };
2775
3353
  }
3354
+ function correctIndexRoute(route) {
3355
+ if (route === "") {
3356
+ return "/";
3357
+ }
3358
+ return route;
3359
+ }
2776
3360
 
2777
3361
  async function callGetStaticPaths({
2778
3362
  isValidate,
@@ -2817,6 +3401,7 @@ class RouteCache {
2817
3401
  this.logging = logging;
2818
3402
  this.mode = mode;
2819
3403
  }
3404
+ /** Clear the cache. */
2820
3405
  clearAll() {
2821
3406
  this.cache = {};
2822
3407
  }
@@ -2856,6 +3441,21 @@ async function getParamsAndProps(opts) {
2856
3441
  const paramsMatch = route.pattern.exec(pathname);
2857
3442
  if (paramsMatch) {
2858
3443
  params = getParams(route.params)(paramsMatch);
3444
+ if (route.type === "endpoint" && mod.getStaticPaths) {
3445
+ const lastSegment = route.segments[route.segments.length - 1];
3446
+ const paramValues = Object.values(params);
3447
+ const lastParam = paramValues[paramValues.length - 1];
3448
+ if (lastSegment.length === 1 && lastSegment[0].dynamic && lastParam === void 0) {
3449
+ throw new AstroError({
3450
+ ...AstroErrorData.PrerenderDynamicEndpointPathCollide,
3451
+ message: AstroErrorData.PrerenderDynamicEndpointPathCollide.message(route.route),
3452
+ hint: AstroErrorData.PrerenderDynamicEndpointPathCollide.hint(route.component),
3453
+ location: {
3454
+ file: route.component
3455
+ }
3456
+ });
3457
+ }
3458
+ }
2859
3459
  }
2860
3460
  }
2861
3461
  let routeCacheEntry = routeCache.get(route);
@@ -2905,7 +3505,7 @@ async function renderPage(mod, ctx, env) {
2905
3505
  params,
2906
3506
  props: pageProps,
2907
3507
  pathname: ctx.pathname,
2908
- propagation: ctx.propagation,
3508
+ componentMetadata: ctx.componentMetadata,
2909
3509
  resolve: env.resolve,
2910
3510
  renderers: env.renderers,
2911
3511
  request: ctx.request,
@@ -2955,6 +3555,7 @@ function createAPIContext({
2955
3555
  });
2956
3556
  },
2957
3557
  url: new URL(request.url),
3558
+ // @ts-expect-error
2958
3559
  get clientAddress() {
2959
3560
  if (!(clientAddressSymbol$1 in request)) {
2960
3561
  if (adapterName) {
@@ -3039,7 +3640,7 @@ const consoleLogDestination = {
3039
3640
  let prefix = "";
3040
3641
  let type = event.type;
3041
3642
  if (type) {
3042
- prefix += dim(dateTimeFormat.format(new Date()) + " ");
3643
+ prefix += dim(dateTimeFormat.format(/* @__PURE__ */ new Date()) + " ");
3043
3644
  if (event.level === "info") {
3044
3645
  type = bold(cyan(`[${type}]`));
3045
3646
  } else if (event.level === "warn") {
@@ -3065,18 +3666,12 @@ const consoleLogDestination = {
3065
3666
  }
3066
3667
  };
3067
3668
 
3068
- function appendForwardSlash(path) {
3069
- return path.endsWith("/") ? path : path + "/";
3070
- }
3071
3669
  function prependForwardSlash(path) {
3072
3670
  return path[0] === "/" ? path : "/" + path;
3073
3671
  }
3074
3672
  function removeTrailingForwardSlash(path) {
3075
3673
  return path.endsWith("/") ? path.slice(0, path.length - 1) : path;
3076
3674
  }
3077
- function removeLeadingForwardSlash(path) {
3078
- return path.startsWith("/") ? path.substring(1) : path;
3079
- }
3080
3675
  function trimSlashes(path) {
3081
3676
  return path.replace(/^\/|\/$/g, "");
3082
3677
  }
@@ -3104,29 +3699,32 @@ function createEnvironment(options) {
3104
3699
  return options;
3105
3700
  }
3106
3701
 
3107
- function getRootPath(base) {
3108
- return appendForwardSlash(new URL(base || "/", "http://localhost/").pathname);
3109
- }
3110
- function joinToRoot(href, base) {
3111
- const rootPath = getRootPath(base);
3112
- const normalizedHref = slashify(href);
3113
- return appendForwardSlash(rootPath) + removeLeadingForwardSlash(normalizedHref);
3702
+ function createAssetLink(href, base, assetsPrefix) {
3703
+ if (assetsPrefix) {
3704
+ return joinPaths(assetsPrefix, slashify(href));
3705
+ } else if (base) {
3706
+ return prependForwardSlash(joinPaths(base, slashify(href)));
3707
+ } else {
3708
+ return href;
3709
+ }
3114
3710
  }
3115
- function createLinkStylesheetElement(href, base) {
3711
+ function createLinkStylesheetElement(href, base, assetsPrefix) {
3116
3712
  return {
3117
3713
  props: {
3118
3714
  rel: "stylesheet",
3119
- href: joinToRoot(href, base)
3715
+ href: createAssetLink(href, base, assetsPrefix)
3120
3716
  },
3121
3717
  children: ""
3122
3718
  };
3123
3719
  }
3124
- function createLinkStylesheetElementSet(hrefs, base) {
3125
- return new Set(hrefs.map((href) => createLinkStylesheetElement(href, base)));
3720
+ function createLinkStylesheetElementSet(hrefs, base, assetsPrefix) {
3721
+ return new Set(
3722
+ hrefs.map((href) => createLinkStylesheetElement(href, base, assetsPrefix))
3723
+ );
3126
3724
  }
3127
- function createModuleScriptElement(script, base) {
3725
+ function createModuleScriptElement(script, base, assetsPrefix) {
3128
3726
  if (script.type === "external") {
3129
- return createModuleScriptElementWithSrc(script.value, base);
3727
+ return createModuleScriptElementWithSrc(script.value, base, assetsPrefix);
3130
3728
  } else {
3131
3729
  return {
3132
3730
  props: {
@@ -3136,11 +3734,11 @@ function createModuleScriptElement(script, base) {
3136
3734
  };
3137
3735
  }
3138
3736
  }
3139
- function createModuleScriptElementWithSrc(src, site) {
3737
+ function createModuleScriptElementWithSrc(src, base, assetsPrefix) {
3140
3738
  return {
3141
3739
  props: {
3142
3740
  type: "module",
3143
- src: joinToRoot(src, site)
3741
+ src: createAssetLink(src, base, assetsPrefix)
3144
3742
  },
3145
3743
  children: ""
3146
3744
  };
@@ -3150,6 +3748,7 @@ function matchRoute(pathname, manifest) {
3150
3748
  return manifest.routes.find((route) => route.pattern.test(decodeURI(pathname)));
3151
3749
  }
3152
3750
 
3751
+ const responseSentSymbol = Symbol.for("astro.responseSent");
3153
3752
  class App {
3154
3753
  #env;
3155
3754
  #manifest;
@@ -3215,7 +3814,10 @@ class App {
3215
3814
  return void 0;
3216
3815
  return routeData;
3217
3816
  } else if (matchNotFound) {
3218
- return matchRoute("/404", this.#manifestData);
3817
+ const notFoundRouteData = matchRoute("/404", this.#manifestData);
3818
+ if (notFoundRouteData == null ? void 0 : notFoundRouteData.prerender)
3819
+ return void 0;
3820
+ return notFoundRouteData;
3219
3821
  } else {
3220
3822
  return void 0;
3221
3823
  }
@@ -3290,13 +3892,14 @@ class App {
3290
3892
  request,
3291
3893
  origin: url.origin,
3292
3894
  pathname,
3293
- propagation: this.#manifest.propagation,
3895
+ componentMetadata: this.#manifest.componentMetadata,
3294
3896
  scripts,
3295
3897
  links,
3296
3898
  route: routeData,
3297
3899
  status
3298
3900
  });
3299
3901
  const response = await renderPage(mod, ctx, this.#env);
3902
+ Reflect.set(request, responseSentSymbol, true);
3300
3903
  return response;
3301
3904
  } catch (err) {
3302
3905
  error(this.#logging, "ssr", err.stack || err.message || String(err));
@@ -3371,6 +3974,18 @@ class NodeApp extends App {
3371
3974
  return super.match(req instanceof Request ? req : createRequestFromNodeRequest(req), opts);
3372
3975
  }
3373
3976
  render(req, routeData) {
3977
+ if (typeof req.body === "string" && req.body.length > 0) {
3978
+ return super.render(
3979
+ req instanceof Request ? req : createRequestFromNodeRequest(req, Buffer.from(req.body)),
3980
+ routeData
3981
+ );
3982
+ }
3983
+ if (typeof req.body === "object" && req.body !== null && Object.keys(req.body).length > 0) {
3984
+ return super.render(
3985
+ req instanceof Request ? req : createRequestFromNodeRequest(req, Buffer.from(JSON.stringify(req.body))),
3986
+ routeData
3987
+ );
3988
+ }
3374
3989
  if ("on" in req) {
3375
3990
  let body = Buffer.from([]);
3376
3991
  let reqBodyComplete = new Promise((resolve, reject) => {