@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.es.js CHANGED
@@ -1120,6 +1120,25 @@ Received "${apiKey}" instead.`);
1120
1120
  const result = await this.graphqlClient.request(TableQuery, { tableId });
1121
1121
  return result.table;
1122
1122
  }
1123
+ async getSitemap({
1124
+ limit = 50,
1125
+ after,
1126
+ pathnamePrefix
1127
+ } = {}) {
1128
+ const url = new URL("v1/sitemap", this.apiOrigin);
1129
+ url.searchParams.set("limit", limit.toString());
1130
+ if (after != null)
1131
+ url.searchParams.set("after", after);
1132
+ if (pathnamePrefix != null)
1133
+ url.searchParams.set("pathnamePrefix", pathnamePrefix);
1134
+ const response = await this.fetch(url.pathname + url.search);
1135
+ if (!response.ok) {
1136
+ console.error("Failed to get sitemap", await response.json());
1137
+ throw new Error(`Failed to get sitemap with error: "${response.statusText}"`);
1138
+ }
1139
+ const sitemap = await response.json();
1140
+ return sitemap;
1141
+ }
1123
1142
  }
1124
1143
  class Document$1 extends NextDocument {
1125
1144
  static async getInitialProps(ctx) {
@@ -1175,7 +1194,7 @@ async function fonts(_req, res, { getFonts } = {}) {
1175
1194
  const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1176
1195
  return res.json(fonts2);
1177
1196
  }
1178
- const version = "0.10.5";
1197
+ const version = "0.10.7";
1179
1198
  async function handler(req, res, { apiKey, unstable_siteVersions }) {
1180
1199
  if (req.query.secret !== apiKey) {
1181
1200
  return res.status(401).json({ message: "Unauthorized" });
@@ -1187,11 +1206,23 @@ async function handler(req, res, { apiKey, unstable_siteVersions }) {
1187
1206
  clientSideNavigation: true,
1188
1207
  elementFromPoint: false,
1189
1208
  customBreakpoints: true,
1190
- unstable_siteVersions
1209
+ unstable_siteVersions,
1210
+ localizedPageSSR: true
1191
1211
  });
1192
1212
  }
1193
1213
  async function proxyPreviewMode(req, res, { apiKey }) {
1194
1214
  const previewModeProxy = createProxyServer();
1215
+ const NextRequestMetaSymbol = Reflect.ownKeys(req).find((key) => key.toString() === "Symbol(NextRequestMeta)");
1216
+ if (NextRequestMetaSymbol) {
1217
+ const nextRequestMeta = req[NextRequestMetaSymbol];
1218
+ const initUrl = nextRequestMeta == null ? void 0 : nextRequestMeta.__NEXT_INIT_URL;
1219
+ const isLocaleStripped = nextRequestMeta == null ? void 0 : nextRequestMeta.__nextStrippedLocale;
1220
+ try {
1221
+ if (isLocaleStripped && initUrl)
1222
+ req.url = new URL(initUrl).pathname;
1223
+ } catch {
1224
+ }
1225
+ }
1195
1226
  previewModeProxy.once("proxyReq", (proxyReq) => {
1196
1227
  proxyReq.removeHeader("X-Makeswift-Preview-Mode");
1197
1228
  proxyReq.removeHeader("X-Invoke-Path");