@uxf/router 11.46.0 → 11.64.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/router",
3
- "version": "11.46.0",
3
+ "version": "11.64.3",
4
4
  "description": "UXF Router",
5
5
  "author": "UXFans <dev@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/router#readme",
package/router.js CHANGED
@@ -59,7 +59,7 @@ function createRouter(routes) {
59
59
  }
60
60
  });
61
61
  if (Object.keys(restParams).length > 0) {
62
- pathname = `${pathname}?${(0, qs_1.stringify)(restParams)}`;
62
+ pathname = `${pathname}?${(0, qs_1.stringify)(restParams, { arrayFormat: "repeat" })}`;
63
63
  }
64
64
  return pathname;
65
65
  },
@@ -38,11 +38,12 @@ ${sitemapItems.map((item) => ` <url>\n${(0, object_to_xml_1.objectToXml)(item
38
38
  return sitemapItems;
39
39
  });
40
40
  return allSitemapItems.map((sitemapItem) => {
41
- var _a, _b;
41
+ var _a, _b, _c, _d;
42
42
  return ({
43
- ...sitemapItem,
44
- changefreq: sitemapItem.changefreq !== undefined ? sitemapItem.changefreq : (_a = this.options) === null || _a === void 0 ? void 0 : _a.defaultChangeFreq,
45
- priority: sitemapItem.priority !== undefined ? sitemapItem.priority : (_b = this.options) === null || _b === void 0 ? void 0 : _b.defaultPriority,
43
+ lastmod: sitemapItem.lastmod,
44
+ loc: ((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.baseUrl) !== null && _b !== void 0 ? _b : "") + sitemapItem.loc,
45
+ changefreq: sitemapItem.changefreq !== undefined ? sitemapItem.changefreq : (_c = this.options) === null || _c === void 0 ? void 0 : _c.defaultChangeFreq,
46
+ priority: sitemapItem.priority !== undefined ? sitemapItem.priority : (_d = this.options) === null || _d === void 0 ? void 0 : _d.defaultPriority,
46
47
  });
47
48
  });
48
49
  }
@@ -6,8 +6,9 @@ const { createSitemapGenerator, routeToUrl } = (0, router_1.createRouter)({
6
6
  catchAllSegments: "/catch-all/[...pathParams]",
7
7
  optionalCatchAllSegments: "/catch-all-optional/[[...pathParams]]",
8
8
  });
9
+ const BASE_URL = "www.uxf.cz";
9
10
  test("routeToUrl", async () => {
10
- const xml = await createSitemapGenerator({})
11
+ const xml = await createSitemapGenerator({ baseUrl: BASE_URL })
11
12
  .add("index", async () => ({ loc: routeToUrl("index", {}) }))
12
13
  .add("catchAllSegments", async () => ({ loc: routeToUrl("catchAllSegments", { pathParams: ["param-1"] }) }))
13
14
  .add("optionalCatchAllSegments", async () => ({
@@ -18,13 +19,13 @@ test("routeToUrl", async () => {
18
19
  expect(xml).toBe(`<?xml version="1.0" encoding="UTF-8"?>
19
20
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
20
21
  <url>
21
- <loc>/</loc>
22
+ <loc>${BASE_URL}/</loc>
22
23
  </url>
23
24
  <url>
24
- <loc>/catch-all/param-1</loc>
25
+ <loc>${BASE_URL}/catch-all/param-1</loc>
25
26
  </url>
26
27
  <url>
27
- <loc>/catch-all-optional/param-1/param-2</loc>
28
+ <loc>${BASE_URL}/catch-all-optional/param-1/param-2</loc>
28
29
  <priority>10</priority>
29
30
  </url>
30
31
  </urlset>`);