Skip to content

Commit c082650

Browse files
committed
fix runtime redirect handling and invoke-output packaging
1 parent fb5336b commit c082650

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

src/adapter.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ const CACHE_RUNTIME_MODULES = [
5151
'cache-store.js',
5252
'sqlite-cache.js',
5353
'isr.js',
54+
'invoke-output.js',
55+
'invoke-output-node.js',
56+
'invoke-output-edge.js',
57+
'invoke-output-types.js',
5458
];
5559

5660
type PreviewProps = NonNullable<
@@ -215,6 +219,10 @@ async function writeServerEntry(outDir: string): Promise<void> {
215219
const sourceCode = await Bun.file(sourcePath).text();
216220
const runtimeServerCode = sourceCode
217221
.replace("import './early-timers.js';", "import './runtime/early-timers.js';")
222+
.replace(
223+
"from './invoke-output.js';",
224+
"from './runtime/invoke-output.js';"
225+
)
218226
.replace("from './cache-store.js';", "from './runtime/cache-store.js';")
219227
.replace(
220228
"from './cache-http-server.js';",

src/runtime/server.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,18 +2624,7 @@ const server = http.createServer(async (req, res) => {
26242624
if (routeHeaders) {
26252625
applyResponseHeaders(res, routeHeaders);
26262626
}
2627-
let redirectLocation = routeLocationHeader;
2628-
if (
2629-
requestUrl.search.length > 0 &&
2630-
routeLocationHeader.startsWith('/') &&
2631-
!routeLocationHeader.includes('?')
2632-
) {
2633-
const locationHashIndex = routeLocationHeader.indexOf('#');
2634-
redirectLocation =
2635-
locationHashIndex >= 0
2636-
? `${routeLocationHeader.slice(0, locationHashIndex)}${requestUrl.search}${routeLocationHeader.slice(locationHashIndex)}`
2637-
: `${routeLocationHeader}${requestUrl.search}`;
2638-
}
2627+
const redirectLocation = routeLocationHeader;
26392628
res.setHeader('location', redirectLocation);
26402629
const redirectStatus = routeStatus as number;
26412630
res.statusCode = redirectStatus;

0 commit comments

Comments
 (0)