hadars 1.0.7 → 1.0.9

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.
@@ -318,6 +318,7 @@ async function buildCacheEntry(res, ttl) {
318
318
  }
319
319
  });
320
320
  headers.push(["content-encoding", "gzip"]);
321
+ headers.push(["vary", "accept-encoding"]);
321
322
  return { body, status: res.status, headers, expiresAt: ttl != null ? Date.now() + ttl : null };
322
323
  }
323
324
  async function serveFromEntry(entry, req) {
package/dist/cli.js CHANGED
@@ -1895,6 +1895,7 @@ async function buildCacheEntry(res, ttl) {
1895
1895
  }
1896
1896
  });
1897
1897
  headers.push(["content-encoding", "gzip"]);
1898
+ headers.push(["vary", "accept-encoding"]);
1898
1899
  return { body, status: res.status, headers, expiresAt: ttl != null ? Date.now() + ttl : null };
1899
1900
  }
1900
1901
  async function serveFromEntry(entry, req) {
@@ -3038,6 +3039,16 @@ async function renderStaticSite(opts) {
3038
3039
  });
3039
3040
  }
3040
3041
  }
3042
+ if (opts.baseURL && rendered.length > 0) {
3043
+ const base = opts.baseURL.replace(/\/$/, "");
3044
+ const urls = rendered.map((p) => ` <url><loc>${base}${p}</loc></url>`).join(`
3045
+ `);
3046
+ const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
3047
+ ` + `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3048
+ ` + urls + `
3049
+ ` + "</urlset>";
3050
+ await writeFile(join(outputDir, "sitemap.xml"), sitemap, "utf-8");
3051
+ }
3041
3052
  const staticDest = join(outputDir, "static");
3042
3053
  await mkdir(staticDest, { recursive: true });
3043
3054
  await cp(staticSrc, staticDest, {
@@ -3168,7 +3179,8 @@ Source plugins require graphql-js to be installed:
3168
3179
  staticSrc,
3169
3180
  paths,
3170
3181
  outputDir: outDir,
3171
- graphql
3182
+ graphql,
3183
+ baseURL: config.baseURL
3172
3184
  });
3173
3185
  for (const p of rendered)
3174
3186
  console.log(` [200] ${p}`);
@@ -1369,6 +1369,7 @@ async function buildCacheEntry(res, ttl) {
1369
1369
  }
1370
1370
  });
1371
1371
  headers.push(["content-encoding", "gzip"]);
1372
+ headers.push(["vary", "accept-encoding"]);
1372
1373
  return { body, status: res.status, headers, expiresAt: ttl != null ? Date.now() + ttl : null };
1373
1374
  }
1374
1375
  async function serveFromEntry(entry, req) {
@@ -6,7 +6,7 @@ import {
6
6
  getReactResponse,
7
7
  makePrecontentHtmlGetter,
8
8
  parseRequest
9
- } from "./chunk-VAR5KTG3.js";
9
+ } from "./chunk-B4NE4AIT.js";
10
10
  import "./chunk-6SOA2HTO.js";
11
11
  import "./chunk-OZUZS2PD.js";
12
12
 
package/dist/lambda.cjs CHANGED
@@ -1409,6 +1409,7 @@ async function buildCacheEntry(res, ttl) {
1409
1409
  }
1410
1410
  });
1411
1411
  headers.push(["content-encoding", "gzip"]);
1412
+ headers.push(["vary", "accept-encoding"]);
1412
1413
  return { body, status: res.status, headers, expiresAt: ttl != null ? Date.now() + ttl : null };
1413
1414
  }
1414
1415
  async function serveFromEntry(entry, req) {
package/dist/lambda.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  getReactResponse,
7
7
  makePrecontentHtmlGetter,
8
8
  parseRequest
9
- } from "./chunk-VAR5KTG3.js";
9
+ } from "./chunk-B4NE4AIT.js";
10
10
  import "./chunk-6SOA2HTO.js";
11
11
  import "./chunk-OZUZS2PD.js";
12
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hadars",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Minimal SSR framework for React — rspack, HMR, TypeScript, Bun/Node/Deno",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",