bun-plugin-stx 0.2.219 → 0.2.221
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.js +9 -8
- package/package.json +1 -1
package/dist/serve.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
extractLayoutMetadata
|
|
5
5
|
} from "./chunk-93ete56h.js";
|
|
6
6
|
import {
|
|
7
7
|
__require
|
|
@@ -8718,7 +8718,7 @@ var defaultConfigDir4 = /* @__PURE__ */ resolve12(process20.cwd(), "config");
|
|
|
8718
8718
|
var defaultGeneratedDir4 = /* @__PURE__ */ resolve12(process20.cwd(), "src/generated");
|
|
8719
8719
|
|
|
8720
8720
|
// src/serve.ts
|
|
8721
|
-
import { BUILD_ID_HEADER, extractPageResponseStatus, findContainerRegion, getBuildId, mergeCrosswindConfig, readResponseHeaders, readResponseStatus, stateDir, stateDirName } from "@stacksjs/stx";
|
|
8721
|
+
import { BUILD_ID_HEADER, extractPageResponseStatus, findContainerRegion, FRAGMENT_CACHE_CONTROL, getBuildId, mergeCrosswindConfig, readResponseHeaders, readResponseStatus, SPA_NAV_HEADER, spaNavVaryHeaders, 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
8724
|
import { actionRedirectResponse, compressResponse, runPageAction as sharedRunPageAction } from "@stacksjs/stx";
|
|
@@ -10508,12 +10508,11 @@ ${html}`;
|
|
|
10508
10508
|
}
|
|
10509
10509
|
if (content) {
|
|
10510
10510
|
const responseStatus = reqCtx.responseStatus ?? 200;
|
|
10511
|
-
const isSpaNav = req.headers.get(
|
|
10511
|
+
const isSpaNav = req.headers.get(SPA_NAV_HEADER) === "true";
|
|
10512
10512
|
if (isSpaNav) {
|
|
10513
|
-
const
|
|
10514
|
-
const pageLayout =
|
|
10515
|
-
const
|
|
10516
|
-
const pageLayoutGroup = i18nConfig && i18nLocale ? `i18n:${i18nLocale}` : groupMetaMatch?.[1] || deriveLayoutGroup(pageLayout);
|
|
10513
|
+
const layoutMetadata = extractLayoutMetadata(content);
|
|
10514
|
+
const pageLayout = layoutMetadata.layout;
|
|
10515
|
+
const pageLayoutGroup = i18nConfig && i18nLocale ? `i18n:${i18nLocale}` : layoutMetadata.group;
|
|
10517
10516
|
let fragment = content;
|
|
10518
10517
|
let containerAttrs = "";
|
|
10519
10518
|
let mainContentStart = -1;
|
|
@@ -10624,7 +10623,8 @@ ${trailingPageScripts.join(`
|
|
|
10624
10623
|
...pageTitle && { "X-STX-Title": encodeURIComponent(pageTitle) },
|
|
10625
10624
|
[BUILD_ID_HEADER]: getBuildId(),
|
|
10626
10625
|
...containerAttrs && { "X-STX-Container-Attrs": encodeURIComponent(containerAttrs) },
|
|
10627
|
-
|
|
10626
|
+
...spaNavVaryHeaders(),
|
|
10627
|
+
"Cache-Control": FRAGMENT_CACHE_CONTROL,
|
|
10628
10628
|
...corsHeaders
|
|
10629
10629
|
}
|
|
10630
10630
|
});
|
|
@@ -10657,6 +10657,7 @@ ${trailingPageScripts.join(`
|
|
|
10657
10657
|
}
|
|
10658
10658
|
const pageHeaders = new Headers({
|
|
10659
10659
|
"Content-Type": "text/html; charset=utf-8",
|
|
10660
|
+
...spaNavVaryHeaders(),
|
|
10660
10661
|
"Cache-Control": "no-store",
|
|
10661
10662
|
...corsHeaders
|
|
10662
10663
|
});
|
package/package.json
CHANGED