@shopify/hydrogen 2023.10.4 → 2023.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.
@@ -322,7 +322,7 @@ function toSerializableResponse(body, response) {
322
322
  function fromSerializableResponse([body, init]) {
323
323
  return [body, new Response(body, init)];
324
324
  }
325
- var checkGraphQLErrors = (body) => !body?.errors;
325
+ var checkGraphQLErrors = (body, response) => !body?.errors && response.status < 400;
326
326
  var swrLock = /* @__PURE__ */ new Set();
327
327
  async function runWithCache(cacheKey, actionFn, {
328
328
  strategy = CacheShort(),
@@ -457,7 +457,7 @@ var warnOnce = (string) => {
457
457
  };
458
458
 
459
459
  // src/version.ts
460
- var LIB_VERSION = "2023.10.4";
460
+ var LIB_VERSION = "2023.10.6";
461
461
 
462
462
  // src/utils/graphql.ts
463
463
  function minifyQuery(string) {
@@ -1004,6 +1004,19 @@ var graphiqlLoader = async function graphiqlLoader2({
1004
1004
  );
1005
1005
  };
1006
1006
 
1007
+ // src/seo/escape.ts
1008
+ var ESCAPE_LOOKUP = {
1009
+ "&": "\\u0026",
1010
+ ">": "\\u003e",
1011
+ "<": "\\u003c",
1012
+ "\u2028": "\\u2028",
1013
+ "\u2029": "\\u2029"
1014
+ };
1015
+ var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
1016
+ function escapeHtml(html) {
1017
+ return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
1018
+ }
1019
+
1007
1020
  // src/seo/generate-seo-tags.ts
1008
1021
  var ERROR_PREFIX = "Error in SEO input: ";
1009
1022
  var schema = {
@@ -1178,7 +1191,9 @@ function generateSeoTags(seoInput) {
1178
1191
  "script",
1179
1192
  {
1180
1193
  type: "application/ld+json",
1181
- children: JSON.stringify(block)
1194
+ children: JSON.stringify(block, (k, value) => {
1195
+ return typeof value === "string" ? escapeHtml(value) : value;
1196
+ })
1182
1197
  },
1183
1198
  // @ts-expect-error
1184
1199
  `json-ld-${block?.["@type"] || block?.name || index++}`