@kenjura/ursa 0.52.0 → 0.54.0

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/src/serve.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import express from "express";
2
+ import compression from "compression";
2
3
  import watch from "node-watch";
3
4
  import { generate, regenerateSingleFile, clearWatchCache } from "./jobs/generate.js";
4
5
  import { join, resolve, dirname } from "path";
@@ -252,6 +253,15 @@ export async function serve({
252
253
  function serveFiles(outputDir, port = 8080) {
253
254
  const app = express();
254
255
 
256
+ // Enable gzip compression for all responses
257
+ // This significantly reduces transfer size for JSON and HTML files
258
+ app.use(compression({
259
+ // Compress everything over 1KB
260
+ threshold: 1024,
261
+ // Use default compression level (good balance of speed vs size)
262
+ level: 6
263
+ }));
264
+
255
265
  app.use(
256
266
  express.static(outputDir, { extensions: ["html"], index: "index.html" })
257
267
  );