astro 7.0.0-alpha.0 → 7.0.0-alpha.2

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 (251) hide show
  1. package/components/Code.astro +1 -1
  2. package/dist/actions/handler.d.ts +32 -0
  3. package/dist/actions/handler.js +45 -0
  4. package/dist/actions/runtime/server.js +1 -1
  5. package/dist/assets/build/generate.js +1 -1
  6. package/dist/assets/build/remote.d.ts +3 -2
  7. package/dist/assets/build/remote.js +16 -9
  8. package/dist/assets/endpoint/dev.js +1 -1
  9. package/dist/assets/endpoint/generic.js +8 -20
  10. package/dist/assets/endpoint/loadImage.d.ts +11 -0
  11. package/dist/assets/endpoint/loadImage.js +19 -0
  12. package/dist/assets/endpoint/shared.js +7 -2
  13. package/dist/assets/fonts/config.d.ts +4 -4
  14. package/dist/assets/fonts/core/optimize-fallbacks.js +38 -13
  15. package/dist/assets/fonts/definitions.d.ts +2 -2
  16. package/dist/assets/fonts/infra/system-fallbacks-provider.d.ts +2 -2
  17. package/dist/assets/fonts/infra/system-fallbacks-provider.js +46 -9
  18. package/dist/assets/fonts/types.d.ts +1 -0
  19. package/dist/assets/index.d.ts +1 -0
  20. package/dist/assets/index.js +2 -0
  21. package/dist/assets/internal.js +22 -3
  22. package/dist/assets/services/service.d.ts +1 -1
  23. package/dist/assets/services/service.js +9 -9
  24. package/dist/assets/services/sharp.js +53 -18
  25. package/dist/assets/utils/generateImageStylesCSS.js +26 -6
  26. package/dist/assets/utils/index.d.ts +1 -0
  27. package/dist/assets/utils/index.js +2 -0
  28. package/dist/assets/utils/inferSourceFormat.d.ts +8 -3
  29. package/dist/assets/utils/inferSourceFormat.js +15 -4
  30. package/dist/assets/utils/metadata.js +1 -1
  31. package/dist/assets/utils/redirectValidation.d.ts +48 -0
  32. package/dist/assets/utils/redirectValidation.js +48 -0
  33. package/dist/assets/utils/remoteProbe.js +25 -2
  34. package/dist/assets/utils/vendor/image-size/types/svg.js +1 -1
  35. package/dist/cli/add/index.js +7 -58
  36. package/dist/cli/dev/background.d.ts +16 -0
  37. package/dist/cli/dev/background.js +116 -0
  38. package/dist/cli/dev/index.js +82 -3
  39. package/dist/cli/dev/logs.d.ts +6 -0
  40. package/dist/cli/dev/logs.js +72 -0
  41. package/dist/cli/dev/status.d.ts +15 -0
  42. package/dist/cli/dev/status.js +27 -0
  43. package/dist/cli/dev/stop.d.ts +12 -0
  44. package/dist/cli/dev/stop.js +43 -0
  45. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  46. package/dist/container/index.js +18 -14
  47. package/dist/content/content-layer.js +16 -11
  48. package/dist/content/data-store.d.ts +1 -1
  49. package/dist/content/loaders/types.d.ts +1 -1
  50. package/dist/content/runtime-assets.d.ts +2 -2
  51. package/dist/content/runtime.d.ts +1 -1
  52. package/dist/content/runtime.js +9 -4
  53. package/dist/content/server-listeners.js +0 -4
  54. package/dist/content/types-generator.js +5 -1
  55. package/dist/content/utils.d.ts +1 -1
  56. package/dist/content/utils.js +1 -1
  57. package/dist/content/vite-plugin-content-assets.js +1 -0
  58. package/dist/content/vite-plugin-content-virtual-mod.js +9 -1
  59. package/dist/core/app/base.d.ts +42 -15
  60. package/dist/core/app/base.js +151 -375
  61. package/dist/core/app/dev/app.d.ts +3 -2
  62. package/dist/core/app/dev/app.js +4 -60
  63. package/dist/core/app/entrypoints/node.d.ts +1 -1
  64. package/dist/core/app/entrypoints/node.js +2 -0
  65. package/dist/core/app/entrypoints/virtual/dev.js +2 -0
  66. package/dist/core/app/entrypoints/virtual/prod.js +4 -1
  67. package/dist/core/app/node.d.ts +16 -0
  68. package/dist/core/app/node.js +59 -13
  69. package/dist/core/app/prepare-response.d.ts +11 -0
  70. package/dist/core/app/prepare-response.js +18 -0
  71. package/dist/core/app/render-options.d.ts +11 -0
  72. package/dist/core/app/render-options.js +11 -0
  73. package/dist/core/base-pipeline.d.ts +48 -1
  74. package/dist/core/base-pipeline.js +63 -8
  75. package/dist/core/build/app.d.ts +3 -4
  76. package/dist/core/build/app.js +3 -17
  77. package/dist/core/build/generate.js +8 -1
  78. package/dist/core/build/index.d.ts +0 -11
  79. package/dist/core/build/index.js +0 -3
  80. package/dist/core/build/internal.d.ts +7 -0
  81. package/dist/core/build/plugins/plugin-chunk-imports.d.ts +6 -0
  82. package/dist/core/build/plugins/plugin-chunk-imports.js +29 -17
  83. package/dist/core/build/plugins/plugin-css.js +40 -1
  84. package/dist/core/build/plugins/plugin-internals.js +1 -1
  85. package/dist/core/build/plugins/plugin-manifest.js +11 -1
  86. package/dist/core/build/static-build.js +22 -141
  87. package/dist/core/build/types.d.ts +0 -1
  88. package/dist/core/build/util.js +8 -1
  89. package/dist/core/build/vite-build-config.d.ts +28 -0
  90. package/dist/core/build/vite-build-config.js +165 -0
  91. package/dist/core/cache/handler.d.ts +29 -0
  92. package/dist/core/cache/handler.js +81 -0
  93. package/dist/core/compile/style.js +18 -1
  94. package/dist/core/config/index.d.ts +1 -1
  95. package/dist/core/config/index.js +4 -1
  96. package/dist/core/config/merge.js +4 -0
  97. package/dist/core/config/schemas/base.d.ts +25 -13
  98. package/dist/core/config/schemas/base.js +39 -10
  99. package/dist/core/config/schemas/relative.d.ts +76 -49
  100. package/dist/core/config/schemas/relative.js +2 -3
  101. package/dist/core/config/settings.js +2 -4
  102. package/dist/core/config/tsconfig.d.ts +24 -9
  103. package/dist/core/config/tsconfig.js +54 -45
  104. package/dist/core/config/validate.js +59 -0
  105. package/dist/core/constants.d.ts +27 -1
  106. package/dist/core/constants.js +14 -1
  107. package/dist/core/cookies/cookies.d.ts +7 -2
  108. package/dist/core/cookies/cookies.js +11 -4
  109. package/dist/core/cookies/response.d.ts +1 -1
  110. package/dist/core/cookies/response.js +1 -2
  111. package/dist/core/create-vite.js +18 -1
  112. package/dist/core/csp/config.js +17 -5
  113. package/dist/core/csp/runtime.js +6 -4
  114. package/dist/core/dev/dev.d.ts +1 -0
  115. package/dist/core/dev/dev.js +4 -13
  116. package/dist/core/dev/lockfile.d.ts +54 -0
  117. package/dist/core/dev/lockfile.js +93 -0
  118. package/dist/core/errors/build-handler.d.ts +17 -0
  119. package/dist/core/errors/build-handler.js +22 -0
  120. package/dist/core/errors/default-handler.d.ts +14 -0
  121. package/dist/core/errors/default-handler.js +144 -0
  122. package/dist/core/errors/dev-handler.d.ts +21 -0
  123. package/dist/core/errors/dev-handler.js +82 -0
  124. package/dist/core/errors/errors-data.d.ts +43 -38
  125. package/dist/core/errors/errors-data.js +79 -73
  126. package/dist/core/errors/handler.d.ts +9 -0
  127. package/dist/core/errors/handler.js +0 -0
  128. package/dist/core/errors/zod-error-map.js +30 -1
  129. package/dist/core/fetch/default-handler.d.ts +17 -0
  130. package/dist/core/fetch/default-handler.js +45 -0
  131. package/dist/core/fetch/fetch-state.d.ts +230 -0
  132. package/dist/core/fetch/fetch-state.js +896 -0
  133. package/dist/core/fetch/index.d.ts +61 -0
  134. package/dist/core/fetch/index.js +121 -0
  135. package/dist/core/fetch/types.d.ts +25 -0
  136. package/dist/core/fetch/types.js +0 -0
  137. package/dist/core/fetch/vite-plugin.d.ts +5 -0
  138. package/dist/core/fetch/vite-plugin.js +76 -0
  139. package/dist/core/hono/index.d.ts +21 -0
  140. package/dist/core/hono/index.js +101 -0
  141. package/dist/core/i18n/domain.d.ts +12 -0
  142. package/dist/core/i18n/domain.js +66 -0
  143. package/dist/core/i18n/handler.d.ts +18 -0
  144. package/dist/core/i18n/handler.js +122 -0
  145. package/dist/core/logger/core.d.ts +9 -1
  146. package/dist/core/logger/core.js +17 -1
  147. package/dist/core/messages/runtime.d.ts +0 -3
  148. package/dist/core/messages/runtime.js +1 -9
  149. package/dist/core/middleware/astro-middleware.d.ts +27 -0
  150. package/dist/core/middleware/astro-middleware.js +51 -0
  151. package/dist/core/module-loader/vite.js +1 -2
  152. package/dist/core/pages/handler.d.ts +20 -0
  153. package/dist/core/pages/handler.js +75 -0
  154. package/dist/core/preview/index.js +6 -5
  155. package/dist/core/preview/static-preview-server.js +5 -2
  156. package/dist/core/redirects/render.d.ts +2 -2
  157. package/dist/core/redirects/render.js +7 -8
  158. package/dist/core/render/params-and-props.js +2 -2
  159. package/dist/core/render/route-cache.d.ts +1 -0
  160. package/dist/core/render/route-cache.js +4 -4
  161. package/dist/core/render/slots.js +9 -2
  162. package/dist/core/rewrites/handler.d.ts +37 -0
  163. package/dist/core/rewrites/handler.js +67 -0
  164. package/dist/core/routing/3xx.js +8 -4
  165. package/dist/core/routing/create-manifest.js +11 -1
  166. package/dist/core/routing/handler.d.ts +17 -0
  167. package/dist/core/routing/handler.js +171 -0
  168. package/dist/core/routing/match.d.ts +0 -7
  169. package/dist/core/routing/match.js +0 -5
  170. package/dist/core/routing/parse-route.js +1 -1
  171. package/dist/core/routing/pattern.js +1 -1
  172. package/dist/core/routing/rewrite.js +2 -5
  173. package/dist/core/routing/router.d.ts +8 -0
  174. package/dist/core/routing/router.js +28 -0
  175. package/dist/core/routing/trailing-slash-handler.d.ts +18 -0
  176. package/dist/core/routing/trailing-slash-handler.js +67 -0
  177. package/dist/core/routing/validation.js +1 -1
  178. package/dist/core/server-islands/vite-plugin-server-islands.d.ts +6 -1
  179. package/dist/core/server-islands/vite-plugin-server-islands.js +13 -3
  180. package/dist/core/session/config.d.ts +1 -1
  181. package/dist/core/session/drivers.d.ts +1 -1
  182. package/dist/core/session/handler.d.ts +11 -0
  183. package/dist/core/session/handler.js +33 -0
  184. package/dist/core/session/runtime.js +7 -2
  185. package/dist/core/util/normalized-url.d.ts +10 -0
  186. package/dist/core/util/normalized-url.js +24 -0
  187. package/dist/core/util/pathname.d.ts +10 -1
  188. package/dist/core/util/pathname.js +13 -4
  189. package/dist/environments.js +1 -1
  190. package/dist/events/session.d.ts +8 -0
  191. package/dist/events/session.js +11 -0
  192. package/dist/i18n/middleware.d.ts +10 -0
  193. package/dist/i18n/middleware.js +4 -88
  194. package/dist/i18n/utils.js +2 -2
  195. package/dist/jsx/rehype.d.ts +1 -1
  196. package/dist/manifest/virtual-module.js +3 -1
  197. package/dist/markdown/index.d.ts +4 -0
  198. package/dist/markdown/index.js +14 -0
  199. package/dist/prefetch/index.js +12 -7
  200. package/dist/prerender/utils.js +5 -1
  201. package/dist/runtime/client/dev-toolbar/apps/audit/rules/a11y.js +9 -0
  202. package/dist/runtime/server/astro-island.js +57 -20
  203. package/dist/runtime/server/astro-island.prebuilt-dev.d.ts +1 -1
  204. package/dist/runtime/server/astro-island.prebuilt-dev.js +1 -1
  205. package/dist/runtime/server/astro-island.prebuilt.d.ts +1 -1
  206. package/dist/runtime/server/astro-island.prebuilt.js +1 -1
  207. package/dist/runtime/server/jsx.js +1 -1
  208. package/dist/runtime/server/render/common.js +10 -4
  209. package/dist/runtime/server/render/component.js +8 -6
  210. package/dist/runtime/server/render/head.js +1 -5
  211. package/dist/runtime/server/render/server-islands.js +2 -1
  212. package/dist/runtime/server/render/util.js +2 -2
  213. package/dist/runtime/server/scripts.js +6 -0
  214. package/dist/runtime/server/transition.d.ts +1 -6
  215. package/dist/runtime/server/transition.js +0 -8
  216. package/dist/transitions/events.d.ts +0 -14
  217. package/dist/transitions/events.js +0 -14
  218. package/dist/transitions/index.d.ts +0 -1
  219. package/dist/transitions/index.js +0 -2
  220. package/dist/transitions/vite-plugin-transitions.js +2 -4
  221. package/dist/types/public/config.d.ts +96 -14
  222. package/dist/types/public/content.d.ts +5 -5
  223. package/dist/types/public/index.d.ts +2 -1
  224. package/dist/types/public/integrations.d.ts +11 -3
  225. package/dist/types/public/internal.d.ts +1 -1
  226. package/dist/types/public/manifest.d.ts +1 -1
  227. package/dist/virtual-modules/i18n.d.ts +2 -2
  228. package/dist/virtual-modules/i18n.js +1 -1
  229. package/dist/vite-plugin-app/app.d.ts +13 -6
  230. package/dist/vite-plugin-app/app.js +51 -89
  231. package/dist/vite-plugin-app/createAstroServerApp.d.ts +3 -1
  232. package/dist/vite-plugin-app/createAstroServerApp.js +4 -3
  233. package/dist/vite-plugin-astro-server/plugin.js +11 -5
  234. package/dist/vite-plugin-astro-server/route-guard.d.ts +33 -0
  235. package/dist/vite-plugin-astro-server/route-guard.js +42 -23
  236. package/dist/vite-plugin-dev-status/index.d.ts +2 -0
  237. package/dist/vite-plugin-dev-status/index.js +15 -0
  238. package/dist/vite-plugin-head/index.js +36 -19
  239. package/dist/vite-plugin-hmr-reload/index.d.ts +1 -1
  240. package/dist/vite-plugin-hmr-reload/index.js +23 -1
  241. package/dist/vite-plugin-integrations-container/index.js +15 -6
  242. package/dist/vite-plugin-markdown/content-entry-type.js +7 -4
  243. package/dist/vite-plugin-markdown/images.js +9 -11
  244. package/dist/vite-plugin-markdown/index.js +12 -11
  245. package/dist/vite-plugin-utils/index.d.ts +1 -0
  246. package/dist/vite-plugin-utils/index.js +10 -1
  247. package/package.json +23 -16
  248. package/templates/content/types.d.ts +1 -0
  249. package/types/transitions.d.ts +0 -7
  250. package/dist/core/render-context.d.ts +0 -77
  251. package/dist/core/render-context.js +0 -826
@@ -0,0 +1,230 @@
1
+ import type { ActionAPIContext } from '../../actions/runtime/types.js';
2
+ import type { ComponentInstance } from '../../types/astro.js';
3
+ import type { Params, Props, RewritePayload } from '../../types/public/common.js';
4
+ import type { APIContext, AstroGlobal } from '../../types/public/context.js';
5
+ import type { RouteData, SSRResult } from '../../types/public/internal.js';
6
+ import { AstroCookies } from '../cookies/index.js';
7
+ import { type Pipeline } from '../render/index.js';
8
+ import type { ResolvedRenderOptions } from '../app/base.js';
9
+ /**
10
+ * The public contract of {@link FetchState} exposed to user-land code
11
+ * (custom fetch handlers, Hono middleware, etc.).
12
+ *
13
+ * Only the members listed here are part of the stable public API.
14
+ * Everything else on the concrete `FetchState` class is internal and
15
+ * may change without notice.
16
+ *
17
+ * If you add a new member to `FetchState` that should be user-visible,
18
+ * add it here first — the `implements` clause on the class ensures a
19
+ * compile-time error if the class falls out of sync.
20
+ */
21
+ export interface AstroFetchState {
22
+ /** The incoming request. */
23
+ readonly request: Request;
24
+ /** Normalized URL derived from the request. */
25
+ readonly url: URL;
26
+ /** Base-stripped, decoded pathname of the request. */
27
+ readonly pathname: string;
28
+ /** The matched route for this request, if any. */
29
+ readonly routeData: RouteData | undefined;
30
+ /** Cookies for this request. */
31
+ readonly cookies: AstroCookies;
32
+ /** Request-scoped locals object, shared with user middleware. */
33
+ readonly locals: App.Locals;
34
+ /** Route params derived from routeData + pathname. */
35
+ readonly params: Params | undefined;
36
+ /** The `Response` produced by handlers, if any. Set after rendering. */
37
+ response: Response | undefined;
38
+ /** Default HTTP status for the rendered response. */
39
+ status: number;
40
+ /**
41
+ * Triggers a rewrite to a different route.
42
+ *
43
+ * [Astro reference](https://docs.astro.build/en/guides/routing/#rewrites)
44
+ */
45
+ rewrite(payload: RewritePayload): Promise<Response>;
46
+ }
47
+ /**
48
+ * Retrieves the `FetchState` stashed on an `APIContext` by
49
+ * `FetchState.getAPIContext()`. Throws if not found — this indicates
50
+ * the context was not created through Astro's request pipeline.
51
+ */
52
+ export declare function getFetchStateFromAPIContext(context: APIContext): FetchState;
53
+ /**
54
+ * Holds per-request state as it flows through the handler pipeline.
55
+ *
56
+ * **This class is user-facing** via `astro/fetch` and `astro/hono`.
57
+ * The {@link AstroFetchState} interface defines the stable public
58
+ * surface. Members not on that interface are internal and
59
+ * may change without notice.
60
+ *
61
+ * Performance note: fields on this class are plain properties — ES
62
+ * private fields (`#foo`) have a non-zero per-access cost in V8
63
+ * which is measurable on the hot render path, so `#` is used only
64
+ * for rarely-accessed memoized caches and Maps.
65
+ */
66
+ export declare class FetchState implements AstroFetchState {
67
+ #private;
68
+ pipeline: Pipeline;
69
+ /**
70
+ * The request to render. Mutated during rewrites so subsequent renders
71
+ * see the rewritten URL.
72
+ */
73
+ request: Request;
74
+ routeData: RouteData | undefined;
75
+ /**
76
+ * The pathname to use for routing and rendering. Starts out as the raw,
77
+ * base-stripped, decoded pathname from the request. May be further
78
+ * normalized by `AstroHandler` after routeData is known (in dev, when
79
+ * the matched route has no `.html` extension, `.html` / `/index.html`
80
+ * suffixes are stripped).
81
+ */
82
+ pathname: string;
83
+ /** Resolved render options (addCookieHeader, clientAddress, locals, etc.). */
84
+ readonly renderOptions: ResolvedRenderOptions;
85
+ /** When the request started, used to log duration. */
86
+ readonly timeStart: number;
87
+ /**
88
+ * The route's loaded component module. Set before middleware runs; may
89
+ * be swapped during in-flight rewrites from inside the middleware chain.
90
+ */
91
+ componentInstance: ComponentInstance | undefined;
92
+ /**
93
+ * Slot overrides supplied by the container API. `undefined` for HTTP
94
+ * requests — `PagesHandler` coalesces to `{}` on read so we don't
95
+ * allocate an empty object per request.
96
+ */
97
+ slots: Record<string, any> | undefined;
98
+ /**
99
+ * The `Response` produced by handlers, if any. Set after page
100
+ * rendering or middleware completes.
101
+ */
102
+ response: Response | undefined;
103
+ /**
104
+ * Default HTTP status for the rendered response. Callers override
105
+ * before rendering runs (e.g. `AstroHandler` sets this from
106
+ * `BaseApp.getDefaultStatusCode`; error handlers set `404` / `500`).
107
+ */
108
+ status: number;
109
+ /** Whether user middleware should be skipped for this request. */
110
+ skipMiddleware: boolean;
111
+ /** A flag that tells the render content if the rewriting was triggered. */
112
+ isRewriting: boolean;
113
+ /** A safety net in case of loops (rewrite counter). */
114
+ counter: number;
115
+ /** Cookies for this request. Created lazily on first access. */
116
+ cookies: AstroCookies;
117
+ get params(): Params | undefined;
118
+ set params(value: Params | undefined);
119
+ /** Normalized URL for this request. */
120
+ url: URL;
121
+ /** Client address for this request. */
122
+ clientAddress: string | undefined;
123
+ /** Whether this is a partial render (container API). */
124
+ partial: boolean | undefined;
125
+ /** Whether to inject CSP meta tags. */
126
+ shouldInjectCspMetaTags: boolean | undefined;
127
+ /** Request-scoped locals object, shared with user middleware. */
128
+ locals: App.Locals;
129
+ /**
130
+ * Memoized `props` (see `getProps`). `null` means "not yet computed"
131
+ * — using `null` (rather than `undefined`) keeps the hidden class
132
+ * stable and distinct from a valid-but-empty result.
133
+ */
134
+ props: APIContext['props'] | null;
135
+ /** Memoized `ActionAPIContext` (see `getActionAPIContext`). */
136
+ actionApiContext: ActionAPIContext | null;
137
+ /** Memoized `APIContext` (see `getAPIContext`). */
138
+ apiContext: APIContext | null;
139
+ /** SSR result for the current page render. */
140
+ result: SSRResult | undefined;
141
+ /** Initial props (from container/error handler). */
142
+ initialProps: Props;
143
+ constructor(pipeline: Pipeline, request: Request, options?: ResolvedRenderOptions);
144
+ /**
145
+ * Triggers a rewrite. Delegates to the Rewrites handler.
146
+ */
147
+ rewrite(payload: RewritePayload): Promise<Response>;
148
+ /**
149
+ * Creates the SSR result for the current page render.
150
+ */
151
+ createResult(mod: ComponentInstance, ctx: ActionAPIContext): Promise<SSRResult>;
152
+ /**
153
+ * Creates the Astro global object for a component render.
154
+ */
155
+ createAstro(result: SSRResult, props: Record<string, any>, slotValues: Record<string, any> | null, apiContext: ActionAPIContext): AstroGlobal;
156
+ /**
157
+ * Creates the Astro page-level partial (prototype for Astro global).
158
+ */
159
+ createAstroPagePartial(result: SSRResult, apiContext: ActionAPIContext): Omit<AstroGlobal, 'props' | 'self' | 'slots'>;
160
+ getClientAddress(): string;
161
+ getCookies(): AstroCookies;
162
+ getCsp(): APIContext['csp'];
163
+ computeCurrentLocale(): string | undefined;
164
+ computePreferredLocale(): string | undefined;
165
+ computePreferredLocaleList(): string[] | undefined;
166
+ /**
167
+ * Lazily loads the route's component module. Returns the cached
168
+ * instance if already loaded. The promise is cached so concurrent
169
+ * callers share the same load.
170
+ */
171
+ loadComponentInstance(): Promise<ComponentInstance>;
172
+ /**
173
+ * Registers a context provider under the given key. Handlers call
174
+ * this to contribute values to the request context (e.g. sessions).
175
+ * The `create` factory is called lazily on the first `resolve(key)`.
176
+ */
177
+ provide<T>(key: string, provider: ContextProvider<T>): void;
178
+ /**
179
+ * Lazily resolves a provider registered under `key`. Calls
180
+ * `provider.create()` on first access and caches the result.
181
+ * Returns `undefined` if no provider was registered for the key.
182
+ */
183
+ resolve<T>(key: string): T | undefined;
184
+ /**
185
+ * Runs all registered `finalize` callbacks. Should be called after
186
+ * the response is produced, typically in a `finally` block.
187
+ *
188
+ * Returns synchronously (no promise allocation) when nothing needs
189
+ * finalizing — important for the hot path where sessions are not used.
190
+ */
191
+ finalizeAll(): Promise<void> | void;
192
+ /**
193
+ * Adds lazy getters to `target` for each registered provider key.
194
+ * Used by context creation (APIContext, Astro global) so that
195
+ * provider values like `session` and `cache` appear as properties
196
+ * without hard-coding the keys.
197
+ *
198
+ * Always defines a `session` getter (returning `undefined` when no
199
+ * provider is registered) so `ctx.session` / `Astro.session` is a
200
+ * present property regardless of whether the sessions handler was
201
+ * included in the pipeline.
202
+ */
203
+ defineProviderGetters(target: Record<string, any>): void;
204
+ /**
205
+ * Returns the resolved `props` for this render, computing them lazily
206
+ * from the route + component module on first access. If the
207
+ * `initialProps` already carries user-supplied props (e.g. the
208
+ * container API) those are used verbatim.
209
+ */
210
+ getProps(): Promise<APIContext['props']>;
211
+ /**
212
+ * Returns the `ActionAPIContext` for this render, creating it lazily.
213
+ * Used by middleware, actions, and page dispatch.
214
+ */
215
+ getActionAPIContext(): ActionAPIContext;
216
+ /**
217
+ * Returns the `APIContext` for this render, creating it lazily from
218
+ * the memoized props + action context.
219
+ *
220
+ * Callers must ensure `getProps()` has resolved at least once before
221
+ * calling this.
222
+ */
223
+ getAPIContext(): APIContext;
224
+ /**
225
+ * Invalidates the cached `APIContext` so the next `getAPIContext()`
226
+ * call re-derives it from the (possibly mutated) state. Used
227
+ * after an in-flight rewrite swaps the route / request / params.
228
+ */
229
+ invalidateContexts(): void;
230
+ }