@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.cjs.js CHANGED
@@ -1208,7 +1208,7 @@ async function fonts(_req, res, { getFonts } = {}) {
1208
1208
  const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1209
1209
  return res.json(fonts2);
1210
1210
  }
1211
- const version = "0.10.5";
1211
+ const version = "0.10.6";
1212
1212
  async function handler(req, res, { apiKey, unstable_siteVersions }) {
1213
1213
  if (req.query.secret !== apiKey) {
1214
1214
  return res.status(401).json({ message: "Unauthorized" });
@@ -1220,11 +1220,23 @@ async function handler(req, res, { apiKey, unstable_siteVersions }) {
1220
1220
  clientSideNavigation: true,
1221
1221
  elementFromPoint: false,
1222
1222
  customBreakpoints: true,
1223
- unstable_siteVersions
1223
+ unstable_siteVersions,
1224
+ localizedPageSSR: true
1224
1225
  });
1225
1226
  }
1226
1227
  async function proxyPreviewMode(req, res, { apiKey }) {
1227
1228
  const previewModeProxy = httpProxy.createProxyServer();
1229
+ const NextRequestMetaSymbol = Reflect.ownKeys(req).find((key) => key.toString() === "Symbol(NextRequestMeta)");
1230
+ if (NextRequestMetaSymbol) {
1231
+ const nextRequestMeta = req[NextRequestMetaSymbol];
1232
+ const initUrl = nextRequestMeta == null ? void 0 : nextRequestMeta.__NEXT_INIT_URL;
1233
+ const isLocaleStripped = nextRequestMeta == null ? void 0 : nextRequestMeta.__nextStrippedLocale;
1234
+ try {
1235
+ if (isLocaleStripped && initUrl)
1236
+ req.url = new URL(initUrl).pathname;
1237
+ } catch {
1238
+ }
1239
+ }
1228
1240
  previewModeProxy.once("proxyReq", (proxyReq) => {
1229
1241
  proxyReq.removeHeader("X-Makeswift-Preview-Mode");
1230
1242
  proxyReq.removeHeader("X-Invoke-Path");