@makeswift/runtime 0.10.5 → 0.10.6

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/index.es.js CHANGED
@@ -1175,7 +1175,7 @@ async function fonts(_req, res, { getFonts } = {}) {
1175
1175
  const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1176
1176
  return res.json(fonts2);
1177
1177
  }
1178
- const version = "0.10.5";
1178
+ const version = "0.10.6";
1179
1179
  async function handler(req, res, { apiKey, unstable_siteVersions }) {
1180
1180
  if (req.query.secret !== apiKey) {
1181
1181
  return res.status(401).json({ message: "Unauthorized" });
@@ -1187,11 +1187,23 @@ async function handler(req, res, { apiKey, unstable_siteVersions }) {
1187
1187
  clientSideNavigation: true,
1188
1188
  elementFromPoint: false,
1189
1189
  customBreakpoints: true,
1190
- unstable_siteVersions
1190
+ unstable_siteVersions,
1191
+ localizedPageSSR: true
1191
1192
  });
1192
1193
  }
1193
1194
  async function proxyPreviewMode(req, res, { apiKey }) {
1194
1195
  const previewModeProxy = createProxyServer();
1196
+ const NextRequestMetaSymbol = Reflect.ownKeys(req).find((key) => key.toString() === "Symbol(NextRequestMeta)");
1197
+ if (NextRequestMetaSymbol) {
1198
+ const nextRequestMeta = req[NextRequestMetaSymbol];
1199
+ const initUrl = nextRequestMeta == null ? void 0 : nextRequestMeta.__NEXT_INIT_URL;
1200
+ const isLocaleStripped = nextRequestMeta == null ? void 0 : nextRequestMeta.__nextStrippedLocale;
1201
+ try {
1202
+ if (isLocaleStripped && initUrl)
1203
+ req.url = new URL(initUrl).pathname;
1204
+ } catch {
1205
+ }
1206
+ }
1195
1207
  previewModeProxy.once("proxyReq", (proxyReq) => {
1196
1208
  proxyReq.removeHeader("X-Makeswift-Preview-Mode");
1197
1209
  proxyReq.removeHeader("X-Invoke-Path");