@cocreate/sitemap 1.6.1 → 1.6.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.6.2](https://github.com/CoCreate-app/CoCreate-sitemap/compare/v1.6.1...v1.6.2) (2026-07-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update node-html-parser dependency and improve HTML parsing logic ([ff8fb8b](https://github.com/CoCreate-app/CoCreate-sitemap/commit/ff8fb8b6e410c3ccbed01348def61bf06632c943))
7
+
1
8
  ## [1.6.1](https://github.com/CoCreate-app/CoCreate-sitemap/compare/v1.6.0...v1.6.1) (2026-07-17)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/sitemap",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "A simple sitemap component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "sitemap",
@@ -37,6 +37,6 @@
37
37
  "type": "module",
38
38
  "main": "./src/index.js",
39
39
  "dependencies": {
40
- "node-html-parser": "^6.1.13"
40
+ "node-html-parser": "^9.0.0"
41
41
  }
42
42
  }
package/src/index.js CHANGED
@@ -3,7 +3,8 @@ import { parse } from "node-html-parser";
3
3
  /**
4
4
  * Clean, stateless functional entry point to check and verify a file against the sitemap.
5
5
  * All dependencies are passed explicitly via the parameters object.
6
- * * @param {Object} options
6
+ *
7
+ * @param {Object} options
7
8
  * @param {Object} options.file - The file object being verified
8
9
  * @param {string} options.host - The active website hostname
9
10
  * @param {Object} options.crud - Crud database instance
@@ -22,7 +23,7 @@ export async function check({ file, host, crud }) {
22
23
  return;
23
24
 
24
25
  // Check if the file is HTML and contains a noindex meta or title tag
25
- if (file["content-type"] === "text/html") {
26
+ if (file["content-type"] === "text/html" && file.src) {
26
27
  if (
27
28
  /<meta\s+name=["']robots["']\s+content=["'][^"']*noindex[^"']*["']/i.test(
28
29
  file.src
@@ -364,7 +365,7 @@ async function getLastSitemapIndex(mainSitemap, filename) {
364
365
  } catch (err) {
365
366
  console.error(
366
367
  `Error determining next sitemap index for ${filename}:`,
367
- err
368
+ `err`
368
369
  );
369
370
  return null;
370
371
  }
@@ -393,6 +394,8 @@ function checkSitemapXml(sitemap) {
393
394
  }
394
395
 
395
396
  function parseHtml(file) {
397
+ if (!file.src || typeof file.src !== "string") return;
398
+
396
399
  const dom = parse(file.src);
397
400
  const entries = dom.querySelectorAll('[sitemap="true"]');
398
401
 
@@ -432,7 +435,8 @@ function parseHtml(file) {
432
435
  } else if (entries[i].tagName === "VIDEO") {
433
436
  type = "video";
434
437
  query = "content_loc";
435
- entryObject.content_loc = entries[i].src;
438
+ // FIXED: Using standard DOM query selector `.getAttribute("src")` instead of property `.src`
439
+ entryObject.content_loc = entries[i].getAttribute("src");
436
440
  entryObject.title =
437
441
  entries[i].getAttribute("sitemap-title") ||
438
442
  entries[i].getAttribute("title");
@@ -450,7 +454,7 @@ function parseHtml(file) {
450
454
  entryObject.title = entries[i].getAttribute("sitemap-title");
451
455
  if (!entryObject.title) {
452
456
  const title = dom.querySelector("title");
453
- entryObject.title = title ? title.text : "";
457
+ entryObject.title = title ? title.textContent : "";
454
458
  }
455
459
 
456
460
  entryObject.publication = {