@makeswift/runtime 0.10.5 → 0.10.7

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
@@ -1153,6 +1153,25 @@ Received "${apiKey}" instead.`);
1153
1153
  const result = await this.graphqlClient.request(TableQuery, { tableId });
1154
1154
  return result.table;
1155
1155
  }
1156
+ async getSitemap({
1157
+ limit = 50,
1158
+ after,
1159
+ pathnamePrefix
1160
+ } = {}) {
1161
+ const url = new URL("v1/sitemap", this.apiOrigin);
1162
+ url.searchParams.set("limit", limit.toString());
1163
+ if (after != null)
1164
+ url.searchParams.set("after", after);
1165
+ if (pathnamePrefix != null)
1166
+ url.searchParams.set("pathnamePrefix", pathnamePrefix);
1167
+ const response = await this.fetch(url.pathname + url.search);
1168
+ if (!response.ok) {
1169
+ console.error("Failed to get sitemap", await response.json());
1170
+ throw new Error(`Failed to get sitemap with error: "${response.statusText}"`);
1171
+ }
1172
+ const sitemap = await response.json();
1173
+ return sitemap;
1174
+ }
1156
1175
  }
1157
1176
  class Document$1 extends NextDocument__default["default"] {
1158
1177
  static async getInitialProps(ctx) {
@@ -1208,7 +1227,7 @@ async function fonts(_req, res, { getFonts } = {}) {
1208
1227
  const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1209
1228
  return res.json(fonts2);
1210
1229
  }
1211
- const version = "0.10.5";
1230
+ const version = "0.10.7";
1212
1231
  async function handler(req, res, { apiKey, unstable_siteVersions }) {
1213
1232
  if (req.query.secret !== apiKey) {
1214
1233
  return res.status(401).json({ message: "Unauthorized" });
@@ -1220,11 +1239,23 @@ async function handler(req, res, { apiKey, unstable_siteVersions }) {
1220
1239
  clientSideNavigation: true,
1221
1240
  elementFromPoint: false,
1222
1241
  customBreakpoints: true,
1223
- unstable_siteVersions
1242
+ unstable_siteVersions,
1243
+ localizedPageSSR: true
1224
1244
  });
1225
1245
  }
1226
1246
  async function proxyPreviewMode(req, res, { apiKey }) {
1227
1247
  const previewModeProxy = httpProxy.createProxyServer();
1248
+ const NextRequestMetaSymbol = Reflect.ownKeys(req).find((key) => key.toString() === "Symbol(NextRequestMeta)");
1249
+ if (NextRequestMetaSymbol) {
1250
+ const nextRequestMeta = req[NextRequestMetaSymbol];
1251
+ const initUrl = nextRequestMeta == null ? void 0 : nextRequestMeta.__NEXT_INIT_URL;
1252
+ const isLocaleStripped = nextRequestMeta == null ? void 0 : nextRequestMeta.__nextStrippedLocale;
1253
+ try {
1254
+ if (isLocaleStripped && initUrl)
1255
+ req.url = new URL(initUrl).pathname;
1256
+ } catch {
1257
+ }
1258
+ }
1228
1259
  previewModeProxy.once("proxyReq", (proxyReq) => {
1229
1260
  proxyReq.removeHeader("X-Makeswift-Preview-Mode");
1230
1261
  proxyReq.removeHeader("X-Invoke-Path");