astro 5.16.5 → 6.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (393) hide show
  1. package/{astro.js → bin/astro.mjs} +7 -8
  2. package/client.d.ts +19 -45
  3. package/components/ClientRouter.astro +0 -5
  4. package/components/Code.astro +2 -2
  5. package/components/Image.astro +2 -2
  6. package/components/Picture.astro +1 -1
  7. package/dist/actions/consts.d.ts +2 -5
  8. package/dist/actions/consts.js +4 -8
  9. package/dist/actions/integration.js +2 -4
  10. package/dist/actions/runtime/client.d.ts +84 -3
  11. package/dist/actions/runtime/client.js +238 -7
  12. package/dist/actions/runtime/entrypoints/client.d.ts +7 -0
  13. package/dist/actions/runtime/entrypoints/client.js +91 -0
  14. package/dist/actions/runtime/entrypoints/route.d.ts +2 -0
  15. package/dist/actions/runtime/{route.js → entrypoints/route.js} +1 -1
  16. package/dist/actions/runtime/entrypoints/server.d.ts +6 -0
  17. package/dist/actions/runtime/entrypoints/server.js +33 -0
  18. package/dist/actions/runtime/server.d.ts +11 -29
  19. package/dist/actions/runtime/server.js +162 -82
  20. package/dist/actions/runtime/types.d.ts +64 -0
  21. package/dist/actions/runtime/types.js +0 -0
  22. package/dist/actions/utils.d.ts +2 -2
  23. package/dist/actions/utils.js +2 -2
  24. package/dist/actions/vite-plugin-actions.js +18 -21
  25. package/dist/assets/build/generate.d.ts +2 -2
  26. package/dist/assets/build/generate.js +11 -9
  27. package/dist/assets/build/remote.js +4 -14
  28. package/dist/assets/endpoint/config.js +2 -2
  29. package/dist/assets/endpoint/dev.js +7 -6
  30. package/dist/assets/fonts/config.d.ts +86 -174
  31. package/dist/assets/fonts/config.js +15 -17
  32. package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.d.ts +3 -3
  33. package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.js +4 -4
  34. package/dist/assets/fonts/types.d.ts +1 -1
  35. package/dist/assets/fonts/vite-plugin-fonts.js +6 -3
  36. package/dist/assets/services/sharp.js +5 -6
  37. package/dist/assets/utils/index.d.ts +0 -6
  38. package/dist/assets/utils/index.js +0 -9
  39. package/dist/assets/utils/{transformToPath.d.ts → node.d.ts} +15 -1
  40. package/dist/assets/utils/{node/emitAsset.js → node.js} +34 -56
  41. package/dist/assets/vite-plugin-assets.js +9 -14
  42. package/dist/cli/index.js +0 -2
  43. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  44. package/dist/cli/preferences/index.js +5 -1
  45. package/dist/config/index.js +11 -16
  46. package/dist/container/index.d.ts +0 -1
  47. package/dist/container/index.js +19 -14
  48. package/dist/container/pipeline.d.ts +2 -1
  49. package/dist/container/pipeline.js +4 -11
  50. package/dist/content/config.d.ts +34 -40
  51. package/dist/content/config.js +17 -13
  52. package/dist/content/content-layer.js +14 -21
  53. package/dist/content/data-store.d.ts +0 -2
  54. package/dist/content/loaders/errors.d.ts +3 -3
  55. package/dist/content/loaders/errors.js +5 -2
  56. package/dist/content/loaders/glob.d.ts +0 -5
  57. package/dist/content/loaders/glob.js +3 -30
  58. package/dist/content/loaders/types.d.ts +11 -4
  59. package/dist/content/mutable-data-store.js +1 -14
  60. package/dist/content/runtime-assets.d.ts +4 -4
  61. package/dist/content/runtime-assets.js +4 -7
  62. package/dist/content/runtime.d.ts +35 -73
  63. package/dist/content/runtime.js +63 -231
  64. package/dist/content/server-listeners.js +25 -88
  65. package/dist/content/types-generator.d.ts +1 -6
  66. package/dist/content/types-generator.js +87 -156
  67. package/dist/content/utils.d.ts +47 -412
  68. package/dist/content/utils.js +88 -203
  69. package/dist/content/vite-plugin-content-assets.d.ts +12 -4
  70. package/dist/content/vite-plugin-content-assets.js +100 -56
  71. package/dist/content/vite-plugin-content-imports.js +10 -8
  72. package/dist/content/vite-plugin-content-virtual-mod.js +13 -131
  73. package/dist/core/app/app.d.ts +5 -0
  74. package/dist/core/app/app.js +13 -0
  75. package/dist/core/app/base.d.ts +132 -0
  76. package/dist/core/app/base.js +448 -0
  77. package/dist/core/app/common.d.ts +6 -2
  78. package/dist/core/app/common.js +60 -33
  79. package/dist/core/app/dev/app.d.ts +15 -0
  80. package/dist/core/app/dev/app.js +86 -0
  81. package/dist/core/app/dev/pipeline.d.ts +13 -0
  82. package/dist/core/app/dev/pipeline.js +123 -0
  83. package/dist/core/app/entrypoint.d.ts +2 -0
  84. package/dist/core/app/entrypoint.js +15 -0
  85. package/dist/core/app/index.d.ts +7 -114
  86. package/dist/core/app/index.js +20 -557
  87. package/dist/core/app/logging.d.ts +3 -0
  88. package/dist/core/app/logging.js +11 -0
  89. package/dist/core/app/manifest.d.ts +9 -0
  90. package/dist/core/app/manifest.js +107 -0
  91. package/dist/core/app/middlewares.js +1 -1
  92. package/dist/core/app/node.d.ts +2 -8
  93. package/dist/core/app/node.js +8 -9
  94. package/dist/core/app/pipeline.d.ts +6 -5
  95. package/dist/core/app/pipeline.js +65 -49
  96. package/dist/core/app/types.d.ts +58 -22
  97. package/dist/core/app/validate-forwarded-headers.d.ts +16 -0
  98. package/dist/core/app/validate-forwarded-headers.js +60 -0
  99. package/dist/core/base-pipeline.d.ts +22 -14
  100. package/dist/core/base-pipeline.js +54 -6
  101. package/dist/core/build/app.d.ts +13 -0
  102. package/dist/core/build/app.js +38 -0
  103. package/dist/core/build/common.d.ts +1 -1
  104. package/dist/core/build/common.js +2 -2
  105. package/dist/core/build/generate.d.ts +1 -1
  106. package/dist/core/build/generate.js +95 -204
  107. package/dist/core/build/graph.js +2 -2
  108. package/dist/core/build/index.js +11 -19
  109. package/dist/core/build/internal.d.ts +3 -29
  110. package/dist/core/build/internal.js +1 -45
  111. package/dist/core/build/pipeline.d.ts +15 -26
  112. package/dist/core/build/pipeline.js +106 -170
  113. package/dist/core/build/plugins/index.d.ts +4 -2
  114. package/dist/core/build/plugins/index.js +17 -23
  115. package/dist/core/build/plugins/plugin-analyzer.d.ts +2 -2
  116. package/dist/core/build/plugins/plugin-analyzer.js +5 -13
  117. package/dist/core/build/plugins/plugin-component-entry.d.ts +7 -2
  118. package/dist/core/build/plugins/plugin-component-entry.js +5 -13
  119. package/dist/core/build/plugins/plugin-css.d.ts +2 -2
  120. package/dist/core/build/plugins/plugin-css.js +86 -41
  121. package/dist/core/build/plugins/plugin-internals.d.ts +2 -2
  122. package/dist/core/build/plugins/plugin-internals.js +24 -18
  123. package/dist/core/build/plugins/plugin-manifest.d.ts +33 -5
  124. package/dist/core/build/plugins/plugin-manifest.js +89 -131
  125. package/dist/core/build/plugins/plugin-middleware.d.ts +2 -2
  126. package/dist/core/build/plugins/plugin-middleware.js +5 -7
  127. package/dist/core/build/plugins/plugin-noop.d.ts +3 -0
  128. package/dist/core/build/plugins/plugin-noop.js +29 -0
  129. package/dist/core/build/plugins/plugin-prerender.d.ts +2 -2
  130. package/dist/core/build/plugins/plugin-prerender.js +7 -64
  131. package/dist/core/build/plugins/plugin-scripts.d.ts +5 -2
  132. package/dist/core/build/plugins/plugin-scripts.js +5 -13
  133. package/dist/core/build/plugins/plugin-ssr.d.ts +2 -2
  134. package/dist/core/build/plugins/plugin-ssr.js +60 -132
  135. package/dist/core/build/plugins/util.d.ts +1 -25
  136. package/dist/core/build/plugins/util.js +0 -47
  137. package/dist/core/build/runtime.d.ts +26 -0
  138. package/dist/core/build/runtime.js +45 -0
  139. package/dist/core/build/static-build.d.ts +2 -2
  140. package/dist/core/build/static-build.js +180 -154
  141. package/dist/core/build/types.d.ts +1 -2
  142. package/dist/core/build/util.d.ts +0 -1
  143. package/dist/core/build/util.js +0 -7
  144. package/dist/core/compile/compile.d.ts +2 -3
  145. package/dist/core/compile/compile.js +2 -4
  146. package/dist/core/config/config.js +2 -2
  147. package/dist/core/config/index.d.ts +0 -1
  148. package/dist/core/config/index.js +0 -2
  149. package/dist/core/config/schemas/base.d.ts +330 -1463
  150. package/dist/core/config/schemas/base.js +40 -56
  151. package/dist/core/config/schemas/refined.d.ts +2 -2
  152. package/dist/core/config/schemas/refined.js +8 -1
  153. package/dist/core/config/schemas/relative.d.ts +607 -1737
  154. package/dist/core/config/schemas/relative.js +4 -4
  155. package/dist/core/config/settings.d.ts +3 -3
  156. package/dist/core/config/settings.js +5 -6
  157. package/dist/core/config/validate.js +13 -2
  158. package/dist/core/config/vite-load.js +12 -3
  159. package/dist/core/constants.d.ts +12 -0
  160. package/dist/core/constants.js +22 -1
  161. package/dist/core/create-vite.d.ts +2 -6
  162. package/dist/core/create-vite.js +36 -47
  163. package/dist/core/csp/common.d.ts +1 -1
  164. package/dist/core/csp/common.js +1 -1
  165. package/dist/core/csp/config.d.ts +8 -4
  166. package/dist/core/csp/config.js +1 -1
  167. package/dist/core/dev/container.js +13 -9
  168. package/dist/core/dev/dev.js +1 -1
  169. package/dist/core/dev/restart.js +15 -6
  170. package/dist/core/errors/dev/runtime.d.ts +6 -0
  171. package/dist/core/errors/dev/runtime.js +27 -0
  172. package/dist/core/errors/dev/vite.js +2 -19
  173. package/dist/core/errors/errors-data.d.ts +85 -57
  174. package/dist/core/errors/errors-data.js +40 -28
  175. package/dist/core/errors/errors.d.ts +3 -3
  176. package/dist/core/errors/errors.js +1 -1
  177. package/dist/core/errors/overlay.js +1 -1
  178. package/dist/core/errors/zod-error-map.d.ts +2 -2
  179. package/dist/core/errors/zod-error-map.js +26 -24
  180. package/dist/core/messages.d.ts +2 -2
  181. package/dist/core/messages.js +2 -2
  182. package/dist/core/middleware/callMiddleware.js +1 -1
  183. package/dist/core/middleware/defineMiddleware.d.ts +2 -0
  184. package/dist/core/middleware/defineMiddleware.js +6 -0
  185. package/dist/core/middleware/index.d.ts +4 -4
  186. package/dist/core/middleware/index.js +6 -12
  187. package/dist/core/middleware/sequence.js +4 -4
  188. package/dist/core/middleware/vite-plugin.d.ts +1 -1
  189. package/dist/core/middleware/vite-plugin.js +18 -7
  190. package/dist/core/module-loader/index.d.ts +2 -2
  191. package/dist/core/module-loader/index.js +1 -1
  192. package/dist/core/module-loader/{loader.d.ts → runner.d.ts} +6 -17
  193. package/dist/core/module-loader/{loader.js → runner.js} +3 -0
  194. package/dist/core/module-loader/vite.d.ts +3 -2
  195. package/dist/core/module-loader/vite.js +17 -13
  196. package/dist/core/preview/index.js +20 -5
  197. package/dist/core/preview/static-preview-server.js +1 -0
  198. package/dist/core/redirects/component.js +1 -2
  199. package/dist/core/redirects/index.d.ts +0 -1
  200. package/dist/core/redirects/index.js +1 -3
  201. package/dist/core/redirects/render.js +5 -2
  202. package/dist/core/render/paginate.d.ts +1 -1
  203. package/dist/core/render/paginate.js +8 -6
  204. package/dist/core/render/params-and-props.d.ts +2 -0
  205. package/dist/core/render/params-and-props.js +19 -7
  206. package/dist/core/render/route-cache.d.ts +3 -3
  207. package/dist/core/render/route-cache.js +7 -7
  208. package/dist/core/render-context.d.ts +9 -7
  209. package/dist/core/render-context.js +46 -47
  210. package/dist/core/routing/astro-designed-error-pages.js +2 -2
  211. package/dist/core/routing/default.js +1 -1
  212. package/dist/core/routing/helpers.d.ts +22 -0
  213. package/dist/core/routing/helpers.js +25 -0
  214. package/dist/core/routing/index.d.ts +1 -1
  215. package/dist/core/routing/index.js +2 -2
  216. package/dist/core/routing/manifest/create.d.ts +6 -1
  217. package/dist/core/routing/manifest/create.js +9 -13
  218. package/dist/core/routing/manifest/generator.d.ts +3 -1
  219. package/dist/core/routing/params.d.ts +2 -1
  220. package/dist/core/routing/params.js +8 -8
  221. package/dist/core/routing/validation.d.ts +1 -2
  222. package/dist/core/routing/validation.js +2 -18
  223. package/dist/core/server-islands/endpoint.d.ts +1 -2
  224. package/dist/core/server-islands/endpoint.js +5 -4
  225. package/dist/core/server-islands/vite-plugin-server-islands.d.ts +1 -1
  226. package/dist/core/server-islands/vite-plugin-server-islands.js +89 -44
  227. package/dist/core/session/vite-plugin.d.ts +6 -0
  228. package/dist/core/session/vite-plugin.js +53 -0
  229. package/dist/core/session.d.ts +4 -2
  230. package/dist/core/session.js +8 -48
  231. package/dist/core/sync/index.d.ts +2 -5
  232. package/dist/core/sync/index.js +19 -34
  233. package/dist/core/util.d.ts +2 -2
  234. package/dist/core/util.js +3 -3
  235. package/dist/entrypoints/legacy.d.ts +2 -0
  236. package/dist/entrypoints/legacy.js +12 -0
  237. package/dist/entrypoints/prerender.d.ts +4 -0
  238. package/dist/entrypoints/prerender.js +7 -0
  239. package/dist/env/env-loader.d.ts +0 -1
  240. package/dist/env/env-loader.js +4 -17
  241. package/dist/env/schema.d.ts +21 -251
  242. package/dist/env/schema.js +6 -3
  243. package/dist/env/vite-plugin-env.js +3 -2
  244. package/dist/env/vite-plugin-import-meta-env.js +3 -2
  245. package/dist/environments.d.ts +3 -0
  246. package/dist/environments.js +11 -0
  247. package/dist/events/error.d.ts +2 -2
  248. package/dist/i18n/index.d.ts +2 -2
  249. package/dist/i18n/index.js +0 -3
  250. package/dist/i18n/utils.d.ts +1 -6
  251. package/dist/i18n/utils.js +1 -63
  252. package/dist/i18n/vite-plugin-i18n.d.ts +0 -5
  253. package/dist/i18n/vite-plugin-i18n.js +1 -22
  254. package/dist/integrations/hooks.d.ts +2 -3
  255. package/dist/integrations/hooks.js +9 -33
  256. package/dist/manifest/serialized.d.ts +9 -0
  257. package/dist/manifest/serialized.js +144 -0
  258. package/dist/manifest/virtual-module.d.ts +1 -4
  259. package/dist/manifest/virtual-module.js +77 -80
  260. package/dist/preferences/index.d.ts +1 -2
  261. package/dist/prefetch/index.d.ts +0 -10
  262. package/dist/prefetch/index.js +1 -1
  263. package/dist/prerender/routing.d.ts +5 -7
  264. package/dist/prerender/routing.js +6 -17
  265. package/dist/runtime/server/astro-global.d.ts +2 -2
  266. package/dist/runtime/server/astro-global.js +86 -24
  267. package/dist/runtime/server/render/server-islands.js +2 -2
  268. package/dist/runtime/server/transition.d.ts +1 -0
  269. package/dist/transitions/events.d.ts +7 -0
  270. package/dist/transitions/router.js +7 -3
  271. package/dist/transitions/vite-plugin-transitions.js +1 -4
  272. package/dist/types/astro.d.ts +10 -8
  273. package/dist/types/public/common.d.ts +1 -3
  274. package/dist/types/public/config.d.ts +364 -415
  275. package/dist/types/public/context.d.ts +21 -52
  276. package/dist/types/public/index.d.ts +2 -1
  277. package/dist/types/public/integrations.d.ts +23 -18
  278. package/dist/types/public/internal.d.ts +3 -18
  279. package/dist/types/public/preview.d.ts +6 -0
  280. package/dist/virtual-modules/i18n.d.ts +10 -2
  281. package/dist/virtual-modules/i18n.js +16 -7
  282. package/dist/virtual-modules/live-config.d.ts +1 -3
  283. package/dist/virtual-modules/live-config.js +1 -5
  284. package/dist/virtual-modules/middleware.d.ts +2 -1
  285. package/dist/virtual-modules/middleware.js +2 -1
  286. package/dist/vite-plugin-adapter-config/index.js +3 -2
  287. package/dist/vite-plugin-app/app.d.ts +47 -0
  288. package/dist/vite-plugin-app/app.js +410 -0
  289. package/dist/vite-plugin-app/createAstroServerApp.d.ts +8 -0
  290. package/dist/vite-plugin-app/createAstroServerApp.js +56 -0
  291. package/dist/vite-plugin-app/index.d.ts +3 -0
  292. package/dist/vite-plugin-app/index.js +16 -0
  293. package/dist/{vite-plugin-astro-server → vite-plugin-app}/pipeline.d.ts +5 -7
  294. package/dist/vite-plugin-app/pipeline.js +166 -0
  295. package/dist/vite-plugin-astro/index.js +11 -13
  296. package/dist/vite-plugin-astro-server/controller.d.ts +1 -1
  297. package/dist/vite-plugin-astro-server/error.d.ts +3 -4
  298. package/dist/vite-plugin-astro-server/error.js +2 -5
  299. package/dist/vite-plugin-astro-server/index.d.ts +1 -2
  300. package/dist/vite-plugin-astro-server/index.js +6 -4
  301. package/dist/vite-plugin-astro-server/metadata.js +1 -1
  302. package/dist/vite-plugin-astro-server/plugin.d.ts +4 -7
  303. package/dist/vite-plugin-astro-server/plugin.js +53 -96
  304. package/dist/vite-plugin-astro-server/server-state.d.ts +1 -1
  305. package/dist/vite-plugin-astro-server/util.d.ts +0 -2
  306. package/dist/vite-plugin-astro-server/util.js +1 -2
  307. package/dist/vite-plugin-astro-server/vite.d.ts +2 -2
  308. package/dist/vite-plugin-astro-server/vite.js +7 -7
  309. package/dist/vite-plugin-config-alias/index.js +40 -32
  310. package/dist/vite-plugin-css/index.d.ts +18 -0
  311. package/dist/vite-plugin-css/index.js +134 -0
  312. package/dist/vite-plugin-css/util.d.ts +5 -0
  313. package/dist/vite-plugin-css/util.js +8 -0
  314. package/dist/vite-plugin-environment/index.d.ts +15 -0
  315. package/dist/vite-plugin-environment/index.js +77 -0
  316. package/dist/vite-plugin-head/index.d.ts +1 -2
  317. package/dist/vite-plugin-head/index.js +42 -58
  318. package/dist/vite-plugin-hmr-reload/index.js +2 -1
  319. package/dist/vite-plugin-markdown/index.js +0 -1
  320. package/dist/vite-plugin-pages/const.d.ts +2 -0
  321. package/dist/vite-plugin-pages/const.js +6 -0
  322. package/dist/vite-plugin-pages/index.d.ts +2 -0
  323. package/dist/vite-plugin-pages/index.js +7 -0
  324. package/dist/vite-plugin-pages/page.d.ts +7 -0
  325. package/dist/vite-plugin-pages/page.js +48 -0
  326. package/dist/vite-plugin-pages/pages.d.ts +8 -0
  327. package/dist/vite-plugin-pages/pages.js +57 -0
  328. package/dist/vite-plugin-pages/util.d.ts +8 -0
  329. package/dist/vite-plugin-pages/util.js +15 -0
  330. package/dist/vite-plugin-renderers/index.d.ts +9 -0
  331. package/dist/vite-plugin-renderers/index.js +40 -0
  332. package/dist/vite-plugin-routes/index.d.ts +14 -0
  333. package/dist/vite-plugin-routes/index.js +177 -0
  334. package/dist/vite-plugin-scripts/index.js +2 -6
  335. package/dist/vite-plugin-scripts/page-ssr.js +3 -2
  336. package/dist/zod.d.ts +2 -2
  337. package/dist/zod.js +2 -2
  338. package/package.json +14 -15
  339. package/templates/content/module.mjs +9 -63
  340. package/templates/content/types.d.ts +32 -78
  341. package/types/actions.d.ts +1 -5
  342. package/types/content.d.ts +9 -11
  343. package/types/transitions.d.ts +25 -0
  344. package/dist/actions/loadActions.d.ts +0 -8
  345. package/dist/actions/loadActions.js +0 -13
  346. package/dist/actions/runtime/route.d.ts +0 -2
  347. package/dist/actions/runtime/shared.d.ts +0 -60
  348. package/dist/actions/runtime/shared.js +0 -296
  349. package/dist/actions/runtime/utils.d.ts +0 -31
  350. package/dist/actions/runtime/utils.js +0 -16
  351. package/dist/actions/runtime/virtual.d.ts +0 -4
  352. package/dist/actions/runtime/virtual.js +0 -127
  353. package/dist/assets/utils/node/emitAsset.d.ts +0 -29
  354. package/dist/assets/utils/transformToPath.js +0 -32
  355. package/dist/config/vite-plugin-content-listen.d.ts +0 -17
  356. package/dist/config/vite-plugin-content-listen.js +0 -26
  357. package/dist/container/polyfill.d.ts +0 -1
  358. package/dist/container/polyfill.js +0 -2
  359. package/dist/core/build/css-asset-name.d.ts +0 -9
  360. package/dist/core/build/css-asset-name.js +0 -89
  361. package/dist/core/build/plugin.d.ts +0 -43
  362. package/dist/core/build/plugin.js +0 -61
  363. package/dist/core/build/plugins/plugin-actions.d.ts +0 -4
  364. package/dist/core/build/plugins/plugin-actions.js +0 -16
  365. package/dist/core/build/plugins/plugin-chunks.d.ts +0 -2
  366. package/dist/core/build/plugins/plugin-chunks.js +0 -33
  367. package/dist/core/build/plugins/plugin-pages.d.ts +0 -6
  368. package/dist/core/build/plugins/plugin-pages.js +0 -66
  369. package/dist/core/build/plugins/plugin-renderers.d.ts +0 -5
  370. package/dist/core/build/plugins/plugin-renderers.js +0 -54
  371. package/dist/core/middleware/loadMiddleware.d.ts +0 -7
  372. package/dist/core/middleware/loadMiddleware.js +0 -14
  373. package/dist/core/polyfill.d.ts +0 -5
  374. package/dist/core/polyfill.js +0 -17
  375. package/dist/core/redirects/helpers.d.ts +0 -7
  376. package/dist/core/redirects/helpers.js +0 -10
  377. package/dist/core/routing/manifest/serialization.d.ts +0 -5
  378. package/dist/core/routing/manifest/serialization.js +0 -37
  379. package/dist/prerender/metadata.d.ts +0 -8
  380. package/dist/prerender/metadata.js +0 -18
  381. package/dist/vite-plugin-astro-postprocess/index.d.ts +0 -2
  382. package/dist/vite-plugin-astro-postprocess/index.js +0 -48
  383. package/dist/vite-plugin-astro-server/css.d.ts +0 -13
  384. package/dist/vite-plugin-astro-server/css.js +0 -48
  385. package/dist/vite-plugin-astro-server/pipeline.js +0 -166
  386. package/dist/vite-plugin-astro-server/request.d.ts +0 -14
  387. package/dist/vite-plugin-astro-server/request.js +0 -73
  388. package/dist/vite-plugin-astro-server/route.d.ts +0 -25
  389. package/dist/vite-plugin-astro-server/route.js +0 -283
  390. package/dist/vite-plugin-scanner/index.d.ts +0 -10
  391. package/dist/vite-plugin-scanner/index.js +0 -87
  392. package/dist/vite-plugin-ssr-manifest/index.d.ts +0 -2
  393. package/dist/vite-plugin-ssr-manifest/index.js +0 -26
@@ -2,9 +2,9 @@ import * as fs from "node:fs";
2
2
  import { fileURLToPath } from "node:url";
3
3
  import { codeToHtml, createCssVariablesTheme } from "shiki";
4
4
  import { AstroError } from "../errors.js";
5
- import { FailedToLoadModuleSSR, InvalidGlob, MdxIntegrationMissingError } from "../errors-data.js";
5
+ import { FailedToLoadModuleSSR, MdxIntegrationMissingError } from "../errors-data.js";
6
6
  import { createSafeError } from "../utils.js";
7
- import { getDocsForError, renderErrorMarkdown } from "./utils.js";
7
+ import { getDocsForError, renderErrorMarkdown } from "./runtime.js";
8
8
  function enhanceViteSSRError({
9
9
  error,
10
10
  filePath,
@@ -47,23 +47,6 @@ function enhanceViteSSRError({
47
47
  stack: safeError.stack
48
48
  });
49
49
  }
50
- if (safeError.message.includes("Invalid glob")) {
51
- const globPattern = /glob: "(.+)" \(/.exec(safeError.message)?.[1];
52
- if (globPattern) {
53
- safeError.message = InvalidGlob.message(globPattern);
54
- safeError.name = "InvalidGlob";
55
- safeError.title = InvalidGlob.title;
56
- const line = lns.findIndex((ln) => ln.includes(globPattern));
57
- if (line !== -1) {
58
- const column = lns[line]?.indexOf(globPattern);
59
- safeError.loc = {
60
- file: path,
61
- line: line + 1,
62
- column
63
- };
64
- }
65
- }
66
- }
67
50
  }
68
51
  return safeError;
69
52
  }
@@ -1,4 +1,4 @@
1
- import type { ZodError } from 'zod';
1
+ import type { $ZodError } from 'zod/v4/core';
2
2
  export interface ErrorData {
3
3
  name: string;
4
4
  title: string;
@@ -282,8 +282,9 @@ export declare const GetStaticPathsExpectedParams: {
282
282
  * export async function getStaticPaths() {
283
283
  * return [
284
284
  * { params: { id: '1' } } // Works
285
- * { params: { id: 2 } } // Works
285
+ * { params: { id: 2 } } // Does not work
286
286
  * { params: { id: false } } // Does not work
287
+ * { params: { id: [1, 2] } } // Does not work
287
288
  * ];
288
289
  * }
289
290
  * ---
@@ -295,8 +296,8 @@ export declare const GetStaticPathsExpectedParams: {
295
296
  * ---
296
297
  * export async function getStaticPaths() {
297
298
  * return [
298
- * { params: { id: 1 } } // /route/1
299
- * { params: { id: 2 } } // /route/2
299
+ * { params: { id: '1' } } // /route/1
300
+ * { params: { id: '2' } } // /route/2
300
301
  * { params: { id: undefined } } // /route/
301
302
  * ];
302
303
  * }
@@ -306,7 +307,7 @@ export declare const GetStaticPathsExpectedParams: {
306
307
  export declare const GetStaticPathsInvalidRouteParam: {
307
308
  name: string;
308
309
  title: string;
309
- message: (key: string, value: any, valueType: any) => string;
310
+ message: (key: string, value: any, valueType: string) => string;
310
311
  hint: string;
311
312
  };
312
313
  /**
@@ -542,8 +543,8 @@ export declare const PrerenderDynamicEndpointPathCollide: {
542
543
  /**
543
544
  * @docs
544
545
  * @see
545
- * - [`getStaticPaths()`](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths)
546
- * - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
546
+ * - [Route Priority Order](https://docs.astro.build/en/guides/routing/#route-priority-order)
547
+ * - [`prerenderConflictBehavior`](https://docs.astro.build/en/reference/configuration-reference/#prerenderconflictbehavior)
547
548
  * @description
548
549
  * Two prerendered routes generate the same path, resulting in a collision.
549
550
  * A static path can only be generated by one route.
@@ -850,6 +851,7 @@ export declare const LocalImageUsedWrongly: {
850
851
  * - [Astro.glob](https://docs.astro.build/en/reference/api-reference/#astroglob)
851
852
  * @description
852
853
  * `Astro.glob()` can only be used in `.astro` files. You can use [`import.meta.glob()`](https://vite.dev/guide/features.html#glob-import) instead to achieve the same result.
854
+ * @deprecated This error was removed in Astro v6.0.0 along with the removal of `Astro.glob()`.
853
855
  */
854
856
  export declare const AstroGlobUsedOutside: {
855
857
  name: string;
@@ -863,6 +865,7 @@ export declare const AstroGlobUsedOutside: {
863
865
  * - [Astro.glob](https://docs.astro.build/en/reference/api-reference/#astroglob)
864
866
  * @description
865
867
  * `Astro.glob()` did not return any matching files. There might be a typo in the glob pattern.
868
+ * @deprecated This error was removed in Astro v6.0.0 along with the removal of `Astro.glob()`.
866
869
  */
867
870
  export declare const AstroGlobNoMatch: {
868
871
  name: string;
@@ -965,6 +968,7 @@ export declare const FailedToLoadModuleSSR: {
965
968
  * - [Glob Patterns](https://docs.astro.build/en/guides/imports/#glob-patterns)
966
969
  * @description
967
970
  * Astro encountered an invalid glob pattern. This is often caused by the glob pattern not being a valid file path.
971
+ * @deprecated This error was removed in Astro v6.0.0 along with the removal of `Astro.glob()`.
968
972
  */
969
973
  export declare const InvalidGlob: {
970
974
  name: string;
@@ -1039,6 +1043,16 @@ export declare const MissingMiddlewareForInternationalization: {
1039
1043
  title: string;
1040
1044
  message: string;
1041
1045
  };
1046
+ /**
1047
+ * @docs
1048
+ * @description
1049
+ * An invalid i18n middleware configuration was detected.
1050
+ */
1051
+ export declare const InvalidI18nMiddlewareConfiguration: {
1052
+ name: string;
1053
+ title: string;
1054
+ message: string;
1055
+ };
1042
1056
  /**
1043
1057
  * @docs
1044
1058
  * @description
@@ -1252,13 +1266,25 @@ export declare const FontFamilyNotFound: {
1252
1266
  * @description
1253
1267
  * The CSP feature isn't enabled
1254
1268
  * @message
1255
- * The `experimental.csp` configuration isn't enabled.
1269
+ * The `security.csp` configuration isn't enabled.
1256
1270
  */
1257
1271
  export declare const CspNotEnabled: {
1258
1272
  name: string;
1259
1273
  title: string;
1260
1274
  message: string;
1261
1275
  };
1276
+ /**
1277
+ * @docs
1278
+ * @description
1279
+ * Unavailable Astro global in getStaticPaths
1280
+ * @message
1281
+ * The Astro global is not available in getStaticPaths().
1282
+ */
1283
+ export declare const UnavailableAstroGlobal: {
1284
+ name: string;
1285
+ title: string;
1286
+ message: (name: string) => string;
1287
+ };
1262
1288
  /**
1263
1289
  * @docs
1264
1290
  * @kind heading
@@ -1441,7 +1467,7 @@ export declare const RenderUndefinedEntryError: {
1441
1467
  /**
1442
1468
  * @docs
1443
1469
  * @description
1444
- * The `getDataEntryById` and `getEntryBySlug` functions are deprecated and cannot be used with content layer collections. Use the `getEntry` function instead.
1470
+ * The `getDataEntryById` and `getEntryBySlug` functions are deprecated and cannot be used with content collections. Use the `getEntry` function instead.
1445
1471
  */
1446
1472
  export declare const GetEntryDeprecationError: {
1447
1473
  name: string;
@@ -1461,18 +1487,19 @@ export declare const GetEntryDeprecationError: {
1461
1487
  * Make sure that all required fields are present, and that all fields are of the correct type.
1462
1488
  * You can check against the collection schema in your `src/content.config.*` file.
1463
1489
  * See the [Content collections documentation](https://docs.astro.build/en/guides/content-collections/) for more information.
1490
+ * @deprecated This error only applies to legacy content collections which were removed in Astro 6.
1464
1491
  */
1465
1492
  export declare const InvalidContentEntryFrontmatterError: {
1466
1493
  name: string;
1467
1494
  title: string;
1468
- message(collection: string, entryId: string, error: ZodError): string;
1495
+ message(collection: string, entryId: string, error: $ZodError): string;
1469
1496
  hint: string;
1470
1497
  };
1471
1498
  /**
1472
1499
  * @docs
1473
1500
  * @message
1474
1501
  * **Example error message:**<br/>
1475
- * **blog** → **post** frontmatter does not match collection schema.<br/>
1502
+ * **blog** → **post** data does not match collection schema.<br/>
1476
1503
  * "title" is required.<br/>
1477
1504
  * "date" must be a valid date.
1478
1505
  * @description
@@ -1484,7 +1511,52 @@ export declare const InvalidContentEntryFrontmatterError: {
1484
1511
  export declare const InvalidContentEntryDataError: {
1485
1512
  name: string;
1486
1513
  title: string;
1487
- message(collection: string, entryId: string, error: ZodError): string;
1514
+ message(collection: string, entryId: string, error: $ZodError): string;
1515
+ hint: string;
1516
+ };
1517
+ /**
1518
+ * @docs
1519
+ * @message
1520
+ * **Example error message:**<br/>
1521
+ * Found legacy content config file in "src/content/config.ts". Please move this file to "src/content.config.ts" and ensure each collection has a loader defined.<br/>
1522
+ * @description
1523
+ * A legacy content config file was found. Move the file to `src/content.config.ts` and update any collection definitions if needed.
1524
+ * See the [Astro 6 migration guide](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections) for more information.
1525
+ */
1526
+ export declare const LegacyContentConfigError: {
1527
+ name: string;
1528
+ title: string;
1529
+ message: (filename: string) => string;
1530
+ hint: string;
1531
+ };
1532
+ /**
1533
+ * @docs
1534
+ * @message
1535
+ * **Example error message:**<br/>
1536
+ * Collections must have a `loader` defined. Check your collection definitions in your content config file.<br/>
1537
+ * @description
1538
+ * A content collection is missing a `loader` definition. Make sure that each collection in your content config file has a `loader`.
1539
+ * See the [Content collections documentation](https://docs.astro.build/en/guides/content-collections/) for more information.
1540
+ */
1541
+ export declare const ContentCollectionMissingLoader: {
1542
+ name: string;
1543
+ title: string;
1544
+ message: (file?: any) => string;
1545
+ hint: string;
1546
+ };
1547
+ /**
1548
+ * @docs
1549
+ * @message
1550
+ * **Example error message:**<br/>
1551
+ * Invalid collection type "data". Remove the type from your collection definition in your content config file.
1552
+ * @description
1553
+ * Content collections should no longer have a `type` field. Remove this field from your content config file.
1554
+ * See the [Astro 6 migration guide](https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections) for more information.
1555
+ */
1556
+ export declare const ContentCollectionInvalidType: {
1557
+ name: string;
1558
+ title: string;
1559
+ message: (type: string, file?: any) => string;
1488
1560
  hint: string;
1489
1561
  };
1490
1562
  /**
@@ -1523,7 +1595,7 @@ export declare const ContentLoaderReturnsInvalidId: {
1523
1595
  export declare const ContentEntryDataError: {
1524
1596
  name: string;
1525
1597
  title: string;
1526
- message(collection: string, entryId: string, error: ZodError): string;
1598
+ message(collection: string, entryId: string, error: $ZodError): string;
1527
1599
  hint: string;
1528
1600
  };
1529
1601
  /**
@@ -1774,50 +1846,6 @@ export declare const SessionStorageSaveError: {
1774
1846
  message: (error: string, driver?: string) => string;
1775
1847
  hint: string;
1776
1848
  };
1777
- /**
1778
- * @docs
1779
- * @see
1780
- * - [Sessions](https://docs.astro.build/en/guides/sessions/)
1781
- * @deprecated This error was removed in Astro 5.7, when the Sessions feature stopped being experimental.
1782
- * @description
1783
- * Your adapter must support server output to use sessions.
1784
- */
1785
- export declare const SessionWithoutSupportedAdapterOutputError: {
1786
- name: string;
1787
- title: string;
1788
- message: string;
1789
- hint: string;
1790
- };
1791
- /**
1792
- * @docs
1793
- * @message The `experimental.session` flag was set to `true`, but no storage was configured. Either configure the storage manually or use an adapter that provides session storage.
1794
- * @deprecated This error was removed in Astro 5.7, when the Sessions feature stopped being experimental.
1795
- * @see
1796
- * - [Sessions](https://docs.astro.build/en/guides/sessions/)
1797
- * @description
1798
- * Thrown when session storage is enabled but not configured.
1799
- */
1800
- export declare const SessionConfigMissingError: {
1801
- name: string;
1802
- title: string;
1803
- message: string;
1804
- hint: string;
1805
- };
1806
- /**
1807
- * @docs
1808
- * @message Session config was provided without enabling the `experimental.session` flag
1809
- * @deprecated This error was removed in Astro 5.7, when the Sessions feature stopped being experimental.
1810
- * @see
1811
- * - [Sessions](https://docs.astro.build/en/guides/sessions/)
1812
- * @description
1813
- * Thrown when session storage is configured but the `experimental.session` flag is not enabled.
1814
- */
1815
- export declare const SessionConfigWithoutFlagError: {
1816
- name: string;
1817
- title: string;
1818
- message: string;
1819
- hint: string;
1820
- };
1821
1849
  /**
1822
1850
  * @docs
1823
1851
  * @message An error occurred while optimizing the SVG file with SVGO.
@@ -85,8 +85,8 @@ const GetStaticPathsExpectedParams = {
85
85
  };
86
86
  const GetStaticPathsInvalidRouteParam = {
87
87
  name: "GetStaticPathsInvalidRouteParam",
88
- title: "Invalid value for `getStaticPaths` route parameter.",
89
- message: (key, value, valueType) => `Invalid getStaticPaths route parameter for \`${key}\`. Expected undefined, a string or a number, received \`${valueType}\` (\`${value}\`)`,
88
+ title: "Invalid route parameter returned by `getStaticPaths()`.",
89
+ message: (key, value, valueType) => `Invalid \`getStaticPaths()\` route parameter for \`${key}\`. Expected a string or undefined, received \`${valueType}\` (\`${value}\`)`,
90
90
  hint: "See https://docs.astro.build/en/reference/routing-reference/#getstaticpaths for more information on getStaticPaths."
91
91
  };
92
92
  const GetStaticPathsRequired = {
@@ -372,6 +372,11 @@ const MissingMiddlewareForInternationalization = {
372
372
  title: "Enabled manual internationalization routing without having a middleware.",
373
373
  message: "Your configuration setting `i18n.routing: 'manual'` requires you to provide your own i18n `middleware` file."
374
374
  };
375
+ const InvalidI18nMiddlewareConfiguration = {
376
+ name: "InvalidI18nMiddlewareConfiguration",
377
+ title: "Invalid internationalization middleware configuration",
378
+ message: "The option `redirectToDefaultLocale` can be enabled only when `prefixDefaultLocale` is also set to `true`, otherwise redirects might cause infinite loops. Enable the option `prefixDefaultLocale` to continue to use `redirectToDefaultLocale`, or ensure both are set to `false`."
379
+ };
375
380
  const CantRenderPage = {
376
381
  name: "CantRenderPage",
377
382
  title: "Astro can't render the route.",
@@ -473,7 +478,12 @@ const FontFamilyNotFound = {
473
478
  const CspNotEnabled = {
474
479
  name: "CspNotEnabled",
475
480
  title: "CSP feature isn't enabled",
476
- message: "The `experimental.csp` configuration isn't enabled."
481
+ message: "The `security.csp` configuration isn't enabled."
482
+ };
483
+ const UnavailableAstroGlobal = {
484
+ name: "UnavailableAstroGlobal",
485
+ title: "Unavailable Astro global in getStaticPaths()",
486
+ message: (name) => `The Astro global is not available in this scope. Please remove "Astro.${name}" from your getStaticPaths() function.`
477
487
  };
478
488
  const UnknownCSSError = {
479
489
  name: "UnknownCSSError",
@@ -541,7 +551,7 @@ const GetEntryDeprecationError = {
541
551
  name: "GetEntryDeprecationError",
542
552
  title: "Invalid use of `getDataEntryById` or `getEntryBySlug` function.",
543
553
  message: (collection, method) => `The \`${method}\` function is deprecated and cannot be used to query the "${collection}" collection. Use \`getEntry\` instead.`,
544
- hint: "Use the `getEntry` or `getCollection` functions to query content layer collections."
554
+ hint: "See https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections for more information."
545
555
  };
546
556
  const InvalidContentEntryFrontmatterError = {
547
557
  name: "InvalidContentEntryFrontmatterError",
@@ -551,7 +561,7 @@ const InvalidContentEntryFrontmatterError = {
551
561
  `**${String(collection)} \u2192 ${String(
552
562
  entryId
553
563
  )}** frontmatter does not match collection schema.`,
554
- ...error.errors.map((zodError) => zodError.message)
564
+ error.message
555
565
  ].join("\n");
556
566
  },
557
567
  hint: "See https://docs.astro.build/en/guides/content-collections/ for more information on content schemas."
@@ -563,12 +573,30 @@ const InvalidContentEntryDataError = {
563
573
  return [
564
574
  `**${String(collection)} \u2192 ${String(entryId)}** data does not match collection schema.
565
575
  `,
566
- ...error.errors.map((zodError) => ` **${zodError.path.join(".")}**: ${zodError.message}`),
576
+ ` **: ${error.message}`,
567
577
  ""
568
578
  ].join("\n");
569
579
  },
570
580
  hint: "See https://docs.astro.build/en/guides/content-collections/ for more information on content schemas."
571
581
  };
582
+ const LegacyContentConfigError = {
583
+ name: "LegacyContentConfigError",
584
+ title: "Legacy content config file found.",
585
+ message: (filename) => `Found legacy content config file in "${filename}". Please move this file to "src/content.config.${filename.split(".").at(-1)}" and ensure each collection has a loader defined.`,
586
+ hint: "See https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections for more information on updating collections."
587
+ };
588
+ const ContentCollectionMissingLoader = {
589
+ name: "ContentCollectionMissingLoader",
590
+ title: "Content collection is missing a `loader` definition.",
591
+ message: (file = "your content config file") => `Collections must have a \`loader\` defined. Check your collection definitions in ${file}.`,
592
+ hint: "See https://docs.astro.build/en/guides/content-collections/ for more information on content loaders and https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections for more information on migrating from legacy collections."
593
+ };
594
+ const ContentCollectionInvalidType = {
595
+ name: "ContentCollectionInvalidType",
596
+ title: "Content collection has an invalid `type` field.",
597
+ message: (type, file = "your content config file") => `Invalid collection type "${type}". Remove the type from your collection definition in ${file}.`,
598
+ hint: "See https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections for more information on migrating from legacy collections."
599
+ };
572
600
  const ContentLoaderReturnsInvalidId = {
573
601
  name: "ContentLoaderReturnsInvalidId",
574
602
  title: "Content loader returned an entry with an invalid `id`.",
@@ -587,7 +615,7 @@ const ContentEntryDataError = {
587
615
  return [
588
616
  `**${String(collection)} \u2192 ${String(entryId)}** data does not match collection schema.
589
617
  `,
590
- ...error.errors.map((zodError) => ` **${zodError.path.join(".")}**: ${zodError.message}`),
618
+ ` **: ${error.message}`,
591
619
  ""
592
620
  ].join("\n");
593
621
  },
@@ -714,24 +742,6 @@ const SessionStorageSaveError = {
714
742
  message: (error, driver) => `Error when saving session data${driver ? ` with driver \`${driver}\`` : ""}. \`${error ?? ""}\``,
715
743
  hint: "For more information, see https://docs.astro.build/en/guides/sessions/"
716
744
  };
717
- const SessionWithoutSupportedAdapterOutputError = {
718
- name: "SessionWithoutSupportedAdapterOutputError",
719
- title: "Sessions cannot be used with an adapter that doesn't support server output.",
720
- message: 'Sessions require an adapter that supports server output. The adapter must set `"server"` in the `buildOutput` adapter feature.',
721
- hint: 'Ensure your adapter supports `buildOutput: "server"`: https://docs.astro.build/en/reference/adapter-reference/#building-an-adapter'
722
- };
723
- const SessionConfigMissingError = {
724
- name: "SessionConfigMissingError",
725
- title: "Session storage was enabled but not configured.",
726
- message: "The `experimental.session` flag was set to `true`, but no storage was configured. Either configure the storage manually or use an adapter that provides session storage",
727
- hint: "For more information, see https://docs.astro.build/en/guides/sessions/"
728
- };
729
- const SessionConfigWithoutFlagError = {
730
- name: "SessionConfigWithoutFlagError",
731
- title: "Session flag not set",
732
- message: "Session config was provided without enabling the `experimental.session` flag",
733
- hint: "For more information, see https://docs.astro.build/en/guides/sessions/"
734
- };
735
745
  const CannotOptimizeSvg = {
736
746
  name: "CannotOptimizeSvg",
737
747
  title: "Cannot optimize SVG",
@@ -758,6 +768,8 @@ export {
758
768
  ClientAddressNotAvailable,
759
769
  ConfigLegacyKey,
760
770
  ConfigNotFound,
771
+ ContentCollectionInvalidType,
772
+ ContentCollectionMissingLoader,
761
773
  ContentCollectionTypeMismatchError,
762
774
  ContentEntryDataError,
763
775
  ContentLoaderInvalidDataError,
@@ -799,8 +811,10 @@ export {
799
811
  InvalidGetStaticPathsEntry,
800
812
  InvalidGetStaticPathsReturn,
801
813
  InvalidGlob,
814
+ InvalidI18nMiddlewareConfiguration,
802
815
  InvalidImageService,
803
816
  InvalidPrerenderExport,
817
+ LegacyContentConfigError,
804
818
  LiveContentConfigError,
805
819
  LocalImageUsedWrongly,
806
820
  LocalsNotAnObject,
@@ -838,12 +852,10 @@ export {
838
852
  RewriteWithBodyUsed,
839
853
  RouteNotFound,
840
854
  ServerOnlyModule,
841
- SessionConfigMissingError,
842
- SessionConfigWithoutFlagError,
843
855
  SessionStorageInitError,
844
856
  SessionStorageSaveError,
845
- SessionWithoutSupportedAdapterOutputError,
846
857
  StaticClientAddressNotAvailable,
858
+ UnavailableAstroGlobal,
847
859
  UnhandledRejection,
848
860
  UnknownCLIError,
849
861
  UnknownCSSError,
@@ -1,4 +1,4 @@
1
- import type { ZodError } from 'zod';
1
+ import type { $ZodError } from 'zod/v4/core';
2
2
  interface ErrorProperties {
3
3
  title?: string;
4
4
  name: string;
@@ -58,11 +58,11 @@ export declare class AggregateError extends AstroError {
58
58
  * Check if an error is a ZodError from an AstroConfig validation.
59
59
  * Used to suppress formatting a ZodError if needed.
60
60
  */
61
- export declare function isAstroConfigZodError(error: unknown): error is ZodError;
61
+ export declare function isAstroConfigZodError(error: unknown): error is $ZodError;
62
62
  /**
63
63
  * Track that a ZodError comes from an AstroConfig validation.
64
64
  */
65
- export declare function trackAstroConfigZodError(error: ZodError): void;
65
+ export declare function trackAstroConfigZodError(error: $ZodError): void;
66
66
  /**
67
67
  * Generic object representing an error with all possible data
68
68
  * Compatible with both Astro's and Vite's errors
@@ -1,6 +1,6 @@
1
1
  import { codeFrame } from "./printer.js";
2
2
  function isAstroError(e) {
3
- return e instanceof AstroError || AstroError.is(e);
3
+ return e != null && (e instanceof AstroError || AstroError.is(e));
4
4
  }
5
5
  class AstroError extends Error {
6
6
  loc;
@@ -754,7 +754,7 @@ function getOverlayCode() {
754
754
  `;
755
755
  }
756
756
  function patchOverlay(code) {
757
- return code.replace("class ErrorOverlay", getOverlayCode() + "\nclass ViteErrorOverlay");
757
+ return code.replace("var ErrorOverlay", getOverlayCode() + "\nvar ViteErrorOverlay");
758
758
  }
759
759
  export {
760
760
  patchOverlay
@@ -1,2 +1,2 @@
1
- import type { ZodErrorMap } from 'zod';
2
- export declare const errorMap: ZodErrorMap;
1
+ import type { $ZodErrorMap } from 'zod/v4/core';
2
+ export declare const errorMap: $ZodErrorMap;
@@ -1,9 +1,9 @@
1
- const errorMap = (baseError, ctx) => {
2
- const baseErrorPath = flattenErrorPath(baseError.path);
3
- if (baseError.code === "invalid_union") {
1
+ const errorMap = (issue) => {
2
+ const baseErrorPath = flattenErrorPath(issue.path ?? []);
3
+ if (issue.code === "invalid_union") {
4
4
  let typeOrLiteralErrByPath = /* @__PURE__ */ new Map();
5
- for (const unionError of baseError.unionErrors.map((e) => e.errors).flat()) {
6
- if (unionError.code === "invalid_type" || unionError.code === "invalid_literal") {
5
+ for (const unionError of issue.errors.flat()) {
6
+ if (unionError.code === "invalid_type") {
7
7
  const flattenedErrorPath = flattenErrorPath(unionError.path);
8
8
  if (typeOrLiteralErrByPath.has(flattenedErrorPath)) {
9
9
  typeOrLiteralErrByPath.get(flattenedErrorPath).expected.push(unionError.expected);
@@ -17,7 +17,7 @@ const errorMap = (baseError, ctx) => {
17
17
  }
18
18
  }
19
19
  const messages = [prefix(baseErrorPath, "Did not match union.")];
20
- const details = [...typeOrLiteralErrByPath.entries()].filter(([, error]) => error.expected.length === baseError.unionErrors.length).map(
20
+ const details = [...typeOrLiteralErrByPath.entries()].filter(([, error]) => error.expected.length === issue.errors.flat().length).map(
21
21
  ([key, error]) => key === baseErrorPath ? (
22
22
  // Avoid printing the key again if it's a base error
23
23
  `> ${getTypeOrLiteralMsg(error)}`
@@ -25,50 +25,52 @@ const errorMap = (baseError, ctx) => {
25
25
  );
26
26
  if (details.length === 0) {
27
27
  const expectedShapes = [];
28
- for (const unionError of baseError.unionErrors) {
28
+ for (const unionErrors of issue.errors) {
29
29
  const expectedShape = [];
30
- for (const issue of unionError.issues) {
31
- if (issue.code === "invalid_union") {
32
- return errorMap(issue, ctx);
30
+ for (const _issue of unionErrors) {
31
+ if (_issue.code === "invalid_union") {
32
+ return errorMap(_issue);
33
33
  }
34
- const relativePath = flattenErrorPath(issue.path).replace(baseErrorPath, "").replace(leadingPeriod, "");
35
- if ("expected" in issue && typeof issue.expected === "string") {
34
+ const relativePath = flattenErrorPath(_issue.path).replace(baseErrorPath, "").replace(leadingPeriod, "");
35
+ if ("expected" in _issue && typeof _issue.expected === "string") {
36
36
  expectedShape.push(
37
- relativePath ? `${relativePath}: ${issue.expected}` : issue.expected
37
+ relativePath ? `${relativePath}: ${_issue.expected}` : _issue.expected
38
38
  );
39
- } else {
39
+ } else if ("values" in _issue) {
40
+ expectedShape.push(
41
+ ..._issue.values.filter((v) => typeof v === "string").map((v) => `"${v}"`)
42
+ );
43
+ } else if (relativePath) {
40
44
  expectedShape.push(relativePath);
41
45
  }
42
46
  }
43
47
  if (expectedShape.length === 1 && !expectedShape[0]?.includes(":")) {
44
48
  expectedShapes.push(expectedShape.join(""));
45
- } else {
49
+ } else if (expectedShape.length > 0) {
46
50
  expectedShapes.push(`{ ${expectedShape.join("; ")} }`);
47
51
  }
48
52
  }
49
53
  if (expectedShapes.length) {
50
54
  details.push("> Expected type `" + expectedShapes.join(" | ") + "`");
51
- details.push("> Received `" + stringify(ctx.data) + "`");
55
+ details.push("> Received `" + stringify(issue.input) + "`");
52
56
  }
53
57
  }
54
58
  return {
55
59
  message: messages.concat(details).join("\n")
56
60
  };
57
- } else if (baseError.code === "invalid_literal" || baseError.code === "invalid_type") {
61
+ } else if (issue.code === "invalid_type") {
58
62
  return {
59
63
  message: prefix(
60
64
  baseErrorPath,
61
65
  getTypeOrLiteralMsg({
62
- code: baseError.code,
63
- received: baseError.received,
64
- expected: [baseError.expected]
66
+ code: issue.code,
67
+ received: typeof issue.input,
68
+ expected: [issue.expected]
65
69
  })
66
70
  )
67
71
  };
68
- } else if (baseError.message) {
69
- return { message: prefix(baseErrorPath, baseError.message) };
70
- } else {
71
- return { message: prefix(baseErrorPath, ctx.defaultError) };
72
+ } else if (issue.message) {
73
+ return { message: prefix(baseErrorPath, issue.message) };
72
74
  }
73
75
  };
74
76
  const getTypeOrLiteralMsg = (error) => {
@@ -1,5 +1,5 @@
1
1
  import type { ResolvedServerUrls } from 'vite';
2
- import type { ZodError } from 'zod';
2
+ import type { $ZodError } from 'zod/v4/core';
3
3
  import { type ErrorWithMetadata } from './errors/index.js';
4
4
  /**
5
5
  * Prestyled messages for the CLI. Used by astro CLI commands.
@@ -45,7 +45,7 @@ export declare function prerelease({ currentVersion }: {
45
45
  export declare function success(message: string, tip?: string): string;
46
46
  export declare function actionRequired(message: string): string;
47
47
  export declare function cancelled(message: string, tip?: string): string;
48
- export declare function formatConfigErrorMessage(err: ZodError): string;
48
+ export declare function formatConfigErrorMessage(err: $ZodError): string;
49
49
  export declare function formatErrorMessage(err: ErrorWithMetadata, showFullStacktrace: boolean): string;
50
50
  /** @deprecated Migrate to HelpDisplay */
51
51
  export declare function printHelp({ commandName, headline, usage, tables, description, }: {
@@ -38,7 +38,7 @@ function serverStart({
38
38
  host,
39
39
  base
40
40
  }) {
41
- const version = "5.16.5";
41
+ const version = "6.0.0-alpha.1";
42
42
  const localPrefix = `${dim("\u2503")} Local `;
43
43
  const networkPrefix = `${dim("\u2503")} Network `;
44
44
  const emptyPrefix = " ".repeat(11);
@@ -275,7 +275,7 @@ function printHelp({
275
275
  message.push(
276
276
  linebreak(),
277
277
  ` ${bgGreen(black(` ${commandName} `))} ${green(
278
- `v${"5.16.5"}`
278
+ `v${"6.0.0-alpha.1"}`
279
279
  )} ${headline}`
280
280
  );
281
281
  }
@@ -7,7 +7,7 @@ async function callMiddleware(onRequest, apiContext, responseFunction) {
7
7
  responseFunctionPromise = responseFunction(apiContext, payload);
8
8
  return responseFunctionPromise;
9
9
  };
10
- let middlewarePromise = onRequest(apiContext, next);
10
+ const middlewarePromise = onRequest(apiContext, next);
11
11
  return await Promise.resolve(middlewarePromise).then(async (value) => {
12
12
  if (nextCalled) {
13
13
  if (typeof value !== "undefined") {
@@ -0,0 +1,2 @@
1
+ import type { MiddlewareHandler } from '../../types/public/common.js';
2
+ export declare function defineMiddleware(fn: MiddlewareHandler): MiddlewareHandler;
@@ -0,0 +1,6 @@
1
+ function defineMiddleware(fn) {
2
+ return fn;
3
+ }
4
+ export {
5
+ defineMiddleware
6
+ };