bun-plugin-stx 0.2.175 → 0.2.177
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 +17 -12
- package/package.json +1 -1
package/dist/serve.d.ts
CHANGED
package/dist/serve.js
CHANGED
|
@@ -8721,7 +8721,7 @@ var defaultGeneratedDir4 = /* @__PURE__ */ resolve12(process20.cwd(), "src/gener
|
|
|
8721
8721
|
import { BUILD_ID_HEADER, extractPageResponseStatus, findContainerRegion, getBuildId, mergeCrosswindConfig, stateDir, stateDirName } from "@stacksjs/stx";
|
|
8722
8722
|
import { buildCodeFrame, locateFailureLine } from "@stacksjs/stx/build-message";
|
|
8723
8723
|
import { clearBundleFailures, getBundleFailures } from "@stacksjs/stx/client-script-bundler";
|
|
8724
|
-
import { compressResponse, runPageAction as sharedRunPageAction } from "@stacksjs/stx";
|
|
8724
|
+
import { actionRedirectResponse, compressResponse, runPageAction as sharedRunPageAction } from "@stacksjs/stx";
|
|
8725
8725
|
var defaultStxModule = import("@stacksjs/stx");
|
|
8726
8726
|
var REACTIVE_TEMPLATE_DIRECTIVE_RE = /@for|:for|@if|:if|@else|:else|x-for|x-if|x-else/;
|
|
8727
8727
|
function extractServerScriptsFromTemplate(content) {
|
|
@@ -9667,7 +9667,7 @@ function __stxOverlay(errs){
|
|
|
9667
9667
|
const userConfig = await crosswindUserConfigPromise;
|
|
9668
9668
|
const merged = mergeCrosswindConfig(cw.config, userConfig);
|
|
9669
9669
|
const generatorConfig = merged.config;
|
|
9670
|
-
const { includePreflight, minify } = merged;
|
|
9670
|
+
const { includePreflight, minify, tokenCSS } = merged;
|
|
9671
9671
|
for (const cls of merged.safelist)
|
|
9672
9672
|
classes.add(cls);
|
|
9673
9673
|
const cacheKey = [...classes].sort().join(" ");
|
|
@@ -9714,7 +9714,7 @@ function __stxOverlay(errs){
|
|
|
9714
9714
|
shortcutCSS += `@media (prefers-color-scheme: dark) { .dark .${name} { ${darkDecls.join(" ")} } }
|
|
9715
9715
|
`;
|
|
9716
9716
|
}
|
|
9717
|
-
const finalCss = baseCss + shortcutCSS;
|
|
9717
|
+
const finalCss = tokenCSS + baseCss + shortcutCSS;
|
|
9718
9718
|
crosswindCssCache.set(cacheKey, finalCss);
|
|
9719
9719
|
return finalCss;
|
|
9720
9720
|
} catch (error) {
|
|
@@ -9733,6 +9733,8 @@ function __stxOverlay(errs){
|
|
|
9733
9733
|
});
|
|
9734
9734
|
if (result.redirect)
|
|
9735
9735
|
reqCtx.actionRedirect = result.redirect;
|
|
9736
|
+
if (result.cookies && result.cookies.length > 0)
|
|
9737
|
+
reqCtx.actionCookies = result.cookies;
|
|
9736
9738
|
}
|
|
9737
9739
|
async function processTemplate(filePath, reqCtx) {
|
|
9738
9740
|
const content = await Bun.file(filePath).text();
|
|
@@ -10437,10 +10439,10 @@ ${html}`;
|
|
|
10437
10439
|
}
|
|
10438
10440
|
const content = await getRoute(path, reqCtx);
|
|
10439
10441
|
if (reqCtx.actionRedirect) {
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
headers
|
|
10443
|
-
|
|
10442
|
+
const redirectResponse = actionRedirectResponse(reqCtx.actionRedirect, reqCtx.actionCookies);
|
|
10443
|
+
for (const [key, value] of Object.entries(corsHeaders))
|
|
10444
|
+
redirectResponse.headers.set(key, value);
|
|
10445
|
+
return redirectResponse;
|
|
10444
10446
|
}
|
|
10445
10447
|
if (content) {
|
|
10446
10448
|
const responseStatus = reqCtx.responseStatus ?? 200;
|
|
@@ -10591,13 +10593,16 @@ ${trailingPageScripts.join(`
|
|
|
10591
10593
|
} catch {}
|
|
10592
10594
|
}
|
|
10593
10595
|
}
|
|
10596
|
+
const pageHeaders = new Headers({
|
|
10597
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
10598
|
+
"Cache-Control": "no-store",
|
|
10599
|
+
...corsHeaders
|
|
10600
|
+
});
|
|
10601
|
+
for (const cookie of reqCtx.actionCookies ?? [])
|
|
10602
|
+
pageHeaders.append("Set-Cookie", cookie);
|
|
10594
10603
|
return new Response(injectHmrClient(cleaned), {
|
|
10595
10604
|
status: pageRenderFailed ? 500 : responseStatus,
|
|
10596
|
-
headers:
|
|
10597
|
-
"Content-Type": "text/html; charset=utf-8",
|
|
10598
|
-
"Cache-Control": "no-store",
|
|
10599
|
-
...corsHeaders
|
|
10600
|
-
}
|
|
10605
|
+
headers: pageHeaders
|
|
10601
10606
|
});
|
|
10602
10607
|
}
|
|
10603
10608
|
if (!isStaticAssetPath(path)) {
|
package/package.json
CHANGED