@sourceregistry/sveltekit-enhance 1.7.0 → 1.7.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.
package/README.md CHANGED
@@ -311,7 +311,7 @@ Locals set: `trace: { id: string; started_at: bigint }`.
311
311
 
312
312
  ### `StartUp`
313
313
 
314
- Gates request handling until app-startup work (DB connect, cache warm, etc.) resolves. Requests during startup get a `503` (JSON) or redirect to a startup page (HTML), both with `Retry-After: 4`. Once ready, `showPage` itself redirects to `readyRedirect` (so a plain Svelte page with no server guard can't be visited after startup completes) — disabled in dev so you can still preview the page. Any rejected startup item calls `onFailure` (defaults to logging + `process.exit(1)`).
314
+ Gates request handling until app-startup work (DB connect, cache warm, etc.) resolves. Requests during startup get a `503` — JSON body for non-HTML requests, or `showPage`'s rendered HTML for HTML requests — both with `Retry-After: 4`. Once ready, `showPage` itself redirects to `readyRedirect` (so a plain Svelte page with no server guard can't be visited after startup completes) — disabled in dev so you can still preview the page. Any rejected startup item calls `onFailure` (defaults to logging + `process.exit(1)`).
315
315
 
316
316
  ```ts
317
317
  import { StartUp, Deferred } from '@sourceregistry/sveltekit-enhance';
@@ -34,8 +34,9 @@ export const StartUp = {
34
34
  const acceptsHtml = input.request.headers.get('accept')?.includes('text/html') ?? false;
35
35
  if (acceptsHtml) {
36
36
  const response = await input.fetch(showPage);
37
- response.headers.append('Retry-After', '4');
38
- throw response;
37
+ const headers = new Headers(response.headers);
38
+ headers.set('Retry-After', '4');
39
+ throw new Response(response.body, { status: 503, headers });
39
40
  }
40
41
  else {
41
42
  throw new Response(JSON.stringify(showJSON), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sourceregistry/sveltekit-enhance",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Composable enhance and form utilities for SvelteKit actions, loads, methods, and hooks.",
5
5
  "author": "A.P.A. Slaa (a.p.a.slaa@projectsource.nl)",
6
6
  "scripts": {