diff --git a/CHANGELOG.md b/CHANGELOG.md index 68597cf4c..26a42ba73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ title: Changelog ### Bug Fixes +- Switch from gzip to deflate for compressing assets to make output consistent across different operating systems, #2796. - Cascaded modifier tags will no longer be copied into type literals, #2802. ## v0.27.3 (2024-12-04) diff --git a/src/lib/output/themes/default/assets/typedoc/utils/decompress.ts b/src/lib/output/themes/default/assets/typedoc/utils/decompress.ts index 00b32d7e5..2b799b771 100644 --- a/src/lib/output/themes/default/assets/typedoc/utils/decompress.ts +++ b/src/lib/output/themes/default/assets/typedoc/utils/decompress.ts @@ -1,7 +1,7 @@ /** - * Decompresses Base64-encoded Gzip data and parses it into a JSON object. + * Decompresses Base64-encoded deflate compressed data and parses it into a JSON object. * - * @param base64 - The Base64-encoded string representing the Gzip-compressed JSON string. + * @param base64 - The Base64-encoded string representing the deflate-compressed JSON string. * @returns A promise that resolves to the parsed JSON object. */ export async function decompressJson(base64: string) { @@ -9,7 +9,7 @@ export async function decompressJson(base64: string) { const blob = new Blob([binaryData]); const decompressedStream = blob .stream() - .pipeThrough(new DecompressionStream("gzip")); + .pipeThrough(new DecompressionStream("deflate")); const decompressedText = await new Response(decompressedStream).text(); return JSON.parse(decompressedText); } diff --git a/src/lib/utils/compress.ts b/src/lib/utils/compress.ts index 8e6274f59..015ffd1e3 100644 --- a/src/lib/utils/compress.ts +++ b/src/lib/utils/compress.ts @@ -1,15 +1,15 @@ -import { gzip } from "zlib"; +import { deflate } from "zlib"; import { promisify } from "util"; -const gzipP = promisify(gzip); +const deflateP = promisify(deflate); /** - * Compresses a JSON-serializable object into a Base64-encoded Gzip string. + * Compresses a JSON-serializable object into a Base64-encoded deflate string. * * @param data - The JSON-serializable object to compress. - * @returns A promise that resolves to a Base64-encoded string of the Gzip-compressed data. + * @returns A promise that resolves to a Base64-encoded string of the deflate-compressed data. */ export async function compressJson(data: any) { - const gz = await gzipP(Buffer.from(JSON.stringify(data))); + const gz = await deflateP(Buffer.from(JSON.stringify(data))); return gz.toString("base64"); }