Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.

chore: @urql/next formatting for 4b7011b70d5718728ff912d02a4dbdc7f703540d

+10 -13
+3 -1
packages/next-urql/src/DataHydrationContext.ts
··· 20 20 21 21 function transportDataToJS(data: any) { 22 22 const key = 'urql_transport'; 23 - return `(window[Symbol.for("${key}")] ??= []).push(${htmlEscapeJsonString(JSON.stringify(data))})`; 23 + return `(window[Symbol.for("${key}")] ??= []).push(${htmlEscapeJsonString( 24 + JSON.stringify(data) 25 + )})`; 24 26 } 25 27 26 28 export const DataHydrationContextProvider = ({
+7 -12
packages/next-urql/src/htmlescape.ts
··· 1 - // -------------------------------------------------------------------------------- 2 - // 3 - // copied from 4 - // https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/src/server/htmlescape.ts 1 + // See: https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/src/server/htmlescape.ts 5 2 // License: https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/license.md 6 - // 7 - // -------------------------------------------------------------------------------- 8 3 9 4 // This utility is based on https://github.com/zertosh/htmlescape 10 5 // License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE 11 6 12 7 const ESCAPE_LOOKUP: { [match: string]: string } = { 13 - "&": "\\u0026", 14 - ">": "\\u003e", 15 - "<": "\\u003c", 16 - "\u2028": "\\u2028", 17 - "\u2029": "\\u2029", 8 + '&': '\\u0026', 9 + '>': '\\u003e', 10 + '<': '\\u003c', 11 + '\u2028': '\\u2028', 12 + '\u2029': '\\u2029', 18 13 }; 19 14 20 15 export const ESCAPE_REGEX = /[&><\u2028\u2029]/g; 21 16 22 17 export function htmlEscapeJsonString(str: string): string { 23 - return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]); 18 + return str.replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]); 24 19 }