fix(render): preserve script position in Astro.slots.render() output (#15627)
Scripts rendered through Astro.slots.render('default') with set:html were
being hoisted to the top of the slot output because renderSlotToString()
collected script RenderInstructions into a separate instructions array,
and stringifyChunk() rendered all instructions before the content string.
This fix uses positional placeholders (<!--astro:script:N-->) embedded in
the content string at the script's original position, with the actual
script instructions stored in a separate scriptInstructions map on
SlotString. At stringification time, placeholders are replaced with the
real script HTML, preserving both original position and deferred
deduplication.
Also updated server-islands.ts to resolve script placeholders when
serializing slot content for island responses.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix(i18n): only trigger fallback for 404 responses (#15688)
The i18n fallback middleware was incorrectly intercepting all responses
with status >= 300, including legitimate 3xx redirects, 403 forbidden,
and 5xx server errors. This caused auth flows and form submissions on
localized server routes to be incorrectly redirected to fallback locales.
Changed the condition to only trigger fallback for 404 (page not found)
responses, which is the intended behavior — fallback should only activate
when a page doesn't exist in the requested locale.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>