bun-plugin-stx 0.2.189 → 0.2.190
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/dist/serve.d.ts +1 -0
- package/dist/serve.js +12 -2
- package/package.json +1 -1
package/dist/serve.d.ts
CHANGED
package/dist/serve.js
CHANGED
|
@@ -9418,6 +9418,12 @@ function __stxOverlay(errs){
|
|
|
9418
9418
|
if (Number.isInteger(status) && status >= 100 && status <= 599)
|
|
9419
9419
|
full.responseStatus = status;
|
|
9420
9420
|
};
|
|
9421
|
+
context.setResponseHeader = (name, value) => {
|
|
9422
|
+
const header = String(name ?? "").trim();
|
|
9423
|
+
if (!header)
|
|
9424
|
+
return;
|
|
9425
|
+
full.responseHeaders = { ...full.responseHeaders, [header]: String(value) };
|
|
9426
|
+
};
|
|
9421
9427
|
}
|
|
9422
9428
|
function htmlCacheKey(filePath, reqCtx) {
|
|
9423
9429
|
if (RENDER_CACHE_VARY === "source")
|
|
@@ -9749,8 +9755,10 @@ function __stxOverlay(errs){
|
|
|
9749
9755
|
const cacheKey = htmlCacheKey(filePath, reqCtx);
|
|
9750
9756
|
const cachedEntry = htmlCache.get(cacheKey);
|
|
9751
9757
|
if (cachedEntry && await templateSignatureFresh(cachedEntry.signature)) {
|
|
9752
|
-
if (reqCtx)
|
|
9758
|
+
if (reqCtx) {
|
|
9753
9759
|
reqCtx.responseStatus = cachedEntry.status;
|
|
9760
|
+
reqCtx.responseHeaders = cachedEntry.headers;
|
|
9761
|
+
}
|
|
9754
9762
|
return cachedEntry.html;
|
|
9755
9763
|
}
|
|
9756
9764
|
}
|
|
@@ -9817,7 +9825,7 @@ function __stxOverlay(errs){
|
|
|
9817
9825
|
}
|
|
9818
9826
|
if (ENABLE_HTML_CACHE && !context.__stx_skip_cache && !skipCacheHint && !isMutating && isRenderableCacheCandidate(output)) {
|
|
9819
9827
|
const signature = await buildTemplateSignature(filePath, dependencies);
|
|
9820
|
-
htmlCache.set(htmlCacheKey(filePath, reqCtx), { html: output, signature, status: reqCtx?.responseStatus ?? 200 });
|
|
9828
|
+
htmlCache.set(htmlCacheKey(filePath, reqCtx), { html: output, signature, status: reqCtx?.responseStatus ?? 200, headers: reqCtx?.responseHeaders });
|
|
9821
9829
|
}
|
|
9822
9830
|
return output;
|
|
9823
9831
|
}
|
|
@@ -10603,6 +10611,8 @@ ${trailingPageScripts.join(`
|
|
|
10603
10611
|
"Cache-Control": "no-store",
|
|
10604
10612
|
...corsHeaders
|
|
10605
10613
|
});
|
|
10614
|
+
for (const [name, value] of Object.entries(reqCtx.responseHeaders ?? {}))
|
|
10615
|
+
pageHeaders.set(name, value);
|
|
10606
10616
|
for (const cookie of reqCtx.actionCookies ?? [])
|
|
10607
10617
|
pageHeaders.append("Set-Cookie", cookie);
|
|
10608
10618
|
return new Response(injectHmrClient(cleaned), {
|
package/package.json
CHANGED